mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 04:35:21 +01:00
Better world feature sets.
This commit is contained in:
parent
cf859f2e61
commit
07ab309e1c
@ -0,0 +1,33 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
public class WorldExceptionSet
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean standard = true;
|
||||
|
||||
public Set<String> exceptions = new LinkedHashSet<String>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONTAINS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean contains(String world)
|
||||
{
|
||||
if (this.exceptions.contains(world)) return !this.standard;
|
||||
return this.standard;
|
||||
}
|
||||
|
||||
public boolean contains(World world)
|
||||
{
|
||||
return this.contains(world.getName());
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,6 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -18,6 +17,7 @@ import com.massivecraft.factions.FFlag;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.WorldExceptionSet;
|
||||
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
||||
import com.massivecraft.factions.integration.dynmap.DynmapStyle;
|
||||
import com.massivecraft.factions.listeners.FactionsListenerChat;
|
||||
@ -55,6 +55,21 @@ public class MConf extends Entity<MConf>
|
||||
|
||||
public List<String> aliasesF = MUtil.list("f");
|
||||
|
||||
// -------------------------------------------- //
|
||||
// WORLDS FEATURE ENABLED
|
||||
// -------------------------------------------- //
|
||||
|
||||
public WorldExceptionSet worldsClaimingEnabled = new WorldExceptionSet();
|
||||
public WorldExceptionSet worldsPowerLossEnabled = new WorldExceptionSet();
|
||||
public WorldExceptionSet worldsPvpRulesEnabled = new WorldExceptionSet();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// DERPY OVERRIDES
|
||||
// -------------------------------------------- //
|
||||
|
||||
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
|
||||
public Set<String> playersWhoBypassAllProtection = new LinkedHashSet<String>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// TASKS
|
||||
// -------------------------------------------- //
|
||||
@ -268,41 +283,6 @@ public class MConf extends Entity<MConf>
|
||||
public String prefixMember = "+";
|
||||
public String prefixRecruit = "-";
|
||||
|
||||
// -------------------------------------------- //
|
||||
// DERPY OVERRIDES
|
||||
// -------------------------------------------- //
|
||||
// TODO: Should worldsNoPowerLoss rather be a bukkit permission node?
|
||||
// TODO: These are derpy because they possibly use an invalid design approach.
|
||||
// After universe support is added. Would some of these be removed?
|
||||
// Could it also be more customizeable using some sort of permission lookup map?
|
||||
|
||||
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
|
||||
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
|
||||
// -------------------------------------------- //
|
||||
|
@ -706,7 +706,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
{
|
||||
if (newFaction.isNormal())
|
||||
{
|
||||
if (mconf.getWorldsNoClaiming().contains(ps.getWorld()))
|
||||
if (!mconf.worldsClaimingEnabled.contains(ps.getWorld()))
|
||||
{
|
||||
msg("<b>Sorry, this world has land claiming disabled.");
|
||||
return false;
|
||||
|
@ -201,7 +201,7 @@ public class FactionsListenerMain implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (MConf.get().getWorldsNoPowerLoss().contains(player.getWorld().getName()))
|
||||
if (!MConf.get().worldsPowerLossEnabled.contains(player.getWorld()))
|
||||
{
|
||||
mplayer.msg("<i>You didn't lose any power due to the world you died in.");
|
||||
return;
|
||||
@ -342,7 +342,7 @@ public class FactionsListenerMain implements Listener
|
||||
}
|
||||
|
||||
// ... are PVP rules completely ignored in this world? ...
|
||||
if (MConf.get().getWorldsIgnlorePvP().contains(defenderPs.getWorld())) return true;
|
||||
if (!MConf.get().worldsPvpRulesEnabled.contains(defenderPs.getWorld())) return true;
|
||||
|
||||
Faction defendFaction = udefender.getFaction();
|
||||
Faction attackFaction = uattacker.getFaction();
|
||||
|
Loading…
Reference in New Issue
Block a user