So I am using this code to check if a player is flying: Code (Text): if (sender.isFlying() == true) { sender.setFlying(false); } else { sender.setFlying(true); } The problem is when they are in SURVIVAL mode it will error out in game 'An internal error occurred when attempting to perform this command' - It works if they are in CREATIVE although they can just double jump and then they're back into fly mode instead of typing /fly. EDIT: I've also tried removing the == true, still same error.
When you see this error in game it means you need to look in cosolen to get detailed information about the issue. There will be a nice stacktrace outlining exactly what went wrong, and where. More information on how to read a stacktrace: https://bukkit.org/threads/how-to-r...ubleshoot-your-own-plugins-by-yourself.32457/
Sorry just got back home, org.bukkit.command.CommandException: Unhandled exception executing command 'fly' in plugin Test at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-e6f93f4-ed60c01] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-e6f93f4-ed60c01] at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchCommand(CraftServer.java:645) ~[spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.PlayerConnection.handleCommand(PlayerConnection.java:1350) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:1185) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_91] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_91] at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:721) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559) [spigot.jar:git-Spigot-e6f93f4-ed60c01] at java.lang.Thread.run(Unknown Source) [?:1.8.0_91] Caused by: java.lang.IllegalArgumentException: Cannot make player fly if getAllowFlight() is false at org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer.setFlying(CraftPlayer.java:1143) ~[spigot.jar:git-Spigot-e6f93f4-ed60c01] at test.moderance.commands.Fly.onCommand(Fly.java:36) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-e6f93f4-ed60c01] ... 15 more
THANK YOU! Fixed, I better start reading the errors more edit: I have this weird glitch where if they are standing still and they do /fly it will always enable it for them?
@ Moderance also u can check the error line : at test.moderance.commands.Fly.onCommand(Fly.java:36) ~[?:?] its very very usefull ^^