Commands don't work when sent from console #1


  • New
  • Defect
Open
Assigned to _ForgeUser7144330
  • _ForgeUser8821410 created this issue Apr 29, 2012

    Any MelooonCensor command executed by the console doesn't work. All that happens is this error appearing in the log:

    2012-04-29 19:55:51 [WARNING] Unexpected exception while parsing console command
    org.bukkit.command.CommandException: Unhandled exception executing command 'mcensor' in plugin Melooon v1.2.5
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:479)
        at org.bukkit.craftbukkit.CraftServer.dispatchServerCommand(CraftServer.java:475)
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:596)
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:565)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:449)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.command.ColouredConsoleSender cannot be cast to org.bukkit.entity.Player
        at me.melooon.MelooonPlugin.onCommand(MelooonPlugin.java:123)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
        ... 7 more

    This exception appeared in v1.2.5.

    It doesn't matter whether there are any arguments. "mcensor" does exactly the same as "mcensor add flower": The exception I posted above.
    I hope you'll be able to fix that :)

  • _ForgeUser8821410 added the tags New Defect Apr 29, 2012
  • _ForgeUser8751396 posted a comment May 20, 2012

    Check to be sure the sender is an instance of a Player, before trying to interact with the Player object.

    "Caused by: java.lang.ClassCastException org.bukkit.craftbukkit.command.ColouredConsoleSender cannot be cast to org.bukkit.entity.Player"

    The console cannot be cast to a player.

    Use a check like: if(sender instanceof Player)

    To ensure your player object is not null.


To post a comment, please login or register a new account.