@Override public Entity getCommandSenderEntity() { return superSender.getCommandSenderEntity(); }
@Override public Entity getCommandSenderEntity() { return this.original.getCommandSenderEntity(); }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { Entity senderEntity = sender.getCommandSenderEntity(); if (senderEntity instanceof EntityPlayer) { NetworkHandler.sendToPlayer((EntityPlayerMP) senderEntity, new PacketManualReload()); } }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if(!(sender.getCommandSenderEntity() instanceof EntityPlayerMP)) { return; } int coords = WorldSavedDataMachines.INSTANCE.nextCoord-1; if(args.length == 1) { coords = Integer.parseInt(args[0]); } if(coords < 0 || coords >= WorldSavedDataMachines.INSTANCE.nextCoord) { return; } EntityPlayerMP player = (EntityPlayerMP)sender.getCommandSenderEntity(); player.openGui(CompactMachines3.instance, GuiIds.MACHINE_ADMIN.ordinal(), player.world, 0,0,0); PackageHandler.instance.sendTo(new MessageMachineContent(coords), player); } }
@Override public boolean checkPermission(MinecraftServer server, ICommandSender sender) { if(sender.getCommandSenderEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) sender.getCommandSenderEntity(); boolean creative = player.capabilities.isCreativeMode; boolean isOp = server.getPlayerList().canSendCommands(player.getGameProfile()); return isAllowed(player, creative, isOp); } return super.checkPermission(server, sender); }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if(!(sender.getCommandSenderEntity() instanceof EntityPlayerMP)) { return; } if(args.length != 1) { return; } EntityPlayerMP player = (EntityPlayerMP) sender.getCommandSenderEntity(); int coords = Integer.parseInt(args[0]); if(coords < 0 || coords >= WorldSavedDataMachines.INSTANCE.nextCoord) { return; } EnumMachineSize size = WorldSavedDataMachines.INSTANCE.machineSizes.get(coords); ItemStack stack = new ItemStack(Blockss.machine, 1, size.getMeta()); NBTTagCompound compound = new NBTTagCompound(); compound.setInteger("coords", coords); stack.setTagCompound(compound); ItemHandlerHelper.giveItemToPlayer(player, stack); WorldSavedDataMachines.INSTANCE.removeMachinePosition(coords); } }
private void executeShared(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final Colony colony) throws CommandException { final Entity senderEntity = sender.getCommandSenderEntity(); if (senderEntity instanceof EntityPlayer) { final EntityPlayer player = (EntityPlayer) sender; if (!canPlayerUseCommand(player, RSRESET, colony.getID())) { sender.sendMessage(new TextComponentString(NOT_PERMITTED)); return; } } colony.getRequestManager().reset(); sender.sendMessage(new TextComponentString(String.format(SUCCESS_MESSAGE, colony.getID()))); }
private void sendProperChatToPlayer(ICommandSender player, String incomingMessage, Object... params) { ITextComponent message; if(minerServer.playerHasClient(player.getCommandSenderEntity().getPersistentID())) { message = new TextComponentTranslation(incomingMessage, params); } else { String rawMessage = I18n.translateToLocal(incomingMessage); message = new TextComponentString(String.format(rawMessage, params)); } player.addChatMessage(message); }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length != 1) throw new WrongUsageException("1 argument required."); Tree tree = TFCRegistries.TREES.getValue(new ResourceLocation(args[0])); if (tree == null) throw new WrongUsageException("Tree type " + args[0] + " not found"); if (sender.getCommandSenderEntity() == null) return; final World world = sender.getEntityWorld(); final BlockPos center = new BlockPos(sender.getCommandSenderEntity()); final TemplateManager manager = ((WorldServer) world).getStructureTemplateManager(); tree.makeTreeWithoutChecking(manager, world, center, random); } }
private void executeShared(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final Colony colony, final String playerName) throws CommandException { final Entity senderEntity = sender.getCommandSenderEntity(); if (senderEntity instanceof EntityPlayer) { final EntityPlayer senderPlayer = (EntityPlayer) sender; if (!canPlayerUseCommand(senderPlayer, ADDOFFICER, colony.getID())) { sender.sendMessage(new TextComponentString(NOT_PERMITTED)); return; } } colony.getPermissions().addPlayer(playerName, Rank.OFFICER, colony.getWorld()); sender.sendMessage(new TextComponentString(String.format(SUCCESS_MESSAGE_ADD_OFFICER, playerName, colony.getID()))); }
private void executeShared(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final Colony colony) { if (sender instanceof EntityPlayer) { final EntityPlayer senderPlayer = (EntityPlayer) sender.getCommandSenderEntity(); if (!canPlayerUseCommand(senderPlayer, Commands.REFRESH_COLONY, colony.getID())) { sender.sendMessage(new TextComponentString(NOT_PERMITTED)); return; } } sender.sendMessage(new TextComponentString(REFRESH)); colony.getPermissions().restoreOwnerIfNull(); colony.markDirty(); }
Entity player = sender.getCommandSenderEntity(); World world = player.world;
/** * Returns the colony of the owner or if not available colony 1. * First tries to get the IColony and then the Colony from the ColonyManager. * * @param sender the sender of the command. * @return the colonyId. */ private static int getColonyId(@NotNull final ICommandSender sender) { final IColony tempColony = ColonyManager.getIColonyByOwner(sender.getEntityWorld(), sender.getCommandSenderEntity().getUniqueID()); if (tempColony != null) { final World world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0); final Colony colony = ColonyManager.getColonyByPosFromWorld(world, tempColony.getCenter()); if (colony != null) { return colony.getID(); } } return 1; }
@Override public void execute(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final String... args) throws CommandException { if (args.length == 0) { sender.sendMessage(new TextComponentString(NO_ARGUMENTS)); return; } final Entity senderEntity = sender.getCommandSenderEntity(); int colonyId = getIthArgument(args, 0, -1); if (colonyId == -1 && senderEntity instanceof EntityPlayer) { final IColony colony = ColonyManager.getIColonyByOwner(sender.getEntityWorld(), ((EntityPlayer) sender).getUniqueID()); if (colony == null) { sender.sendMessage(new TextComponentString(COLONY_NULL)); return; } colonyId = colony.getID(); } final Colony colony = ColonyManager.getColonyByWorld(colonyId, server.getWorld(0)); if (colony == null) { sender.sendMessage(new TextComponentString(String.format(COLONY_NULL, colonyId))); return; } executeShared(server, sender, colony); }
target = CommandBase.getEntity(server, sender, args[1]); else target = sender.getCommandSenderEntity();
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { World world = sender.getEntityWorld(); if (world.isRemote) { sender.sendMessage(new TextComponentString(TextFormatting.RED + "Not processing on Client side")); return; } EntityPlayer player = (EntityPlayer) sender.getCommandSenderEntity(); if (player == null) { sender.sendMessage(new TextComponentString(TextFormatting.RED + "Non player command sender not supported")); return; } if (args.length == 0) { sender.sendMessage(new TextComponentString(TextFormatting.GRAY + "/gog-spawn <npc|mob>")); return; } String command = args[0].toLowerCase(); if (command.equals("npc")) { spawnNpcs(world, player); sender.sendMessage(new TextComponentString(TextFormatting.GREEN + "Summoning: npcs")); } else if (command.equals("mob")) { int count = spawnMobs(world, player); sender.sendMessage(new TextComponentString( TextFormatting.GREEN + "Summoning: " + TextFormatting.ITALIC + "" + TextFormatting.GRAY + count + TextFormatting.RESET + TextFormatting.GREEN + " mobs")); } }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length != 1) throw new WrongUsageException("1 argument required."); double heat = parseDouble(args[0], 0, 1600); Entity e = sender.getCommandSenderEntity(); if (e instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) e; ItemStack s = player.getHeldItemMainhand(); IItemHeat h = s.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null); if (h == null) throw new WrongUsageException("The held item in mainhand does not have the item heat capability"); h.setTemperature((float) heat); s.setTagCompound(h.serializeNBT()); } else { throw new WrongUsageException("Can only be used by a player"); } } }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if(args.length != 1) { throw this.getUsageException(sender); } if(!SchemaRegistry.instance.hasSchema(args[0])) { throw this.getException(sender, "unknown_schema"); } if (sender.getEntityWorld().provider.getDimension() != ConfigurationHandler.Settings.dimensionId) { throw this.getException(sender, "not_in_machine_dimension"); } Schema schema = SchemaRegistry.instance.getSchema(args[0]); int coords = StructureTools.getCoordsForPos(sender.getCommandSenderEntity().getPosition()); EnumMachineSize machineSize = WorldSavedDataMachines.INSTANCE.machineSizes.get(coords); if(machineSize != schema.getSize()) { throw this.getException(sender, "machine_size_does_not_match"); } sender.sendMessage(new TextComponentTranslation("commands.compactmachines3.schema.load.machine_schema_set_to", args[0])); StructureTools.restoreSchema(schema, coords); }
@Override public void execute(MinecraftServer server, ICommandSender ic, String[] args) { if (ic instanceof EntityPlayer == false) { return; } World world = ic.getCommandSenderEntity().getEntityWorld(); EntityPlayer player = (EntityPlayer) ic; if (player.dimension != 0) { // :"Can only teleport to worldhome in the overworld" UtilChat.addChatMessage(ic, "command.worldhome.dim"); return; } // this tends to always get something at y=64, regardless if there is AIR or // not // so we need to safely push the player up out of any blocks they are in UtilSound.playSound(player, player.getPosition(), SoundEvents.ENTITY_ENDERMEN_TELEPORT, player.getSoundCategory()); UtilEntity.teleportWallSafe(player, world, world.getSpawnPoint()); UtilSound.playSound(player, world.getSpawnPoint(), SoundEvents.ENTITY_ENDERMEN_TELEPORT, player.getSoundCategory()); } }
final Entity senderEntity = sender.getCommandSenderEntity();