Use UUID, not just name

This commit is contained in:
Jesse Boyd 2019-04-17 22:18:03 +10:00
parent d31dbc7c7c
commit 8ac23b92d8
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
@ -43,7 +44,12 @@ import java.util.UUID;
for (File folder : container.listFiles()) { for (File folder : container.listFiles()) {
String name = folder.getName(); String name = folder.getName();
if (!WorldUtil.IMP.isWorld(name) && PlotId.fromStringOrNull(name) == null) { if (!WorldUtil.IMP.isWorld(name) && PlotId.fromStringOrNull(name) == null) {
UUID uuid = UUIDHandler.getUUID(name, null); UUID uuid;
if (name.length() > 16) {
uuid = UUID.fromString(name);
} else {
uuid = UUIDHandler.getUUID(name, null);
}
if (uuid == null) { if (uuid == null) {
uuid = uuid =
UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)); UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8));