[1.18.1.a.1] Bug Fix + 1.18 Update

This commit is contained in:
TheTealViper 2022-04-23 16:17:33 -07:00
parent d2f7c0365c
commit c7f06bdad9
7 changed files with 47 additions and 32 deletions

View File

@ -16,7 +16,22 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="D:/My Documents/Minecraft Stuff/1.16.5 Plugin Tester/spigot.jar">
<classpathentry kind="lib" path="D:/My Documents/Minecraft Stuff/1.18 Plugin Tester/bundler/libraries/spigot-api-1.18.1-R0.1-SNAPSHOT.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="D:/My Documents/Minecraft Stuff/1.18 Plugin Tester/bundler/libraries/commons-io-2.11.0.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="D:/My Documents/Minecraft Stuff/1.18 Plugin Tester/bundler/libraries/gson-2.8.8.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="D:/My Documents/Minecraft Stuff/1.18 Plugin Tester/bundler/libraries/snakeyaml-1.28.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>

View File

@ -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.

View File

@ -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:

View File

@ -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) {

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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;