From df9b10e07414529924f41cc014e7c2fee6b39e9c Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 9 Aug 2013 10:06:28 +0200 Subject: [PATCH] Make world sets case insensitive so people can WrItE HoWeVeR tHeY WaNt. --- .../massivecraft/factions/entity/MConf.java | 21 +++++++++++++++++++ .../massivecraft/factions/entity/UPlayer.java | 2 +- .../listeners/FactionsListenerMain.java | 4 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/factions/entity/MConf.java b/src/com/massivecraft/factions/entity/MConf.java index 9a1060dd..fd8a6524 100644 --- a/src/com/massivecraft/factions/entity/MConf.java +++ b/src/com/massivecraft/factions/entity/MConf.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.entity; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; +import java.util.TreeSet; import org.bukkit.ChatColor; import org.bukkit.event.EventPriority; @@ -131,8 +132,28 @@ public class MConf extends Entity public Set playersWhoBypassAllProtection = new LinkedHashSet(); public Set worldsNoClaiming = new LinkedHashSet(); + public Set getWorldsNoClaiming() + { + Set ret = new TreeSet(String.CASE_INSENSITIVE_ORDER); + ret.addAll(this.worldsNoClaiming); + return ret; + } + public Set worldsNoPowerLoss = new LinkedHashSet(); + public Set getWorldsNoPowerLoss() + { + Set ret = new TreeSet(String.CASE_INSENSITIVE_ORDER); + ret.addAll(this.worldsNoPowerLoss); + return ret; + } + public Set worldsIgnorePvP = new LinkedHashSet(); + public Set getWorldsIgnlorePvP() + { + Set ret = new TreeSet(String.CASE_INSENSITIVE_ORDER); + ret.addAll(this.worldsIgnorePvP); + return ret; + } // -------------------------------------------- // // EXPLOITS diff --git a/src/com/massivecraft/factions/entity/UPlayer.java b/src/com/massivecraft/factions/entity/UPlayer.java index 07a3bd8e..869f6ae4 100644 --- a/src/com/massivecraft/factions/entity/UPlayer.java +++ b/src/com/massivecraft/factions/entity/UPlayer.java @@ -679,7 +679,7 @@ public class UPlayer extends SenderEntity implements EconomyParticipato { if (newFaction.isNormal()) { - if (mconf.worldsNoClaiming.contains(ps.getWorld())) + if (mconf.getWorldsNoClaiming().contains(ps.getWorld())) { msg("Sorry, this world has land claiming disabled."); return false; diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java index 1671c021..0fc1d31d 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java @@ -201,7 +201,7 @@ public class FactionsListenerMain implements Listener return; } - if (MConf.get().worldsNoPowerLoss.contains(player.getWorld().getName())) + if (MConf.get().getWorldsNoPowerLoss().contains(player.getWorld().getName())) { uplayer.msg("You didn't lose any power due to the world you died in."); return; @@ -333,7 +333,7 @@ public class FactionsListenerMain implements Listener } // ... are PVP rules completely ignored in this world? ... - if (MConf.get().worldsIgnorePvP.contains(defenderPs.getWorld())) return true; + if (MConf.get().getWorldsIgnlorePvP().contains(defenderPs.getWorld())) return true; Faction defendFaction = udefender.getFaction(); Faction attackFaction = uattacker.getFaction();