-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static TypeFaction i = new TypeFaction();
- public static TypeFaction get() { return i; }
- public TypeFaction() { super(Faction.class); }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getVisualInner(Faction value, CommandSender sender)
- {
- return value.describeTo(MPlayer.get(sender));
- }
-
- @Override
- public String getNameInner(Faction value)
- {
- return ChatColor.stripColor(value.getName());
- }
-
- @Override
- public Faction read(String str, CommandSender sender) throws MassiveException
- {
- Faction ret;
-
- // Nothing/Remove targets Wilderness
- if (MassiveCore.NOTHING_REMOVE.contains(str))
- {
- return FactionColl.get().getNone();
- }
-
- // Faction Id Exact
- if (FactionColl.get().containsId(str))
- {
- ret = FactionColl.get().get(str);
- if (ret != null) return ret;
- }
-
- // Faction Name Exact
- ret = FactionColl.get().getByName(str);
- if (ret != null) return ret;
-
- // MPlayer Name Exact
- String id = IdUtil.getId(str);
- if (id != null)
- {
- MPlayer mplayer = MPlayerColl.get().get(id, false);
- if (mplayer != null)
- {
- return mplayer.getFaction();
- }
- }
-
- throw new MassiveException().addMsg("No faction or player matching \"%s\".", str);
- }
-
- @Override
- public Collection getTabList(CommandSender sender, String arg)
- {
- // Create
- Set ret = new TreeSet<>(ComparatorCaseInsensitive.get());
-
- // Fill
- for (Faction faction : FactionColl.get().getAll())
- {
- ret.add(ChatColor.stripColor(faction.getName()));
- }
-
- // Return
- return ret;
- }
-
-}
+package com.massivecraft.factions.cmd.type;
+
+import com.massivecraft.factions.entity.Faction;
+import com.massivecraft.factions.entity.FactionColl;
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.factions.entity.MPlayerColl;
+import com.massivecraft.massivecore.MassiveCore;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.TypeAbstract;
+import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
+import com.massivecraft.massivecore.util.IdUtil;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.TreeSet;
+
+public class TypeFaction extends TypeAbstract
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static TypeFaction i = new TypeFaction();
+ public static TypeFaction get() { return i; }
+ public TypeFaction() { super(Faction.class); }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getVisualInner(Faction value, CommandSender sender)
+ {
+ return value.describeTo(MPlayer.get(sender));
+ }
+
+ @Override
+ public String getNameInner(Faction value)
+ {
+ return ChatColor.stripColor(value.getName());
+ }
+
+ @Override
+ public Faction read(String str, CommandSender sender) throws MassiveException
+ {
+ Faction ret;
+
+ // Nothing/Remove targets Wilderness
+ if (MassiveCore.NOTHING_REMOVE.contains(str))
+ {
+ return FactionColl.get().getNone();
+ }
+
+ // Faction Id Exact
+ if (FactionColl.get().containsId(str))
+ {
+ ret = FactionColl.get().get(str);
+ if (ret != null) return ret;
+ }
+
+ // Faction Name Exact
+ ret = FactionColl.get().getByName(str);
+ if (ret != null) return ret;
+
+ // MPlayer Name Exact
+ String id = IdUtil.getId(str);
+ if (id != null)
+ {
+ MPlayer mplayer = MPlayerColl.get().get(id, false);
+ if (mplayer != null)
+ {
+ return mplayer.getFaction();
+ }
+ }
+
+ throw new MassiveException().addMsg("No faction or player matching \"%s\".", str);
+ }
+
+ @Override
+ public Collection getTabList(CommandSender sender, String arg)
+ {
+ // Create
+ Set ret = new TreeSet<>(ComparatorCaseInsensitive.get());
+
+ // Fill
+ for (Faction faction : FactionColl.get().getAll())
+ {
+ ret.add(ChatColor.stripColor(faction.getName()));
+ }
+
+ // Return
+ return ret;
+ }
+
+}
diff --git a/src/com/massivecraft/factions/cmd/type/TypeMFlag.java b/src/com/massivecraft/factions/cmd/type/TypeMFlag.java
index aa0793d3..48d8084d 100644
--- a/src/com/massivecraft/factions/cmd/type/TypeMFlag.java
+++ b/src/com/massivecraft/factions/cmd/type/TypeMFlag.java
@@ -1,38 +1,38 @@
-package com.massivecraft.factions.cmd.type;
-
-import com.massivecraft.factions.entity.MFlag;
-import com.massivecraft.factions.entity.MFlagColl;
-import com.massivecraft.massivecore.command.type.store.TypeEntity;
-
-import java.util.Collection;
-
-public class TypeMFlag extends TypeEntity
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static TypeMFlag i = new TypeMFlag();
- public static TypeMFlag get() { return i; }
- public TypeMFlag()
- {
- super(MFlagColl.get());
- }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getName()
- {
- return "faction flag";
- }
-
- @Override
- public Collection getAll()
- {
- return MFlag.getAll();
- }
-
-}
+package com.massivecraft.factions.cmd.type;
+
+import com.massivecraft.factions.entity.MFlag;
+import com.massivecraft.factions.entity.MFlagColl;
+import com.massivecraft.massivecore.command.type.store.TypeEntity;
+
+import java.util.Collection;
+
+public class TypeMFlag extends TypeEntity
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static TypeMFlag i = new TypeMFlag();
+ public static TypeMFlag get() { return i; }
+ public TypeMFlag()
+ {
+ super(MFlagColl.get());
+ }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getName()
+ {
+ return "faction flag";
+ }
+
+ @Override
+ public Collection getAll()
+ {
+ return MFlag.getAll();
+ }
+
+}
diff --git a/src/com/massivecraft/factions/cmd/type/TypeMPerm.java b/src/com/massivecraft/factions/cmd/type/TypeMPerm.java
index f7c4f333..8e502f0d 100644
--- a/src/com/massivecraft/factions/cmd/type/TypeMPerm.java
+++ b/src/com/massivecraft/factions/cmd/type/TypeMPerm.java
@@ -1,39 +1,39 @@
-package com.massivecraft.factions.cmd.type;
-
-import com.massivecraft.factions.entity.MPerm;
-import com.massivecraft.factions.entity.MPermColl;
-import com.massivecraft.massivecore.command.type.store.TypeEntity;
-
-import java.util.Collection;
-
-public class TypeMPerm extends TypeEntity
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static TypeMPerm i = new TypeMPerm();
- public static TypeMPerm get() { return i; }
- public TypeMPerm()
- {
- super(MPermColl.get());
- }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getName()
- {
- return "faction permission";
- }
-
- @Override
- public Collection getAll()
- {
- return MPerm.getAll();
- }
-
-
-}
+package com.massivecraft.factions.cmd.type;
+
+import com.massivecraft.factions.entity.MPerm;
+import com.massivecraft.factions.entity.MPermColl;
+import com.massivecraft.massivecore.command.type.store.TypeEntity;
+
+import java.util.Collection;
+
+public class TypeMPerm extends TypeEntity
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static TypeMPerm i = new TypeMPerm();
+ public static TypeMPerm get() { return i; }
+ public TypeMPerm()
+ {
+ super(MPermColl.get());
+ }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getName()
+ {
+ return "faction permission";
+ }
+
+ @Override
+ public Collection getAll()
+ {
+ return MPerm.getAll();
+ }
+
+
+}
diff --git a/src/com/massivecraft/factions/cmd/type/TypeMPlayer.java b/src/com/massivecraft/factions/cmd/type/TypeMPlayer.java
index 66bffd20..5042ed9a 100644
--- a/src/com/massivecraft/factions/cmd/type/TypeMPlayer.java
+++ b/src/com/massivecraft/factions/cmd/type/TypeMPlayer.java
@@ -1,18 +1,18 @@
-package com.massivecraft.factions.cmd.type;
-
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.factions.entity.MPlayerColl;
-import com.massivecraft.massivecore.command.type.Type;
-
-public class TypeMPlayer
-{
- // -------------------------------------------- //
- // INSTANCE
- // -------------------------------------------- //
-
- public static Type get()
- {
- return MPlayerColl.get().getTypeEntity();
- }
-
-}
+package com.massivecraft.factions.cmd.type;
+
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.factions.entity.MPlayerColl;
+import com.massivecraft.massivecore.command.type.Type;
+
+public class TypeMPlayer
+{
+ // -------------------------------------------- //
+ // INSTANCE
+ // -------------------------------------------- //
+
+ public static Type get()
+ {
+ return MPlayerColl.get().getTypeEntity();
+ }
+
+}
diff --git a/src/com/massivecraft/factions/cmd/type/TypeRel.java b/src/com/massivecraft/factions/cmd/type/TypeRel.java
index 7ad6c3bd..88a6ed13 100644
--- a/src/com/massivecraft/factions/cmd/type/TypeRel.java
+++ b/src/com/massivecraft/factions/cmd/type/TypeRel.java
@@ -1,40 +1,40 @@
-package com.massivecraft.factions.cmd.type;
-
-import com.massivecraft.factions.Rel;
-import com.massivecraft.massivecore.command.type.enumeration.TypeEnum;
-
-import java.util.Set;
-
-public class TypeRel extends TypeEnum
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static TypeRel i = new TypeRel();
- public static TypeRel get() { return i; }
- public TypeRel() { super(Rel.class); }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getName()
- {
- return "relation";
- }
-
- @Override
- public String getNameInner(Rel value)
- {
- return value.getName();
- }
-
- @Override
- public Set getNamesInner(Rel value)
- {
- return value.getNames();
- }
-
-}
+package com.massivecraft.factions.cmd.type;
+
+import com.massivecraft.factions.Rel;
+import com.massivecraft.massivecore.command.type.enumeration.TypeEnum;
+
+import java.util.Set;
+
+public class TypeRel extends TypeEnum
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static TypeRel i = new TypeRel();
+ public static TypeRel get() { return i; }
+ public TypeRel() { super(Rel.class); }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getName()
+ {
+ return "relation";
+ }
+
+ @Override
+ public String getNameInner(Rel value)
+ {
+ return value.getName();
+ }
+
+ @Override
+ public Set getNamesInner(Rel value)
+ {
+ return value.getNames();
+ }
+
+}
diff --git a/src/com/massivecraft/factions/cmd/type/TypeSortMPlayer.java b/src/com/massivecraft/factions/cmd/type/TypeSortMPlayer.java
index 404e2e2c..c74af029 100644
--- a/src/com/massivecraft/factions/cmd/type/TypeSortMPlayer.java
+++ b/src/com/massivecraft/factions/cmd/type/TypeSortMPlayer.java
@@ -1,39 +1,39 @@
-package com.massivecraft.factions.cmd.type;
-
-import com.massivecraft.factions.comparator.ComparatorMPlayerInactivity;
-import com.massivecraft.factions.comparator.ComparatorMPlayerPower;
-import com.massivecraft.factions.comparator.ComparatorMPlayerRole;
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
-
-import java.util.Comparator;
-
-public class TypeSortMPlayer extends TypeAbstractChoice>
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static TypeSortMPlayer i = new TypeSortMPlayer();
- public static TypeSortMPlayer get() { return i; }
- public TypeSortMPlayer()
- {
- super(Comparator.class);
- this.setAll(
- ComparatorMPlayerRole.get(),
- ComparatorMPlayerPower.get(),
- ComparatorMPlayerInactivity.get()
- );
- }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getName()
- {
- return "player sorter";
- }
-
-}
+package com.massivecraft.factions.cmd.type;
+
+import com.massivecraft.factions.comparator.ComparatorMPlayerInactivity;
+import com.massivecraft.factions.comparator.ComparatorMPlayerPower;
+import com.massivecraft.factions.comparator.ComparatorMPlayerRole;
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
+
+import java.util.Comparator;
+
+public class TypeSortMPlayer extends TypeAbstractChoice>
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static TypeSortMPlayer i = new TypeSortMPlayer();
+ public static TypeSortMPlayer get() { return i; }
+ public TypeSortMPlayer()
+ {
+ super(Comparator.class);
+ this.setAll(
+ ComparatorMPlayerRole.get(),
+ ComparatorMPlayerPower.get(),
+ ComparatorMPlayerInactivity.get()
+ );
+ }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getName()
+ {
+ return "player sorter";
+ }
+
+}
diff --git a/src/com/massivecraft/factions/comparator/ComparatorFactionList.java b/src/com/massivecraft/factions/comparator/ComparatorFactionList.java
index 74de992f..0b0f9b5d 100644
--- a/src/com/massivecraft/factions/comparator/ComparatorFactionList.java
+++ b/src/com/massivecraft/factions/comparator/ComparatorFactionList.java
@@ -1,54 +1,54 @@
-package com.massivecraft.factions.comparator;
-
-import com.massivecraft.factions.entity.Faction;
-import com.massivecraft.massivecore.comparator.ComparatorAbstract;
-import com.massivecraft.massivecore.comparator.ComparatorComparable;
-import com.massivecraft.massivecore.util.IdUtil;
-import org.bukkit.command.CommandSender;
-
-import java.lang.ref.WeakReference;
-
-public class ComparatorFactionList extends ComparatorAbstract
-{
- // -------------------------------------------- //
- // FIELDS
- // -------------------------------------------- //
-
- private final WeakReference watcher;
- public CommandSender getWatcher() { return this.watcher.get(); }
-
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- public static ComparatorFactionList get(Object watcherObject) { return new ComparatorFactionList(watcherObject); }
- public ComparatorFactionList(Object watcherObject)
- {
- this.watcher = new WeakReference<>(IdUtil.getSender(watcherObject));
- }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public int compareInner(Faction f1, Faction f2)
- {
- // None a.k.a. Wilderness
- if (f1.isNone() && f2.isNone()) return 0;
- if (f1.isNone()) return -1;
- if (f2.isNone()) return 1;
-
- // Players Online
- int ret = f2.getMPlayersWhereOnlineTo(this.getWatcher()).size() - f1.getMPlayersWhereOnlineTo(this.getWatcher()).size();
- if (ret != 0) return ret;
-
- // Players Total
- ret = f2.getMPlayers().size() - f1.getMPlayers().size();
- if (ret != 0) return ret;
-
- // Tie by Id
- return ComparatorComparable.get().compare(f1.getId(), f2.getId());
- }
-
-}
+package com.massivecraft.factions.comparator;
+
+import com.massivecraft.factions.entity.Faction;
+import com.massivecraft.massivecore.comparator.ComparatorAbstract;
+import com.massivecraft.massivecore.comparator.ComparatorComparable;
+import com.massivecraft.massivecore.util.IdUtil;
+import org.bukkit.command.CommandSender;
+
+import java.lang.ref.WeakReference;
+
+public class ComparatorFactionList extends ComparatorAbstract
+{
+ // -------------------------------------------- //
+ // FIELDS
+ // -------------------------------------------- //
+
+ private final WeakReference watcher;
+ public CommandSender getWatcher() { return this.watcher.get(); }
+
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ public static ComparatorFactionList get(Object watcherObject) { return new ComparatorFactionList(watcherObject); }
+ public ComparatorFactionList(Object watcherObject)
+ {
+ this.watcher = new WeakReference<>(IdUtil.getSender(watcherObject));
+ }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public int compareInner(Faction f1, Faction f2)
+ {
+ // None a.k.a. Wilderness
+ if (f1.isNone() && f2.isNone()) return 0;
+ if (f1.isNone()) return -1;
+ if (f2.isNone()) return 1;
+
+ // Players Online
+ int ret = f2.getMPlayersWhereOnlineTo(this.getWatcher()).size() - f1.getMPlayersWhereOnlineTo(this.getWatcher()).size();
+ if (ret != 0) return ret;
+
+ // Players Total
+ ret = f2.getMPlayers().size() - f1.getMPlayers().size();
+ if (ret != 0) return ret;
+
+ // Tie by Id
+ return ComparatorComparable.get().compare(f1.getId(), f2.getId());
+ }
+
+}
diff --git a/src/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java b/src/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java
index 967874ca..66fc9e84 100644
--- a/src/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java
+++ b/src/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java
@@ -1,44 +1,44 @@
-package com.massivecraft.factions.comparator;
-
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.Named;
-import com.massivecraft.massivecore.comparator.ComparatorAbstract;
-
-public class ComparatorMPlayerInactivity extends ComparatorAbstract implements Named
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static ComparatorMPlayerInactivity i = new ComparatorMPlayerInactivity();
- public static ComparatorMPlayerInactivity get() { return i; }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getName()
- {
- return "Time";
- }
-
- @Override
- public int compareInner(MPlayer m1, MPlayer m2)
- {
- // Online
- boolean o1 = m1.isOnline();
- boolean o2 = m2.isOnline();
-
- if (o1 && o2) return 0;
- else if (o1) return -1;
- else if (o2) return +1;
-
- // Inactivity Time
- long r1 = m1.getLastActivityMillis();
- long r2 = m2.getLastActivityMillis();
-
- return (int) (r1 - r2);
- }
-
-}
+package com.massivecraft.factions.comparator;
+
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.massivecore.Named;
+import com.massivecraft.massivecore.comparator.ComparatorAbstract;
+
+public class ComparatorMPlayerInactivity extends ComparatorAbstract implements Named
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static ComparatorMPlayerInactivity i = new ComparatorMPlayerInactivity();
+ public static ComparatorMPlayerInactivity get() { return i; }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getName()
+ {
+ return "Time";
+ }
+
+ @Override
+ public int compareInner(MPlayer m1, MPlayer m2)
+ {
+ // Online
+ boolean o1 = m1.isOnline();
+ boolean o2 = m2.isOnline();
+
+ if (o1 && o2) return 0;
+ else if (o1) return -1;
+ else if (o2) return +1;
+
+ // Inactivity Time
+ long r1 = m1.getLastActivityMillis();
+ long r2 = m2.getLastActivityMillis();
+
+ return (int) (r1 - r2);
+ }
+
+}
diff --git a/src/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java b/src/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java
index 5fd01fdc..f22201c3 100644
--- a/src/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java
+++ b/src/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java
@@ -1,37 +1,37 @@
-package com.massivecraft.factions.comparator;
-
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.Named;
-import com.massivecraft.massivecore.comparator.ComparatorAbstract;
-
-public class ComparatorMPlayerPower extends ComparatorAbstract implements Named
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static ComparatorMPlayerPower i = new ComparatorMPlayerPower();
- public static ComparatorMPlayerPower get() { return i; }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getName()
- {
- return "Power";
- }
-
- @Override
- public int compareInner(MPlayer m1, MPlayer m2)
- {
- // Power
- int ret = m1.getPowerRounded() - m2.getPowerRounded();
- if (ret != 0) return ret;
-
- // MaxPower
- return m1.getPowerMaxRounded() - m2.getPowerMaxRounded();
- }
-
-}
+package com.massivecraft.factions.comparator;
+
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.massivecore.Named;
+import com.massivecraft.massivecore.comparator.ComparatorAbstract;
+
+public class ComparatorMPlayerPower extends ComparatorAbstract implements Named
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static ComparatorMPlayerPower i = new ComparatorMPlayerPower();
+ public static ComparatorMPlayerPower get() { return i; }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getName()
+ {
+ return "Power";
+ }
+
+ @Override
+ public int compareInner(MPlayer m1, MPlayer m2)
+ {
+ // Power
+ int ret = m1.getPowerRounded() - m2.getPowerRounded();
+ if (ret != 0) return ret;
+
+ // MaxPower
+ return m1.getPowerMaxRounded() - m2.getPowerMaxRounded();
+ }
+
+}
diff --git a/src/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java b/src/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java
index fabcbf80..4dabd94b 100644
--- a/src/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java
+++ b/src/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java
@@ -1,37 +1,37 @@
-package com.massivecraft.factions.comparator;
-
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.factions.entity.Rank;
-import com.massivecraft.massivecore.Named;
-import com.massivecraft.massivecore.comparator.ComparatorAbstract;
-
-public class ComparatorMPlayerRole extends ComparatorAbstract implements Named
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static ComparatorMPlayerRole i = new ComparatorMPlayerRole();
- public static ComparatorMPlayerRole get() { return i; }
-
- // -------------------------------------------- //
- // OVERRIDE
- // -------------------------------------------- //
-
- @Override
- public String getName()
- {
- return "Rank";
- }
-
- @Override
- public int compareInner(MPlayer m1, MPlayer m2)
- {
- // Rank
- if (m1.getFaction() != m2.getFaction()) throw new IllegalArgumentException("Noncomparable players");
- Rank r1 = m1.getRank();
- Rank r2 = m2.getRank();
- return r2.getPriority() - r1.getPriority() ;
- }
-
-}
+package com.massivecraft.factions.comparator;
+
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.factions.entity.Rank;
+import com.massivecraft.massivecore.Named;
+import com.massivecraft.massivecore.comparator.ComparatorAbstract;
+
+public class ComparatorMPlayerRole extends ComparatorAbstract implements Named
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static ComparatorMPlayerRole i = new ComparatorMPlayerRole();
+ public static ComparatorMPlayerRole get() { return i; }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public String getName()
+ {
+ return "Rank";
+ }
+
+ @Override
+ public int compareInner(MPlayer m1, MPlayer m2)
+ {
+ // Rank
+ if (m1.getFaction() != m2.getFaction()) throw new IllegalArgumentException("Noncomparable players");
+ Rank r1 = m1.getRank();
+ Rank r2 = m2.getRank();
+ return r2.getPriority() - r1.getPriority() ;
+ }
+
+}
diff --git a/src/com/massivecraft/factions/engine/EngineEcon.java b/src/com/massivecraft/factions/engine/EngineEcon.java
index 89292cad..ecc01b90 100644
--- a/src/com/massivecraft/factions/engine/EngineEcon.java
+++ b/src/com/massivecraft/factions/engine/EngineEcon.java
@@ -1,263 +1,263 @@
-package com.massivecraft.factions.engine;
-
-import com.massivecraft.factions.Factions;
-import com.massivecraft.factions.cmd.CmdFactions;
-import com.massivecraft.factions.entity.Faction;
-import com.massivecraft.factions.entity.MConf;
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.factions.event.EventFactionsAbstractSender;
-import com.massivecraft.factions.event.EventFactionsChunkChangeType;
-import com.massivecraft.factions.event.EventFactionsChunksChange;
-import com.massivecraft.factions.event.EventFactionsCreate;
-import com.massivecraft.factions.event.EventFactionsDescriptionChange;
-import com.massivecraft.factions.event.EventFactionsDisband;
-import com.massivecraft.factions.event.EventFactionsFlagChange;
-import com.massivecraft.factions.event.EventFactionsWarpAdd;
-import com.massivecraft.factions.event.EventFactionsWarpRemove;
-import com.massivecraft.factions.event.EventFactionsWarpTeleport;
-import com.massivecraft.factions.event.EventFactionsInvitedChange;
-import com.massivecraft.factions.event.EventFactionsMembershipChange;
-import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
-import com.massivecraft.factions.event.EventFactionsNameChange;
-import com.massivecraft.factions.event.EventFactionsRelationChange;
-import com.massivecraft.factions.event.EventFactionsTitleChange;
-import com.massivecraft.factions.integration.Econ;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.Txt;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-
-public class EngineEcon extends Engine
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static EngineEcon i = new EngineEcon();
- public static EngineEcon get() { return i; }
-
- // -------------------------------------------- //
- // TAKE ON LEAVE
- // -------------------------------------------- //
-
- @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
- public void takeOnLeave(EventFactionsMembershipChange event)
- {
- if (!Econ.isEnabled()) return;
-
- // If a player is leaving the faction ...
- if (event.getReason() != MembershipChangeReason.LEAVE) return;
-
- // ... and that player was the last one in the faction ...
- MPlayer mplayer = event.getMPlayer();
- Faction oldFaction = mplayer.getFaction();
- if (oldFaction.getMPlayers().size() > 1) return;
-
- // ... then transfer all money to the player.
- double money = Econ.getMoney(oldFaction);
- if (money == 0) return;
- Econ.transferMoney(mplayer, oldFaction, mplayer, money);
- }
-
- // -------------------------------------------- //
- // TAKE ON DISBAND
- // -------------------------------------------- //
-
- @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
- public void takeOnDisband(EventFactionsDisband event)
- {
- // If there is a mplayer ...
- MPlayer mplayer = event.getMPlayer();
- if (mplayer == null) return;
-
- // ... and economy is enabled ...
- if (!Econ.isEnabled()) return;
-
- // ... then transfer all the faction money to the sender.
- Faction faction = event.getFaction();
-
- double amount = Econ.getMoney(faction);
-
- // Check that there is an amount
- if (amount == 0) return;
-
- String amountString = Money.format(amount);
-
- Econ.transferMoney(faction, mplayer, mplayer, amount, true);
-
- mplayer.msg("You have been given the disbanded faction's bank, totaling %s.", amountString);
- Factions.get().log(mplayer.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getName()+".");
- }
-
- // -------------------------------------------- //
- // PAY FOR ACTION
- // -------------------------------------------- //
-
- public static void payForAction(EventFactionsAbstractSender event, Double cost, String desc)
- {
- // If there is an mplayer ...
- MPlayer mplayer = event.getMPlayer();
- if (mplayer == null) return;
-
- // ... and there is a cost ...
- if (cost == null) return;
- if (cost == 0) return;
-
- // ... that the sender can't afford ...
- if (Econ.payForAction(cost, mplayer, desc)) return;
-
- // ... then cancel.
- event.setCancelled(true);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForAction(EventFactionsChunksChange event)
- {
- double cost = 0;
- List typeNames = new ArrayList<>();
-
- for (Entry> typeChunks : event.getTypeChunks().entrySet())
- {
- final EventFactionsChunkChangeType type = typeChunks.getKey();
- final Set chunks = typeChunks.getValue();
-
- Double typeCost = MConf.get().econChunkCost.get(type);
- if (typeCost == null) continue;
- if (typeCost == 0) continue;
-
- typeCost *= chunks.size();
- cost += typeCost;
-
- typeNames.add(type.now);
- }
-
- String desc = Txt.implodeCommaAnd(typeNames) + " this land";
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForAction(EventFactionsMembershipChange event)
- {
- Double cost = null;
- String desc = null;
-
- if (event.getReason() == MembershipChangeReason.JOIN)
- {
- cost = MConf.get().econCostJoin;
- desc = "join a faction";
- }
- else if (event.getReason() == MembershipChangeReason.LEAVE)
- {
- cost = MConf.get().econCostLeave;
- desc = "leave a faction";
- }
- else if (event.getReason() == MembershipChangeReason.KICK)
- {
- cost = MConf.get().econCostKick;
- desc = "kick someone from a faction";
- }
- else
- {
- return;
- }
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsRelationChange event)
- {
- Double cost = MConf.get().econRelCost.get(event.getNewRelation());
- String desc = CmdFactions.get().cmdFactionsRelation.cmdFactionsRelationSet.getDesc();
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsWarpAdd event)
- {
- Double cost = MConf.get().econCostWarpAdd;
- String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionWarpAdd.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsWarpRemove event)
- {
- Double cost = MConf.get().econCostWarpRemove;
- String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionWarpRemove.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsCreate event)
- {
- Double cost = MConf.get().econCostCreate;
- String desc = CmdFactions.get().cmdFactionsCreate.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsDescriptionChange event)
- {
- Double cost = MConf.get().econCostDescription;
- String desc = CmdFactions.get().cmdFactionsDescription.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsNameChange event)
- {
- Double cost = MConf.get().econCostName;
- String desc = CmdFactions.get().cmdFactionsName.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsTitleChange event)
- {
- Double cost = MConf.get().econCostTitle;
- String desc = CmdFactions.get().cmdFactionsTitle.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsFlagChange event)
- {
- Double cost = MConf.get().econCostFlag;
- String desc = CmdFactions.get().cmdFactionsFlag.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsInvitedChange event)
- {
- Double cost = event.isNewInvited() ? MConf.get().econCostInvite : MConf.get().econCostDeinvite;
- String desc = CmdFactions.get().cmdFactionsInvite.getDesc();
-
- payForAction(event, cost, desc);
- }
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void payForCommand(EventFactionsWarpTeleport event)
- {
- Double cost = MConf.get().econCostWarpGo;
- String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.getDesc();
-
- payForAction(event, cost, desc);
- }
-
-}
+package com.massivecraft.factions.engine;
+
+import com.massivecraft.factions.Factions;
+import com.massivecraft.factions.cmd.CmdFactions;
+import com.massivecraft.factions.entity.Faction;
+import com.massivecraft.factions.entity.MConf;
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.factions.event.EventFactionsAbstractSender;
+import com.massivecraft.factions.event.EventFactionsChunkChangeType;
+import com.massivecraft.factions.event.EventFactionsChunksChange;
+import com.massivecraft.factions.event.EventFactionsCreate;
+import com.massivecraft.factions.event.EventFactionsDescriptionChange;
+import com.massivecraft.factions.event.EventFactionsDisband;
+import com.massivecraft.factions.event.EventFactionsFlagChange;
+import com.massivecraft.factions.event.EventFactionsWarpAdd;
+import com.massivecraft.factions.event.EventFactionsWarpRemove;
+import com.massivecraft.factions.event.EventFactionsWarpTeleport;
+import com.massivecraft.factions.event.EventFactionsInvitedChange;
+import com.massivecraft.factions.event.EventFactionsMembershipChange;
+import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
+import com.massivecraft.factions.event.EventFactionsNameChange;
+import com.massivecraft.factions.event.EventFactionsRelationChange;
+import com.massivecraft.factions.event.EventFactionsTitleChange;
+import com.massivecraft.factions.integration.Econ;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.Txt;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+public class EngineEcon extends Engine
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static EngineEcon i = new EngineEcon();
+ public static EngineEcon get() { return i; }
+
+ // -------------------------------------------- //
+ // TAKE ON LEAVE
+ // -------------------------------------------- //
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void takeOnLeave(EventFactionsMembershipChange event)
+ {
+ if (!Econ.isEnabled()) return;
+
+ // If a player is leaving the faction ...
+ if (event.getReason() != MembershipChangeReason.LEAVE) return;
+
+ // ... and that player was the last one in the faction ...
+ MPlayer mplayer = event.getMPlayer();
+ Faction oldFaction = mplayer.getFaction();
+ if (oldFaction.getMPlayers().size() > 1) return;
+
+ // ... then transfer all money to the player.
+ double money = Econ.getMoney(oldFaction);
+ if (money == 0) return;
+ Econ.transferMoney(mplayer, oldFaction, mplayer, money);
+ }
+
+ // -------------------------------------------- //
+ // TAKE ON DISBAND
+ // -------------------------------------------- //
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void takeOnDisband(EventFactionsDisband event)
+ {
+ // If there is a mplayer ...
+ MPlayer mplayer = event.getMPlayer();
+ if (mplayer == null) return;
+
+ // ... and economy is enabled ...
+ if (!Econ.isEnabled()) return;
+
+ // ... then transfer all the faction money to the sender.
+ Faction faction = event.getFaction();
+
+ double amount = Econ.getMoney(faction);
+
+ // Check that there is an amount
+ if (amount == 0) return;
+
+ String amountString = Money.format(amount);
+
+ Econ.transferMoney(faction, mplayer, mplayer, amount, true);
+
+ mplayer.msg("You have been given the disbanded faction's bank, totaling %s.", amountString);
+ Factions.get().log(mplayer.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getName()+".");
+ }
+
+ // -------------------------------------------- //
+ // PAY FOR ACTION
+ // -------------------------------------------- //
+
+ public static void payForAction(EventFactionsAbstractSender event, Double cost, String desc)
+ {
+ // If there is an mplayer ...
+ MPlayer mplayer = event.getMPlayer();
+ if (mplayer == null) return;
+
+ // ... and there is a cost ...
+ if (cost == null) return;
+ if (cost == 0) return;
+
+ // ... that the sender can't afford ...
+ if (Econ.payForAction(cost, mplayer, desc)) return;
+
+ // ... then cancel.
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForAction(EventFactionsChunksChange event)
+ {
+ double cost = 0;
+ List typeNames = new ArrayList<>();
+
+ for (Entry> typeChunks : event.getTypeChunks().entrySet())
+ {
+ final EventFactionsChunkChangeType type = typeChunks.getKey();
+ final Set chunks = typeChunks.getValue();
+
+ Double typeCost = MConf.get().econChunkCost.get(type);
+ if (typeCost == null) continue;
+ if (typeCost == 0) continue;
+
+ typeCost *= chunks.size();
+ cost += typeCost;
+
+ typeNames.add(type.now);
+ }
+
+ String desc = Txt.implodeCommaAnd(typeNames) + " this land";
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForAction(EventFactionsMembershipChange event)
+ {
+ Double cost = null;
+ String desc = null;
+
+ if (event.getReason() == MembershipChangeReason.JOIN)
+ {
+ cost = MConf.get().econCostJoin;
+ desc = "join a faction";
+ }
+ else if (event.getReason() == MembershipChangeReason.LEAVE)
+ {
+ cost = MConf.get().econCostLeave;
+ desc = "leave a faction";
+ }
+ else if (event.getReason() == MembershipChangeReason.KICK)
+ {
+ cost = MConf.get().econCostKick;
+ desc = "kick someone from a faction";
+ }
+ else
+ {
+ return;
+ }
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsRelationChange event)
+ {
+ Double cost = MConf.get().econRelCost.get(event.getNewRelation());
+ String desc = CmdFactions.get().cmdFactionsRelation.cmdFactionsRelationSet.getDesc();
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsWarpAdd event)
+ {
+ Double cost = MConf.get().econCostWarpAdd;
+ String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionWarpAdd.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsWarpRemove event)
+ {
+ Double cost = MConf.get().econCostWarpRemove;
+ String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionWarpRemove.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsCreate event)
+ {
+ Double cost = MConf.get().econCostCreate;
+ String desc = CmdFactions.get().cmdFactionsCreate.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsDescriptionChange event)
+ {
+ Double cost = MConf.get().econCostDescription;
+ String desc = CmdFactions.get().cmdFactionsDescription.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsNameChange event)
+ {
+ Double cost = MConf.get().econCostName;
+ String desc = CmdFactions.get().cmdFactionsName.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsTitleChange event)
+ {
+ Double cost = MConf.get().econCostTitle;
+ String desc = CmdFactions.get().cmdFactionsTitle.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsFlagChange event)
+ {
+ Double cost = MConf.get().econCostFlag;
+ String desc = CmdFactions.get().cmdFactionsFlag.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsInvitedChange event)
+ {
+ Double cost = event.isNewInvited() ? MConf.get().econCostInvite : MConf.get().econCostDeinvite;
+ String desc = CmdFactions.get().cmdFactionsInvite.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void payForCommand(EventFactionsWarpTeleport event)
+ {
+ Double cost = MConf.get().econCostWarpGo;
+ String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.getDesc();
+
+ payForAction(event, cost, desc);
+ }
+
+}
diff --git a/src/com/massivecraft/factions/engine/EngineSeeChunk.java b/src/com/massivecraft/factions/engine/EngineSeeChunk.java
index 670e33af..6001f505 100644
--- a/src/com/massivecraft/factions/engine/EngineSeeChunk.java
+++ b/src/com/massivecraft/factions/engine/EngineSeeChunk.java
@@ -1,173 +1,173 @@
-package com.massivecraft.factions.engine;
-
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.MUtil;
-import com.massivecraft.massivecore.util.PeriodUtil;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Particle;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.player.PlayerChangedWorldEvent;
-
-import java.security.InvalidParameterException;
-import java.util.ArrayList;
-import java.util.List;
-
-public class EngineSeeChunk extends Engine
-{
- // -------------------------------------------- //
- // INSTANCE & CONSTRUCT
- // -------------------------------------------- //
-
- private static EngineSeeChunk i = new EngineSeeChunk();
- public static EngineSeeChunk get() { return i; }
- public EngineSeeChunk()
- {
- this.setPeriod(1L);
- }
-
- // -------------------------------------------- //
- // LEAVE AND WORLD CHANGE REMOVAL
- // -------------------------------------------- //
-
- public static void leaveAndWorldChangeRemoval(Player player)
- {
- if (MUtil.isntPlayer(player)) return;
-
- final MPlayer mplayer = MPlayer.get(player);
- mplayer.setSeeingChunk(false);
- }
-
- // Can't be cancelled
- @EventHandler(priority = EventPriority.NORMAL)
- public void leaveAndWorldChangeRemoval(EventMassiveCorePlayerLeave event)
- {
- leaveAndWorldChangeRemoval(event.getPlayer());
- }
-
- // Can't be cancelled
- @EventHandler(priority = EventPriority.NORMAL)
- public void leaveAndWorldChangeRemoval(PlayerChangedWorldEvent event)
- {
- leaveAndWorldChangeRemoval(event.getPlayer());
- }
-
- // -------------------------------------------- //
- // MODULO REPEAT TASK
- // -------------------------------------------- //
-
- @Override
- public void run()
- {
- // Do we have a new period?
- final long now = System.currentTimeMillis();
- final long length = 500;
- if ( ! PeriodUtil.isNewPeriod(this, length, now)) return;
-
- // Get the period number
- final long period = PeriodUtil.getPeriod(length, now);
-
- // Calculate the "step" from the period number
- final int steps = 1; // Example: 4
- final int step = (int) (period % steps); // Example: 0, 1, 2, 3
-
- // Load other related config options
- final float offsetX = 0.0f;
- final float offsetY = 2;
- final float offsetZ = 0.0f;
- final float speed = 0;
- final int amount = 30;
-
- // For each player
- for (Player player : Bukkit.getOnlinePlayers())
- {
- // Hide for dead players since the death screen looks better without.
- if (player.isDead()) continue;
-
- // The player must obviously have the feature activated.
- MPlayer mplayer = MPlayer.get(player);
- if ( ! mplayer.isSeeingChunk()) continue;
-
- // Calculate locations and play the effect there.
- List locations = getLocations(player, steps, step);
- for (Location location : locations)
- {
- location.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, location, amount, offsetX, offsetY, offsetZ, speed);
- //ParticleEffect.EXPLOSION_NORMAL.display(location, offsetX, offsetY, offsetZ, speed, amount, player);
- }
- }
- }
-
- public static List getLocations(Player player, int steps, int step)
- {
- // Clean Args
- if (player == null) throw new NullPointerException("player");
- if (steps < 1) throw new InvalidParameterException("steps must be larger than 0");
- if (step < 0) throw new InvalidParameterException("step must at least be 0");
- if (step >= steps) throw new InvalidParameterException("step must be less than steps");
-
- // Create Ret
- List ret = new ArrayList<>();
-
- final Location location = player.getLocation();
- final World world = location.getWorld();
- PS chunk = PS.valueOf(location).getChunk(true);
-
- final int xmin = chunk.getChunkX() * 16;
- final int xmax = xmin + 15;
- final double y = location.getBlockY() + 2;
- final int zmin = chunk.getChunkZ() * 16;
- final int zmax = zmin + 15;
-
- int keepEvery = 5;
- if (keepEvery <= 0) keepEvery = Integer.MAX_VALUE;
-
- int skipEvery = 0;
- if (skipEvery <= 0) skipEvery = Integer.MAX_VALUE;
-
- int x = xmin;
- int z = zmin;
- int i = 0;
-
- // Add #1
- while (x + 1 <= xmax)
- {
- x++;
- i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
-
- // Add #2
- while (z + 1 <= zmax)
- {
- z++;
- i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
-
- // Add #3
- while (x - 1 >= xmin)
- {
- x--;
- i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
-
- // Add #4
- while (z - 1 >= zmin)
- {
- z--;
- i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
-
- // Return Ret
- return ret;
- }
-}
+package com.massivecraft.factions.engine;
+
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.MUtil;
+import com.massivecraft.massivecore.util.PeriodUtil;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Particle;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
+
+import java.security.InvalidParameterException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class EngineSeeChunk extends Engine
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static EngineSeeChunk i = new EngineSeeChunk();
+ public static EngineSeeChunk get() { return i; }
+ public EngineSeeChunk()
+ {
+ this.setPeriod(1L);
+ }
+
+ // -------------------------------------------- //
+ // LEAVE AND WORLD CHANGE REMOVAL
+ // -------------------------------------------- //
+
+ public static void leaveAndWorldChangeRemoval(Player player)
+ {
+ if (MUtil.isntPlayer(player)) return;
+
+ final MPlayer mplayer = MPlayer.get(player);
+ mplayer.setSeeingChunk(false);
+ }
+
+ // Can't be cancelled
+ @EventHandler(priority = EventPriority.NORMAL)
+ public void leaveAndWorldChangeRemoval(EventMassiveCorePlayerLeave event)
+ {
+ leaveAndWorldChangeRemoval(event.getPlayer());
+ }
+
+ // Can't be cancelled
+ @EventHandler(priority = EventPriority.NORMAL)
+ public void leaveAndWorldChangeRemoval(PlayerChangedWorldEvent event)
+ {
+ leaveAndWorldChangeRemoval(event.getPlayer());
+ }
+
+ // -------------------------------------------- //
+ // MODULO REPEAT TASK
+ // -------------------------------------------- //
+
+ @Override
+ public void run()
+ {
+ // Do we have a new period?
+ final long now = System.currentTimeMillis();
+ final long length = 500;
+ if ( ! PeriodUtil.isNewPeriod(this, length, now)) return;
+
+ // Get the period number
+ final long period = PeriodUtil.getPeriod(length, now);
+
+ // Calculate the "step" from the period number
+ final int steps = 1; // Example: 4
+ final int step = (int) (period % steps); // Example: 0, 1, 2, 3
+
+ // Load other related config options
+ final float offsetX = 0.0f;
+ final float offsetY = 2;
+ final float offsetZ = 0.0f;
+ final float speed = 0;
+ final int amount = 30;
+
+ // For each player
+ for (Player player : Bukkit.getOnlinePlayers())
+ {
+ // Hide for dead players since the death screen looks better without.
+ if (player.isDead()) continue;
+
+ // The player must obviously have the feature activated.
+ MPlayer mplayer = MPlayer.get(player);
+ if ( ! mplayer.isSeeingChunk()) continue;
+
+ // Calculate locations and play the effect there.
+ List locations = getLocations(player, steps, step);
+ for (Location location : locations)
+ {
+ location.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, location, amount, offsetX, offsetY, offsetZ, speed);
+ //ParticleEffect.EXPLOSION_NORMAL.display(location, offsetX, offsetY, offsetZ, speed, amount, player);
+ }
+ }
+ }
+
+ public static List getLocations(Player player, int steps, int step)
+ {
+ // Clean Args
+ if (player == null) throw new NullPointerException("player");
+ if (steps < 1) throw new InvalidParameterException("steps must be larger than 0");
+ if (step < 0) throw new InvalidParameterException("step must at least be 0");
+ if (step >= steps) throw new InvalidParameterException("step must be less than steps");
+
+ // Create Ret
+ List ret = new ArrayList<>();
+
+ final Location location = player.getLocation();
+ final World world = location.getWorld();
+ PS chunk = PS.valueOf(location).getChunk(true);
+
+ final int xmin = chunk.getChunkX() * 16;
+ final int xmax = xmin + 15;
+ final double y = location.getBlockY() + 2;
+ final int zmin = chunk.getChunkZ() * 16;
+ final int zmax = zmin + 15;
+
+ int keepEvery = 5;
+ if (keepEvery <= 0) keepEvery = Integer.MAX_VALUE;
+
+ int skipEvery = 0;
+ if (skipEvery <= 0) skipEvery = Integer.MAX_VALUE;
+
+ int x = xmin;
+ int z = zmin;
+ int i = 0;
+
+ // Add #1
+ while (x + 1 <= xmax)
+ {
+ x++;
+ i++;
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
+
+ // Add #2
+ while (z + 1 <= zmax)
+ {
+ z++;
+ i++;
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
+
+ // Add #3
+ while (x - 1 >= xmin)
+ {
+ x--;
+ i++;
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
+
+ // Add #4
+ while (z - 1 >= zmin)
+ {
+ z--;
+ i++;
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
+
+ // Return Ret
+ return ret;
+ }
+}
diff --git a/src/com/massivecraft/factions/entity/Board.java b/src/com/massivecraft/factions/entity/Board.java
index 8ac59350..94b4726c 100644
--- a/src/com/massivecraft/factions/entity/Board.java
+++ b/src/com/massivecraft/factions/entity/Board.java
@@ -1,292 +1,292 @@
-package com.massivecraft.factions.entity;
-
-import com.google.gson.reflect.TypeToken;
-import com.massivecraft.factions.Factions;
-import com.massivecraft.factions.TerritoryAccess;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.store.Entity;
-
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-public class Board extends Entity implements BoardInterface
-{
- public static final transient Type MAP_TYPE = new TypeToken