diff --git a/.classpath b/.classpath index d2f7488..43a0b04 100644 --- a/.classpath +++ b/.classpath @@ -16,7 +16,22 @@ - + + + + + + + + + + + + + + + + diff --git a/config.yml b/config.yml index 07a5bc3..6fe5c55 100644 --- a/config.yml +++ b/config.yml @@ -133,6 +133,8 @@ Dump_Into_Inventory_Blacklist: #%eb_pagecost% -> Cost of next page #%eb_pagecostitemname% -> Name of item required for next page purchase #%eb_pagecostitemamount% -> Amount of item required for next page purchase +#%eb_playername% -> Name of player +#%eb_currentpage% -> Current page of bank open GUI: Next_Page: @@ -176,5 +178,5 @@ GUI: # Version # ########################################################## -VERSION: 9 +VERSION: 10 #Do not touch this. No touchy. \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index 1d988a6..6979dfa 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,7 +1,7 @@ name: "EnderBank" author: TheTealViper -version: "1.16.5.a.1" -api-version: 1.16 +version: "1.18.1.a.1" +api-version: 1.18 description: "Bank system from popular RPG's." main: me.TheTealViper.enderbank.EnderBank commands: diff --git a/src/me/TheTealViper/enderbank/BankStorage.java b/src/me/TheTealViper/enderbank/BankStorage.java index 2addda0..71b98ed 100644 --- a/src/me/TheTealViper/enderbank/BankStorage.java +++ b/src/me/TheTealViper/enderbank/BankStorage.java @@ -83,6 +83,8 @@ public class BankStorage { //Set other default values pf.set("unlockedPages", 1); pf.save(); + + new BankStorage(p.getUniqueId()); } public BankStorage(UUID bankOwnerUUID) { diff --git a/src/me/TheTealViper/enderbank/EnderBank.java b/src/me/TheTealViper/enderbank/EnderBank.java index 0a59e67..37fd012 100644 --- a/src/me/TheTealViper/enderbank/EnderBank.java +++ b/src/me/TheTealViper/enderbank/EnderBank.java @@ -382,13 +382,13 @@ public class EnderBank extends JavaPlugin implements Listener { if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().equals(Material.ENDER_CHEST) && !disabledWorlds.contains(e.getPlayer().getWorld().getName())) { e.setCancelled(true); Player p = (Player) e.getPlayer(); - if(!BankStorage.hasBank(p.getUniqueId())) - BankStorage.initiateBank(p); openEnderBank(p); } } public void openEnderBank(Player p) { + if(!BankStorage.hasBank(p.getUniqueId())) + BankStorage.initiateBank(p); BankStorage bank = BankStorage.getBank(p.getUniqueId()); bank.openPage(1, p); } diff --git a/src/me/TheTealViper/enderbank/utils/EnableShit.java b/src/me/TheTealViper/enderbank/utils/EnableShit.java index 1e74761..f7be1e6 100644 --- a/src/me/TheTealViper/enderbank/utils/EnableShit.java +++ b/src/me/TheTealViper/enderbank/utils/EnableShit.java @@ -59,7 +59,7 @@ public class EnableShit { if(update){ File file = new File("plugins/" + plugin.getDescription().getName() + "/config.yml"); try { - com.google.common.io.Files.copy(file, new File("plugins/" + plugin.getDescription().getName() + "/configBACKUP_" + oldVersion + ".yml")); + org.apache.commons.io.FileUtils.copyFile(file, new File("plugins/" + plugin.getDescription().getName() + "/configBACKUP_" + oldVersion + ".yml")); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/me/TheTealViper/enderbank/utils/LoadItemstackFromConfig.java b/src/me/TheTealViper/enderbank/utils/LoadItemstackFromConfig.java index 3534253..6028c12 100644 --- a/src/me/TheTealViper/enderbank/utils/LoadItemstackFromConfig.java +++ b/src/me/TheTealViper/enderbank/utils/LoadItemstackFromConfig.java @@ -1,25 +1,16 @@ package me.TheTealViper.enderbank.utils; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; -import java.util.UUID; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.craftbukkit.libs.org.apache.commons.codec.binary.Base64; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; public class LoadItemstackFromConfig { /** @@ -154,22 +145,27 @@ public class LoadItemstackFromConfig { String value = tagStringProcessed[1]; switch(tag) { case "playerskullskin": - JsonParser parser = new JsonParser(); - JsonObject o = parser.parse(new String(Base64.decodeBase64(value))).getAsJsonObject(); - String skinUrl = o.get("textures").getAsJsonObject().get("SKIN").getAsJsonObject().get("url").getAsString(); - SkullMeta skullMeta = (SkullMeta) meta; - GameProfile profile = new GameProfile(UUID.randomUUID(), null); - byte[] encodedData = Base64.encodeBase64(("{textures:{SKIN:{url:\"" + skinUrl + "\"}}}").getBytes()); - profile.getProperties().put("textures", new Property("textures", new String(encodedData))); - Field profileField = null; - try { - profileField = skullMeta.getClass().getDeclaredField("profile"); - profileField.setAccessible(true); - profileField.set(skullMeta, profile); - } catch (Exception e) { - e.printStackTrace(); - } - meta = skullMeta; + //TODO +// JsonParser parser = new JsonParser(); +// JsonObject o = parser.parse(new String(Base64.decodeBase64(value))).getAsJsonObject(); +// String skinUrl = o.get("textures").getAsJsonObject().get("SKIN").getAsJsonObject().get("url").getAsString(); +// SkullMeta skullMeta = (SkullMeta) meta; +// GameProfile profile = new GameProfile(UUID.randomUUID(), null); +// byte[] encodedData = Base64.encodeBase64(("{textures:{SKIN:{url:\"" + skinUrl + "\"}}}").getBytes()); +// profile.getProperties().put("textures", new Property("textures", new String(encodedData))); +// Field profileField = null; +// try { +// profileField = skullMeta.getClass().getDeclaredField("profile"); +// profileField.setAccessible(true); +// profileField.set(skullMeta, profile); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// meta = skullMeta; + +// UUID hashAsId = new UUID(texture.hashCode(), texture.hashCode()); +// Bukkit.getUnsafe().modifyItemStack(itemStack, "{SkullOwner:{Id:\"" + hashAsId + "\",Properties:{textures:[{Value:\"" +// + texture + "\"}]}}}"); break; case "vanilladurability": Damageable dam = (Damageable) meta;