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; 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.configuration.file.FileConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings; 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.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler; 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 { public class ClassicPlotMeConnector extends APlotMeConnector {
private String plugin; private String plugin;
@ -109,7 +107,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
owner = DBFunc.everyone; owner = DBFunc.everyone;
} }
else { else {
if (checkUUID){ if (checkUUID || checkUUID2){
try { try {
byte[] bytes = r.getBytes(column); byte[] bytes = r.getBytes(column);
if (bytes != null) { if (bytes != null) {
@ -174,6 +172,29 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
if (name.equals("*")) { if (name.equals("*")) {
denied = DBFunc.everyone; denied = DBFunc.everyone;
} else { } 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); MainUtil.sendConsoleMessage("&6Could not identify denied for plot: " + id);
continue; continue;
} }
@ -195,6 +216,29 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
if (name.equals("*")) { if (name.equals("*")) {
helper = DBFunc.everyone; helper = DBFunc.everyone;
} else { } 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); MainUtil.sendConsoleMessage("&6Could not identify helper for plot: " + id);
continue; continue;
} }