I should just rewrite this, instead I do a band-aid fix.

This commit is contained in:
nossr50 2019-09-20 16:42:34 -07:00
parent 2165d1448e
commit 1d7bfc615f
3 changed files with 28 additions and 21 deletions

View File

@ -27,7 +27,7 @@ public class McMMOCommand implements CommandExecutor {
String description = pluginRef.getLocaleManager().getString("mcMMO.Description");
String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit);
sender.sendMessage(LocaleLoader.getString("mcMMO.Description.FormerDevs"));
sender.sendMessage(pluginRef.getLocaleManager().getString("mcMMO.Description.FormerDevs"));
if (pluginRef.getConfigManager().getConfigAds().isShowDonationInfo()) {
sender.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Donate"));

View File

@ -121,7 +121,7 @@ public abstract class ChatCommand implements TabExecutor {
}
mcMMOPlayer.enableChat(chatMode);
sender.sendMessage(chatMode.getEnabledMessage());
sender.sendMessage(getChatModeEnabledMessage(chatMode, true));
}
private void disableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) {
@ -131,6 +131,29 @@ public abstract class ChatCommand implements TabExecutor {
}
mcMMOPlayer.disableChat(chatMode);
sender.sendMessage(chatMode.getDisabledMessage());
sender.sendMessage(getChatModeEnabledMessage(chatMode, false));
}
private String getChatModeEnabledMessage(ChatMode chatMode, boolean enabled) {
switch(chatMode) {
case ADMIN:
return getAdminMessage(enabled);
default:
return getPartyMessage(enabled);
}
}
private String getAdminMessage(boolean enabled) {
if(enabled)
return pluginRef.getLocaleManager().getString("Commands.AdminChat.On");
else
return pluginRef.getLocaleManager().getString("Commands.AdminChat.Off");
}
private String getPartyMessage(boolean enabled) {
if(enabled)
return pluginRef.getLocaleManager().getString("Commands.Party.Chat.On");
else
return pluginRef.getLocaleManager().getString("Commands.Party.Chat.Off");
}
}

View File

@ -1,22 +1,6 @@
package com.gmail.nossr50.datatypes.chat;
public enum ChatMode {
ADMIN(pluginRef.getLocaleManager().getString("Commands.AdminChat.On"), pluginRef.getLocaleManager().getString("Commands.AdminChat.Off")),
PARTY(pluginRef.getLocaleManager().getString("Commands.Party.Chat.On"), pluginRef.getLocaleManager().getString("Commands.Party.Chat.Off"));
private String enabledMessage;
private String disabledMessage;
ChatMode(String enabledMessage, String disabledMessage) {
this.enabledMessage = enabledMessage;
this.disabledMessage = disabledMessage;
}
public String getEnabledMessage() {
return enabledMessage;
}
public String getDisabledMessage() {
return disabledMessage;
}
ADMIN,
PARTY;
}