Search in sources :

Example 1 with LazyPlayerSet

use of org.bukkit.craftbukkit.v.util.LazyPlayerSet in project Arclight by IzzelAliz.

the class ServerPlayNetHandlerMixin method handleSlashCommand.

/**
 * @author IzzelAliz
 * @reason
 */
@Overwrite
private void handleSlashCommand(String s) {
    if (SpigotConfig.logCommands) {
        LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
    }
    CraftPlayer player = this.getPlayer();
    PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet(this.minecraftServer));
    this.server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        return;
    }
    try {
        minecraftServer.getCommandManager().handleCommand(((CraftPlayer) event.getPlayer()).getHandle().getCommandSource(), event.getMessage());
    } catch (CommandException ex) {
        player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
        java.util.logging.Logger.getLogger(ServerPlayNetHandler.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : PlayerCommandPreprocessEvent(org.bukkit.event.player.PlayerCommandPreprocessEvent) ServerPlayNetHandler(net.minecraft.network.play.ServerPlayNetHandler) CraftPlayer(org.bukkit.craftbukkit.v.entity.CraftPlayer) LazyPlayerSet(org.bukkit.craftbukkit.v.util.LazyPlayerSet) CommandException(net.minecraft.command.CommandException) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Aggregations

CommandException (net.minecraft.command.CommandException)1 ServerPlayNetHandler (net.minecraft.network.play.ServerPlayNetHandler)1 CraftPlayer (org.bukkit.craftbukkit.v.entity.CraftPlayer)1 LazyPlayerSet (org.bukkit.craftbukkit.v.util.LazyPlayerSet)1 PlayerCommandPreprocessEvent (org.bukkit.event.player.PlayerCommandPreprocessEvent)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1