protected void emptyTeam(ICommandSender p_147188_1_, String[] p_147188_2_, int p_147188_3_) throws CommandException { Scoreboard scoreboard = this.getScoreboard(); ScorePlayerTeam scoreplayerteam = this.getTeam(p_147188_2_[p_147188_3_]); if (scoreplayerteam != null) { Collection<String> collection = Lists.newArrayList(scoreplayerteam.getMembershipCollection()); p_147188_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, collection.size()); if (collection.isEmpty()) { throw new CommandException("commands.scoreboard.teams.empty.alreadyEmpty", new Object[] {scoreplayerteam.getRegisteredName()}); } else { for (String s : collection) { scoreboard.removePlayerFromTeam(s, scoreplayerteam); } notifyOperators(p_147188_1_, this, "commands.scoreboard.teams.empty.success", new Object[] {Integer.valueOf(collection.size()), scoreplayerteam.getRegisteredName()}); } } }
protected void emptyTeam(ICommandSender sender, String[] p_184917_2_, int p_184917_3_, MinecraftServer server) throws CommandException { Scoreboard scoreboard = this.getScoreboard(server); ScorePlayerTeam scoreplayerteam = this.convertToTeam(p_184917_2_[p_184917_3_], server); if (scoreplayerteam != null) { Collection<String> collection = Lists.newArrayList(scoreplayerteam.getMembershipCollection()); sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, collection.size()); if (collection.isEmpty()) { throw new CommandException("commands.scoreboard.teams.empty.alreadyEmpty", new Object[] {scoreplayerteam.getRegisteredName()}); } else { for (String s : collection) { scoreboard.removePlayerFromTeam(s, scoreplayerteam); } notifyCommandListener(sender, this, "commands.scoreboard.teams.empty.success", new Object[] {Integer.valueOf(collection.size()), scoreplayerteam.getRegisteredName()}); } } }
public Entity(World worldIn) { this.entityId = nextEntityID++; this.renderDistanceWeight = 1.0D; this.boundingBox = ZERO_AABB; this.width = 0.6F; this.height = 1.8F; this.nextStepDistance = 1; this.rand = new Random(); this.fireResistance = 1; this.firstUpdate = true; this.entityUniqueID = MathHelper.getRandomUuid(this.rand); this.cmdResultStats = new CommandResultStats(); this.worldObj = worldIn; this.setPosition(0.0D, 0.0D, 0.0D); if (worldIn != null) { this.dimension = worldIn.provider.getDimensionId(); } this.dataWatcher = new DataWatcher(this); this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); this.dataWatcher.addObject(1, Short.valueOf((short)300)); this.dataWatcher.addObject(3, Byte.valueOf((byte)0)); this.dataWatcher.addObject(2, ""); this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); this.entityInit(); }
/** * Callback when the command is invoked */ public void processCommand(ICommandSender sender, String[] args) throws CommandException { int i = MinecraftServer.getServer().getCurrentPlayerCount(); sender.addChatMessage(new ChatComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(MinecraftServer.getServer().getMaxPlayers())})); sender.addChatMessage(new ChatComponentText(MinecraftServer.getServer().getConfigurationManager().func_181058_b(args.length > 0 && "uuids".equalsIgnoreCase(args[0])))); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i); }
protected void listPlayers(ICommandSender p_147195_1_, String[] p_147195_2_, int p_147195_3_) throws CommandException { Scoreboard scoreboard = this.getScoreboard(); if (p_147195_2_.length > p_147195_3_) { String s = getEntityName(p_147195_1_, p_147195_2_[p_147195_3_]); Map<ScoreObjective, Score> map = scoreboard.getObjectivesForEntity(s); p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size()); if (map.size() <= 0) { throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s}); } ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); p_147195_1_.addChatMessage(chatcomponenttranslation); for (Score score : map.values()) { p_147195_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()})); } } else { Collection<String> collection = scoreboard.getObjectiveNames(); p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size()); if (collection.size() <= 0) { throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]); } ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())}); chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); p_147195_1_.addChatMessage(chatcomponenttranslation1); p_147195_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray()))); } }
/** * Callback for when the command is executed */ public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { int i = server.getCurrentPlayerCount(); sender.addChatMessage(new TextComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(server.getMaxPlayers())})); sender.addChatMessage(new TextComponentString(server.getPlayerList().getFormattedListOfPlayers(args.length > 0 && "uuids".equalsIgnoreCase(args[0])))); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i); }
protected void listPlayers(ICommandSender sender, String[] p_184920_2_, int p_184920_3_, MinecraftServer server) throws CommandException { Scoreboard scoreboard = this.getScoreboard(server); if (p_184920_2_.length > p_184920_3_) { String s = getEntityName(server, sender, p_184920_2_[p_184920_3_]); Map<ScoreObjective, Score> map = scoreboard.getObjectivesForEntity(s); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size()); if (map.isEmpty()) { throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s}); } TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s}); textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN); sender.addChatMessage(textcomponenttranslation); for (Score score : map.values()) { sender.addChatMessage(new TextComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()})); } } else { Collection<String> collection = scoreboard.getObjectiveNames(); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size()); if (collection.isEmpty()) { throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]); } TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())}); textcomponenttranslation1.getStyle().setColor(TextFormatting.DARK_GREEN); sender.addChatMessage(textcomponenttranslation1); sender.addChatMessage(new TextComponentString(joinNiceString(collection.toArray()))); } }
@Override public CommandResultStats getCommandStats() { if (m_realPlayer == null) { return super.getCommandStats(); } else { syncToRealPlayer(); return syncPublicFieldsFromRealAndReturn(m_realPlayer.getCommandStats()); } }
@Override public CommandResultStats getCommandStats() { if (m_realPlayer == null) { return super.getCommandStats(); } else { return m_realPlayer.getCommandStats(); } }
public Entity(World worldIn) { this.entityId = nextEntityID++; this.riddenByEntities = Lists.<Entity>newArrayList(); this.boundingBox = ZERO_AABB; this.width = 0.6F; this.height = 1.8F; this.nextStepDistance = 1; this.rand = new Random(); this.field_190534_ay = -this.func_190531_bD(); this.firstUpdate = true; this.entityUniqueID = MathHelper.getRandomUUID(this.rand); this.cachedUniqueIdString = this.entityUniqueID.toString(); this.cmdResultStats = new CommandResultStats(); this.tags = Sets.<String>newHashSet(); this.field_191505_aI = new double[] {0.0D, 0.0D, 0.0D}; this.world = worldIn; this.setPosition(0.0D, 0.0D, 0.0D); if (worldIn != null) { this.dimension = worldIn.provider.getDimensionType().getId(); } this.dataManager = new EntityDataManager(this); this.dataManager.register(FLAGS, Byte.valueOf((byte)0)); this.dataManager.register(AIR, Integer.valueOf(300)); this.dataManager.register(CUSTOM_NAME_VISIBLE, Boolean.valueOf(false)); this.dataManager.register(CUSTOM_NAME, ""); this.dataManager.register(SILENT, Boolean.valueOf(false)); this.dataManager.register(NO_GRAVITY, Boolean.valueOf(false)); this.entityInit(); }
public void setCommandStat(CommandResultStats.Type type, int amount) { if (this.world != null && !this.world.isRemote) { this.cmdResultStats.setCommandStatForSender(this.world.getMinecraftServer(), this, type, amount); } }
public void setCommandStat(CommandResultStats.Type type, int amount) { if (this.worldObj != null && !this.worldObj.isRemote) { this.cmdResultStats.setCommandStatForSender(this.worldObj.getMinecraftServer(), this, type, amount); } }
public void setCommandStat(CommandResultStats.Type type, int amount) { this.cmdResultStats.func_179672_a(this, type, amount); }
public CommandResultStats getCommandStats() { return this.cmdResultStats; }
public void setCommandStat(CommandResultStats.Type type, int amount) { }
protected void leaveTeam(ICommandSender sender, String[] p_184911_2_, int p_184911_3_, MinecraftServer server) throws CommandException { Scoreboard scoreboard = this.getScoreboard(server); Set<String> set = Sets.<String>newHashSet(); Set<String> set1 = Sets.<String>newHashSet(); if (sender instanceof EntityPlayer && p_184911_3_ == p_184911_2_.length) { String s3 = getCommandSenderAsPlayer(sender).getName(); if (scoreboard.removePlayerFromTeams(s3)) { set.add(s3); } else { set1.add(s3); } } else { while (p_184911_3_ < p_184911_2_.length) { String s = p_184911_2_[p_184911_3_++]; if (s.startsWith("@")) { for (Entity entity : getEntityList(server, sender, s)) { String s2 = getEntityName(server, sender, entity.getCachedUniqueIdString()); if (scoreboard.removePlayerFromTeams(s2)) { set.add(s2); } else { set1.add(s2); } } } else { String s1 = getEntityName(server, sender, s); if (scoreboard.removePlayerFromTeams(s1)) { set.add(s1); } else { set1.add(s1); } } } } if (!set.isEmpty()) { sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size()); notifyCommandListener(sender, this, "commands.scoreboard.teams.leave.success", new Object[] {Integer.valueOf(set.size()), joinNiceString(set.toArray(new String[set.size()]))}); } if (!set1.isEmpty()) { throw new CommandException("commands.scoreboard.teams.leave.failure", new Object[] {Integer.valueOf(set1.size()), joinNiceString(set1.toArray(new String[set1.size()]))}); } }
protected void applyPlayerTag(MinecraftServer server, ICommandSender sender, String[] p_184924_3_, int p_184924_4_) throws CommandException { String s = getEntityName(server, sender, p_184924_3_[p_184924_4_]); Entity entity = getEntity(server, sender, p_184924_3_[p_184924_4_++]); String s1 = p_184924_3_[p_184924_4_++]; Set<String> set = entity.getTags(); if ("list".equals(s1)) { if (!set.isEmpty()) { TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.players.tag.list", new Object[] {s}); textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN); sender.addChatMessage(textcomponenttranslation); sender.addChatMessage(new TextComponentString(joinNiceString(set.toArray()))); } sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, set.size()); } else if (p_184924_3_.length < 5) { throw new WrongUsageException("commands.scoreboard.players.tag.usage", new Object[0]); } else { String s2 = p_184924_3_[p_184924_4_++]; if (p_184924_3_.length > p_184924_4_) { try { NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(buildString(p_184924_3_, p_184924_4_)); NBTTagCompound nbttagcompound1 = entityToNBT(entity); if (!NBTUtil.areNBTEquals(nbttagcompound, nbttagcompound1, true)) { throw new CommandException("commands.scoreboard.players.tag.tagMismatch", new Object[] {s}); } } catch (NBTException nbtexception) { throw new CommandException("commands.scoreboard.players.tag.tagError", new Object[] {nbtexception.getMessage()}); } } if ("add".equals(s1)) { if (!entity.addTag(s2)) { throw new CommandException("commands.scoreboard.players.tag.tooMany", new Object[] {Integer.valueOf(1024)}); } notifyCommandListener(sender, this, "commands.scoreboard.players.tag.success.add", new Object[] {s2}); } else { if (!"remove".equals(s1)) { throw new WrongUsageException("commands.scoreboard.players.tag.usage", new Object[0]); } if (!entity.removeTag(s2)) { throw new CommandException("commands.scoreboard.players.tag.notFound", new Object[] {s2}); } notifyCommandListener(sender, this, "commands.scoreboard.players.tag.success.remove", new Object[] {s2}); } } }
public boolean executeCommand(final EntityPlayer playerIn) { ICommandSender icommandsender = new ICommandSender() { public String getName() { return playerIn.getName(); } public IChatComponent getDisplayName() { return playerIn.getDisplayName(); } public void addChatMessage(IChatComponent component) { } public boolean canCommandSenderUseCommand(int permLevel, String commandName) { return permLevel <= 2; } public BlockPos getPosition() { return TileEntitySign.this.pos; } public Vec3 getPositionVector() { return new Vec3((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D); } public World getEntityWorld() { return playerIn.getEntityWorld(); } public Entity getCommandSenderEntity() { return playerIn; } public boolean sendCommandFeedback() { return false; } public void setCommandStat(CommandResultStats.Type type, int amount) { TileEntitySign.this.stats.func_179672_a(this, type, amount); } }; for (int i = 0; i < this.signText.length; ++i) { ChatStyle chatstyle = this.signText[i] == null ? null : this.signText[i].getChatStyle(); if (chatstyle != null && chatstyle.getChatClickEvent() != null) { ClickEvent clickevent = chatstyle.getChatClickEvent(); if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND) { MinecraftServer.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue()); } } } return true; }
public CommandResultStats getStats() { return this.stats; }
private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException { int i = -1; for (int j = 0; j < p_175780_2_.length; ++j) { if (this.isUsernameIndex(p_175780_2_, j) && "*".equals(p_175780_2_[j])) { if (i >= 0) { throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]); } i = j; } } if (i < 0) { return false; } else { List<String> list1 = Lists.newArrayList(this.getScoreboard().getObjectiveNames()); String s = p_175780_2_[i]; List<String> list = Lists.<String>newArrayList(); for (String s1 : list1) { p_175780_2_[i] = s1; try { this.processCommand(p_175780_1_, p_175780_2_); list.add(s1); } catch (CommandException commandexception) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects()); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); p_175780_1_.addChatMessage(chatcomponenttranslation); } } p_175780_2_[i] = s; p_175780_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size()); if (list.size() == 0) { throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]); } else { return true; } } }
protected void listTeams(ICommandSender p_147186_1_, String[] p_147186_2_, int p_147186_3_) throws CommandException { Scoreboard scoreboard = this.getScoreboard(); if (p_147186_2_.length > p_147186_3_) { ScorePlayerTeam scoreplayerteam = this.getTeam(p_147186_2_[p_147186_3_]); if (scoreplayerteam == null) { return; } Collection<String> collection = scoreplayerteam.getMembershipCollection(); p_147186_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size()); if (collection.size() <= 0) { throw new CommandException("commands.scoreboard.teams.list.player.empty", new Object[] {scoreplayerteam.getRegisteredName()}); } ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.teams.list.player.count", new Object[] {Integer.valueOf(collection.size()), scoreplayerteam.getRegisteredName()}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); p_147186_1_.addChatMessage(chatcomponenttranslation); p_147186_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray()))); } else { Collection<ScorePlayerTeam> collection1 = scoreboard.getTeams(); p_147186_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection1.size()); if (collection1.size() <= 0) { throw new CommandException("commands.scoreboard.teams.list.empty", new Object[0]); } ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.teams.list.count", new Object[] {Integer.valueOf(collection1.size())}); chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); p_147186_1_.addChatMessage(chatcomponenttranslation1); for (ScorePlayerTeam scoreplayerteam1 : collection1) { p_147186_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.teams.list.entry", new Object[] {scoreplayerteam1.getRegisteredName(), scoreplayerteam1.getTeamName(), Integer.valueOf(scoreplayerteam1.getMembershipCollection().size())})); } } }
protected void joinTeam(ICommandSender p_147190_1_, String[] p_147190_2_, int p_147190_3_) throws CommandException { Scoreboard scoreboard = this.getScoreboard(); String s = p_147190_2_[p_147190_3_++]; Set<String> set = Sets.<String>newHashSet(); Set<String> set1 = Sets.<String>newHashSet(); if (p_147190_1_ instanceof EntityPlayer && p_147190_3_ == p_147190_2_.length) { String s4 = getCommandSenderAsPlayer(p_147190_1_).getName(); if (scoreboard.addPlayerToTeam(s4, s)) { set.add(s4); } else { set1.add(s4); } } else { while (p_147190_3_ < p_147190_2_.length) { String s1 = p_147190_2_[p_147190_3_++]; if (s1.startsWith("@")) { for (Entity entity : func_175763_c(p_147190_1_, s1)) { String s3 = getEntityName(p_147190_1_, entity.getUniqueID().toString()); if (scoreboard.addPlayerToTeam(s3, s)) { set.add(s3); } else { set1.add(s3); } } } else { String s2 = getEntityName(p_147190_1_, s1); if (scoreboard.addPlayerToTeam(s2, s)) { set.add(s2); } else { set1.add(s2); } } } } if (!set.isEmpty()) { p_147190_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size()); notifyOperators(p_147190_1_, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))}); } if (!set1.isEmpty()) { throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))}); } }
protected void leaveTeam(ICommandSender p_147199_1_, String[] p_147199_2_, int p_147199_3_) throws CommandException { Scoreboard scoreboard = this.getScoreboard(); Set<String> set = Sets.<String>newHashSet(); Set<String> set1 = Sets.<String>newHashSet(); if (p_147199_1_ instanceof EntityPlayer && p_147199_3_ == p_147199_2_.length) { String s3 = getCommandSenderAsPlayer(p_147199_1_).getName(); if (scoreboard.removePlayerFromTeams(s3)) { set.add(s3); } else { set1.add(s3); } } else { while (p_147199_3_ < p_147199_2_.length) { String s = p_147199_2_[p_147199_3_++]; if (s.startsWith("@")) { for (Entity entity : func_175763_c(p_147199_1_, s)) { String s2 = getEntityName(p_147199_1_, entity.getUniqueID().toString()); if (scoreboard.removePlayerFromTeams(s2)) { set.add(s2); } else { set1.add(s2); } } } else { String s1 = getEntityName(p_147199_1_, s); if (scoreboard.removePlayerFromTeams(s1)) { set.add(s1); } else { set1.add(s1); } } } } if (!set.isEmpty()) { p_147199_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size()); notifyOperators(p_147199_1_, this, "commands.scoreboard.teams.leave.success", new Object[] {Integer.valueOf(set.size()), joinNiceString(set.toArray(new String[set.size()]))}); } if (!set1.isEmpty()) { throw new CommandException("commands.scoreboard.teams.leave.failure", new Object[] {Integer.valueOf(set1.size()), joinNiceString(set1.toArray(new String[set1.size()]))}); } }
public void setCommandStat(CommandResultStats.Type type, int amount) { this.resultStats.func_179672_a(this, type, amount); }