From fbbe519381c3d1a69277aa81cbbb4b9ec03f2d1c Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 6 Jul 2016 18:27:35 +0200 Subject: [PATCH] Remove craftbukkit dependency in 'ShopChest' artifact --- ShopChest/dependency-reduced-pom.xml | 6 ------ ShopChest/pom.xml | 7 ------- .../src/main/java/de/epiceric/shopchest/utils/Utils.java | 7 ++++--- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/ShopChest/dependency-reduced-pom.xml b/ShopChest/dependency-reduced-pom.xml index f7dbad3..f413699 100644 --- a/ShopChest/dependency-reduced-pom.xml +++ b/ShopChest/dependency-reduced-pom.xml @@ -8,12 +8,6 @@ 4.0.0 ShopChest - - org.bukkit - craftbukkit - 1.10-R0.1-SNAPSHOT - provided - org.spigotmc spigot-api diff --git a/ShopChest/pom.xml b/ShopChest/pom.xml index 754c5cf..b611753 100644 --- a/ShopChest/pom.xml +++ b/ShopChest/pom.xml @@ -12,13 +12,6 @@ ShopChest - - org.bukkit - craftbukkit - 1.10-R0.1-SNAPSHOT - provided - - de.epiceric ShopChest_NMS-Abstract diff --git a/ShopChest/src/main/java/de/epiceric/shopchest/utils/Utils.java b/ShopChest/src/main/java/de/epiceric/shopchest/utils/Utils.java index c9a1e7d..3418790 100644 --- a/ShopChest/src/main/java/de/epiceric/shopchest/utils/Utils.java +++ b/ShopChest/src/main/java/de/epiceric/shopchest/utils/Utils.java @@ -1,12 +1,13 @@ package de.epiceric.shopchest.utils; -import org.apache.commons.codec.binary.Base64; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import javax.xml.bind.DatatypeConverter; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; public class Utils { @@ -82,7 +83,7 @@ public class Utils { public static String encode(ItemStack itemStack) { YamlConfiguration config = new YamlConfiguration(); config.set("i", itemStack); - return new String(Base64.encodeBase64(config.saveToString().getBytes())); + return DatatypeConverter.printBase64Binary(config.saveToString().getBytes(StandardCharsets.UTF_8)); } /** @@ -93,7 +94,7 @@ public class Utils { public static ItemStack decode(String string) { YamlConfiguration config = new YamlConfiguration(); try { - config.loadFromString(new String(Base64.decodeBase64(string.getBytes()))); + config.loadFromString(new String(DatatypeConverter.parseBase64Binary(string), StandardCharsets.UTF_8)); } catch (Exception e) { e.printStackTrace(); return null;