Fixes #753
This commit is contained in:
Jesse Boyd
2015-12-04 20:00:30 +11:00
parent c72edc40f0
commit 35589dcc5f
13 changed files with 310 additions and 249 deletions

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
@ -22,15 +21,6 @@ public abstract class EventUtil {
public static EventUtil manager = null;
public static void unregisterPlayer(final PlotPlayer player) {
final String name = player.getName();
if (SetupUtils.setupMap.containsKey(name)) {
SetupUtils.setupMap.remove(name);
}
CmdConfirm.removePending(name);
PS.get().IMP.unregister(player);
}
public abstract Rating callRating(final PlotPlayer player, final Plot plot, final Rating rating);
public abstract boolean callClaim(final PlotPlayer player, final Plot plot, final boolean auto);

View File

@ -108,27 +108,32 @@ public abstract class UUIDHandlerImplementation {
* lazy UUID conversion:
* - Useful if the person misconfigured the database, or settings before PlotMe conversion
*/
if (!Settings.OFFLINE_MODE) {
UUID offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
if (!unknown.contains(offline) && !name.value.equals(name.value.toLowerCase())) {
offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
if (!unknown.contains(offline)) {
offline = null;
}
}
if (offline != null && !offline.equals(uuid)) {
unknown.remove(offline);
final Set<Plot> plots = PS.get().getPlots(offline);
if (plots.size() > 0) {
for (final Plot plot : plots) {
plot.owner = uuid;
if (!Settings.OFFLINE_MODE && unknown.size() > 0) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
UUID offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
if (!unknown.contains(offline) && !name.value.equals(name.value.toLowerCase())) {
offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value.toLowerCase()).getBytes(Charsets.UTF_8));
if (!unknown.contains(offline)) {
offline = null;
}
}
if (offline != null && !offline.equals(uuid)) {
unknown.remove(offline);
final Set<Plot> plots = PS.get().getPlots(offline);
if (plots.size() > 0) {
for (final Plot plot : plots) {
plot.owner = uuid;
}
DBFunc.replaceUUID(offline, uuid);
PS.debug("&cDetected invalid UUID stored for: " + name.value);
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database.");
}
}
DBFunc.replaceUUID(offline, uuid);
PS.debug("&cDetected invalid UUID stored for: " + name.value);
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database.");
}
}
});
}
try {
final UUID offline = uuidMap.put(name, uuid);