[snipped] A way to use bukkit methods is a safe way whit another thread

Discussion in 'Resources' started by ferrybig, Jun 22, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    ferrybig

    The problem
    When you are doing java for some time, you mostly use graphical user interfaces with also use an scheduler kind system at swing. There are match useful classes inside swing, like SwingWorker. But they don't exist at bukkit, so I decided to make my own minimalized version of an so called "BukkitWorker" to replace the things that SwingWorker provided to us.

    The solution
    I designed the following class to make our life as programmer more easier:
    see http://dev.bukkit.org/paste/5642/ for the code, if you use it, plz give credit

    Example plugin

    url check plugin (open)
    See https://dl.dropbox.com/u/60864086/FerryBukkitWorker.jar for the jar, sources are included
    When you installed the plugin, you can do /bukkitworkertest, the plugin will look with of the Minecraft sites are online and offline, by default it test the following site:
    (The example plugin accepts commands from the console to, unlike most plugins, :p)

    backup plugin (open)

    See https://dl.dropbox.com/u/60864086/FerryBackup.jar for the jar, sources are included
    This plugin gives an /backup command, when you do that, it creates an directory inside the server directory, and backup the files for the worldedit snapshot format.


    More information
    I did my best to add an nice javadoc to it, if you find any bugs, post it and I will look how I can solve it.
     
  2. Offline

    totokaka

    Looks very interesting!
    Think I will use this in some plugins.
    But may you make more examples? I am reading and rereading the code to understand it fully, would help with more examples! What about sending a message every x secound?
     
  3. Offline

    ferrybig

    ok, I wil try another simple backup plugin as an example, that tells in game how far the backis while procsing the files (whitout locking the server)

    Notice, whit the example already there, there are 3 classes files:
    me.ferry.bukkit.plugins.PluginBase - The class that provides funcinality that is shared by mutch plugin I make
    me.ferry.bukkit.plugins.BukkitWorker - The class explaned above
    me.ferry.bukkit.plugins.bukkitworker.BukkitWorkerPlugin - The main class of the plugin, uses bukkitworker to check the urls if they are working
     
  4. Offline

    chaseoes Retired Staff

    What's "whits", "usefull", "anny" and a "schedular"?
     
    Drkmaster83 and heisan213 like this.
  5. Offline

    ferrybig

    what do you mean whit it?
     
  6. Offline

    chaseoes Retired Staff

    Whit?
     
    Drkmaster83 likes this.
  7. Offline

    jimbo8

    Don't be like a kid, please. I know you understand what he mean.
     
    CarlosArias604 and ferrybig like this.
  8. Offline

    chaseoes Retired Staff

    Yet he has made no effort to change.
     
    Drkmaster83 likes this.
  9. Offline

    CarlosArias604

    Maybe English isn't his first language? Have you though of that? No, You just assumed everyone knows perfect English.

    -C
     
    ferrybig and jimbo8 like this.
  10. Offline

    jimbo8

    I thought that nearly every plugin developer was great persons.. Well, probably not.
     
  11. Offline

    ferrybig

    I chanced it inside the main post, if you didnĀ“t notice....
     
  12. Offline

    evilmidget38 Retired Staff

    I was just glancing at your code, thought I'd mention that you shouldn't use .bukkit in your namespace.
     
  13. Offline

    ferrybig

    they mean things like net.bukkit, com.bukkit, org.bukkit at the start
     
    Icyene likes this.
Thread Status:
Not open for further replies.

Share This Page