Town/nation color fixes, reload command

This commit is contained in:
Norbi Peti 2019-03-16 14:33:03 +01:00
parent c7f04b8731
commit 049ad55168
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
5 changed files with 25 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import buttondevteam.chat.commands.MWikiCommand;
import buttondevteam.chat.commands.ucmds.HelpCommand;
import buttondevteam.chat.commands.ucmds.HistoryCommand;
import buttondevteam.chat.commands.ucmds.InfoCommand;
import buttondevteam.chat.commands.ucmds.ReloadCommand;
import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
import buttondevteam.chat.components.announce.AnnouncerComponent;
import buttondevteam.chat.components.appendext.AppendTextComponent;
@ -77,6 +78,7 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
getCommand2MC().registerCommand(new HistoryCommand());
getCommand2MC().registerCommand(new InfoCommand());
getCommand2MC().registerCommand(new MWikiCommand());
getCommand2MC().registerCommand(new ReloadCommand());
}
public static Essentials essentials = null;

View file

@ -0,0 +1,20 @@
package buttondevteam.chat.commands.ucmds;
import buttondevteam.chat.PluginMain;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import org.bukkit.command.CommandSender;
@CommandClass(helpText = {
"Reload",
"Reloads Thorpe-Chat"
}, modOnly = true)
public class ReloadCommand extends UCommandBase {
@Command2.Subcommand
public void def(CommandSender sender) {
if (PluginMain.Instance.tryReloadConfig())
sender.sendMessage("§bReloaded config");
else
sender.sendMessage("§cFailed to reload config.");
}
}

View file

@ -113,6 +113,7 @@ public class TownColorComponent extends Component<PluginMain> implements Listene
if (useNationColors().get())
registerCommand(new buttondevteam.chat.components.towncolors.admin.NationColorCommand());
registerCommand(new TCCount());
registerCommand(new NColorCommand());
registerListener(new TownyListener());
registerListener(this);
}

View file

@ -35,7 +35,7 @@ public class NationColorCommand extends AdminCommandBase {
if (!c.get().getName().equals(Color.White.getName())) { //Default nation color
for (val e : TownColorComponent.NationColor.entrySet()) {
if (e.getValue().getName().equals(c.get().getName())) {
sender.sendMessage("§The nation " + e.getKey() + " already uses this color!");
sender.sendMessage("§cThe nation " + e.getKey() + " already uses this color!");
return true;
}
}

View file

@ -41,7 +41,7 @@ public class TownColorCommand extends AdminCommandBase { //TODO: Command path al
val c = getColorOrSendError(colors[i], sender);
if (!c.isPresent())
return true;
clrs[i - 1] = c.get();
clrs[i] = c.get();
}
Color tnc;
boolean usenc = TownColorComponent.getComponent().useNationColors().get();