This commit is contained in:
Jesse Boyd 2015-11-30 02:24:01 +11:00
parent 9118f111e4
commit 82ccca8f63
3 changed files with 37 additions and 34 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>3.2.20</version> <version>3.2.21</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -1765,45 +1765,48 @@ public class MainUtil {
if (!pw.ALLOW_SIGNS) { if (!pw.ALLOW_SIGNS) {
return null; return null;
} }
Location loc = plot.getManager().getSignLoc(pw, plot); try {
ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false); Location loc = plot.getManager().getSignLoc(pw, plot);
String[] lines = BlockManager.manager.getSign(loc); ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false);
if (lines == null) { String[] lines = BlockManager.manager.getSign(loc);
return null; if (lines == null) {
}
loop:
for (int i = 4; i > 0; i--) {
String caption = C.valueOf("OWNER_SIGN_LINE_" + i).s();
int index = caption.indexOf("%plr%");
if (index == -1) {
continue;
}
String name = lines[i - 1].substring(index);
if (name.length() == 0) {
return null; return null;
} }
UUID owner = UUIDHandler.getUUID(name, null); loop: for (int i = 4; i > 0; i--) {
if (owner != null) { String caption = C.valueOf("OWNER_SIGN_LINE_" + i).s();
plot.owner = owner; int index = caption.indexOf("%plr%");
break; if (index == -1) {
} continue;
if (lines[i - 1].length() == 15) { }
BiMap<StringWrapper, UUID> map = UUIDHandler.getUuidMap(); String name = lines[i - 1].substring(index);
for (Entry<StringWrapper, UUID> entry : map.entrySet()) { if (name.length() == 0) {
String key = entry.getKey().value; return null;
if (key.length() > name.length() && key.startsWith(name)) { }
plot.owner = entry.getValue(); UUID owner = UUIDHandler.getUUID(name, null);
break loop; if (owner != null) {
plot.owner = owner;
break;
}
if (lines[i - 1].length() == 15) {
BiMap<StringWrapper, UUID> map = UUIDHandler.getUuidMap();
for (Entry<StringWrapper, UUID> entry : map.entrySet()) {
String key = entry.getKey().value;
if (key.length() > name.length() && key.startsWith(name)) {
plot.owner = entry.getValue();
break loop;
}
} }
} }
plot.owner = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8));
break;
} }
plot.owner = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8)); if (plot.owner != null) {
break; plot.create();
}
return plot.owner;
} catch (Exception e) {
return null;
} }
if (plot.owner != null) {
plot.create();
}
return plot.owner;
} }
public static boolean isUnowned(final String world, final PlotId pos1, final PlotId pos2) { public static boolean isUnowned(final String world, final PlotId pos1, final PlotId pos2) {

Binary file not shown.