public static int fireCommand(ICommandSender sender, String input){ CommandSender wrapped = null; if(sender instanceof EntityPlayerMP){ wrapped = NailedPlatform.instance().getPlayer(((EntityPlayerMP) sender).getGameProfile().getId()); }else if(sender instanceof CommandBlockLogic){ wrapped = new CommandBlockCommandSender(((CommandBlockLogic) sender)); //TODO: replace this with our own api }else if(sender instanceof RConConsoleSource){ //wrapped = new RConCommandSender(((RConConsoleSource) sender)); }else if(sender instanceof MinecraftServer){ wrapped = serverCommandSender; } if(wrapped == null){ return -1; } return NailedCommandManager.fireCommand((wrapped instanceof Player) ? input.substring(1) : input, wrapped, sender); }
public static List<String> fireTabCompletion(ICommandSender sender, String input){ CommandSender wrapped = null; if(sender instanceof EntityPlayerMP){ wrapped = NailedPlatform.instance().getPlayer(((EntityPlayerMP) sender).getGameProfile().getId()); }else if(sender instanceof CommandBlockLogic){ wrapped = new CommandBlockCommandSender(((CommandBlockLogic) sender)); //TODO: replace this with our own api }else if(sender instanceof RConConsoleSource){ //wrapped = new RConCommandSender(((RConConsoleSource) sender)); }else if(sender instanceof MinecraftServer){ wrapped = serverCommandSender; } if(wrapped == null){ return null; } return NailedCommandManager.fireAutocompletion(input, wrapped, sender); }
/** * Handle a command received by an RCon instance */ public String handleRConCommand(String command) { RConConsoleSource.getInstance().resetLog(); this.commandManager.executeCommand(RConConsoleSource.getInstance(), command); return RConConsoleSource.getInstance().getLogContents(); }
/** * @author jamierocks - 1st September 2016 * @reason Log command feedback */ @Overwrite public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams) { final MinecraftServer server = MinecraftServer.getServer(); final IChatComponent feedback = new ChatComponentTranslation("chat.type.admin", sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)); feedback.getChatStyle().setColor(EnumChatFormatting.GRAY); feedback.getChatStyle().setItalic(true); if (sender.sendCommandFeedback()) { for (final EntityPlayer player : server.getConfigurationManager().getPlayerList()) { if (player != sender && server.getConfigurationManager().canSendCommands(player.getGameProfile()) && command .canCommandSenderUseCommand(sender)) { final boolean broadcastConsoleToOps = sender instanceof MinecraftServer && MinecraftServer.getServer().shouldBroadcastConsoleToOps(); final boolean broadcastRconToOps = sender instanceof RConConsoleSource && MinecraftServer.getServer().shouldBroadcastRconToOps(); if (broadcastConsoleToOps || broadcastRconToOps || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer)) { player.addChatMessage(feedback); } } } } // Neptune - Always log command feedback //if (sender != server && server.worldServers[0].getGameRules().getBoolean("logAdminCommands")) { server.addChatMessage(feedback); //} // Neptune - end final boolean shouldSendCommandFeedback = sender instanceof CommandBlockLogic ? ((CommandBlockLogic) sender).shouldTrackOutput() : server.worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); if ((flags & 1) != 1 && shouldSendCommandFeedback || sender instanceof MinecraftServer) { sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams)); } }
public void func_152372_a(ICommandSender p_152372_1_, ICommand p_152372_2_, int p_152372_3_, String p_152372_4_, Object ... p_152372_5_) { boolean flag = true; if (p_152372_1_ instanceof CommandBlockLogic && !MinecraftServer.getServer().worldServers[0].getGameRules().getGameRuleBooleanValue("commandBlockOutput")) { flag = false; } ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.type.admin", new Object[] {p_152372_1_.getCommandSenderName(), new ChatComponentTranslation(p_152372_4_, p_152372_5_)}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY); chatcomponenttranslation.getChatStyle().setItalic(Boolean.valueOf(true)); if (flag) { Iterator iterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer)iterator.next(); if (entityplayer != p_152372_1_ && MinecraftServer.getServer().getConfigurationManager().func_152596_g(entityplayer.getGameProfile()) && p_152372_2_.canCommandSenderUseCommand(entityplayer) && (!(p_152372_1_ instanceof RConConsoleSource) || MinecraftServer.getServer().func_152363_m())) { entityplayer.addChatMessage(chatcomponenttranslation); } } } if (p_152372_1_ != MinecraftServer.getServer()) { MinecraftServer.getServer().addChatMessage(chatcomponenttranslation); } if ((p_152372_3_ & 1) != 1) { p_152372_1_.addChatMessage(new ChatComponentTranslation(p_152372_4_, p_152372_5_)); } }
@SideOnly(Side.SERVER) public String handleRConCommand(String p_71252_1_) { RConConsoleSource.instance.resetLog(); this.commandManager.executeCommand(RConConsoleSource.instance, p_71252_1_); return RConConsoleSource.instance.getLogContents(); }
@Override public void sendMessage(String message) { RConConsoleSource.instance.sendMessage(message + "\n"); // Send a newline after each message, to preserve formatting. }
/** * Send an informative message to the server operators */ public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams) { boolean flag = true; MinecraftServer minecraftserver = MinecraftServer.getServer(); if (!sender.sendCommandFeedback()) { flag = false; } IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)}); ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY); ichatcomponent.getChatStyle().setItalic(Boolean.valueOf(true)); if (flag) { for (EntityPlayer entityplayer : minecraftserver.getConfigurationManager().func_181057_v()) { if (entityplayer != sender && minecraftserver.getConfigurationManager().canSendCommands(entityplayer.getGameProfile()) && command.canCommandSenderUseCommand(sender)) { boolean flag1 = sender instanceof MinecraftServer && MinecraftServer.getServer().func_183002_r(); boolean flag2 = sender instanceof RConConsoleSource && MinecraftServer.getServer().func_181034_q(); if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer)) { entityplayer.addChatMessage(ichatcomponent); } } } } if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands")) { minecraftserver.addChatMessage(ichatcomponent); } boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); if (sender instanceof CommandBlockLogic) { flag3 = ((CommandBlockLogic)sender).shouldTrackOutput(); } if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer) { sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams)); } }
/** * Send an informative message to the server operators */ public void notifyListener(ICommandSender sender, ICommand command, int flags, String translationKey, Object... translationArgs) { boolean flag = true; MinecraftServer minecraftserver = this.server; if (!sender.sendCommandFeedback()) { flag = false; } ITextComponent itextcomponent = new TextComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new TextComponentTranslation(translationKey, translationArgs)}); itextcomponent.getStyle().setColor(TextFormatting.GRAY); itextcomponent.getStyle().setItalic(Boolean.valueOf(true)); if (flag) { for (EntityPlayer entityplayer : minecraftserver.getPlayerList().getPlayerList()) { if (entityplayer != sender && minecraftserver.getPlayerList().canSendCommands(entityplayer.getGameProfile()) && command.checkPermission(this.server, sender)) { boolean flag1 = sender instanceof MinecraftServer && this.server.shouldBroadcastConsoleToOps(); boolean flag2 = sender instanceof RConConsoleSource && this.server.shouldBroadcastRconToOps(); if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer)) { entityplayer.addChatMessage(itextcomponent); } } } } if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands")) { minecraftserver.addChatMessage(itextcomponent); } boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); if (sender instanceof CommandBlockBaseLogic) { flag3 = ((CommandBlockBaseLogic)sender).shouldTrackOutput(); } if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer) { sender.addChatMessage(new TextComponentTranslation(translationKey, translationArgs)); } }
public static boolean isCommandSenderOpped(ICommandSender player) { if (player instanceof EntityPlayer) { return isPlayerOpped((EntityPlayer) player); } return player instanceof MinecraftServer || player instanceof RConConsoleSource; }
public BukkitRemoteCommandSender(BukkitServer server, RConConsoleSource sender) { super(server); this.sender = Preconditions.checkNotNull(sender); }
public String func_71252_i(String p_71252_1_) { RConConsoleSource.field_70010_a.func_70007_b(); this.field_71321_q.func_71556_a(RConConsoleSource.field_70010_a, p_71252_1_); return RConConsoleSource.field_70010_a.func_70008_c(); }
public String executeCommand(String par1Str) { RConConsoleSource.consoleBuffer.resetLog(); this.commandManager.executeCommand(RConConsoleSource.consoleBuffer, par1Str); return RConConsoleSource.consoleBuffer.getChatBuffer(); }