From bd86caa818592593e7854b0f536c609ed6841afe Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 24 Aug 2015 00:17:17 +1000 Subject: [PATCH] Fixed fallback plotme conversion --- .../database/plotme/ClassicPlotMeConnector.java | 14 +++++++++++++- .../plotsquared/sponge/object/SpongePlayer.java | 1 - 2 files changed, 13 insertions(+), 2 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 333fbbc89..9699ba4ec 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java @@ -1,6 +1,9 @@ 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; @@ -102,7 +105,16 @@ public class ClassicPlotMeConnector extends APlotMeConnector { try { byte[] bytes = r.getBytes("ownerid"); if (bytes != null) { - owner = UUID.nameUUIDFromBytes(bytes); + try { + ByteBuffer bb = ByteBuffer.wrap(bytes); + long high = bb.getLong(); + long low = bb.getLong(); + owner = new UUID(high, low); + } + catch (Exception e) { + e.printStackTrace(); + owner = UUID.nameUUIDFromBytes(bytes); + } if (owner != null) { UUIDHandler.add(new StringWrapper(name), owner); } diff --git a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index d980fcc58..4ddf029af 100644 --- a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -11,7 +11,6 @@ import org.spongepowered.api.entity.player.Player; import org.spongepowered.api.entity.player.gamemode.GameMode; import org.spongepowered.api.entity.player.gamemode.GameModes; import org.spongepowered.api.text.Texts; -import org.spongepowered.api.text.chat.ChatType; import org.spongepowered.api.text.chat.ChatTypes; import com.flowpowered.math.vector.Vector3d;