mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Simplify a few things in EssentialsChat.
This commit is contained in:
parent
ac0858dcdb
commit
b7704a4ea8
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user