Simplify a few things in EssentialsChat.

This commit is contained in:
drtshock 2015-04-22 10:58:04 -05:00
parent ac0858dcdb
commit b7704a4ea8
2 changed files with 5 additions and 14 deletions

View File

@ -24,14 +24,10 @@ public abstract class EssentialsChatPlayer implements Listener {
this.chatStorage = chatStorage;
}
public void onPlayerChat(final AsyncPlayerChatEvent event) {
}
public abstract void onPlayerChat(final AsyncPlayerChatEvent event);
public boolean isAborted(final AsyncPlayerChatEvent event) {
if (event.isCancelled()) {
return true;
}
return false;
return event.isCancelled();
}
public String getChatType(final String message) {

View File

@ -48,17 +48,12 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
permission.append("essentials.chat.").append(chatStore.getType());
if (user.isAuthorized(permission.toString())) {
final StringBuilder format = new StringBuilder();
format.append(chatStore.getType()).append("Format");
event.setMessage(event.getMessage().substring(1));
event.setFormat(tl(format.toString(), event.getFormat()));
event.setFormat(tl(chatStore.getType() + "Format", event.getFormat()));
return;
}
final StringBuilder errorMsg = new StringBuilder();
errorMsg.append("notAllowedTo").append(chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatStore.getType().substring(1));
user.sendMessage(tl(errorMsg.toString()));
user.sendMessage(tl("notAllowedTo" + chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH) + chatStore.getType().substring(1)));
event.setCancelled(true);
return;
}
@ -66,7 +61,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
final Location loc = user.getLocation();
final World world = loc.getWorld();
if (charge(event, chatStore) == false) {
if (!charge(event, chatStore)) {
return;
}