Fix various issues

This commit is contained in:
Draycia committed 2020-08-10 20:13:33 -07:00
1 parent 22a068ff09
commit 6b36c330ee
7 files changed
+46 -31

No files matched your search

@@ -53,6 +53,8 @@ public abstract class ChatChannel implements ForwardingAudience {
public abstract String getSwitchOtherMessage();
public abstract String getSwitchFailureMessage();
/**
* @return The message to be send to the player when toggling this channel off.
*/
@@ -333,6 +333,11 @@ public class CarbonChatChannel extends ChatChannel {
return getString("switch-other-message");
}
@Override
public String getSwitchFailureMessage() {
return getString("switch-failure-message");
}
@Override
public String getToggleOffMessage() {
return getString("toggle-off-message");
@@ -18,6 +18,10 @@ public class PingHandler implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPing(ChatComponentEvent event) {
if (event.getTarget() == null) {
return;
}
if (event.getSender().getUUID().equals(event.getTarget().getUUID())) {
return;
}
@@ -104,7 +104,8 @@ public class CarbonChatUser implements ChatUser, ForwardingAudience {
@Override
public void setSelectedChannel(ChatChannel chatChannel, boolean fromRemote) {
String failureMessage = carbonChat.getConfig().getString("language.channel-switch-failure");
String failureMessage = chatChannel.getSwitchFailureMessage();
ChannelSwitchEvent event = new ChannelSwitchEvent(chatChannel, this, failureMessage);
Bukkit.getPluginManager().callEvent(event);