mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-03 09:00:55 +01:00
Updated expiremanager + PlotMe converter
- ExpireManager should be more stable - the PlotMe converter can convert merged plots (I'm not sure when the official PlotMe will get around to adding this, but the converter works)
This commit is contained in:
parent
80db0136e2
commit
981f745c3b
@ -11,6 +11,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
@ -89,6 +91,15 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
plots.put(id2, merge1);
|
plots.put(id2, merge1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getWorld(final String world) {
|
||||||
|
for (final World newworld : Bukkit.getWorlds()) {
|
||||||
|
if (newworld.getName().equalsIgnoreCase(world)) {
|
||||||
|
return newworld.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException {
|
public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException {
|
||||||
ResultSet r;
|
ResultSet r;
|
||||||
@ -108,6 +119,9 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
if (!plots.containsKey(world)) {
|
if (!plots.containsKey(world)) {
|
||||||
int plot = PlotSquared.config.getInt("worlds." + world + ".plot.size");
|
int plot = PlotSquared.config.getInt("worlds." + world + ".plot.size");
|
||||||
int path = PlotSquared.config.getInt("worlds." + world + ".road.width");
|
int path = PlotSquared.config.getInt("worlds." + world + ".road.width");
|
||||||
|
if (plot == 0 && path == 0) {
|
||||||
|
|
||||||
|
}
|
||||||
plotWidth.put(world, plot);
|
plotWidth.put(world, plot);
|
||||||
roadWidth.put(world, path);
|
roadWidth.put(world, path);
|
||||||
plots.put(world, new HashMap<PlotId, Plot>());
|
plots.put(world, new HashMap<PlotId, Plot>());
|
||||||
|
@ -116,24 +116,24 @@ public class LikePlotMeConverter {
|
|||||||
for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
|
for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
|
||||||
sendMessage("Copying config for: " + world);
|
sendMessage("Copying config for: " + world);
|
||||||
try {
|
try {
|
||||||
final String plotMeWorldName = world.toLowerCase();
|
String actualWorldName = getWorld(world);
|
||||||
final Integer pathwidth = plotConfig.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
final Integer pathwidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
||||||
PlotSquared.config.set("worlds." + world + ".road.width", pathwidth);
|
PlotSquared.config.set("worlds." + actualWorldName + ".road.width", pathwidth);
|
||||||
final Integer plotsize = plotConfig.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
|
final Integer plotsize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
|
||||||
PlotSquared.config.set("worlds." + world + ".plot.size", plotsize);
|
PlotSquared.config.set("worlds." + actualWorldName + ".plot.size", plotsize);
|
||||||
final String wallblock = plotConfig.getString("worlds." + plotMeWorldName + ".WallBlockId"); //
|
final String wallblock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
|
||||||
PlotSquared.config.set("worlds." + world + ".wall.block", wallblock);
|
PlotSquared.config.set("worlds." + actualWorldName + ".wall.block", wallblock);
|
||||||
final String floor = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFloorBlockId"); //
|
final String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
||||||
PlotSquared.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor));
|
PlotSquared.config.set("worlds." + actualWorldName + ".plot.floor", Arrays.asList(floor));
|
||||||
final String filling = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFillingBlockId"); //
|
final String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
||||||
PlotSquared.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling));
|
PlotSquared.config.set("worlds." + actualWorldName + ".plot.filling", Arrays.asList(filling));
|
||||||
final String road = plotConfig.getString("worlds." + plotMeWorldName + ".RoadMainBlockId");
|
final String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
||||||
PlotSquared.config.set("worlds." + world + ".road.block", road);
|
PlotSquared.config.set("worlds." + actualWorldName + ".road.block", road);
|
||||||
Integer height = plotConfig.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
Integer height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
||||||
if (height == null) {
|
if (height == null) {
|
||||||
height = 64;
|
height = 64;
|
||||||
}
|
}
|
||||||
PlotSquared.config.set("worlds." + world + ".road.height", height);
|
PlotSquared.config.set("worlds." + actualWorldName + ".road.height", height);
|
||||||
PlotSquared.config.save(PlotSquared.configFile);
|
PlotSquared.config.save(PlotSquared.configFile);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually");
|
sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually");
|
||||||
@ -156,6 +156,7 @@ public class LikePlotMeConverter {
|
|||||||
final YamlConfiguration PLOTME_DG_YML = YamlConfiguration.loadConfiguration(PLOTME_DG_FILE);
|
final YamlConfiguration PLOTME_DG_YML = YamlConfiguration.loadConfiguration(PLOTME_DG_FILE);
|
||||||
try {
|
try {
|
||||||
for (final String world : plots.keySet()) {
|
for (final String world : plots.keySet()) {
|
||||||
|
String actualWorldName = getWorld(world);
|
||||||
final String plotMeWorldName = world.toLowerCase();
|
final String plotMeWorldName = world.toLowerCase();
|
||||||
Integer pathwidth = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
Integer pathwidth = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
||||||
if (pathwidth == null) {
|
if (pathwidth == null) {
|
||||||
@ -194,9 +195,9 @@ public class LikePlotMeConverter {
|
|||||||
height = 64;
|
height = 64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.config.set("worlds." + world + ".road.height", height);
|
PlotSquared.config.set("worlds." + actualWorldName + ".road.height", height);
|
||||||
PlotSquared.config.set("worlds." + world + ".plot.height", height);
|
PlotSquared.config.set("worlds." + actualWorldName + ".plot.height", height);
|
||||||
PlotSquared.config.set("worlds." + world + ".wall.height", height);
|
PlotSquared.config.set("worlds." + actualWorldName + ".wall.height", height);
|
||||||
PlotSquared.config.save(PlotSquared.configFile);
|
PlotSquared.config.save(PlotSquared.configFile);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
@ -94,6 +94,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
|||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
@ -269,6 +270,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final StringWrapper name = new StringWrapper(username);
|
final StringWrapper name = new StringWrapper(username);
|
||||||
final UUID uuid = pp.getUUID();
|
final UUID uuid = pp.getUUID();
|
||||||
UUIDHandler.add(name, uuid);
|
UUIDHandler.add(name, uuid);
|
||||||
|
ExpireManager.dates.put(uuid, System.currentTimeMillis());
|
||||||
if (PlotSquared.worldEdit != null) {
|
if (PlotSquared.worldEdit != null) {
|
||||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
WEManager.bypass.add(pp.getName());
|
WEManager.bypass.add(pp.getName());
|
||||||
@ -1068,6 +1070,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
@EventHandler(priority= EventPriority.MONITOR)
|
@EventHandler(priority= EventPriority.MONITOR)
|
||||||
public void onLeave(final PlayerQuitEvent event) {
|
public void onLeave(final PlayerQuitEvent event) {
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
|
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
|
||||||
|
ExpireManager.dates.put(pp.getUUID(), System.currentTimeMillis());
|
||||||
EventUtil.unregisterPlayer(pp);
|
EventUtil.unregisterPlayer(pp);
|
||||||
if (PlotSquared.worldEdit != null) {
|
if (PlotSquared.worldEdit != null) {
|
||||||
WEManager.bypass.remove(pp.getName());
|
WEManager.bypass.remove(pp.getName());
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -17,7 +19,6 @@ 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;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||||
@ -29,9 +30,10 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
|||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class ExpireManager {
|
public class ExpireManager {
|
||||||
public static ConcurrentHashMap<String, HashMap<Plot, Long>> expiredPlots = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<String, List<Plot>> expiredPlots = new ConcurrentHashMap<>();
|
||||||
public static ConcurrentHashMap<String, Boolean> updatingPlots = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<String, Boolean> updatingPlots = new ConcurrentHashMap<>();
|
||||||
public static ConcurrentHashMap<String, Long> timestamp = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<String, Long> timestamp = new ConcurrentHashMap<>();
|
||||||
|
public static ConcurrentHashMap<UUID, Long> dates = new ConcurrentHashMap<>();
|
||||||
public static int task;
|
public static int task;
|
||||||
|
|
||||||
public static long getTimeStamp(final String world) {
|
public static long getTimeStamp(final String world) {
|
||||||
@ -48,13 +50,47 @@ public class ExpireManager {
|
|||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
if (now > getTimeStamp(world)) {
|
if (now > getTimeStamp(world)) {
|
||||||
timestamp.put(world, now + 86400000l);
|
timestamp.put(world, now + 86400000l);
|
||||||
|
|
||||||
|
|
||||||
|
// TaskManager.index.increment();
|
||||||
|
// final ArrayList<Plot> plots = new ArrayList<>(PlotSquared.getPlots(world).values());
|
||||||
|
// int value = TaskManager.index.intValue();
|
||||||
|
// int id = TaskManager.runTaskRepeat(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// long start = System.currentTimeMillis();
|
||||||
|
// while (System.currentTimeMillis() - start < 15) {
|
||||||
|
// Plot plot = plots.remove(0);
|
||||||
|
// final Flag keepFlag = FlagManager.getPlotFlag(plot, "keep");
|
||||||
|
// if (keepFlag != null && (Boolean) keepFlag.getValue()) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// final HashMap<Plot, Long> toRemove = new HashMap<>();
|
||||||
|
// final HashMap<UUID, Long> remove = new HashMap<>();
|
||||||
|
// final Set<UUID> keep = new HashSet<>();
|
||||||
|
// Iterator<Plot> iter = plots.iterator();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }, 1);
|
||||||
|
//
|
||||||
|
// TaskManager.tasks.put(value, id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final HashMap<Plot, Long> plots = getOldPlots(world);
|
try {
|
||||||
PlotSquared.log("&cFound " + plots.size() + " expired plots for " + world + "!");
|
final List<Plot> plots = getOldPlots(world);
|
||||||
expiredPlots.put(world, plots);
|
PlotSquared.log("&cFound " + plots.size() + " expired plots for " + world + "!");
|
||||||
updatingPlots.put(world, false);
|
expiredPlots.put(world, plots);
|
||||||
|
updatingPlots.put(world, false);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
@ -80,7 +116,7 @@ public class ExpireManager {
|
|||||||
updateExpired(world);
|
updateExpired(world);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Set<Plot> plots = expiredPlots.get(world).keySet();
|
final List<Plot> plots = expiredPlots.get(world);
|
||||||
if ((plots == null) || (plots.size() == 0)) {
|
if ((plots == null) || (plots.size() == 0)) {
|
||||||
if (updateExpired(world)) {
|
if (updateExpired(world)) {
|
||||||
return;
|
return;
|
||||||
@ -138,13 +174,26 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
final String name = UUIDHandler.getName(uuid);
|
final String name = UUIDHandler.getName(uuid);
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
final OfflinePlayer op = Bukkit.getOfflinePlayer(name);
|
long last;
|
||||||
if (op.hasPlayedBefore()) {
|
if (dates.contains(uuid)) {
|
||||||
final long last = op.getLastPlayed();
|
last = dates.get(uuid);
|
||||||
final long compared = System.currentTimeMillis() - last;
|
}
|
||||||
if (compared >= (86400000l * Settings.AUTO_CLEAR_DAYS)) {
|
else {
|
||||||
return true;
|
final OfflinePlayer op = Bukkit.getOfflinePlayer(name);
|
||||||
|
if (op.hasPlayedBefore()) {
|
||||||
|
last = op.getLastPlayed();
|
||||||
|
dates.put(uuid, last);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (last == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final long compared = System.currentTimeMillis() - last;
|
||||||
|
if (compared >= (86400000l * Settings.AUTO_CLEAR_DAYS)) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -159,11 +208,9 @@ public class ExpireManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Plot, Long> getOldPlots(final String world) {
|
public static List<Plot> getOldPlots(final String world) {
|
||||||
final Collection<Plot> plots = PlotSquared.getPlots(world).values();
|
final Collection<Plot> plots = PlotSquared.getPlots(world).values();
|
||||||
final HashMap<Plot, Long> toRemove = new HashMap<>();
|
final List<Plot> toRemove = new ArrayList<>();
|
||||||
final HashMap<UUID, Long> remove = new HashMap<>();
|
|
||||||
final Set<UUID> keep = new HashSet<>();
|
|
||||||
Iterator<Plot> iter = plots.iterator();
|
Iterator<Plot> iter = plots.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Plot plot = iter.next();
|
Plot plot = iter.next();
|
||||||
@ -172,31 +219,15 @@ public class ExpireManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final UUID uuid = plot.owner;
|
final UUID uuid = plot.owner;
|
||||||
if ((uuid == null) || remove.containsKey(uuid)) {
|
if (uuid == null) {
|
||||||
Long stamp;
|
toRemove.add(plot);
|
||||||
if (uuid == null) {
|
|
||||||
stamp = 0l;
|
|
||||||
} else {
|
|
||||||
stamp = remove.get(uuid);
|
|
||||||
}
|
|
||||||
toRemove.put(plot, stamp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (keep.contains(uuid)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
keep.add(uuid);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final OfflinePlotPlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
if (isExpired(plot)) {
|
||||||
if ((op == null) || (op.getLastPlayed() == 0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
long last = op.getLastPlayed();
|
|
||||||
long compared = System.currentTimeMillis() - last;
|
|
||||||
if (compared >= (86400000l * Settings.AUTO_CLEAR_DAYS)) {
|
|
||||||
if (Settings.AUTO_CLEAR_CHECK_DISK) {
|
if (Settings.AUTO_CLEAR_CHECK_DISK) {
|
||||||
final String worldname = Bukkit.getWorlds().get(0).getName();
|
final String worldname = Bukkit.getWorlds().get(0).getName();
|
||||||
String foldername;
|
String foldername;
|
||||||
@ -204,6 +235,7 @@ public class ExpireManager {
|
|||||||
if (BukkitMain.checkVersion(1, 7, 5)) {
|
if (BukkitMain.checkVersion(1, 7, 5)) {
|
||||||
foldername = "playerdata";
|
foldername = "playerdata";
|
||||||
try {
|
try {
|
||||||
|
final OfflinePlotPlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||||
filename = op.getUUID() + ".dat";
|
filename = op.getUUID() + ".dat";
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
filename = uuid.toString() + ".dat";
|
filename = uuid.toString() + ".dat";
|
||||||
@ -221,10 +253,9 @@ public class ExpireManager {
|
|||||||
PlotSquared.log("Could not find file: " + filename);
|
PlotSquared.log("Could not find file: " + filename);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
last = playerFile.lastModified();
|
long last = playerFile.lastModified();
|
||||||
compared = System.currentTimeMillis() - last;
|
long compared = System.currentTimeMillis() - last;
|
||||||
if (compared < (86400000l * Settings.AUTO_CLEAR_DAYS)) {
|
if (compared < (86400000l * Settings.AUTO_CLEAR_DAYS)) {
|
||||||
keep.add(uuid);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -233,11 +264,8 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toRemove.put(plot, last);
|
toRemove.add(plot);
|
||||||
remove.put(uuid, last);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
keep.add(uuid);
|
|
||||||
}
|
}
|
||||||
return toRemove;
|
return toRemove;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
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.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;
|
||||||
@ -130,6 +131,7 @@ public class UUIDHandler {
|
|||||||
final UUID uuid = UUID.fromString(s);
|
final UUID uuid = UUID.fromString(s);
|
||||||
if (check || all.contains(uuid)) {
|
if (check || all.contains(uuid)) {
|
||||||
OfflinePlayer op = Bukkit.getOfflinePlayer(uuid);
|
OfflinePlayer op = Bukkit.getOfflinePlayer(uuid);
|
||||||
|
ExpireManager.dates.put(uuid, op.getLastPlayed());
|
||||||
add(new StringWrapper(op.getName()), uuid);
|
add(new StringWrapper(op.getName()), uuid);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -183,6 +185,7 @@ public class UUIDHandler {
|
|||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
try {
|
try {
|
||||||
final OfflinePlotPlayer player = wrapper.getOfflinePlayer(uuid);
|
final OfflinePlotPlayer player = wrapper.getOfflinePlayer(uuid);
|
||||||
|
ExpireManager.dates.put(uuid, player.getLastPlayed());
|
||||||
uuid = UUIDHandler.uuidWrapper.getUUID(player);
|
uuid = UUIDHandler.uuidWrapper.getUUID(player);
|
||||||
final StringWrapper name = new StringWrapper(player.getName());
|
final StringWrapper name = new StringWrapper(player.getName());
|
||||||
add(name, uuid);
|
add(name, uuid);
|
||||||
|
Loading…
Reference in New Issue
Block a user