use of v1_8_9.net.minecraft.util.ChatComponentText in project BiomeTweaker by superckl.
the class CommandInfo method processCommand.
@Override
public void processCommand(final ICommandSender sender, final String[] p_71515_2_) {
final ChunkCoordinates coord = sender.getPlayerCoordinates();
final World world = sender.getEntityWorld();
if ((coord != null) && (world != null)) {
final JsonObject obj = BiomeHelper.fillJsonObject(world.getBiomeGenForCoords(coord.posX, coord.posZ), coord.posX, coord.posY, coord.posZ);
sender.addChatMessage(new ChatComponentTranslation("biometweaker.msg.info.output.text").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA)));
final ChatStyle gold = new ChatStyle().setColor(EnumChatFormatting.GOLD);
final Gson gson = new GsonBuilder().setPrettyPrinting().create();
for (final Entry<String, JsonElement> entry : obj.entrySet()) if (entry.getValue().isJsonArray())
// It looks hideous in MC chat.
sender.addChatMessage(new ChatComponentText(entry.getKey() + ": Check the output files.").setChatStyle(gold));
else
sender.addChatMessage(new ChatComponentText(entry.getKey() + ": " + gson.toJson(entry.getValue())).setChatStyle(gold));
} else
sender.addChatMessage(new ChatComponentTranslation("biometweaker.msg.info.invalsender.text").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.
the class CmdDelEffect method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length < 2) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Several parameters are missing!"));
return;
} else if (args.length > 2) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
return;
}
String effectName = fetchString(sender, args, 1, "");
effectName = "EFFECT_" + effectName.toUpperCase();
EffectType type = null;
try {
type = EffectType.valueOf(effectName);
} catch (IllegalArgumentException e) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Bad effect name!"));
return;
}
World world = sender.getEntityWorld();
int dim = world.provider.dimensionId;
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
DimensionInformation information = dimensionManager.getDimensionInformation(dim);
if (information == null) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
return;
}
if (!information.getEffectTypes().contains(type)) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This effect is not active!"));
return;
}
information.getEffectTypes().remove(type);
dimensionManager.save(world);
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.
the class CmdLoadDim method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length < 3) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "The dimension and filename parameters are missing!"));
return;
} else if (args.length > 3) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
return;
}
int dim = fetchInt(sender, args, 1, 0);
String filename = fetchString(sender, args, 2, null);
World world = sender.getEntityWorld();
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
if (dimensionManager.getDimensionDescriptor(dim) == null) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
return;
}
DimensionInformation information = dimensionManager.getDimensionInformation(dim);
String error = information.loadFromJson(filename);
if (error != null) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Error: " + error));
} else {
dimensionManager.save(world);
}
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.
the class CmdSetOwner method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length < 3) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "The dimension and player parameters are missing!"));
return;
} else if (args.length > 3) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
return;
}
int dim = fetchInt(sender, args, 1, 0);
String playerName = fetchString(sender, args, 2, null);
World world = sender.getEntityWorld();
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
if (dimensionManager.getDimensionDescriptor(dim) == null) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
return;
}
for (Object o : MinecraftServer.getServer().getConfigurationManager().playerEntityList) {
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) o;
if (playerName.equals(entityPlayerMP.getDisplayName())) {
DimensionInformation information = dimensionManager.getDimensionInformation(dim);
information.setOwner(playerName, entityPlayerMP.getGameProfile().getId());
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Owner of dimension changed!"));
dimensionManager.save(world);
return;
}
}
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not find player!"));
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project RFTools by McJty.
the class CmdDelDimension method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length < 2) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "The dimension parameters is missing!"));
return;
} else if (args.length > 2) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
return;
}
int dim = fetchInt(sender, args, 1, 0);
World world = sender.getEntityWorld();
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
if (dimensionManager.getDimensionDescriptor(dim) == null) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
return;
}
dimensionManager.removeDimension(dim);
dimensionManager.save(world);
DimensionStorage dimensionStorage = DimensionStorage.getDimensionStorage(world);
dimensionStorage.removeDimension(dim);
dimensionStorage.save(world);
sender.addChatMessage(new ChatComponentText("Dimension deleted."));
}
Aggregations