mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Add per channel bungee toggle
This commit is contained in:
1 parent
c798208670
commit
cb060225f1
4 files changed
+25
-2
No files matched your search
@@ -42,6 +42,8 @@ public abstract class ChatChannel {
|
||||
*/
|
||||
public abstract boolean isIgnorable();
|
||||
|
||||
public abstract boolean shouldBungee();
|
||||
|
||||
/**
|
||||
* @return The name of this channel.
|
||||
*/
|
||||
@@ -139,6 +141,7 @@ public abstract class ChatChannel {
|
||||
public abstract ChatChannel.Builder setToggleOffMessage(String toggleOffMessage);
|
||||
public abstract ChatChannel.Builder setToggleOnMessage(String toggleOnMessage);
|
||||
public abstract ChatChannel.Builder setShouldForwardFormatting(boolean forwardFormatting);
|
||||
public abstract ChatChannel.Builder setShouldBungee(boolean shouldBungee);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
private String toggleOffMessage;
|
||||
private String toggleOnMessage;
|
||||
private boolean forwardFormatting;
|
||||
private boolean shouldBungee;
|
||||
|
||||
private DiscordWebhook discordWebhook = null;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
private SimpleChatChannel() { }
|
||||
|
||||
SimpleChatChannel(TextColor color, long id, Map<String, String> formats, String webhook, boolean isDefault, boolean ignorable, String name, double distance, String switchMessage, String toggleOffMessage, String toggleOnMessage, boolean forwardFormatting, SimpleChat simpleChat) {
|
||||
SimpleChatChannel(TextColor color, long id, Map<String, String> formats, String webhook, boolean isDefault, boolean ignorable, String name, double distance, String switchMessage, String toggleOffMessage, String toggleOnMessage, boolean forwardFormatting, boolean shouldBungee, SimpleChat simpleChat) {
|
||||
this.color = color;
|
||||
this.id = id;
|
||||
this.formats = formats;
|
||||
@@ -59,6 +60,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
this.toggleOffMessage = toggleOffMessage;
|
||||
this.toggleOnMessage = toggleOnMessage;
|
||||
this.forwardFormatting = forwardFormatting;
|
||||
this.shouldBungee = shouldBungee;
|
||||
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
@@ -277,6 +279,11 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
return ignorable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBungee() {
|
||||
return shouldBungee;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
@@ -325,6 +332,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
private String toggleOffMessage = "<gray>You can no longer see <color><channel> <gray>chat!";
|
||||
private String toggleOnMessage = "<gray>You can now see <color><channel> <gray>chat!";
|
||||
private boolean forwardFormatting = true;
|
||||
private boolean shouldBungee = false;
|
||||
|
||||
private Builder() { }
|
||||
|
||||
@@ -334,7 +342,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
@Override
|
||||
public SimpleChatChannel build(SimpleChat simpleChat) {
|
||||
return new SimpleChatChannel(color, id, formats, webhook, isDefault, ignorable, name, distance, switchMessage, toggleOffMessage, toggleOnMessage, forwardFormatting, simpleChat);
|
||||
return new SimpleChatChannel(color, id, formats, webhook, isDefault, ignorable, name, distance, switchMessage, toggleOffMessage, toggleOnMessage, forwardFormatting, shouldBungee, simpleChat);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -425,6 +433,13 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setShouldBungee(boolean shouldBungee) {
|
||||
this.shouldBungee = shouldBungee;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -97,6 +97,10 @@ public class ChannelManager {
|
||||
builder.setShouldForwardFormatting(section.getBoolean("forward-format"));
|
||||
}
|
||||
|
||||
if (section.contains("should-bungee")) {
|
||||
builder.setShouldBungee(section.getBoolean("should-bungee"));
|
||||
}
|
||||
|
||||
ChatChannel channel = builder.build(simpleChat);
|
||||
|
||||
if (channel.isTownChat() || channel.isNationChat() || channel.isAllianceChat()) {
|
||||
|
||||
Reference in new issue
Block a user