From a63110f3035b7a29c63a61735f0fab8980b21072 Mon Sep 17 00:00:00 2001 From: Pieter Maes Date: Sun, 30 Aug 2015 16:23:05 +0200 Subject: [PATCH] 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 --- .../plotme/ClassicPlotMeConnector.java | 72 +++++++++++++++---- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java b/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java index 3a55ec3f1..7a9f86006 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java @@ -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; }