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

    Engelier

  2. Offline

    Delocaz

    Alright, so you're telling us beginners we can not use any Bukkit function WHAT SO EVER except Block.getBlock(x, y, z) and player.sendMessage(msg)? That is bullshit.
     
  3. Offline

    Njol

    I use this code to prevent this:
    Code:
            @EventHandler
            public void onPlayerChat(final AsyncPlayerChatEvent e) {
                if (!e.isAsynchronous()) {
                    execute(e);
                } else {
                    final Future<Void> f = Bukkit.getScheduler().callSyncMethod(plugin, new Callable<Void>() {
                        @Override
                        public Void call() throws Exception {
                            execute(e);
                            return null;
                        }
                    });
                    try {
                        while (true) {
                            try {
                                f.get();
                                break;
                            } catch (final InterruptedException e1) {}
                        }
                    } catch (final ExecutionException e1) {
                        // The execute() method generated an exception!
                    }
                }
            }
    
    Simply define a method "private void execute(AsyncPlayerChatEvent e)" which will be called when a player chats and is guaranteed to run on Bukkit's main thread, i.e. you'll be able to use any methods you want.

    PS: If you neither want to cancel the event nor change the message in any way you could also simply schedule a task with no delay instead of using callSyncMethod.

    PP: I apologize if this code is not 100% correct ^^
     
  4. Offline

    feildmaster

  5. Offline

    Wolvereness Bukkit Team Member

    EntityChangeBlockEvent is no longer restricted to LivingEntities. Unfortunately, this is a bytecode incompatibility and requires any plugin that calls EntityChangeBlockEvent.getEntity() to recompile. If you relied on it being a living entity, take note that you should use an instanceof check as sand / gravel will now fire the event.
     
  6. Offline

    deep15mine

    Craftbukkit Dev Version 1.4.5-R0.3 (2505) adds Bukkit 3078, EntityChangeBlockEvent. When I updated server from 2504 to 2505 I got lots of EntityChangeBlockEvent errors as soon as server finished booting. I can still run with no problems with 2504. What did you mean by "requires any plugin that calls EntityChangeBlockEvent to recompile"? What do I need to do to move server to 2505? Sample printout follows:

    2012-12-04 23:30:55 [INFO] There are 0 out of maximum 20 players online.
    2012-12-04 23:30:55 [SEVERE] Could not pass event EntityChangeBlockEvent to WorldGuard v5.6.5
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:341)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
    at org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(CraftEventFactory.java:467)
    at org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(CraftEventFactory.java:451)
    at net.minecraft.server.PathfinderGoalEatTile.e(PathfinderGoalEatTile.java:67)
    at net.minecraft.server.PathfinderGoalSelector.a(PathfinderGoalSelector.java:104)
    at net.minecraft.server.EntityLiving.bl(EntityLiving.java:1422)
     
  7. Offline

    feildmaster

    He meant exactly what he said. Your plugins need to be updated.
     
  8. Offline

    deep15mine

    I checked an hour ago and there are no updates from the version of plugins I am running. Tried running the jars through the update folder again with no change. Can I rebuild server with same plugins or do I have to wait until developers update them and recompile them. Thanks

    I found and read info at this site and I think it answered my question. I need to wait until the plugins are corrected and updated to handle the EntityChangeBlockEvent correctly. Everything is still working on CB 2504. http://forums.bukkit.org/threads/ho...ubleshoot-your-own-plugins-by-yourself.32457/ Thanks

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

    chillecharlie

    Nevermind.
     
  10. Offline

    feildmaster

  11. Nevermind my confused self up there ^^. Found the error:

    [​IMG]
     
  12. Offline

    GeekPlaya

    getPortalTravelAgent() now broken on all plugins relying on it for teleporting users via portal on custom worlds.

    Happened after EdGruberman's changes.
     
Thread Status:
Not open for further replies.

Share This Page