mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Optimized UUID caching + made Async
This commit is contained in:
parent
8401c0dbcd
commit
7c55aa488c
@ -524,7 +524,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
||||||
} else {
|
} else {
|
||||||
AbstractTitle.TITLE_CLASS = new DefaultTitle();
|
AbstractTitle.TITLE_CLASS = new DefaultTitle();
|
||||||
|
|
||||||
if (UUIDHandler.uuidWrapper instanceof DefaultUUIDWrapper) {
|
if (UUIDHandler.uuidWrapper instanceof DefaultUUIDWrapper) {
|
||||||
Settings.TWIN_MODE_UUID = true;
|
Settings.TWIN_MODE_UUID = true;
|
||||||
}
|
}
|
||||||
|
@ -718,9 +718,7 @@ public class PlotSquared {
|
|||||||
for (final String flag : intFlags) {
|
for (final String flag : intFlags) {
|
||||||
FlagManager.addFlag(new AbstractFlag(flag, new FlagValue.UnsignedIntegerValue()));
|
FlagManager.addFlag(new AbstractFlag(flag, new FlagValue.UnsignedIntegerValue()));
|
||||||
}
|
}
|
||||||
if (Settings.PHYSICS_LISTENER) {
|
|
||||||
FlagManager.addFlag(new AbstractFlag("disable-physics", new FlagValue.BooleanValue()));
|
FlagManager.addFlag(new AbstractFlag("disable-physics", new FlagValue.BooleanValue()));
|
||||||
}
|
|
||||||
FlagManager.addFlag(new AbstractFlag("fly", new FlagValue.BooleanValue()));
|
FlagManager.addFlag(new AbstractFlag("fly", new FlagValue.BooleanValue()));
|
||||||
FlagManager.addFlag(new AbstractFlag("explosion", new FlagValue.BooleanValue()));
|
FlagManager.addFlag(new AbstractFlag("explosion", new FlagValue.BooleanValue()));
|
||||||
FlagManager.addFlag(new AbstractFlag("hostile-interact", new FlagValue.BooleanValue()));
|
FlagManager.addFlag(new AbstractFlag("hostile-interact", new FlagValue.BooleanValue()));
|
||||||
@ -806,7 +804,6 @@ public class PlotSquared {
|
|||||||
options.put("protection.redstone.disable-offline", Settings.REDSTONE_DISABLER);
|
options.put("protection.redstone.disable-offline", Settings.REDSTONE_DISABLER);
|
||||||
options.put("protection.tnt-listener.enabled", Settings.TNT_LISTENER);
|
options.put("protection.tnt-listener.enabled", Settings.TNT_LISTENER);
|
||||||
options.put("protection.piston.falling-blocks", Settings.PISTON_FALLING_BLOCK_CHECK);
|
options.put("protection.piston.falling-blocks", Settings.PISTON_FALLING_BLOCK_CHECK);
|
||||||
options.put("protection.physics-listener.enabled", Settings.PHYSICS_LISTENER);
|
|
||||||
|
|
||||||
// Clusters
|
// Clusters
|
||||||
options.put("clusters.enabled", Settings.ENABLE_CLUSTERS);
|
options.put("clusters.enabled", Settings.ENABLE_CLUSTERS);
|
||||||
@ -890,7 +887,6 @@ public class PlotSquared {
|
|||||||
Settings.REDSTONE_DISABLER = config.getBoolean("protection.tnt-listener.enabled");
|
Settings.REDSTONE_DISABLER = config.getBoolean("protection.tnt-listener.enabled");
|
||||||
Settings.TNT_LISTENER = config.getBoolean("protection.tnt-listener.enabled");
|
Settings.TNT_LISTENER = config.getBoolean("protection.tnt-listener.enabled");
|
||||||
Settings.PISTON_FALLING_BLOCK_CHECK = config.getBoolean("protection.piston.falling-blocks");
|
Settings.PISTON_FALLING_BLOCK_CHECK = config.getBoolean("protection.piston.falling-blocks");
|
||||||
Settings.PHYSICS_LISTENER = config.getBoolean("protection.physics-listener.enabled");
|
|
||||||
|
|
||||||
// Clusters
|
// Clusters
|
||||||
Settings.ENABLE_CLUSTERS = config.getBoolean("clusters.enabled");
|
Settings.ENABLE_CLUSTERS = config.getBoolean("clusters.enabled");
|
||||||
@ -902,7 +898,7 @@ public class PlotSquared {
|
|||||||
|
|
||||||
// UUID
|
// UUID
|
||||||
Settings.OFFLINE_MODE = config.getBoolean("UUID.offline");
|
Settings.OFFLINE_MODE = config.getBoolean("UUID.offline");
|
||||||
Settings.UUID_LOWERCASE = config.getBoolean("UUID.force-lowercase");
|
Settings.UUID_LOWERCASE = Settings.OFFLINE_MODE && config.getBoolean("UUID.force-lowercase");
|
||||||
Settings.UUID_FROM_DISK = config.getBoolean("uuid.read-from-disk");
|
Settings.UUID_FROM_DISK = config.getBoolean("uuid.read-from-disk");
|
||||||
|
|
||||||
// Mob stuff
|
// Mob stuff
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
public abstract class NamedSubCommand extends SubCommand {
|
||||||
|
|
||||||
|
public NamedSubCommand(Command command, String description, String usage, CommandCategory category, boolean isPlayer) {
|
||||||
|
super(command, description, usage, category, isPlayer);
|
||||||
|
}
|
||||||
|
public NamedSubCommand(String cmd, String permission, String description, String usage, CommandCategory category, boolean isPlayer, String[] aliases) {
|
||||||
|
super(cmd, permission, description, usage, category, isPlayer, aliases);
|
||||||
|
}
|
||||||
|
public NamedSubCommand(String cmd, String permission, String description, String usage, String alias, CommandCategory category, boolean isPlayer) {
|
||||||
|
super(cmd, permission, description, usage, alias, category, isPlayer);
|
||||||
|
}
|
||||||
|
}
|
@ -288,9 +288,9 @@ public class list extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
if (Settings.FANCY_CHAT) {
|
if (player != null && Settings.FANCY_CHAT) {
|
||||||
ChatColor color;
|
ChatColor color;
|
||||||
if (player == null) {
|
if (plot.owner == null) {
|
||||||
color = ChatColor.GOLD;
|
color = ChatColor.GOLD;
|
||||||
}
|
}
|
||||||
else if (plot.isOwner(player.getUUID())) {
|
else if (plot.isOwner(player.getUUID())) {
|
||||||
@ -397,7 +397,7 @@ public class list extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, message);
|
MainUtil.sendMessage(player, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.FANCY_CHAT) {
|
if (player != null && Settings.FANCY_CHAT) {
|
||||||
if (page < totalPages && page > 0) {
|
if (page < totalPages && page > 0) {
|
||||||
// back | next
|
// back | next
|
||||||
new FancyMessage("")
|
new FancyMessage("")
|
||||||
|
@ -65,10 +65,6 @@ public class Settings {
|
|||||||
* Check for falling blocks when pistons extend?
|
* Check for falling blocks when pistons extend?
|
||||||
*/
|
*/
|
||||||
public static boolean PISTON_FALLING_BLOCK_CHECK = true;
|
public static boolean PISTON_FALLING_BLOCK_CHECK = true;
|
||||||
/**
|
|
||||||
* Physics listener
|
|
||||||
*/
|
|
||||||
public static boolean PHYSICS_LISTENER = false;
|
|
||||||
/**
|
/**
|
||||||
* Max auto claiming size
|
* Max auto claiming size
|
||||||
*/
|
*/
|
||||||
|
@ -123,7 +123,6 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.REDSTONE_DISABLER) {
|
if (Settings.REDSTONE_DISABLER) {
|
||||||
if (UUIDHandler.getPlayer(plot.owner) == null) {
|
if (UUIDHandler.getPlayer(plot.owner) == null) {
|
||||||
boolean disable = true;
|
boolean disable = true;
|
||||||
@ -225,7 +224,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.PHYSICS_LISTENER && block.getType().hasGravity()) {
|
if (block.getType().hasGravity()) {
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
@ -698,7 +697,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (MainUtil.isPlotRoad(loc)) {
|
if (MainUtil.isPlotRoad(loc)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
else if (Settings.PHYSICS_LISTENER) {
|
else {
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
if (FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
|
if (FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
@ -912,9 +911,6 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST)
|
||||||
public void onEntityFall(EntityChangeBlockEvent event) {
|
public void onEntityFall(EntityChangeBlockEvent event) {
|
||||||
if (!Settings.PHYSICS_LISTENER) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (event.getEntityType() != EntityType.FALLING_BLOCK) {
|
if (event.getEntityType() != EntityType.FALLING_BLOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1580,12 +1576,10 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.PHYSICS_LISTENER) {
|
|
||||||
if (FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
|
if (FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
|
||||||
Block block = event.getBlockPlaced();
|
Block block = event.getBlockPlaced();
|
||||||
sendBlockChange(block.getLocation(), block.getType(), block.getData());
|
sendBlockChange(block.getLocation(), block.getType(), block.getData());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
else if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,13 @@
|
|||||||
package com.intellectualcrafters.plot.util.bukkit;
|
package com.intellectualcrafters.plot.util.bukkit;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -11,6 +15,9 @@ import org.bukkit.OfflinePlayer;
|
|||||||
|
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
|
import com.google.common.io.Files;
|
||||||
|
import com.google.common.io.InputSupplier;
|
||||||
|
import com.google.common.io.OutputSupplier;
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -21,6 +28,10 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
|
import com.intellectualcrafters.plot.util.NbtFactory;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.NbtFactory.NbtCompound;
|
||||||
|
import com.intellectualcrafters.plot.util.NbtFactory.StreamOptions;
|
||||||
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
|
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
|
||||||
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
|
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
|
||||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||||
@ -111,12 +122,18 @@ public class UUIDHandler {
|
|||||||
if (CACHED) {
|
if (CACHED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotSquared.log(C.PREFIX.s() + "&6Starting player data caching: " + world);
|
final File container = Bukkit.getWorldContainer();
|
||||||
UUIDHandler.CACHED = true;
|
UUIDHandler.CACHED = true;
|
||||||
add(new StringWrapper("*"), DBFunc.everyone);
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PlotSquared.log(C.PREFIX.s() + "&6Starting player data caching for: " + world);
|
||||||
|
final HashMap<StringWrapper, UUID> toAdd = new HashMap<>();
|
||||||
|
toAdd.put(new StringWrapper("*"), DBFunc.everyone);
|
||||||
if (Settings.TWIN_MODE_UUID) {
|
if (Settings.TWIN_MODE_UUID) {
|
||||||
HashSet<UUID> all = getAllUUIDS();
|
HashSet<UUID> all = getAllUUIDS();
|
||||||
final File playerdataFolder = new File(Bukkit.getWorldContainer(), world + File.separator + "playerdata");
|
PlotSquared.log("&aFast mod UUID caching enabled!");
|
||||||
|
final File playerdataFolder = new File(container, world + File.separator + "playerdata");
|
||||||
String[] dat = playerdataFolder.list(new FilenameFilter() {
|
String[] dat = playerdataFolder.list(new FilenameFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(final File f, final String s) {
|
public boolean accept(final File f, final String s) {
|
||||||
@ -128,18 +145,24 @@ public class UUIDHandler {
|
|||||||
for (final String current : dat) {
|
for (final String current : dat) {
|
||||||
final String s = current.replaceAll(".dat$", "");
|
final String s = current.replaceAll(".dat$", "");
|
||||||
try {
|
try {
|
||||||
final UUID uuid = UUID.fromString(s);
|
UUID uuid = UUID.fromString(s);
|
||||||
if (check || all.contains(uuid)) {
|
if (check || all.contains(uuid)) {
|
||||||
OfflinePlayer op = Bukkit.getOfflinePlayer(uuid);
|
File file = new File(playerdataFolder + File.separator + current);
|
||||||
ExpireManager.dates.put(uuid, op.getLastPlayed());
|
InputSupplier<FileInputStream> is = Files.newInputStreamSupplier(file);
|
||||||
add(new StringWrapper(op.getName()), uuid);
|
NbtCompound compound = NbtFactory.fromStream(is, StreamOptions.GZIP_COMPRESSION);
|
||||||
|
NbtCompound bukkit = (NbtCompound) compound.get("bukkit");
|
||||||
|
String name = (String) bukkit.get("lastKnownName");
|
||||||
|
long last = (long) bukkit.get("lastPlayed");
|
||||||
|
ExpireManager.dates.put(uuid, last);
|
||||||
|
toAdd.put(new StringWrapper(name), uuid);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: " + current);
|
PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: " + current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
|
cache(toAdd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final HashSet<String> worlds = new HashSet<>();
|
final HashSet<String> worlds = new HashSet<>();
|
||||||
@ -147,16 +170,17 @@ public class UUIDHandler {
|
|||||||
worlds.add("world");
|
worlds.add("world");
|
||||||
final HashSet<UUID> uuids = new HashSet<>();
|
final HashSet<UUID> uuids = new HashSet<>();
|
||||||
final HashSet<String> names = new HashSet<>();
|
final HashSet<String> names = new HashSet<>();
|
||||||
|
File playerdataFolder = null;
|
||||||
for (final String worldname : worlds) {
|
for (final String worldname : worlds) {
|
||||||
// Getting UUIDs
|
// Getting UUIDs
|
||||||
final File playerdataFolder = new File(Bukkit.getWorldContainer(), worldname + File.separator + "playerdata");
|
playerdataFolder = new File(container, worldname + File.separator + "playerdata");
|
||||||
String[] dat = playerdataFolder.list(new FilenameFilter() {
|
String[] dat = playerdataFolder.list(new FilenameFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(final File f, final String s) {
|
public boolean accept(final File f, final String s) {
|
||||||
return s.endsWith(".dat");
|
return s.endsWith(".dat");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (dat != null) {
|
if (dat != null && dat.length != 0) {
|
||||||
for (final String current : dat) {
|
for (final String current : dat) {
|
||||||
final String s = current.replaceAll(".dat$", "");
|
final String s = current.replaceAll(".dat$", "");
|
||||||
try {
|
try {
|
||||||
@ -166,6 +190,7 @@ public class UUIDHandler {
|
|||||||
PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: " + current);
|
PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: " + current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// Getting names
|
// Getting names
|
||||||
final File playersFolder = new File(worldname + File.separator + "players");
|
final File playersFolder = new File(worldname + File.separator + "players");
|
||||||
@ -175,20 +200,30 @@ public class UUIDHandler {
|
|||||||
return s.endsWith(".dat");
|
return s.endsWith(".dat");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (dat != null) {
|
if (dat != null && dat.length != 0) {
|
||||||
for (final String current : dat) {
|
for (final String current : dat) {
|
||||||
names.add(current.replaceAll(".dat$", ""));
|
names.add(current.replaceAll(".dat$", ""));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final UUIDWrapper wrapper = new DefaultUUIDWrapper();
|
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
try {
|
try {
|
||||||
final OfflinePlotPlayer player = wrapper.getOfflinePlayer(uuid);
|
File file = new File(playerdataFolder + File.separator + uuid.toString() + ".dat");
|
||||||
ExpireManager.dates.put(uuid, player.getLastPlayed());
|
InputSupplier<FileInputStream> is = Files.newInputStreamSupplier(file);
|
||||||
uuid = UUIDHandler.uuidWrapper.getUUID(player);
|
NbtCompound compound = NbtFactory.fromStream(is, StreamOptions.GZIP_COMPRESSION);
|
||||||
final StringWrapper name = new StringWrapper(player.getName());
|
NbtCompound bukkit = (NbtCompound) compound.get("bukkit");
|
||||||
add(name, uuid);
|
String name = (String) bukkit.get("lastKnownName");
|
||||||
|
long last = (long) bukkit.get("lastPlayed");
|
||||||
|
if (Settings.OFFLINE_MODE) {
|
||||||
|
if (!Settings.UUID_LOWERCASE || !name.toLowerCase().equals(name)) {
|
||||||
|
long most = (long) compound.get("UUIDMost");
|
||||||
|
long least = (long) compound.get("UUIDLeast");
|
||||||
|
uuid = new UUID(most, least);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ExpireManager.dates.put(uuid, last);
|
||||||
|
toAdd.put(new StringWrapper(name), uuid);
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
PlotSquared.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
PlotSquared.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||||
}
|
}
|
||||||
@ -196,22 +231,35 @@ public class UUIDHandler {
|
|||||||
for (final String name : names) {
|
for (final String name : names) {
|
||||||
final UUID uuid = uuidWrapper.getUUID(name);
|
final UUID uuid = uuidWrapper.getUUID(name);
|
||||||
final StringWrapper nameWrap = new StringWrapper(name);
|
final StringWrapper nameWrap = new StringWrapper(name);
|
||||||
add(nameWrap, uuid);
|
toAdd.put(nameWrap, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (uuidMap.size() == 0) {
|
if (uuidMap.size() == 0) {
|
||||||
for (OfflinePlotPlayer op : uuidWrapper.getOfflinePlayers()) {
|
for (OfflinePlotPlayer op : uuidWrapper.getOfflinePlayers()) {
|
||||||
if (op.getLastPlayed() != 0) {
|
if (op.getLastPlayed() != 0) {
|
||||||
String name = op.getName();
|
String name = op.getName();
|
||||||
StringWrapper wrap = new StringWrapper(name);
|
StringWrapper wrap = new StringWrapper(name);
|
||||||
UUID uuid = uuidWrapper.getUUID(op);
|
UUID uuid = uuidWrapper.getUUID(op);
|
||||||
add(wrap, uuid);
|
toAdd.put(wrap, uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cache(toAdd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cache(final HashMap<StringWrapper, UUID> toAdd) {
|
||||||
|
TaskManager.runTask(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (Entry<StringWrapper, UUID> entry : toAdd.entrySet()) {
|
||||||
|
add(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
|
PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static UUID getUUID(final PlotPlayer player) {
|
public static UUID getUUID(final PlotPlayer player) {
|
||||||
return UUIDHandler.uuidWrapper.getUUID(player);
|
return UUIDHandler.uuidWrapper.getUUID(player);
|
||||||
|
Loading…
Reference in New Issue
Block a user