Make world sets case insensitive so people can WrItE HoWeVeR tHeY WaNt.

This commit is contained in:
Olof Larsson 2013-08-09 10:06:28 +02:00
parent 642f5c00d0
commit df9b10e074
3 changed files with 24 additions and 3 deletions

View File

@ -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<MConf>
public Set<String> playersWhoBypassAllProtection = new LinkedHashSet<String>();
public Set<String> worldsNoClaiming = new LinkedHashSet<String>();
public Set<String> getWorldsNoClaiming()
{
Set<String> ret = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
ret.addAll(this.worldsNoClaiming);
return ret;
}
public Set<String> worldsNoPowerLoss = new LinkedHashSet<String>();
public Set<String> getWorldsNoPowerLoss()
{
Set<String> ret = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
ret.addAll(this.worldsNoPowerLoss);
return ret;
}
public Set<String> worldsIgnorePvP = new LinkedHashSet<String>();
public Set<String> getWorldsIgnlorePvP()
{
Set<String> ret = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
ret.addAll(this.worldsIgnorePvP);
return ret;
}
// -------------------------------------------- //
// EXPLOITS

View File

@ -679,7 +679,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
{
if (newFaction.isNormal())
{
if (mconf.worldsNoClaiming.contains(ps.getWorld()))
if (mconf.getWorldsNoClaiming().contains(ps.getWorld()))
{
msg("<b>Sorry, this world has land claiming disabled.");
return false;

View File

@ -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("<i>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();