[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 14, 2011.

     
  1. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    [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

    This post has been edited 2 times. It was last edited by Adamki11s Jan 3, 2012.
    iPhysX, zhuowei and JWhy like this.
  2.  
  3. Offline

    shadrxninga

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This looks great :D

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

    cholo71796

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    "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.
  5. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Heyy, It was 5am my time when I posted this, cut me some slack :p Thanks though.
    See above :D.
    shadrxninga likes this.
  6. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Adding a scheduler library. Hope to finish it today
  7. Offline

    Kohle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Amazing. Good job.
  8. Offline

    DrBowe

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  9. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Finished Cryptography Library & Added Scheduler Library.
    Working on a basic video tutorial and some example plugins now.
  10. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Added updateInventory() method - Not sure if it works though :p.
  11. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Added :

    public abstract Block getLookedAtBlock(Player p);

    public abstract Location getLocationLooked(Player p);
  12. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Fixed Cryptography Methods
  13. Offline

    Daniel Heppner

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  14. Offline

    cholo71796

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Me too, hahah.
  15. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  16. Offline

    wouter0100

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Broken download link?
  17. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Sorry, fixed now, just re-download.
  18. Offline

    wouter0100

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)


    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.
  19. Offline

    Jaker232

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Maven? Is that required? I don't have it installed.
  20. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  21. Offline

    wouter0100

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  22. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  23. Offline

    Styx Reborn

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Styx Reborn approves. (atleast the dev)
  24. Offline

    Shamebot

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Did you see my comments on github?
  25. Offline

    Jaker232

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    When we hook into this plugin, does the downloader have to install this first?
  26. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You're meant to download this and include it as a library in your project.
  27. Offline

    Jaker232

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Ohhh.. thanks.

    Can you add a smoke method?
  28. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Soon, when I release my Warzone plugin ;)
  29. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Fixed a small issue with scheduler tasks.
  30. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  31. Offline

    Adamki11s

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.

Share This Page