fixed all deprecations
This commit is contained in:
@@ -29,7 +29,7 @@ public class AFKListener implements Listener {
|
||||
BukkitTask i = Bukkit.getServer().getScheduler().runTaskLater(App.main, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
p.playerListName(App.main.helper.R3SMessage(Type.ERROR, "[AFK] " + p.getName()));
|
||||
p.playerListName(App.helper.R3SMessage(Type.ERROR, "[AFK] " + p.getName()));
|
||||
}
|
||||
}, (5 * 60 * 20));
|
||||
timers.put(p.getUniqueId(), i);
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.kyori.adventure.text.Component;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -25,7 +24,6 @@ import org.bukkit.inventory.RecipeChoice.MaterialChoice;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.components.CustomModelDataComponent;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -36,7 +34,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class App extends JavaPlugin {
|
||||
public de.hessj.helper.Helper helper = new de.hessj.helper.Helper();
|
||||
public static de.hessj.helper.Helper helper = new de.hessj.helper.Helper();
|
||||
public static App main;
|
||||
public ItemStack backPack;
|
||||
public ItemStack backPack2;
|
||||
@@ -62,133 +60,8 @@ public class App extends JavaPlugin {
|
||||
public FileConfiguration tpConfig = YamlConfiguration.loadConfiguration(tpYml);
|
||||
|
||||
|
||||
public boolean isInteractable(Block b) {
|
||||
List<Material> interactableBlocks = new ArrayList<Material>();
|
||||
interactableBlocks.add(Material.CHEST);
|
||||
interactableBlocks.add(Material.TRAPPED_CHEST);
|
||||
interactableBlocks.add(Material.ENDER_CHEST);
|
||||
interactableBlocks.add(Material.BARREL);
|
||||
interactableBlocks.add(Material.SHULKER_BOX);
|
||||
interactableBlocks.add(Material.HOPPER);
|
||||
interactableBlocks.add(Material.DISPENSER);
|
||||
interactableBlocks.add(Material.DROPPER);
|
||||
interactableBlocks.add(Material.CRAFTING_TABLE);
|
||||
interactableBlocks.add(Material.FURNACE);
|
||||
interactableBlocks.add(Material.BLAST_FURNACE);
|
||||
interactableBlocks.add(Material.SMOKER);
|
||||
interactableBlocks.add(Material.CARTOGRAPHY_TABLE);
|
||||
interactableBlocks.add(Material.SMITHING_TABLE);
|
||||
interactableBlocks.add(Material.LOOM);
|
||||
interactableBlocks.add(Material.STONECUTTER);
|
||||
interactableBlocks.add(Material.GRINDSTONE);
|
||||
interactableBlocks.add(Material.ANVIL);
|
||||
interactableBlocks.add(Material.CHIPPED_ANVIL);
|
||||
interactableBlocks.add(Material.DAMAGED_ANVIL);
|
||||
interactableBlocks.add(Material.LEVER);
|
||||
interactableBlocks.add(Material.STONE_BUTTON);
|
||||
interactableBlocks.add(Material.OAK_BUTTON);
|
||||
interactableBlocks.add(Material.BIRCH_BUTTON);
|
||||
interactableBlocks.add(Material.BAMBOO_BUTTON);
|
||||
interactableBlocks.add(Material.DARK_OAK_BUTTON);
|
||||
interactableBlocks.add(Material.SPRUCE_BUTTON);
|
||||
interactableBlocks.add(Material.JUNGLE_BUTTON);
|
||||
interactableBlocks.add(Material.ACACIA_BUTTON);
|
||||
interactableBlocks.add(Material.STONE_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.OAK_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.BIRCH_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.BAMBOO_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.DARK_OAK_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.SPRUCE_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.JUNGLE_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.ACACIA_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.LIGHT_WEIGHTED_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.HEAVY_WEIGHTED_PRESSURE_PLATE);
|
||||
interactableBlocks.add(Material.TRIPWIRE_HOOK);
|
||||
interactableBlocks.add(Material.COMPARATOR);
|
||||
interactableBlocks.add(Material.REPEATER);
|
||||
interactableBlocks.add(Material.LECTERN);
|
||||
interactableBlocks.add(Material.OAK_DOOR);
|
||||
interactableBlocks.add(Material.BIRCH_DOOR);
|
||||
interactableBlocks.add(Material.BAMBOO_DOOR);
|
||||
interactableBlocks.add(Material.DARK_OAK_DOOR);
|
||||
interactableBlocks.add(Material.SPRUCE_DOOR);
|
||||
interactableBlocks.add(Material.JUNGLE_DOOR);
|
||||
interactableBlocks.add(Material.ACACIA_DOOR);
|
||||
interactableBlocks.add(Material.OAK_TRAPDOOR);
|
||||
interactableBlocks.add(Material.BIRCH_TRAPDOOR);
|
||||
interactableBlocks.add(Material.BAMBOO_TRAPDOOR);
|
||||
interactableBlocks.add(Material.DARK_OAK_TRAPDOOR);
|
||||
interactableBlocks.add(Material.SPRUCE_TRAPDOOR);
|
||||
interactableBlocks.add(Material.JUNGLE_TRAPDOOR);
|
||||
interactableBlocks.add(Material.ACACIA_TRAPDOOR);
|
||||
interactableBlocks.add(Material.OAK_FENCE_GATE);
|
||||
interactableBlocks.add(Material.BIRCH_FENCE_GATE);
|
||||
interactableBlocks.add(Material.BAMBOO_FENCE_GATE);
|
||||
interactableBlocks.add(Material.DARK_OAK_FENCE_GATE);
|
||||
interactableBlocks.add(Material.SPRUCE_FENCE_GATE);
|
||||
interactableBlocks.add(Material.JUNGLE_FENCE_GATE);
|
||||
interactableBlocks.add(Material.ACACIA_FENCE_GATE);
|
||||
interactableBlocks.add(Material.CHEST_MINECART);
|
||||
interactableBlocks.add(Material.HOPPER_MINECART);
|
||||
interactableBlocks.add(Material.FURNACE_MINECART);
|
||||
interactableBlocks.add(Material.MINECART);
|
||||
interactableBlocks.add(Material.TNT_MINECART);
|
||||
interactableBlocks.add(Material.OAK_BOAT);
|
||||
interactableBlocks.add(Material.BIRCH_BOAT);
|
||||
interactableBlocks.add(Material.BAMBOO_RAFT);
|
||||
interactableBlocks.add(Material.DARK_OAK_BOAT);
|
||||
interactableBlocks.add(Material.SPRUCE_BOAT);
|
||||
interactableBlocks.add(Material.JUNGLE_BOAT);
|
||||
interactableBlocks.add(Material.ACACIA_BOAT);
|
||||
interactableBlocks.add(Material.OAK_CHEST_BOAT);
|
||||
interactableBlocks.add(Material.BIRCH_CHEST_BOAT);
|
||||
interactableBlocks.add(Material.BAMBOO_CHEST_RAFT);
|
||||
interactableBlocks.add(Material.DARK_OAK_CHEST_BOAT);
|
||||
interactableBlocks.add(Material.SPRUCE_CHEST_BOAT);
|
||||
interactableBlocks.add(Material.JUNGLE_CHEST_BOAT);
|
||||
interactableBlocks.add(Material.ACACIA_CHEST_BOAT);
|
||||
interactableBlocks.add(Material.ENCHANTING_TABLE);
|
||||
interactableBlocks.add(Material.RESPAWN_ANCHOR);
|
||||
interactableBlocks.add(Material.BREWING_STAND);
|
||||
interactableBlocks.add(Material.LECTERN);
|
||||
interactableBlocks.add(Material.WHITE_BED);
|
||||
interactableBlocks.add(Material.LIGHT_GRAY_BED);
|
||||
interactableBlocks.add(Material.GRAY_BED);
|
||||
interactableBlocks.add(Material.BLACK_BED);
|
||||
interactableBlocks.add(Material.BROWN_BED);
|
||||
interactableBlocks.add(Material.RED_BED);
|
||||
interactableBlocks.add(Material.ORANGE_BED);
|
||||
interactableBlocks.add(Material.YELLOW_BED);
|
||||
interactableBlocks.add(Material.LIME_BED);
|
||||
interactableBlocks.add(Material.GREEN_BED);
|
||||
interactableBlocks.add(Material.CYAN_BED);
|
||||
interactableBlocks.add(Material.LIGHT_BLUE_BED);
|
||||
interactableBlocks.add(Material.BLUE_BED);
|
||||
interactableBlocks.add(Material.PURPLE_BED);
|
||||
interactableBlocks.add(Material.MAGENTA_BED);
|
||||
interactableBlocks.add(Material.PINK_BED);
|
||||
interactableBlocks.add(Material.BELL);
|
||||
interactableBlocks.add(Material.CAKE);
|
||||
interactableBlocks.add(Material.JUKEBOX);
|
||||
interactableBlocks.add(Material.NOTE_BLOCK);
|
||||
interactableBlocks.add(Material.CANDLE);
|
||||
interactableBlocks.add(Material.COMPOSTER);
|
||||
interactableBlocks.add(Material.ITEM_FRAME);
|
||||
interactableBlocks.add(Material.GLOW_ITEM_FRAME);
|
||||
interactableBlocks.add(Material.ARMOR_STAND);
|
||||
interactableBlocks.add(Material.DRAGON_EGG);
|
||||
interactableBlocks.add(Material.BEACON);
|
||||
|
||||
if(interactableBlocks.contains(b.getType())){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
tpConfig.addDefault("url", "https://mc.hessj.de/texturepack/CUSTOM.zip");
|
||||
tpConfig.addDefault("sha1", "a7f7bde9e54279b502d65435877d251aa522cabc");
|
||||
|
||||
@@ -435,7 +308,7 @@ public class App extends JavaPlugin {
|
||||
Recipe r = Bukkit.getServer().getRecipe(desiredItem.getType().getKey());
|
||||
ShapedRecipe sr = (ShapedRecipe) r;
|
||||
HashMap<RecipeChoice, Integer> ingredients = new HashMap<RecipeChoice, Integer>();
|
||||
HashMap<Material, Integer> helper = new HashMap<Material, Integer>();
|
||||
HashMap<Material, Integer> hmhelper = new HashMap<Material, Integer>();
|
||||
int reqItemsCount = 0;
|
||||
for (RecipeChoice rC : sr.getChoiceMap().values()) {
|
||||
if (rC != null) {
|
||||
@@ -454,7 +327,7 @@ public class App extends JavaPlugin {
|
||||
ItemStack is = new ItemStack(maat);
|
||||
if (playerInv.containsAtLeast(is, amount)) {
|
||||
reqItemsCount++;
|
||||
helper.put(maat, amount);
|
||||
hmhelper.put(maat, amount);
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
@@ -462,13 +335,13 @@ public class App extends JavaPlugin {
|
||||
|
||||
}
|
||||
if (reqItemsCount == ingredients.size()) {
|
||||
for (Map.Entry<Material, Integer> entry : helper.entrySet()) {
|
||||
for (Map.Entry<Material, Integer> entry : hmhelper.entrySet()) {
|
||||
ItemStack is = new ItemStack(entry.getKey(), entry.getValue());
|
||||
playerInv.removeItem(is);
|
||||
}
|
||||
}
|
||||
reqItemsCount = 0;
|
||||
helper = new HashMap<Material, Integer>();
|
||||
hmhelper = new HashMap<Material, Integer>();
|
||||
ingredients = new HashMap<RecipeChoice, Integer>();
|
||||
////////////////////////
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
|
||||
|
||||
if (label.equalsIgnoreCase("afk")) {
|
||||
Player p = (Player) sender;
|
||||
p.playerListName(App.main.helper.R3SMessage(Type.ERROR, "[AFK] " + p.getName()));
|
||||
p.playerListName(App.helper.R3SMessage(Type.ERROR, "[AFK] " + p.getName()));
|
||||
}
|
||||
|
||||
if (label.equalsIgnoreCase("pin")) {
|
||||
|
||||
@@ -55,7 +55,6 @@ import org.bukkit.event.player.PlayerAttemptPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MerchantRecipe;
|
||||
@@ -63,6 +62,7 @@ import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import de.hessj.helper.Helper;
|
||||
import de.hessj.helper.Helper.*;
|
||||
|
||||
public class EnvironmentExListeners implements Listener {
|
||||
@@ -541,25 +541,25 @@ public class EnvironmentExListeners implements Listener {
|
||||
if (size == 1) {
|
||||
inv = Bukkit.createInventory(null, 9, Component.translatable("tempBackpack"));
|
||||
ItemStack[] is;
|
||||
is = itemStackArrayFromBase64(
|
||||
is = Helper.itemStackArrayFromBase64(
|
||||
App.main.getConfig().getString(p.getUniqueId() + ".backpack.contents.leatherbackpack"));
|
||||
inv.setContents(is);
|
||||
} else if (size == 2) {
|
||||
inv = Bukkit.createInventory(null, 18, Component.translatable("tempBackpack2"));
|
||||
ItemStack[] is;
|
||||
is = itemStackArrayFromBase64(
|
||||
is = Helper.itemStackArrayFromBase64(
|
||||
App.main.getConfig().getString(p.getUniqueId() + ".backpack.contents.ironbackpack"));
|
||||
inv.setContents(is);
|
||||
} else if (size == 3) {
|
||||
inv = Bukkit.createInventory(null, 27, Component.translatable("tempBackpack3"));
|
||||
ItemStack[] is;
|
||||
is = itemStackArrayFromBase64(
|
||||
is = Helper.itemStackArrayFromBase64(
|
||||
App.main.getConfig().getString(p.getUniqueId() + ".backpack.contents.goldbackpack"));
|
||||
inv.setContents(is);
|
||||
} else if (size == 4) {
|
||||
inv = Bukkit.createInventory(null, 36, Component.translatable("tempBackpack4"));
|
||||
ItemStack[] is;
|
||||
is = itemStackArrayFromBase64(
|
||||
is = Helper.itemStackArrayFromBase64(
|
||||
App.main.getConfig().getString(p.getUniqueId() + ".backpack.contents.diamondbackpack"));
|
||||
inv.setContents(is);
|
||||
}
|
||||
@@ -606,16 +606,16 @@ public class EnvironmentExListeners implements Listener {
|
||||
|
||||
if (size == 1) {
|
||||
App.main.getConfig().set(p.getUniqueId() + ".backpack.contents.leatherbackpack",
|
||||
itemStackArrayToBase64(inv.getContents()));
|
||||
Helper.itemStackArrayToBase64(inv.getContents()));
|
||||
} else if (size == 2) {
|
||||
App.main.getConfig().set(p.getUniqueId() + ".backpack.contents.ironbackpack",
|
||||
itemStackArrayToBase64(inv.getContents()));
|
||||
Helper.itemStackArrayToBase64(inv.getContents()));
|
||||
} else if (size == 3) {
|
||||
App.main.getConfig().set(p.getUniqueId() + ".backpack.contents.goldbackpack",
|
||||
itemStackArrayToBase64(inv.getContents()));
|
||||
Helper.itemStackArrayToBase64(inv.getContents()));
|
||||
} else if (size == 4) {
|
||||
App.main.getConfig().set(p.getUniqueId() + ".backpack.contents.diamondbackpack",
|
||||
itemStackArrayToBase64(inv.getContents()));
|
||||
Helper.itemStackArrayToBase64(inv.getContents()));
|
||||
}
|
||||
App.main.saveConfig();
|
||||
}
|
||||
@@ -647,8 +647,8 @@ public class EnvironmentExListeners implements Listener {
|
||||
&& e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
|
||||
.get(App.main.nsk, PersistentDataType.STRING).toString().equals("R3S_kleiner_Rucksack")) {
|
||||
if (e.getAction() == Action.RIGHT_CLICK_AIR || (e.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
&& (!App.main.isInteractable(e.getClickedBlock()))
|
||||
|| e.getClickedBlock() != null && (App.main.isInteractable(e.getClickedBlock())
|
||||
&& (!App.helper.isInteractable(e.getClickedBlock()))
|
||||
|| e.getClickedBlock() != null && (App.helper.isInteractable(e.getClickedBlock())
|
||||
&& (e.getClickedBlock().getBlockData() != null
|
||||
&& (e.getClickedBlock().getBlockData() instanceof Stairs
|
||||
|| e.getClickedBlock().getBlockData() instanceof Fence))))) {
|
||||
@@ -675,8 +675,8 @@ public class EnvironmentExListeners implements Listener {
|
||||
&& e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
|
||||
.get(App.main.nsk2, PersistentDataType.STRING).toString().equals("R3S_Rucksack")) {
|
||||
if (e.getAction() == Action.RIGHT_CLICK_AIR || (e.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
&& (!App.main.isInteractable(e.getClickedBlock()))
|
||||
|| (App.main.isInteractable(e.getClickedBlock())
|
||||
&& (!App.helper.isInteractable(e.getClickedBlock()))
|
||||
|| (App.helper.isInteractable(e.getClickedBlock())
|
||||
&& (e.getClickedBlock().getBlockData() != null
|
||||
&& (e.getClickedBlock().getBlockData() instanceof Stairs
|
||||
|| e.getClickedBlock().getBlockData() instanceof Fence))))) { // inv2 =
|
||||
@@ -700,8 +700,8 @@ public class EnvironmentExListeners implements Listener {
|
||||
&& e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
|
||||
.get(App.main.nsk3, PersistentDataType.STRING).toString().equals("R3S_großer_Rucksack")) {
|
||||
if (e.getAction() == Action.RIGHT_CLICK_AIR || (e.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
&& (!App.main.isInteractable(e.getClickedBlock()))
|
||||
|| (App.main.isInteractable(e.getClickedBlock())
|
||||
&& (!App.helper.isInteractable(e.getClickedBlock()))
|
||||
|| (App.helper.isInteractable(e.getClickedBlock())
|
||||
&& (e.getClickedBlock().getBlockData() != null
|
||||
&& (e.getClickedBlock().getBlockData() instanceof Stairs
|
||||
|| e.getClickedBlock().getBlockData() instanceof Fence))))) { // inv3 =
|
||||
@@ -726,8 +726,8 @@ public class EnvironmentExListeners implements Listener {
|
||||
&& e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
|
||||
.get(App.main.nsk4, PersistentDataType.STRING).toString().equals("R3S_riesiger_Rucksack")) {
|
||||
if (e.getAction() == Action.RIGHT_CLICK_AIR || (e.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
&& (!App.main.isInteractable(e.getClickedBlock()))
|
||||
|| (App.main.isInteractable(e.getClickedBlock())
|
||||
&& (!App.helper.isInteractable(e.getClickedBlock()))
|
||||
|| (App.helper.isInteractable(e.getClickedBlock())
|
||||
&& (e.getClickedBlock().getBlockData() != null
|
||||
&& (e.getClickedBlock().getBlockData() instanceof Stairs
|
||||
|| e.getClickedBlock().getBlockData() instanceof Fence))))) { // inv4 =
|
||||
@@ -760,28 +760,28 @@ public class EnvironmentExListeners implements Listener {
|
||||
App.main.getConfig().createSection(e.getPlayer().getUniqueId() + ".backpack.contents.leatherbackpack");
|
||||
}
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.leatherbackpack",
|
||||
itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
Helper.itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
App.main.saveConfig();
|
||||
} else if (e.getInventory() == hm2.get(e.getPlayer())) {
|
||||
if (!App.main.getConfig().contains(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack")) {
|
||||
App.main.getConfig().createSection(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack");
|
||||
}
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack",
|
||||
itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
Helper.itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
App.main.saveConfig();
|
||||
} else if (e.getInventory() == hm3.get(e.getPlayer())) {
|
||||
if (!App.main.getConfig().contains(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack")) {
|
||||
App.main.getConfig().createSection(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack");
|
||||
}
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack",
|
||||
itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
Helper.itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
App.main.saveConfig();
|
||||
} else if (e.getInventory() == hm4.get(e.getPlayer())) {
|
||||
if (!App.main.getConfig().contains(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack")) {
|
||||
App.main.getConfig().createSection(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack");
|
||||
}
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack",
|
||||
itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
Helper.itemStackArrayToBase64(e.getInventory().getContents()));
|
||||
App.main.saveConfig();
|
||||
}
|
||||
}
|
||||
@@ -789,7 +789,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent e) throws IllegalArgumentException, IOException {
|
||||
e.deathMessage(null);
|
||||
ItemStack itemStack[] = itemStackArrayFromBase64(
|
||||
ItemStack itemStack[] = Helper.itemStackArrayFromBase64(
|
||||
"rO0ABXVyACFbTG9yZy5idWtraXQuaW52ZW50b3J5Lkl0ZW1TdGFjazuWEWyPcqQUzwIAAHhwAAAACXBwcHBwcHBwcA==");
|
||||
for (ItemStack is : e.getPlayer().getInventory().getContents()) {
|
||||
if (is == null || !is.hasItemMeta() || is.getItemMeta().getPersistentDataContainer() == null) {
|
||||
@@ -802,7 +802,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.leatherbackpack")) {
|
||||
Inventory inv = Bukkit.createInventory(null, 9,
|
||||
Component.translatable("Kleiner Rucksack DEAD"));
|
||||
inv.setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
inv.setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.leatherbackpack")));
|
||||
for (ItemStack bis : inv.getContents()) {
|
||||
if (bis != null) {
|
||||
@@ -812,7 +812,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
}
|
||||
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.leatherbackpack",
|
||||
itemStackArrayToBase64(itemStack));
|
||||
Helper.itemStackArrayToBase64(itemStack));
|
||||
|
||||
App.main.saveConfig();
|
||||
}
|
||||
@@ -821,7 +821,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
if (App.main.getConfig()
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack")) {
|
||||
Inventory inv = Bukkit.createInventory(null, 18, Component.translatable("Rucksack DEAD"));
|
||||
inv.setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
inv.setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack")));
|
||||
for (ItemStack bis : inv.getContents()) {
|
||||
if (bis != null) {
|
||||
@@ -830,7 +830,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
|
||||
}
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack",
|
||||
itemStackArrayToBase64(itemStack));
|
||||
Helper.itemStackArrayToBase64(itemStack));
|
||||
App.main.saveConfig();
|
||||
}
|
||||
} else if (is.getItemMeta().getPersistentDataContainer().has(App.main.nsk3,
|
||||
@@ -839,7 +839,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack")) {
|
||||
Inventory inv = Bukkit.createInventory(null, 27,
|
||||
Component.translatable("Großer Rucksack DEAD"));
|
||||
inv.setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
inv.setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack")));
|
||||
for (ItemStack bis : inv.getContents()) {
|
||||
if (bis != null) {
|
||||
@@ -848,7 +848,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
|
||||
}
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack",
|
||||
itemStackArrayToBase64(itemStack));
|
||||
Helper.itemStackArrayToBase64(itemStack));
|
||||
App.main.saveConfig();
|
||||
}
|
||||
} else if (is.getItemMeta().getPersistentDataContainer().has(App.main.nsk4,
|
||||
@@ -857,7 +857,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack")) {
|
||||
Inventory inv = Bukkit.createInventory(null, 36,
|
||||
Component.translatable("Riesiger Rucksack DEAD"));
|
||||
inv.setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
inv.setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack")));
|
||||
for (ItemStack bis : inv.getContents()) {
|
||||
if (bis != null) {
|
||||
@@ -866,7 +866,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
|
||||
}
|
||||
App.main.getConfig().set(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack",
|
||||
itemStackArrayToBase64(itemStack));
|
||||
Helper.itemStackArrayToBase64(itemStack));
|
||||
App.main.saveConfig();
|
||||
}
|
||||
}
|
||||
@@ -888,7 +888,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
.equals("R3S_kleiner_Rucksack")) {
|
||||
if (App.main.getConfig()
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.leatherbackpack")) {
|
||||
e.getInventory().setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
e.getInventory().setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.leatherbackpack")));
|
||||
}
|
||||
} else if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
|
||||
@@ -897,7 +897,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
.get(App.main.nsk2, PersistentDataType.STRING).toString().equals("R3S_Rucksack")) {
|
||||
if (App.main.getConfig()
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack")) {
|
||||
e.getInventory().setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
e.getInventory().setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.ironbackpack")));
|
||||
}
|
||||
} else if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
|
||||
@@ -907,7 +907,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
.equals("R3S_großer_Rucksack")) {
|
||||
if (App.main.getConfig()
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack")) {
|
||||
e.getInventory().setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
e.getInventory().setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.goldbackpack")));
|
||||
}
|
||||
} else if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
|
||||
@@ -917,7 +917,7 @@ public class EnvironmentExListeners implements Listener {
|
||||
.equals("R3S_riesiger_Rucksack")) {
|
||||
if (App.main.getConfig()
|
||||
.contains(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack")) {
|
||||
e.getInventory().setContents(itemStackArrayFromBase64(App.main.getConfig()
|
||||
e.getInventory().setContents(Helper.itemStackArrayFromBase64(App.main.getConfig()
|
||||
.getString(e.getPlayer().getUniqueId() + ".backpack.contents.diamondbackpack")));
|
||||
}
|
||||
}
|
||||
@@ -1095,28 +1095,6 @@ public class EnvironmentExListeners implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
static String itemStackArrayToBase64(ItemStack[] itemArray) throws IllegalStateException {
|
||||
|
||||
try {
|
||||
byte[] iss = ItemStack.serializeItemsAsBytes(itemArray);
|
||||
App.main.log(Base64Coder.encodeLines(iss));
|
||||
return Base64Coder.encodeLines(iss);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Error whilst saving items, Please contact the developer", e);
|
||||
}
|
||||
}
|
||||
|
||||
static ItemStack[] itemStackArrayFromBase64(String data) throws IOException {
|
||||
try {
|
||||
App.main.log(data);
|
||||
ItemStack[] is = ItemStack.deserializeItemsFromBytes(Base64Coder.decodeLines(data));
|
||||
return is;
|
||||
} catch (IllegalStateException e) {
|
||||
throw new IOException("Error whilst loading items, Please contact the developer", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTraderDeath(EntityDeathEvent event) {
|
||||
if (event.getEntityType() == EntityType.WANDERING_TRADER) {
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ExpBottleListener implements Listener {
|
||||
public void onUse(PlayerInteractEvent e) {
|
||||
ExperienceManager expMan = new ExperienceManager(e.getPlayer());
|
||||
if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK
|
||||
|| (e.getAction() == Action.RIGHT_CLICK_BLOCK && App.main.isInteractable(e.getClickedBlock()))) {
|
||||
|| (e.getAction() == Action.RIGHT_CLICK_BLOCK && App.helper.isInteractable(e.getClickedBlock()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public class InfinityWaterBucket implements Listener {
|
||||
e.setCancelled(true);
|
||||
Player player = e.getPlayer();
|
||||
if (player.getWorld().getEnvironment() == Environment.NETHER
|
||||
|| (App.main.isInteractable(e.getClickedBlock()) && !e.getPlayer().isSneaking()))
|
||||
|| (App.helper.isInteractable(e.getClickedBlock()) && !e.getPlayer().isSneaking()))
|
||||
return;
|
||||
|
||||
Block block = e.getClickedBlock().getRelative(e.getBlockFace());
|
||||
|
||||
@@ -57,7 +57,7 @@ public class WorkbenchToGo implements Listener {
|
||||
|
||||
if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK
|
||||
|| e.getAction() == Action.PHYSICAL
|
||||
|| (e.getClickedBlock() != null && App.main.isInteractable(e.getClickedBlock()))) {
|
||||
|| (e.getClickedBlock() != null && App.helper.isInteractable(e.getClickedBlock()))) {
|
||||
return;
|
||||
}
|
||||
e.setCancelled(true);
|
||||
|
||||
Reference in New Issue
Block a user