Abstract Data storage method for future implementations. Thanks to Ryan from Reactive MC
Also included: -Heavily optimized loading process -Optimizations for various commands.
This commit is contained in:
@@ -15,7 +15,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||
private transient double toleranceMillis;
|
||||
|
||||
public AutoLeaveProcessTask() {
|
||||
ArrayList<FPlayer> fplayers = new ArrayList<FPlayer>(FPlayers.i.get());
|
||||
ArrayList<FPlayer> fplayers = new ArrayList<FPlayer>(FPlayers.getInstance().getAllFPlayers());
|
||||
this.iterator = fplayers.listIterator();
|
||||
this.toleranceMillis = Conf.autoLeaveAfterDaysOfInactivity * 24 * 60 * 60 * 1000;
|
||||
this.readyToGo = true;
|
||||
@@ -61,7 +61,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||
|
||||
fplayer.leave(false);
|
||||
iterator.remove(); // go ahead and remove this list's link to the FPlayer object
|
||||
fplayer.detach();
|
||||
fplayer.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@@ -9,9 +11,9 @@ import org.bukkit.World;
|
||||
* yet when an object of this class is created, only when the Location is first accessed.
|
||||
*/
|
||||
|
||||
public class LazyLocation {
|
||||
|
||||
private Location location = null;
|
||||
public class LazyLocation implements Serializable {
|
||||
private static final long serialVersionUID = -6049901271320963314L;
|
||||
private transient Location location = null;
|
||||
private String worldName;
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
@@ -5,6 +5,10 @@ import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -55,5 +59,24 @@ public class MiscUtil {
|
||||
return ret.toLowerCase();
|
||||
}
|
||||
|
||||
public static ArrayList<String> validateTag(String str) {
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
|
||||
if (getComparisonString(str).length() < Conf.factionTagLengthMin) {
|
||||
errors.add(P.p.txt.parse("<i>The faction tag can't be shorter than <h>%s<i> chars.", Conf.factionTagLengthMin));
|
||||
}
|
||||
|
||||
if (str.length() > Conf.factionTagLengthMax) {
|
||||
errors.add(P.p.txt.parse("<i>The faction tag can't be longer than <h>%s<i> chars.", Conf.factionTagLengthMax));
|
||||
}
|
||||
|
||||
for (char c : str.toCharArray()) {
|
||||
if (!substanceChars.contains(String.valueOf(c))) {
|
||||
errors.add(P.p.txt.parse("<i>Faction tag must be alphanumeric. \"<h>%s<i>\" is not allowed.", c));
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user