Fixes round 3000

This commit is contained in:
Draycia committed 2020-07-02 11:48:44 -07:00
1 parent 58477c0b6a
commit 569cd78748
15 files changed
+583 -54

No files matched your search

@@ -4,9 +4,11 @@ import com.palmergames.bukkit.towny.TownyAPI;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
import java.util.HashMap;
import java.util.Map;
public class AllianceChatChannel extends SimpleChatChannel {
@@ -55,9 +57,142 @@ public class AllianceChatChannel extends SimpleChatChannel {
return new AllianceChatChannel.Builder(name);
}
public static class Builder extends SimpleChatChannel.Builder {
private Builder(String name) {
super(name);
public static class Builder extends ChatChannel.Builder {
private TextColor color = TextColor.of(255, 255, 255);
private long id = -1;
private Map<String, String> formats = new HashMap<>();
private String webhook = null;
private boolean isDefault = false;
private boolean ignorable = true;
private String name;
private double distance = -1;
private String switchMessage = "<gray>You are now in <color><channel> <gray>chat!";
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 boolean filterEnabled = true;
private boolean firstMatchingGroup = false;
Builder(String name) {
this.name = name.toLowerCase();
}
@Override
public AllianceChatChannel build(SimpleChat simpleChat) {
return new AllianceChatChannel(color, id, formats, webhook, isDefault, ignorable, name, distance, switchMessage, toggleOffMessage, toggleOnMessage, forwardFormatting, shouldBungee, filterEnabled, firstMatchingGroup, simpleChat);
}
@Override
public AllianceChatChannel.Builder setColor(TextColor color) {
this.color = color;
return this;
}
@Override
public AllianceChatChannel.Builder setColor(String color) {
return setColor(TextColor.fromHexString(color));
}
@Override
public AllianceChatChannel.Builder setId(long id) {
this.id = id;
return this;
}
@Override
public AllianceChatChannel.Builder setFormats(Map<String, String> formats) {
this.formats = formats;
return this;
}
@Override
public AllianceChatChannel.Builder setWebhook(String webhook) {
this.webhook = webhook;
return this;
}
@Override
public AllianceChatChannel.Builder setIsDefault(boolean aDefault) {
this.isDefault = aDefault;
return this;
}
@Override
public AllianceChatChannel.Builder setIgnorable(boolean ignorable) {
this.ignorable = ignorable;
return this;
}
@Override
public AllianceChatChannel.Builder setName(String name) {
this.name = name;
return this;
}
@Override
public AllianceChatChannel.Builder setDistance(double distance) {
this.distance = distance;
return this;
}
@Override
public AllianceChatChannel.Builder setSwitchMessage(String switchMessage) {
this.switchMessage = switchMessage;
return this;
}
@Override
public AllianceChatChannel.Builder setToggleOffMessage(String toggleOffMessage) {
this.toggleOffMessage = toggleOffMessage;
return this;
}
@Override
public AllianceChatChannel.Builder setToggleOnMessage(String toggleOnMessage) {
this.toggleOnMessage = toggleOnMessage;
return this;
}
@Override
public AllianceChatChannel.Builder setShouldForwardFormatting(boolean forwardFormatting) {
this.forwardFormatting = forwardFormatting;
return this;
}
@Override
public AllianceChatChannel.Builder setShouldBungee(boolean shouldBungee) {
this.shouldBungee = shouldBungee;
return this;
}
@Override
public AllianceChatChannel.Builder setFilterEnabled(boolean filterEnabled) {
this.filterEnabled = filterEnabled;
return this;
}
@Override
public AllianceChatChannel.Builder setFirstMatchingGroup(boolean firstMatchingGroup) {
this.firstMatchingGroup = firstMatchingGroup;
return this;
}
}
}
@@ -5,9 +5,11 @@ import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Nation;
import com.palmergames.bukkit.towny.object.Resident;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
import java.util.HashMap;
import java.util.Map;
public class NationChatChannel extends SimpleChatChannel {
@@ -54,9 +56,141 @@ public class NationChatChannel extends SimpleChatChannel {
return new NationChatChannel.Builder(name);
}
public static class Builder extends SimpleChatChannel.Builder {
private Builder(String name) {
super(name);
public static class Builder extends ChatChannel.Builder {
private TextColor color = TextColor.of(255, 255, 255);
private long id = -1;
private Map<String, String> formats = new HashMap<>();
private String webhook = null;
private boolean isDefault = false;
private boolean ignorable = true;
private String name;
private double distance = -1;
private String switchMessage = "<gray>You are now in <color><channel> <gray>chat!";
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 boolean filterEnabled = true;
private boolean firstMatchingGroup = false;
Builder(String name) {
this.name = name.toLowerCase();
}
@Override
public NationChatChannel build(SimpleChat simpleChat) {
return new NationChatChannel(color, id, formats, webhook, isDefault, ignorable, name, distance, switchMessage, toggleOffMessage, toggleOnMessage, forwardFormatting, shouldBungee, filterEnabled, firstMatchingGroup, simpleChat);
}
@Override
public NationChatChannel.Builder setColor(TextColor color) {
this.color = color;
return this;
}
@Override
public NationChatChannel.Builder setColor(String color) {
return setColor(TextColor.fromHexString(color));
}
@Override
public NationChatChannel.Builder setId(long id) {
this.id = id;
return this;
}
@Override
public NationChatChannel.Builder setFormats(Map<String, String> formats) {
this.formats = formats;
return this;
}
@Override
public NationChatChannel.Builder setWebhook(String webhook) {
this.webhook = webhook;
return this;
}
@Override
public NationChatChannel.Builder setIsDefault(boolean aDefault) {
this.isDefault = aDefault;
return this;
}
@Override
public NationChatChannel.Builder setIgnorable(boolean ignorable) {
this.ignorable = ignorable;
return this;
}
@Override
public NationChatChannel.Builder setName(String name) {
this.name = name;
return this;
}
@Override
public NationChatChannel.Builder setDistance(double distance) {
this.distance = distance;
return this;
}
@Override
public NationChatChannel.Builder setSwitchMessage(String switchMessage) {
this.switchMessage = switchMessage;
return this;
}
@Override
public NationChatChannel.Builder setToggleOffMessage(String toggleOffMessage) {
this.toggleOffMessage = toggleOffMessage;
return this;
}
@Override
public NationChatChannel.Builder setToggleOnMessage(String toggleOnMessage) {
this.toggleOnMessage = toggleOnMessage;
return this;
}
@Override
public NationChatChannel.Builder setShouldForwardFormatting(boolean forwardFormatting) {
this.forwardFormatting = forwardFormatting;
return this;
}
@Override
public NationChatChannel.Builder setShouldBungee(boolean shouldBungee) {
this.shouldBungee = shouldBungee;
return this;
}
@Override
public NationChatChannel.Builder setFilterEnabled(boolean filterEnabled) {
this.filterEnabled = filterEnabled;
return this;
}
@Override
public NationChatChannel.Builder setFirstMatchingGroup(boolean firstMatchingGroup) {
this.firstMatchingGroup = firstMatchingGroup;
return this;
}
}
@@ -2,9 +2,11 @@ package net.draycia.simplechat.channels.impls;
import com.gmail.nossr50.api.PartyAPI;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
import java.util.HashMap;
import java.util.Map;
public class PartyChatChannel extends SimpleChatChannel {
@@ -35,9 +37,141 @@ public class PartyChatChannel extends SimpleChatChannel {
return new PartyChatChannel.Builder(name);
}
public static class Builder extends SimpleChatChannel.Builder {
private Builder(String name) {
super(name);
public static class Builder extends ChatChannel.Builder {
private TextColor color = TextColor.of(255, 255, 255);
private long id = -1;
private Map<String, String> formats = new HashMap<>();
private String webhook = null;
private boolean isDefault = false;
private boolean ignorable = true;
private String name;
private double distance = -1;
private String switchMessage = "<gray>You are now in <color><channel> <gray>chat!";
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 boolean filterEnabled = true;
private boolean firstMatchingGroup = false;
Builder(String name) {
this.name = name.toLowerCase();
}
@Override
public PartyChatChannel build(SimpleChat simpleChat) {
return new PartyChatChannel(color, id, formats, webhook, isDefault, ignorable, name, distance, switchMessage, toggleOffMessage, toggleOnMessage, forwardFormatting, shouldBungee, filterEnabled, firstMatchingGroup, simpleChat);
}
@Override
public PartyChatChannel.Builder setColor(TextColor color) {
this.color = color;
return this;
}
@Override
public PartyChatChannel.Builder setColor(String color) {
return setColor(TextColor.fromHexString(color));
}
@Override
public PartyChatChannel.Builder setId(long id) {
this.id = id;
return this;
}
@Override
public PartyChatChannel.Builder setFormats(Map<String, String> formats) {
this.formats = formats;
return this;
}
@Override
public PartyChatChannel.Builder setWebhook(String webhook) {
this.webhook = webhook;
return this;
}
@Override
public PartyChatChannel.Builder setIsDefault(boolean aDefault) {
this.isDefault = aDefault;
return this;
}
@Override
public PartyChatChannel.Builder setIgnorable(boolean ignorable) {
this.ignorable = ignorable;
return this;
}
@Override
public PartyChatChannel.Builder setName(String name) {
this.name = name;
return this;
}
@Override
public PartyChatChannel.Builder setDistance(double distance) {
this.distance = distance;
return this;
}
@Override
public PartyChatChannel.Builder setSwitchMessage(String switchMessage) {
this.switchMessage = switchMessage;
return this;
}
@Override
public PartyChatChannel.Builder setToggleOffMessage(String toggleOffMessage) {
this.toggleOffMessage = toggleOffMessage;
return this;
}
@Override
public PartyChatChannel.Builder setToggleOnMessage(String toggleOnMessage) {
this.toggleOnMessage = toggleOnMessage;
return this;
}
@Override
public PartyChatChannel.Builder setShouldForwardFormatting(boolean forwardFormatting) {
this.forwardFormatting = forwardFormatting;
return this;
}
@Override
public PartyChatChannel.Builder setShouldBungee(boolean shouldBungee) {
this.shouldBungee = shouldBungee;
return this;
}
@Override
public PartyChatChannel.Builder setFilterEnabled(boolean filterEnabled) {
this.filterEnabled = filterEnabled;
return this;
}
@Override
public PartyChatChannel.Builder setFirstMatchingGroup(boolean firstMatchingGroup) {
this.firstMatchingGroup = firstMatchingGroup;
return this;
}
}
@@ -258,14 +258,14 @@ public class SimpleChatChannel extends ChatChannel {
return false;
}
if (sender instanceof Player) {
if (getDistance() > 0 && targetPlayer.getLocation().distance(((Player)sender).getLocation()) > getDistance()) {
if (sender.isOnline()) {
if (getDistance() > 0 && targetPlayer.getLocation().distance(sender.asPlayer().getLocation()) > getDistance()) {
return false;
}
}
if (isIgnorable() && sender != null) {
if (target.isIgnoringUser(sender.getUUID()) && !targetPlayer.hasPermission("simplechat.ignoreexempt")) {
if (isIgnorable()) {
if (target.isIgnoringUser(sender) && !targetPlayer.hasPermission("simplechat.ignoreexempt")) {
return false;
}
@@ -4,9 +4,11 @@ import com.palmergames.bukkit.towny.TownyAPI;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
import java.util.HashMap;
import java.util.Map;
public class TownChatChannel extends SimpleChatChannel {
@@ -49,10 +51,143 @@ public class TownChatChannel extends SimpleChatChannel {
return new TownChatChannel.Builder(name);
}
public static class Builder extends SimpleChatChannel.Builder {
private Builder(String name) {
super(name);
public static class Builder extends ChatChannel.Builder {
private TextColor color = TextColor.of(255, 255, 255);
private long id = -1;
private Map<String, String> formats = new HashMap<>();
private String webhook = null;
private boolean isDefault = false;
private boolean ignorable = true;
private String name;
private double distance = -1;
private String switchMessage = "<gray>You are now in <color><channel> <gray>chat!";
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 boolean filterEnabled = true;
private boolean firstMatchingGroup = false;
Builder(String name) {
this.name = name.toLowerCase();
}
@Override
public TownChatChannel build(SimpleChat simpleChat) {
return new TownChatChannel(color, id, formats, webhook, isDefault, ignorable, name, distance, switchMessage, toggleOffMessage, toggleOnMessage, forwardFormatting, shouldBungee, filterEnabled, firstMatchingGroup, simpleChat);
}
@Override
public TownChatChannel.Builder setColor(TextColor color) {
this.color = color;
return this;
}
@Override
public TownChatChannel.Builder setColor(String color) {
return setColor(TextColor.fromHexString(color));
}
@Override
public TownChatChannel.Builder setId(long id) {
this.id = id;
return this;
}
@Override
public TownChatChannel.Builder setFormats(Map<String, String> formats) {
this.formats = formats;
return this;
}
@Override
public TownChatChannel.Builder setWebhook(String webhook) {
this.webhook = webhook;
return this;
}
@Override
public TownChatChannel.Builder setIsDefault(boolean aDefault) {
this.isDefault = aDefault;
return this;
}
@Override
public TownChatChannel.Builder setIgnorable(boolean ignorable) {
this.ignorable = ignorable;
return this;
}
@Override
public TownChatChannel.Builder setName(String name) {
this.name = name;
return this;
}
@Override
public TownChatChannel.Builder setDistance(double distance) {
this.distance = distance;
return this;
}
@Override
public TownChatChannel.Builder setSwitchMessage(String switchMessage) {
this.switchMessage = switchMessage;
return this;
}
@Override
public TownChatChannel.Builder setToggleOffMessage(String toggleOffMessage) {
this.toggleOffMessage = toggleOffMessage;
return this;
}
@Override
public TownChatChannel.Builder setToggleOnMessage(String toggleOnMessage) {
this.toggleOnMessage = toggleOnMessage;
return this;
}
@Override
public TownChatChannel.Builder setShouldForwardFormatting(boolean forwardFormatting) {
this.forwardFormatting = forwardFormatting;
return this;
}
@Override
public TownChatChannel.Builder setShouldBungee(boolean shouldBungee) {
this.shouldBungee = shouldBungee;
return this;
}
@Override
public TownChatChannel.Builder setFilterEnabled(boolean filterEnabled) {
this.filterEnabled = filterEnabled;
return this;
}
@Override
public TownChatChannel.Builder setFirstMatchingGroup(boolean firstMatchingGroup) {
this.firstMatchingGroup = firstMatchingGroup;
return this;
}
}
}