Fixing plotme converter for some installations

-Making sure the uuid is checked when it's ownerId
-Checking if there are uuid's for denied/allowed, then use them if those are not in the cache
This commit is contained in:
Pieter Maes 2015-08-30 16:23:05 +02:00
parent 4027e84a0a
commit a63110f303

View File

@ -1,18 +1,5 @@
package com.plotsquared.bukkit.database.plotme;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.UUID;
import com.intellectualcrafters.configuration.file.FileConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
@ -25,6 +12,17 @@ import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
import java.io.File;
import java.nio.ByteBuffer;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.UUID;
public class ClassicPlotMeConnector extends APlotMeConnector {
private String plugin;
@ -109,7 +107,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
owner = DBFunc.everyone;
}
else {
if (checkUUID){
if (checkUUID || checkUUID2){
try {
byte[] bytes = r.getBytes(column);
if (bytes != null) {
@ -174,6 +172,29 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
if (name.equals("*")) {
denied = DBFunc.everyone;
} else {
if (DBFunc.hasColumn(r, "playerid")) {
try {
byte[] bytes = r.getBytes("playerid");
if (bytes != null) {
try {
ByteBuffer bb = ByteBuffer.wrap(bytes);
long high = bb.getLong();
long low = bb.getLong();
denied = new UUID(high, low);
} catch (Exception e) {
e.printStackTrace();
denied = UUID.nameUUIDFromBytes(bytes);
}
if (denied != null) {
UUIDHandler.add(new StringWrapper(name), denied);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (denied == null){
MainUtil.sendConsoleMessage("&6Could not identify denied for plot: " + id);
continue;
}
@ -195,6 +216,29 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
if (name.equals("*")) {
helper = DBFunc.everyone;
} else {
if (DBFunc.hasColumn(r, "playerid")) {
try {
byte[] bytes = r.getBytes("playerid");
if (bytes != null) {
try {
ByteBuffer bb = ByteBuffer.wrap(bytes);
long high = bb.getLong();
long low = bb.getLong();
helper = new UUID(high, low);
} catch (Exception e) {
e.printStackTrace();
helper = UUID.nameUUIDFromBytes(bytes);
}
if (helper != null) {
UUIDHandler.add(new StringWrapper(name), helper);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (helper == null){
MainUtil.sendConsoleMessage("&6Could not identify helper for plot: " + id);
continue;
}