Skip to content

Commit

Permalink
Fixed RCON dispatch command ClassCastException (CrucibleMC#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotori0629 committed Aug 18, 2023
1 parent cdd69f1 commit 721ebc7
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.command.ICommandSender;
import net.minecraft.network.rcon.RConConsoleSource;
import org.bukkit.Server;
import org.bukkit.command.*;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
Expand Down Expand Up @@ -41,8 +42,13 @@ public boolean dispatch(CommandSender sender, String commandLine) throws Command
if (!target.testPermission(sender)) return true;
if (sender instanceof ConsoleCommandSender) {
FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(this.vanillaConsoleSender, commandLine);
} else
// CauldronX start - fix RemoteConsoleSender execute command ClassCastException
} else if (sender instanceof RemoteConsoleCommandSender) {
FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(RConConsoleSource.instance, commandLine);
// CauldronX end
} else {
FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(((CraftPlayer) sender).getHandle(), commandLine);
}
} else {
// Cauldron end
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
Expand Down

0 comments on commit 721ebc7

Please sign in to comment.