lishid / OpenInv

Open anyone's inventory as a chest, real-time!
GNU General Public License v3.0
120 stars 97 forks source link

Improve handling of runnable used to reset shulker box viewer count #64

Closed dartasen closed 7 years ago

dartasen commented 7 years ago

When you open a shulker box with the silent option, an error appears on console but also a message in chat like "Couldn't send silent chest" 👎

Using latest spigot 1.11 🗡

Jikoo commented 7 years ago

And the console error would be? Please paste the full trace.

dartasen commented 7 years ago

``[18:02:13] [Server thread/WARN]: java.lang.IllegalArgumentException: Plugin cannot be null [18:02:13] [Server thread/WARN]: at org.apache.commons.lang.Validate.notNull(Validate.java:192) [18:02:13] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftScheduler.validate(CraftScheduler.java:400) [18:02:13] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:126) [18:02:13] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftScheduler.runTaskLater(CraftScheduler.java:109) [18:02:13] [Server thread/WARN]: at org.bukkit.scheduler.BukkitRunnable.runTaskLater(BukkitRunnable.java:64) [18:02:13] [Server thread/WARN]: at com.lishid.openinv.internal.v1_11_R1.AnySilentContainer.activateContainer(AnySilentContainer.java:275) [18:02:13] [Server thread/WARN]: at com.lishid.openinv.listeners.PlayerListener.onPlayerInteract(PlayerListener.java:75) [18:02:13] [Server thread/WARN]: at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source) [18:02:13] [Server thread/WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [18:02:13] [Server thread/WARN]: at java.lang.reflect.Method.invoke(Method.java:498) [18:02:13] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) [18:02:13] [Server thread/WARN]: at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [18:02:13] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [18:02:13] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [18:02:13] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_11_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:234) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.PlayerInteractManager.a(PlayerInteractManager.java:444) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:904) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:37) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:1) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [18:02:13] [Server thread/WARN]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [18:02:13] [Server thread/WARN]: at java.util.concurrent.FutureTask.run(FutureTask.java:266) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:747) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678) [18:02:13] [Server thread/WARN]: at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576) [18:02:13] [Server thread/WARN]: at java.lang.Thread.run(Thread.java:745)

Jikoo commented 7 years ago

What server version/OpenInv version? The error is caused by a null plugin instance being returned by the plugin manager, however, that should not be possible unless you're running a version of OpenInv that is not named "OpenInv"- this line.

dartasen commented 7 years ago

Hey, I'm using both latest version of Spigot and Openinv 🥇 Oh sorry, I renamed my plugins to prevent OP moderator to see them

Jikoo commented 7 years ago

Please consider using permissions instead of op status. It's really not a good idea to have someone you don't trust opped. You could also remove their ability to use /plugins and /version.

I'll leave this open because the method used to obtain the plugin instance for use in the runnable is hacky, but I don't consider this to be an OpenInv issue as you're modifying the files.

Jikoo commented 7 years ago

Going to close this. If the new method does not work in 1.11 we'll chalk it up to a Minecraft limitation, and people who want to use older versions will have to suffer with the downsides that come with them. You can now (pending me drafting a release) modify the name in the plugin.yml to your heart's content, though, as stated previously, you really should just use a permissions plugin.