Discussion: Oops, I broke your plugins!

Discussion in 'Plugin Development' started by EvilSeph, Jan 17, 2011.

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


    Well, fair enough- but point being I can't do it from within package borders now. It's very annoying because it only happens at runtime- do I need to adjust Eclipse settings?

    It's happened to me on method calls, too- I mean it really feels kind of crappy, frankly. I have to exercise every single code path in all of my plugins, now? WTF?

    Please tell me I'm doing something wrong.

    Well, I guess some of my admins don't know about RBs. It's very hard to keep track, when people come and paste an error that makes it obvious that the tense was (kind of needlessly) changed for a bunch of event names, I'm not about to go hunt down when and where that happened in the code, figure out if it's in the latest RB yet, etc. That's a huge pain in the ass.

    No, I'm going to update to latest, Make it Work with that, and publish. Sorry, that's the best I can do.

    Anyway- this security thing fricking blows. I'd like to know how to turn that back off, or at least make my compiler match whatever settings were changed.
  2. Offline


    Did you try an really easy plugin with two classes?

    Do you mean latest RB or build? With 556 there are no event changes (no PLAYER_INTERACT).

  3. Offline


    I mean latest build- I build against code, not jars- and that's basically where the process falls apart for me. I guess I should stop doing that, because it's really hard to get code at a particular RB. (At least, I never find it works well for me- have to match up Bukkit and CB, big hassle)
  4. Offline


    Btw, jenkins will tell you what version of bukkit was used

    For example, this is the 556 RB.

    It has:
    Revision: 6c6c30a097fc308b96e882cf5a20e7167991df37
    This is the commit revision of CraftBukkit

    Also, it has

    Upstream Builds
    dev-Bukkit #461

    This gives you a link to the matched Bukkit version and that has
    Revision: 9768ecc96bb56a04668d08adacea56fab35d0860

    These are the git commit numbers, so you can
    cd CraftBukkit
    git checkout master
    git checkout 6c6c30a097fc308b96e882cf5a20e7167991df37

    cd Bukkit
    git checkout master
    git checkout 9768ecc96bb56a04668d08adacea56fab35d0860

    and that gives you the RB source.
  5. Offline


    Thanks! I gave it some thought, though, and I think I decided I don't care :)

    Previous versions of my plugins are always available for download, so I'm just going to keep up with the code. I'd like some sort of download table, eventually- maybe in the wiki for each plugin, that maps RB's to plugin versions, but that's a lot of work.
  6. Offline


    I've just gotten back online and am playing catch up.

    A new RB will hopefully be coming tomorrow. Please note: this WILL break a lot of plugins, but we've given you a heads up and more than enough time to prepare for the next RB so things should go fine tomorrow.
  7. Offline


    Okay, I have to ask, before you guys mark an RB, could you PLEASE push this commit? Without it, any plugin depending on blocks actually being loaded when WORLD_LOAD is called is going to seriously break: https://github.com/Bukkit/CraftBukkit/pull/214
  8. Offline


    As you can probably see above, the next Recommended Build will break your plugins if you haven't already prepared to address the issues in this thread.

    The following changes (and possibly more, if I've missed any) will likely break any outdated plugins:
    • PlayerInteractEvent replaces: BlockRightClickEvent, BlockInteractEvent and PlayerItemEvent
    • Renamed events/constants (from past to future tense)
    • Added PlayerBucketFill, PlayerBucketEmpty and PlayerInteract events
    • Updated: BlockDamage and BlockPlace events
    • Refactored many event signatures.
    • Replaced void teleportTo(Location) with boolean teleport(Location).
    • World.spawnCreature now returns LivingEntity instead of Creature.
    While this list looks small, the changes made will break a large number of plugins. Please make sure you're prepared for the next recommended build which will happen SOON - most likely later today!
  9. Offline


    Thanks for the advance notice.
  10. Offline


    I'm having a hard time discerning if this is sarcasm. It's been...2 weeks since the last RB?
  11. Offline


    Sarcasm seems to be a running thing on the forum, this past weeks :p
    I blame Notch and Special-K
  12. Offline


    Sorry, not sarcasm, I'm genuinely happy to know ahead of time, even if it's only "It's probably coming today" because I've delayed releasing plugin builds that will break with current RBs at the expense of not yet supporting 561+.

    Any form of advance notice lets me know I should be wrapping up any feature additions and working towards testing plugins with new builds.
  13. Offline


    A question about new update:

    with onPlayerBucketEmpty, where can i get location, where water/lava is supposed to spawn? You can use getBlockClicked, but this will report actual clicked block, not position of placed water/lava, which can be different.
  14. Offline

    Celtic Minstrel


    Something like that.
  15. Offline


    It's not that simple. If you hit the wall, water will move in relative horizontal block. and if you hit ceiling, it will use BlockFace.DOWN.

    Isn't there any more accurate solution than checking all block faces of getBlockClicked?
  16. Offline

    Celtic Minstrel

    Ah, try using something like evt.getBlockFaceClicked() in place of BlockFace.UP, then.
  17. Offline


    getBlockFaceClicked works. Thanks!
  18. Offline


    where can i download the lastest bukkit API ?

    Since i take the last Bukkit API 482 from http://wiki.bukkit.org/Main_Page, i have some event that disapear (as blockrightclick) and new which appeared (as onPlayerInteract) but when i use them i write this in the javaplugin :
    pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Normal, this);
    and in the playerListener :
        public void onPlayerInteract(PlayerInteractEvent event) {
    but PlayerInteractEvent is not define, then i can't get the information from "event.getAction"
  19. Offline


    Go on ci.bukkit.org and select dev-CraftBukkit or dev-Bukkit. There you can find the newest builds.

  20. Offline


    I scanned both threads, didn't see this at all, forgive me if it was covered. What is this about?

    6:41:51 [SEVERE] Plugin attempted to register CREATURE_SPAWN while not enabled loading CrowdControl v0.21 (Is it up to date?)
    org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register CREATURE_SPAWN while not enabled
    I get this on all my plugins now, anytime they register events. Yeah, I do that in onEnable- I guess that's wrong now? Where does that go, the new onLoad?

    I was not (as far as I know) ever getting the warning message that @Dinnerbone talked about. I don't see any discussion of the issue this warning was actually nagging about, though, nor a description of what to actually do when this happens.
  21. Offline


    @NathanWolf I'm not sure if this would be the cause, but in "initialize()" you have the ability to disable the plugin, yet even if you do the rest of onEnable() is run, which means that the plugin can be disabled yet still try to register an event on CREATURE_SPAWN
  22. Offline


    You should cancel the onEnable() method if you disable your plugin (e.g. with return):
        public void onEnable() {
            } catch (Exception e) {
                MyWarp.logger.severe("Could not load data. Disabling " + this.name + "!", e);
                return; // This command is important!
  23. Offline


    I'm not disabling my plugins... I didn't really change anything. It's working on 577, it's broken now. No idea why.

    EDIT: Hm, well they do disable themselves if Persistence isn't found- so maybe Persistence failed higher up in the log. Let me go look for root cause instead of firing random complaints...

    Thanks for your help, @Drakia and @xZise!

    EDIT2: I missed the player event changes, I guess- so that's breaking Persistence. However, I early-out of onEnable (which is where I disable my plugins if Persistence doesn't load) - so it should not be setting up events in that case. Do I still need to cancel the event?
  24. Offline

    Celtic Minstrel

    People should start using the "depend:" list in the plugin.yml when they require another plugin in order to work. For example, in your case, "plugin: [Persistance]".

    I had no idea it even existed until yesterday, but if you did that I think your onEnable would never even get called in the first place if Persistance was missing or threw an error.
  25. Offline


    @NathanWolf I'm not at home so can't verify, but I'm pretty sure your plugin dependency check is in initialize and not onenable. So even though you drop out of initialize, onenable continues to run.
  26. Offline


    I think I call an "initialize" function from onEnable, but I don't think I ever updated any of my plugins to use onInitialize (or onLoad? Whatever the new one is....)

    @Celtic Minstrel - that is an excellent suggestion! I did not know that existed, either- I'm going to make a note of that. Do you have an example I could look at so I don't have to bang my head against YML? :D
  27. Offline


    What the hell is this:

    2011-03-29 22:58:19 [SEVERE] class com.matejdro.bukkit.jail.JailPlayer overrides final method onPlayerJoin.(Lorg/bukkit/event/player/PlayerEvent;)V loading Jail v0.5.6 (Is it up to date?)
    java.lang.VerifyError: class com.matejdro.bukkit.jail.JailPlayer overrides final method onPlayerJoin.(Lorg/bukkit/event/player/PlayerEvent;)V
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:36)
        at org.bukkit.plugin.java.JavaPluginLoader.getClassByName(JavaPluginLoader.java:142)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:32)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at com.matejdro.bukkit.jail.Jail.onEnable(Jail.java:60)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:511)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:216)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:93)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:71)
        at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:204)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:191)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:131)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:246)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    My code:

    		getServer().getPluginManager().registerEvent(Event.Type.PLAYER_JOIN, PlayerListener, Event.Priority.Monitor, this);
    public void onPlayerJoin(PlayerEvent event) {
    		 if (Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase()))
    			 JailPrisoner prisoner = Jail.prisoners.get(event.getPlayer().getName().toLowerCase());
    			 if (prisoner.OfflinePending())
    				 if (prisoner.getTransferDestination().isEmpty())
    					 if (prisoner.getRemainingTime() != 0)
    						 plugin.Jail(prisoner, event.getPlayer());
    						 plugin.UnJail(prisoner, event.getPlayer());
    					 plugin.Transfer(prisoner, event.getPlayer());
  28. Offline


    @NathanWolf Tgats the function I'm referrig to. Yo call initialize from onenable, then check for your plugin dependecy in that function, not in onenable. So even though that function drops out, onenable still finishes.
  29. Offline


    Ah, I see, I need to that, not that's what I'm doing currently :)

    I'll change that eventually, that sounds like a better approach- but it also seems like my current approach works so long as Persistence is there and starts up ok.
  30. Offline


    onPlayerJoin now takes a PlayerJoinEvent.
Thread Status:
Not open for further replies.

Share This Page