[DEV] Extras v1.1 - Additional useful and advanced methods for plugin developers [1.0.1-R1]

Discussion in 'Inactive/Unsupported Plugins' started by Adamki11s, Jul 13, 2011.

  1. Offline

    Adamki11s

    [​IMG]
    Extra's
    Version 1.1[1.0.1-R1]

    What is Extras? An open source, modular, lightweight, library which contains a large set of both useful and advanced methods for plugin developers.

    If you have any suggestions, would like to report a bug or request a feature then please don't hesitate :).

    [​IMG]


    [​IMG]


    To make use of the library you will first need to import it. You can do this in Eclipse by right-clicking on your src folder. Then select General > File System and import the source folder from "YourSavedPath/Extras-Library/Extras/src".

    Extras library contains the following packages:
    PHP:
    couk.Adamki11s.Extras.Colour;
    couk.Adamki11s.Extras.Cryptography;
    couk.Adamki11s.Extras.Events;
    couk.Adamki11s.Extras.Extras;
    couk.Adamki11s.Extras.Inventory;
    couk.Adamki11s.Extras.Player;
    couk.Adamki11s.Extras.Random;
    couk.Adamki11s.Extras.Regions;
    couk.Adamki11s.Extras.Scheduler;
    couk.Adamki11s.Extras.Terrain;
    couk.Adamki11s.Extras.Trace;
    I have added extensive Java Docs to all of the methods so I won't go over what they do in this thread but only how to hook into those classes and access those events. Each class and it's methods extend an abstract class so you can hook into it very easily:
    PHP:
    ExtrasColour extrasColour = new ExtrasColour();
    ExtrasCryptography extrasCrypt = new ExtrasCryptography();
    ExtrasEvents extrasEvents = new ExtrasEvents();
    ExtrasInventory extrasInventory = new ExtrasInventory();
    ExtrasPlayer extrasPlayer = new ExtrasPlayer();
    ExtrasRandom extrasRandom = new ExtrasRandom();
    ExtrasRegions extrasRegions = new ExtrasRegions();
    ExtrasScheduler extrasScheduler = new ExtrasScheduler();
    ExtrasTerrain extrasTerrain = new ExtrasRegions();
    ExtrasTrace extrasTrace = new ExtrasTrace();
    But before hooking into these methods you should hook into the core first which consists of a constructor with your plugin name which will help identify errors whilst sending player messages if a null parameter is passed. This is done easily like so :
    PHP:
    Extras ex = new Extras("YourPluginName");
    I'd recommend doing this inside onEnable or before you make an API calls to Extra's.

    ChangeLog:
    • Version 1.1 : Added Scheduler library and a few additional methods.
    • Version 1.0 : Initial Release
     
    iPhysX, zhuowei and JWhy like this.
  2. Offline

    shadrxninga

    This looks great :D

    But your missing the version number and craftbukkit build number in you thread title.
     
  3. Offline

    cholo71796

    "Extras" should not have an apostrophe unless you're saying that "extra is" or talking about something that "extra" owns. Also, the first sentence says "opensource" twice, which, by the way, should be "open source." Another apostrophe mishap on "javadocs." Anyway, this is interesting-- keep it up.
     
  4. Offline

    Adamki11s

    Heyy, It was 5am my time when I posted this, cut me some slack :p Thanks though.
    See above :D.

    Adding a scheduler library. Hope to finish it today

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
    shadrxninga likes this.
  5. Offline

    Kohle

    Amazing. Good job.
     
  6. Offline

    DrBowe

    Brilliant. I will most definitely use this for its regions, and once you're completed with the Scheduler, I'll take a look into that as well.
     
  7. Offline

    Adamki11s

    Finished Cryptography Library & Added Scheduler Library.
    Working on a basic video tutorial and some example plugins now.

    Added updateInventory() method - Not sure if it works though :p.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  8. Offline

    Adamki11s

    Added :

    public abstract Block getLookedAtBlock(Player p);

    public abstract Location getLocationLooked(Player p);

    Fixed Cryptography Methods

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  9. Offline

    Daniel Heppner

    That apostrophe is really bugging me.

    Oh, and you should make a Maven repository because you can't just throw a file into Eclipse with Maven, you actually need to have a repository and you need to point Maven to the repo. You should be using Maven. :p
     
  10. Offline

    cholo71796

    Me too, hahah.
     
  11. Offline

    Adamki11s

    I made this post originally at 5am :p
    As for Maven I'm not too sure what you're suggesting but I have no experience with it.

    As for that apostrophe...look again ;)
     
    Daniel Heppner and cholo71796 like this.
  12. Offline

    wouter0100

    Broken download link?
     
  13. Offline

    Adamki11s

    Sorry, fixed now, just re-download.
     
  14. Offline

    wouter0100



    Do you have a function like
    GetWeather(World)
    Returns a string with storm, sun and thunder?
    and
    IsBlockAboveHead(Player)
    Returns true when there is a block above Player's head.
    and false when not.
     
  15. Offline

    Jaker232

    Maven? Is that required? I don't have it installed.
     
  16. Offline

    Adamki11s

    Nope, just import it and it's ready to use.
    I like the block above head idea, I'll add that in, as for the getweather don't you mean a string either storm sun or thunder?
     
    iPhysX likes this.
  17. Offline

    wouter0100

    Over that getweather yes, that i mean, and A block above his head thanks :D
    Idea:
    IsBlockAboveHead(Player p, Blocks b)
    Blocks = How much blocks they check? if 0 all blocks above his head.
     
  18. Offline

    Adamki11s

  19. Offline

    Styx Reborn

    Styx Reborn approves. (atleast the dev)
     
  20. Offline

    Shamebot

    Did you see my comments on github?
     
  21. Offline

    Jaker232

    When we hook into this plugin, does the downloader have to install this first?
     
  22. Offline

    Adamki11s

    You're meant to download this and include it as a library in your project.
     
  23. Offline

    Jaker232

    Ohhh.. thanks.

    Can you add a smoke method?
     
  24. Offline

    Adamki11s

    Soon, when I release my Warzone plugin ;)
     
  25. Offline

    Adamki11s

    Fixed a small issue with scheduler tasks.
     
  26. Offline

    Celtic Minstrel

    Frankly, this looks like 75% unnecessary fluff and 25% actually useful stuff. (Percentages not ratified.)

    I don't even know what the colour methods do differently than the built-in sendMessage (because I'm going exclusively from your JavaDocs; don't make people look at the source to figure out what a method does, okay?).

    The cryptography functions I can see as being useful, but surely these things already exist somewhere in java.* or javax.*? If so, including them here is totally pointless. Even if not, I can't think of many uses for them in Bukkit. Still, they're definitely not useless.

    The move event methods certainly look useful.

    I can kinda see the point of the inventory methods, though most of them are not that useful since they look like they'd be a thin wrapper around the Bukkit methods to allow you to manipulate the inventory without constructing an ItemStack.

    The player methods look mostly useful; forceChat however seems entirely useless since it looks like it does the exact same thing as player.chat(), and mountPlayer is entirely useless since you could achieve the exact same effect using mountEntity. That said, I don't see the point of having mountEntity when you can just use... what was it, entity.setPassenger() or something like that?

    Half of your random methods are useless. Why include getRandomInt/Float/Double when they already exist in the Random class? The other three look useful though. What about getRandomBlock() that returns a Material instead of an int?

    Region methods look useful.

    What's the point of the scheduler? Bukkit already has a built-in scheduler; what makes yours any different/better than the built-in one?

    I guess the terrain methods are useful, though I'd change the ArrayList ones to just List.

    I don't even know what the trace methods do, since your documentation seems to be written with the assumption that I already know what it does.

    From what I can tell from the documentation class, the Extras class is totally useless at its intended task; you should a) make the pluginName a non-static member of Extras, b) make all of the ExtrasXYZ classes take an Extras as a parameter, and possibly c) make the Extras constructor take Plugin as an argument instead of String. Why is it useless? Because if multiple plugins use your libraries, the use of the plugin name for reporting errors will get messed up and report the wrong plugin in many situations.

    In summary, this (a utility library for Bukkit) is a good idea, but I think you should try to improve your documentation and maybe reconsider the usefulness of some of these things. I could go on to suggest other things that I think would be useful to add, but this post is long enough for now. Maybe later.
     
  27. Offline

    Adamki11s

    Of course the cryptography methods exist in Java however I am providing an easy interface to do a somewhat advanced process and with plugin such as AuthMe and other password protections security is important. I wouldn't like my password stored as plaintext.

    The inventory methods are a thin wrapper, yes but they make everything that little bit easier for new plugin devs who are inexperienced with ItemStacks and the like which is mainly what this plugin attempts to appeal to.

    I am not going to deny that my Scheduler is simply a wrapper for Bukkit's one however, as mentioned before this library is aimed mainly at aspiring/new developers who would get confused with variable scope within the run() method and also how the whole thing is constructed. My method makes an easy and straightforward (For new developers) implementation.

    The documentation on Trace is a bit vague I admit but overall it's just a way for people to 'trace' how long it takes for a certain piece of code to run.
     
  28. Offline

    Celtic Minstrel

    I definitely agree with that sentiment.

    I won't deny that. The sort method looks perhaps slightly useful as well.

    Ah, I see. Looking more closely at your documentation, I can see how it differs from the built-in Bukkit scheduler API; I guess it uses reflection?

    Ah, that does sound like it could be useful for debugging.
     
  29. Offline

    Shamebot

    About the scheduler, i think it would be better if you wouldn't create a new instance of the class, but call the method on an existing instance.
     
  30. Offline

    Tster

    This has to be one of my favorite resources,
    Bump
     

Share This Page