All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.CommandDispatcher Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package net.minecraft.server;

public class CommandDispatcher extends CommandHandler implements ICommandDispatcher {

  public CommandDispatcher() {
    this.a(new CommandTime());
    this.a(new CommandGamemode());
    this.a(new CommandDifficulty());
    this.a(new CommandGamemodeDefault());
    this.a(new CommandKill());
    this.a(new CommandToggleDownfall());
    this.a(new CommandWeather());
    this.a(new CommandXp());
    this.a(new CommandTp());
    this.a(new CommandGive());
    this.a(new CommandReplaceItem());
    this.a(new CommandStats());
    this.a(new CommandEffect());
    this.a(new CommandEnchant());
    this.a(new CommandParticle());
    this.a(new CommandMe());
    this.a(new CommandSeed());
    this.a(new CommandHelp());
    this.a(new CommandDebug());
    this.a(new CommandTell());
    this.a(new CommandSay());
    this.a(new CommandSpawnpoint());
    this.a(new CommandSetWorldSpawn());
    this.a(new CommandGamerule());
    this.a(new CommandClear());
    this.a(new CommandTestFor());
    this.a(new CommandSpreadPlayers());
    this.a(new CommandPlaySound());
    this.a(new CommandScoreboard());
    this.a(new CommandExecute());
    this.a(new CommandTrigger());
    this.a(new CommandAchievement());
    this.a(new CommandSummon());
    this.a(new CommandSetBlock());
    this.a(new CommandFill());
    this.a(new CommandClone());
    this.a(new CommandTestForBlocks());
    this.a(new CommandBlockData());
    this.a(new CommandTestForBlock());
    this.a(new CommandTellRaw());
    this.a(new CommandWorldBorder());
    this.a(new CommandTitle());
    this.a(new CommandEntityData());
    if (MinecraftServer.getServer().ae()) {
      this.a(new CommandOp());
      this.a(new CommandDeop());
      this.a(new CommandStop());
      this.a(new CommandSaveAll());
      this.a(new CommandSaveOff());
      this.a(new CommandSaveOn());
      this.a(new CommandBanIp());
      this.a(new CommandPardonIP());
      this.a(new CommandBan());
      this.a(new CommandBanList());
      this.a(new CommandPardon());
      this.a(new CommandKick());
      this.a(new CommandList());
      this.a(new CommandWhitelist());
      this.a(new CommandIdleTimeout());
    } else {
      this.a(new CommandPublish());
    }

    CommandAbstract.a(this);
  }

  public void a(ICommandListener icommandlistener, ICommand icommand, int i, String s, Object... aobject) {
    boolean flag = true;
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (!icommandlistener.getSendCommandFeedback()) {
      flag = false;
    }

    ChatMessage chatmessage = new ChatMessage("chat.type.admin", icommandlistener.getName(), new ChatMessage(s, aobject));

    chatmessage.getChatModifier().setColor(EnumChatFormat.GRAY);
    chatmessage.getChatModifier().setItalic(true);
    if (flag) {
  
      for (EntityPlayer entityPlayer : minecraftserver.getPlayerList().v()) {
  
        if (entityPlayer != icommandlistener && minecraftserver.getPlayerList().isOp(entityPlayer.getProfile()) && icommand.canUse(icommandlistener)) {
          boolean flag1 = icommandlistener instanceof MinecraftServer && MinecraftServer.getServer().r();
          boolean flag2 = icommandlistener instanceof RemoteControlCommandListener && MinecraftServer.getServer().q();
      
          if (flag1 || flag2 || !(icommandlistener instanceof RemoteControlCommandListener) && !(icommandlistener instanceof MinecraftServer)) {
            ((EntityHuman) entityPlayer).sendMessage(chatmessage);
          }
        }
      }
    }

    if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands") && !org.spigotmc.SpigotConfig.silentCommandBlocks) { // Spigot
      minecraftserver.sendMessage(chatmessage);
    }

    boolean flag3 = minecraftserver.worldServer[0].getGameRules().getBoolean("sendCommandFeedback");

    if (icommandlistener instanceof CommandBlockListenerAbstract) {
      flag3 = ((CommandBlockListenerAbstract) icommandlistener).m();
    }

    if ((i & 1) != 1 && flag3 || icommandlistener instanceof MinecraftServer) {
      icommandlistener.sendMessage(new ChatMessage(s, aobject));
    }

  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy