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);
+1 -1
View File
@@ -7,6 +7,7 @@ default:
# switch-message, toggle-off-message and toggle-on-message support PlaceholderAPI
switch-message: '<gray>You are now in <color><channel> <gray>chat!'
switch-other-message: '<gray><player> </rainbow><gray>is now in <color><channel> <gray>chat!'
switch-failure-message: '<red>You cannot use channel <channel>!'
toggle-on-message: '<gray>You can now see <color><channel> <gray>chat!'
toggle-off-message: '<gray>You can no longer see <color><channel> <gray>chat!'
toggle-other-on: '<gray><player> </rainbow><gray>can now see <color><channel> <gray>chat!'
@@ -85,7 +86,6 @@ language:
spy-whispers: '<yellow>Spy [<gray><sender></rainbow> <gold>-> <gray><target></rainbow><yellow>] <message>'
no-reply-target: '<red>You have no one to reply to!'
empty-channel: 'NONE' #<channel>, set to "NONE" to disable
channel-switch-failure: '<red>You cannot use channel <channel>!'
other-nickname-set: '<green><user></rainbow>''s nickname was set to <nickname><green>!'
other-nickname-reset: '<green><user></rainbow>''s nickname was reset!'