More components, broadcasts #98
9 changed files with 68 additions and 41 deletions
|
@ -9,6 +9,7 @@ import buttondevteam.chat.components.towncolors.TownColorComponent;
|
||||||
import buttondevteam.chat.components.towny.TownyComponent;
|
import buttondevteam.chat.components.towny.TownyComponent;
|
||||||
import buttondevteam.chat.listener.PlayerJoinLeaveListener;
|
import buttondevteam.chat.listener.PlayerJoinLeaveListener;
|
||||||
import buttondevteam.chat.listener.PlayerListener;
|
import buttondevteam.chat.listener.PlayerListener;
|
||||||
|
import buttondevteam.core.MainPlugin;
|
||||||
import buttondevteam.core.component.channel.Channel;
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.architecture.ButtonPlugin;
|
import buttondevteam.lib.architecture.ButtonPlugin;
|
||||||
|
@ -17,7 +18,6 @@ import buttondevteam.lib.architecture.ConfigData;
|
||||||
import buttondevteam.lib.chat.Color;
|
import buttondevteam.lib.chat.Color;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
import net.milkbowl.vault.chat.Chat;
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -50,6 +50,7 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
|
||||||
TBMCChatAPI.AddCommands(this, YeehawCommand.class);
|
TBMCChatAPI.AddCommands(this, YeehawCommand.class);
|
||||||
|
MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler
|
||||||
Console = this.getServer().getConsoleSender();
|
Console = this.getServer().getConsoleSender();
|
||||||
|
|
||||||
SB = getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
SB = getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
||||||
|
@ -79,7 +80,6 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
||||||
|
|
||||||
public static Permission permission = null;
|
public static Permission permission = null;
|
||||||
public static Economy economy = null;
|
public static Economy economy = null;
|
||||||
public static Chat chat = null;
|
|
||||||
|
|
||||||
private boolean setupPermissions() {
|
private boolean setupPermissions() {
|
||||||
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager()
|
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package buttondevteam.chat.components.announce;
|
package buttondevteam.chat.components.announce;
|
||||||
|
|
||||||
|
import buttondevteam.chat.PluginMain;
|
||||||
import buttondevteam.core.component.channel.Channel;
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
import buttondevteam.lib.architecture.Component;
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
@ -9,7 +10,7 @@ import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class AnnouncerComponent extends Component implements Runnable {
|
public class AnnouncerComponent extends Component<PluginMain> implements Runnable {
|
||||||
public ConfigData<ArrayList<String>> AnnounceMessages() {
|
public ConfigData<ArrayList<String>> AnnounceMessages() {
|
||||||
return getConfig().getData("announceMessages", new ArrayList<>(0));
|
return getConfig().getData("announceMessages", new ArrayList<>(0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package buttondevteam.chat.components.flair;
|
package buttondevteam.chat.components.flair;
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
|
import buttondevteam.chat.PluginMain;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.architecture.Component;
|
import buttondevteam.lib.architecture.Component;
|
||||||
import buttondevteam.lib.architecture.ConfigData;
|
import buttondevteam.lib.architecture.ConfigData;
|
||||||
|
@ -21,7 +22,7 @@ import java.net.UnknownHostException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class FlairComponent extends Component {
|
public class FlairComponent extends Component<PluginMain> {
|
||||||
private ConfigData<String> FlairThreadURL() {
|
private ConfigData<String> FlairThreadURL() {
|
||||||
return getConfig().getData("flairThreadURL", "https://www.reddit.com/r/Chromagamers/comments/51ys94/flair_thread_for_the_mc_server/");
|
return getConfig().getData("flairThreadURL", "https://www.reddit.com/r/Chromagamers/comments/51ys94/flair_thread_for_the_mc_server/");
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import buttondevteam.lib.architecture.Component;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -29,7 +28,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class FunComponent extends Component implements Listener {
|
public class FunComponent extends Component<PluginMain> implements Listener {
|
||||||
private final static String[] LaughStrings = new String[]{"xd", "lel", "lawl", "kek", "lmao", "hue", "hah", "rofl"};
|
private final static String[] LaughStrings = new String[]{"xd", "lel", "lawl", "kek", "lmao", "hue", "hah", "rofl"};
|
||||||
private boolean ActiveF = false;
|
private boolean ActiveF = false;
|
||||||
private ChatPlayer FPlayer = null;
|
private ChatPlayer FPlayer = null;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import buttondevteam.lib.player.TBMCPlayerJoinEvent;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
import com.palmergames.bukkit.towny.object.Nation;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.experimental.var;
|
import lombok.experimental.var;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -35,7 +36,7 @@ import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ComponentMetadata(depends = TownyComponent.class)
|
@ComponentMetadata(depends = TownyComponent.class)
|
||||||
public class TownColorComponent extends Component implements Listener {
|
public class TownColorComponent extends Component<PluginMain> implements Listener {
|
||||||
/**
|
/**
|
||||||
* Names lowercased
|
* Names lowercased
|
||||||
*/
|
*/
|
||||||
|
@ -49,17 +50,22 @@ public class TownColorComponent extends Component implements Listener {
|
||||||
return getConfig().getData("colorCount", (byte) 1, cc -> ((Integer) cc).byteValue(), Byte::intValue);
|
return getConfig().getData("colorCount", (byte) 1, cc -> ((Integer) cc).byteValue(), Byte::intValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigData<Boolean> useNationColors() { //TODO
|
public ConfigData<Boolean> useNationColors() {
|
||||||
return getConfig().getData("useNationColors", true);
|
return getConfig().getData("useNationColors", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static TownColorComponent component;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
|
component = this;
|
||||||
//TODO: Don't register all commands automatically (welp)
|
//TODO: Don't register all commands automatically (welp)
|
||||||
Consumer<ConfigurationSection> loadTC = cs -> TownColorComponent.TownColors.putAll(cs.getValues(true).entrySet().stream()
|
Consumer<ConfigurationSection> loadTC = cs -> TownColorComponent.TownColors.putAll(cs.getValues(true).entrySet().stream()
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, v -> ((List<String>) v.getValue()).stream()
|
.collect(Collectors.toMap(Map.Entry::getKey, v -> ((List<String>) v.getValue()).stream()
|
||||||
.map(Color::valueOf).toArray(Color[]::new))));
|
.map(Color::valueOf).toArray(Color[]::new))));
|
||||||
|
boolean usenc = useNationColors().get();
|
||||||
Consumer<ConfigurationSection> loadNC = ncs ->
|
Consumer<ConfigurationSection> loadNC = ncs ->
|
||||||
TownColorComponent.NationColor.putAll(ncs.getValues(true).entrySet().stream()
|
TownColorComponent.NationColor.putAll(ncs.getValues(true).entrySet().stream()
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, v -> Color.valueOf((String) v.getValue()))));
|
.collect(Collectors.toMap(Map.Entry::getKey, v -> Color.valueOf((String) v.getValue()))));
|
||||||
|
@ -68,14 +74,17 @@ public class TownColorComponent extends Component implements Listener {
|
||||||
loadTC.accept(cs);
|
loadTC.accept(cs);
|
||||||
else
|
else
|
||||||
load_old(loadTC, null); //Load old data
|
load_old(loadTC, null); //Load old data
|
||||||
var ncs = getConfig().getConfig().getConfigurationSection("nationcolors");
|
if (usenc) {
|
||||||
if (ncs != null)
|
var ncs = getConfig().getConfig().getConfigurationSection("nationcolors");
|
||||||
loadNC.accept(ncs);
|
if (ncs != null)
|
||||||
else
|
loadNC.accept(ncs);
|
||||||
load_old(null, loadNC); //Why not choose by making different args null
|
else
|
||||||
|
load_old(null, loadNC); //Why not choose by making different args null
|
||||||
|
}
|
||||||
|
|
||||||
TownColors.keySet().removeIf(t -> !TownyComponent.TU.getTownsMap().containsKey(t)); // Removes town colors for deleted/renamed towns
|
TownColors.keySet().removeIf(t -> !TownyComponent.TU.getTownsMap().containsKey(t)); // Removes town colors for deleted/renamed towns
|
||||||
NationColor.keySet().removeIf(n -> !TownyComponent.TU.getNationsMap().containsKey(n)); // Removes nation colors for deleted/renamed nations
|
if (usenc)
|
||||||
|
NationColor.keySet().removeIf(n -> !TownyComponent.TU.getNationsMap().containsKey(n)); // Removes nation colors for deleted/renamed nations
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(getPlugin(), () -> {
|
Bukkit.getScheduler().runTask(getPlugin(), () -> {
|
||||||
val dtp = (DynmapTownyPlugin) Bukkit.getPluginManager().getPlugin("Dynmap-Towny");
|
val dtp = (DynmapTownyPlugin) Bukkit.getPluginManager().getPlugin("Dynmap-Towny");
|
||||||
|
@ -86,7 +95,9 @@ public class TownColorComponent extends Component implements Listener {
|
||||||
val town = TownyComponent.TU.getTownsMap().get(entry.getKey());
|
val town = TownyComponent.TU.getTownsMap().get(entry.getKey());
|
||||||
Nation nation;
|
Nation nation;
|
||||||
Color nc;
|
Color nc;
|
||||||
if (!town.hasNation() || (nation = town.getNation()) == null || (nc = NationColor.get(nation.getName().toLowerCase())) == null)
|
if (!useNationColors().get())
|
||||||
|
nc = null;
|
||||||
|
else if (!town.hasNation() || (nation = town.getNation()) == null || (nc = NationColor.get(nation.getName().toLowerCase())) == null)
|
||||||
nc = Color.White;
|
nc = Color.White;
|
||||||
setTownColor(dtp, buttondevteam.chat.components.towncolors.admin.TownColorCommand.getTownNameCased(entry.getKey()), entry.getValue(), nc);
|
setTownColor(dtp, buttondevteam.chat.components.towncolors.admin.TownColorCommand.getTownNameCased(entry.getKey()), entry.getValue(), nc);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -96,9 +107,11 @@ public class TownColorComponent extends Component implements Listener {
|
||||||
});
|
});
|
||||||
|
|
||||||
registerCommand(new TownColorCommand());
|
registerCommand(new TownColorCommand());
|
||||||
registerCommand(new NationColorCommand());
|
if (useNationColors().get())
|
||||||
|
registerCommand(new NationColorCommand());
|
||||||
registerCommand(new buttondevteam.chat.components.towncolors.admin.TownColorCommand());
|
registerCommand(new buttondevteam.chat.components.towncolors.admin.TownColorCommand());
|
||||||
registerCommand(new buttondevteam.chat.components.towncolors.admin.NationColorCommand());
|
if (useNationColors().get())
|
||||||
|
registerCommand(new buttondevteam.chat.components.towncolors.admin.NationColorCommand());
|
||||||
registerCommand(new TCCount());
|
registerCommand(new TCCount());
|
||||||
registerListener(new TownyListener());
|
registerListener(new TownyListener());
|
||||||
registerListener(this);
|
registerListener(this);
|
||||||
|
@ -108,8 +121,9 @@ public class TownColorComponent extends Component implements Listener {
|
||||||
protected void disable() {
|
protected void disable() {
|
||||||
getConfig().getConfig().createSection("towncolors", TownColors.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
|
getConfig().getConfig().createSection("towncolors", TownColors.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
|
||||||
v -> Arrays.stream(v.getValue()).map(Enum::toString).toArray(String[]::new))));
|
v -> Arrays.stream(v.getValue()).map(Enum::toString).toArray(String[]::new))));
|
||||||
getConfig().getConfig().createSection("nationcolors", NationColor.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
|
if (useNationColors().get())
|
||||||
v -> v.getValue().toString())));
|
getConfig().getConfig().createSection("nationcolors", NationColor.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
|
||||||
|
v -> v.getValue().toString())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,18 +171,20 @@ public class TownColorComponent extends Component implements Listener {
|
||||||
len = name.length() / (clrs.length+1);
|
len = name.length() / (clrs.length+1);
|
||||||
else
|
else
|
||||||
len = name.length() / clrs.length;*/
|
len = name.length() / clrs.length;*/
|
||||||
|
boolean usenc = component.useNationColors().get();
|
||||||
val nclar = cp.NameColorLocations().get();
|
val nclar = cp.NameColorLocations().get();
|
||||||
int[] ncl = nclar == null ? null : nclar.stream().mapToInt(Integer::intValue).toArray();
|
int[] ncl = nclar == null ? null : nclar.stream().mapToInt(Integer::intValue).toArray();
|
||||||
if (ncl != null && (Arrays.stream(ncl).sum() != name.length() || ncl.length != clrs.length + 1)) //+1: Nation color
|
if (ncl != null && (Arrays.stream(ncl).sum() != name.length() || ncl.length != clrs.length + (usenc ? 1 : 0))) //+1: Nation color
|
||||||
ncl = null; // Reset if name length changed
|
ncl = null; // Reset if name length changed
|
||||||
//System.out.println("ncl: "+Arrays.toString(ncl)+" - sum: "+Arrays.stream(ncl).sum()+" - name len: "+name.length());
|
//System.out.println("ncl: "+Arrays.toString(ncl)+" - sum: "+Arrays.stream(ncl).sum()+" - name len: "+name.length());
|
||||||
if (!res.getTown().hasNation()
|
if (usenc) {
|
||||||
|| (nc = NationColor.get(res.getTown().getNation().getName().toLowerCase())) == null)
|
if (!res.getTown().hasNation()
|
||||||
nc = Color.White;
|
|| (nc = NationColor.get(res.getTown().getNation().getName().toLowerCase())) == null)
|
||||||
ret.append(anyColoredNamePart.apply(nc, ncl == null ? len : ncl[0])); //Make first color the nation color
|
nc = Color.White;
|
||||||
|
ret.append(anyColoredNamePart.apply(nc, ncl == null ? len : ncl[0])); //Make first color the nation color
|
||||||
|
}
|
||||||
for (int i = 0; i < clrs.length; i++)
|
for (int i = 0; i < clrs.length; i++)
|
||||||
//ret.append(coloredNamePart.apply(ncl == null ? len : (nc==null?ncl[i]:ncl[i+1]), i));
|
ret.append(coloredNamePart.apply(ncl == null ? len : (usenc ? ncl[i + 1] : ncl[i]), i));
|
||||||
ret.append(coloredNamePart.apply(ncl == null ? len : ncl[i + 1], i));
|
|
||||||
return ret.toString();
|
return ret.toString();
|
||||||
} catch (NotRegisteredException e) {
|
} catch (NotRegisteredException e) {
|
||||||
return nickname;
|
return nickname;
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class TownyListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNationRename(RenameNationEvent event) {
|
public void onNationRename(RenameNationEvent event) {
|
||||||
|
if (!TownColorComponent.getComponent().useNationColors().get()) return;
|
||||||
val clrs = TownColorComponent.NationColor.remove(event.getOldName().toLowerCase());
|
val clrs = TownColorComponent.NationColor.remove(event.getOldName().toLowerCase());
|
||||||
if (clrs != null)
|
if (clrs != null)
|
||||||
TownColorComponent.NationColor.put(event.getNation().getName().toLowerCase(), clrs);
|
TownColorComponent.NationColor.put(event.getNation().getName().toLowerCase(), clrs);
|
||||||
|
@ -68,21 +69,25 @@ public class TownyListener implements Listener {
|
||||||
|
|
||||||
@EventHandler //Gets called on town load as well
|
@EventHandler //Gets called on town load as well
|
||||||
public void onNationJoin(NationAddTownEvent event) {
|
public void onNationJoin(NationAddTownEvent event) {
|
||||||
|
if (!TownColorComponent.getComponent().useNationColors().get()) return;
|
||||||
updateTownMembers(event.getTown());
|
updateTownMembers(event.getTown());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNationLeave(NationRemoveTownEvent event) {
|
public void onNationLeave(NationRemoveTownEvent event) {
|
||||||
|
if (!TownColorComponent.getComponent().useNationColors().get()) return;
|
||||||
updateTownMembers(event.getTown()); //The town still has it's colours
|
updateTownMembers(event.getTown()); //The town still has it's colours
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNationDelete(DeleteNationEvent event) {
|
public void onNationDelete(DeleteNationEvent event) {
|
||||||
|
if (!TownColorComponent.getComponent().useNationColors().get()) return;
|
||||||
TownColorComponent.NationColor.remove(event.getNationName().toLowerCase());
|
TownColorComponent.NationColor.remove(event.getNationName().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNationCreate(NewNationEvent event) {
|
public void onNationCreate(NewNationEvent event) {
|
||||||
|
if (!TownColorComponent.getComponent().useNationColors().get()) return;
|
||||||
Player p = Bukkit.getPlayer(event.getNation().getCapital().getMayor().getName());
|
Player p = Bukkit.getPlayer(event.getNation().getCapital().getMayor().getName());
|
||||||
if (p != null)
|
if (p != null)
|
||||||
p.sendMessage("§6Use /u nationcolor to set a color for the nation.");
|
p.sendMessage("§6Use /u nationcolor to set a color for the nation.");
|
||||||
|
|
|
@ -51,21 +51,26 @@ public class TownColorCommand extends AdminCommandBase {
|
||||||
clrs[i - 1] = c.get();
|
clrs[i - 1] = c.get();
|
||||||
}
|
}
|
||||||
Color tnc;
|
Color tnc;
|
||||||
try {
|
boolean usenc = TownColorComponent.getComponent().useNationColors().get();
|
||||||
tnc = TownColorComponent.NationColor.get(targetTown.getNation().getName().toLowerCase());
|
if (usenc) {
|
||||||
} catch (Exception e) {
|
try {
|
||||||
tnc = null;
|
tnc = TownColorComponent.NationColor.get(targetTown.getNation().getName().toLowerCase());
|
||||||
}
|
} catch (Exception e) {
|
||||||
if (tnc == null) tnc = Color.White; //Default nation color - TODO: Make configurable
|
tnc = null;
|
||||||
|
}
|
||||||
|
if (tnc == null) tnc = Color.White; //Default nation color - TODO: Make configurable
|
||||||
|
} else tnc = null;
|
||||||
for (Map.Entry<String, Color[]> other : TownColorComponent.TownColors.entrySet()) {
|
for (Map.Entry<String, Color[]> other : TownColorComponent.TownColors.entrySet()) {
|
||||||
Color nc;
|
Color nc;
|
||||||
try {
|
if (usenc) {
|
||||||
nc = TownColorComponent.NationColor.get(TownyComponent.TU.getTownsMap().get(other.getKey()).getNation().getName().toLowerCase());
|
try {
|
||||||
} catch (Exception e) { //Too lazy for lots of null-checks and it may throw exceptions anyways
|
nc = TownColorComponent.NationColor.get(TownyComponent.TU.getTownsMap().get(other.getKey()).getNation().getName().toLowerCase());
|
||||||
nc = null;
|
} catch (Exception e) { //Too lazy for lots of null-checks and it may throw exceptions anyways
|
||||||
}
|
nc = null;
|
||||||
if (nc == null) nc = Color.White; //Default nation color
|
}
|
||||||
if (nc.getName().equals(tnc.getName())) {
|
if (nc == null) nc = Color.White; //Default nation color
|
||||||
|
} else nc = null;
|
||||||
|
if (!usenc || nc.getName().equals(tnc.getName())) {
|
||||||
int C = 0;
|
int C = 0;
|
||||||
if (clrs.length == other.getValue().length)
|
if (clrs.length == other.getValue().length)
|
||||||
for (int i = 0; i < clrs.length; i++)
|
for (int i = 0; i < clrs.length; i++)
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class TownyComponent extends Component {
|
public class TownyComponent extends Component<PluginMain> {
|
||||||
public static TownyUniverse TU;
|
public static TownyUniverse TU;
|
||||||
private static ArrayList<String> Towns;
|
private static ArrayList<String> Towns;
|
||||||
private static ArrayList<String> Nations;
|
private static ArrayList<String> Nations;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: ButtonChat
|
name: Thorpe-Chat
|
||||||
main: buttondevteam.chat.PluginMain
|
main: buttondevteam.chat.PluginMain
|
||||||
version: 4.0
|
version: 4.0
|
||||||
commands:
|
commands:
|
||||||
|
|
Loading…
Reference in a new issue