use of mcjty.lib.gui.GuiStyle in project RFTools by McJty.
the class CmdSetStyle method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length > 2) {
ITextComponent component = new TextComponentString(TextFormatting.RED + "Too many parameters!");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
return;
}
if (!(sender instanceof EntityPlayer)) {
ITextComponent component = new TextComponentString(TextFormatting.RED + "This command only works as a player!");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
return;
}
EntityPlayer player = (EntityPlayer) sender;
PreferencesProperties properties = McJtyLib.getPreferencesProperties(player);
if (args.length < 2) {
GuiStyle style = properties.getStyle();
ITextComponent component = new TextComponentString(TextFormatting.YELLOW + "Current GUI style: " + style.getStyle());
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
return;
}
String s = fetchString(sender, args, 1, "");
boolean b = properties.setStyle(s);
if (!b) {
String buf = "";
for (GuiStyle style : GuiStyle.values()) {
buf = buf + " " + style.getStyle();
}
ITextComponent component = new TextComponentString(TextFormatting.RED + "Unknown style! Options:" + buf);
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
}
}
Aggregations