private Object[] doCommand(String command) { if (server != null && server.isCommandBlockEnabled()) { ICommandManager commandManager = server.getCommandManager(); try { output.clear(); int result = commandManager.executeCommand(this, command); return new Object[]{result > 0, Maps.newHashMap(output)}; } catch (Throwable t) { return new Object[]{false, Collections.singletonMap(1, "Java Exception Thrown: " + t)}; } } return new Object[]{false, Collections.singletonMap(1, ("Command blocks disabled by server"))}; }
public void execute(EntityPlayer player) { player.getServer().getCommandManager().executeCommand(player.getServer(), commandString.replaceAll("@p", player.getDisplayNameString())); }
private static void summonFireworks(EntityLiving npc, Town town, BlockPos pos, int lifetime, int type, int flicker, int trail, String colors, String fadeColor) { pos = town.getCoordinatesFromOffset(HFBuildings.FESTIVAL_GROUNDS, pos); FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(npc, "/summon FireworksRocketEntity " + pos.getX() + " " + pos.getY() + " " + pos.getZ() + " {LifeTime:" + lifetime + ",FireworksItem:{id:fireworks,Count:1,tag:{Fireworks:{Explosions:[{Type:" + type + ",Flicker:" + flicker + ",Trail:" + trail + ",Colors:[" + colors + "],FadeColors:[" + fadeColor + "]}]}}}}"); }