use of net.minecraft.util.text.TextComponentString in project minecolonies by Minecolonies.
the class ColonyTeleportCommand method execute.
@Override
public void execute(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final ActionMenu actionMenu) throws CommandException {
Colony colony = actionMenu.getColonyForArgument("colony");
if (null == colony) {
final EntityPlayer player = actionMenu.getPlayerForArgument("player");
if (player != null) {
IColony iColony = ColonyManager.getIColonyByOwner(server.getEntityWorld(), player);
if (null == iColony) {
if (sender instanceof EntityPlayer) {
final Entity senderEntity = sender.getCommandSenderEntity();
if (senderEntity != null) {
final UUID mayorID = senderEntity.getUniqueID();
if (iColony == null) {
iColony = ColonyManager.getIColonyByOwner(sender.getEntityWorld(), mayorID);
}
}
}
}
if (null != iColony) {
colony = ColonyManager.getColony(iColony.getID());
}
}
}
// Required argument: would never be null at this point.
if (null == colony) {
sender.sendMessage(new TextComponentString("You are not allowed to do this"));
return;
}
executeShared(server, sender, colony);
}
use of net.minecraft.util.text.TextComponentString in project minecolonies by Minecolonies.
the class ColonyTeleportCommand method execute.
@Override
public void execute(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final String... args) throws CommandException {
Colony colony = null;
// see if player is allowed to use in the configs
if (args.length == 1) {
try {
final int colonyId = Integer.parseInt(args[0]);
colony = ColonyManager.getColony(colonyId);
} catch (final NumberFormatException e) {
// we ignore the exception and deal with a null colony below.
}
}
if (null == colony) {
sender.sendMessage(new TextComponentString("You are not allowed to do this"));
return;
}
executeShared(server, sender, colony);
}
use of net.minecraft.util.text.TextComponentString in project minecolonies by Minecolonies.
the class DisableBarbarianSpawnsCommand method executeShared.
private void executeShared(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final Colony colony, final boolean canHaveBarbEvents) throws CommandException {
if (sender instanceof EntityPlayer && !isPlayerOpped(sender)) {
sender.sendMessage(new TextComponentString("Must be OP to use this command"));
}
colony.getBarbManager().setCanHaveBarbEvents(canHaveBarbEvents);
sender.sendMessage(new TextComponentString("Colony \" Can have Barbarian Events \" now set to: " + colony.isCanHaveBarbEvents()));
}
use of net.minecraft.util.text.TextComponentString in project minecolonies by Minecolonies.
the class DoRaidNowCommand method executeShared.
private void executeShared(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @Nullable final Colony colony) {
if (sender instanceof EntityPlayer && !isPlayerOpped(sender)) {
sender.sendMessage(new TextComponentString("Must be OP to use command"));
return;
}
MobEventsUtils.barbarianEvent(colony.getWorld(), colony);
sender.sendMessage(SUCCESSFUL);
}
use of net.minecraft.util.text.TextComponentString in project minecolonies by Minecolonies.
the class DoRaidTonightCommand method executeShared.
private void executeShared(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @Nullable final Colony colony) {
if (sender instanceof EntityPlayer && !isPlayerOpped(sender)) {
sender.sendMessage(new TextComponentString("Must be OP to use command"));
return;
}
colony.getBarbManager().setWillRaidTonight(true);
sender.sendMessage(SUCCESSFUL);
}
Aggregations