diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..113431c --- /dev/null +++ b/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + + com.zivilon + Shadowhold + 1 + jar + + Shadowhold + + + UTF-8 + 1.7 + 1.7 + + + + + org.bukkit + bukkit + 1.7.10-R0.1-SNAPSHOT + provided + + + com.github.flinbein + PowerNBT + 0.8.9.2 + + + + + package + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 1.7 + 1.7 + + + + + diff --git a/src/main/java/com/zivilon/shadowhold/Shadowhold.java b/src/main/java/com/zivilon/shadowhold/Shadowhold.java new file mode 100644 index 0000000..6a65601 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/Shadowhold.java @@ -0,0 +1,185 @@ +package com.zivilon.shadowhold; + +import org.bukkit.Bukkit; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.Material; +import org.bukkit.Location; +import org.bukkit.block.BlockFace; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.UUID; + +import me.dpohvar.powernbt.api.NBTCompound; +import me.dpohvar.powernbt.api.NBTList; +import me.dpohvar.powernbt.api.NBTManager; + +import com.zivilon.shadowhold.boss_key; +import com.zivilon.shadowhold.chest_list_generator; +import com.zivilon.shadowhold.shadowhold_chest; +import com.zivilon.shadowhold.shadowhold_pillars; +import com.zivilon.shadowhold.commands.shadowhold_command; +import com.zivilon.shadowhold.listeners.damage_listener; +import com.zivilon.shadowhold.listeners.key_listener; +import com.zivilon.shadowhold.listeners.key_click_listener; +import com.zivilon.shadowhold.listeners.pillar_listener; + +public class Shadowhold extends JavaPlugin { + public List key_list = new ArrayList<>(); + public boss_key selected_key; + public List chest_list = new ArrayList<>(); + public shadowhold_chest selected_chest; + public UUID sessionKeyUUID; + public boolean bloodguard_passive = true; + NBTManager NBT_manager = me.dpohvar.powernbt.PowerNBT.getApi(); + + public void add_chest(int x, int y, int z, BlockFace direction, Material chestType, Material blockBelowMaterial, byte blockBelowData) { + shadowhold_chest chest = new shadowhold_chest(x, y, z, direction, chestType, blockBelowMaterial, blockBelowData); + chest_list.add(chest); + } + public void add_key(int x, int y, int z, int count, int offset) { + boss_key key = new boss_key(x, y, z, count, offset); + key_list.add(key); + } + + @Override + public void onEnable() { + // Fired when the server enables the plugin + new chest_list_generator(this); + new key_list_generator(this); + damage_listener listener = new damage_listener(this); + shadowhold_pillars pillars = new shadowhold_pillars(this); + getCommand("shadowhold").setExecutor(new shadowhold_command(this, listener, pillars)); + getServer().getPluginManager().registerEvents(new key_listener(this), this); + getServer().getPluginManager().registerEvents(new damage_listener(this), this); + getServer().getPluginManager().registerEvents(new key_click_listener(this), this); + getServer().getPluginManager().registerEvents(new pillar_listener(this, pillars), this); + getLogger().info("Shadowhold patches enabled!"); + } + + @Override + public void onDisable() { + getLogger().info("Shadowhold patches disabled!"); + } + + public void place_chest() { + Random random = new Random(); + selected_chest = chest_list.get(random.nextInt(chest_list.size())); + sessionKeyUUID = UUID.randomUUID(); // Generate a new UUID + selected_chest.place(sessionKeyUUID); // Pass the UUID to the place method + } + + public void place_key() { + Random random = new Random(); + selected_key = key_list.get(random.nextInt(key_list.size())); + selected_key.place(); + } + + public UUID getSessionKeyUUID() { + return sessionKeyUUID; + } + + public boolean get_bloodguard_passive() { + return bloodguard_passive; + } + public void set_bloodguard_passive(boolean val) { + bloodguard_passive = val; + } + + public shadowhold_chest get_selected_chest() { + return selected_chest; + } + + public void clear_selected_chest() { + selected_chest = null; + } + + public void clear_selected_key() { + selected_key = null; + } + + public boss_key get_selected_key() { + return selected_key; + } + + public void setSessionKeyUUID() { + sessionKeyUUID = null; + } + + public void remove_chests() { + for (shadowhold_chest chest : chest_list) { + chest.remove(); + } + selected_chest = null; + sessionKeyUUID = null; + } + public void reset_keys() { + for (boss_key key : key_list) { + key.reset(); + } + selected_key = null; + } + public boolean is_location(Location location) { + for (boss_key key : key_list) { + if (key.get_x() == location.getBlockX() && key.get_y() == location.getBlockY() - key.get_offset() && key.get_z() == location.getBlockZ()) { + return true; + } + } + return false; + } + public boolean has_key(Location location) { + if (selected_key == null) { + return false; + } + return selected_key.get_x() == location.getBlockX() && selected_key.get_y() == location.getBlockY() - selected_key.get_offset() && selected_key.get_z() == location.getBlockZ(); + } + public void remove_key() { + reset_keys(); + selected_key = null; + } + public void give(final Player player) { + final Material item_material = Material.getMaterial("LOTR_ITEMUTUMNOKEY"); + final String item_name = "§8Key of Secret Shadow"; + List lore = new ArrayList<>(); + lore.add("§5Key used to defeat the Shadowhold Elf"); + lore.add("§5Use on the altar in middle of the room"); + lore.add("§5to diminish his power."); + + ItemStack item = new ItemStack(item_material, 1, (short) 1); + ItemMeta item_meta = item.getItemMeta(); + item_meta.setDisplayName(item_name); + item_meta.setLore(lore); + item.setItemMeta(item_meta); + + // Check if there's space in the player's inventory + if (player.getInventory().firstEmpty() != -1) { + player.getInventory().addItem(item); + + // Now, find the item in the inventory and add the NBT tag + for (ItemStack item_ref : player.getInventory().getContents()) { + if (item_ref != null && item_ref.getType() == item_material && item_ref.getItemMeta().getDisplayName().equals(item_name)) { + // This is the item we just added - add the NBT tag here + NBTCompound compound = NBT_manager.read(item_ref); + + if (getSessionKeyUUID() == null) { + Bukkit.getLogger().warning("UUID from getSessionKeyUUID() is null"); + return; + } + compound.put("ShadowholdBossKeyID", getSessionKeyUUID().toString()); + NBT_manager.write(item_ref, compound); + + break; + } + } + + } + + } + + +} diff --git a/src/main/java/com/zivilon/shadowhold/boss_key.java b/src/main/java/com/zivilon/shadowhold/boss_key.java new file mode 100644 index 0000000..05b1821 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/boss_key.java @@ -0,0 +1,68 @@ +package com.zivilon.shadowhold; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Chest; +import org.bukkit.block.Block; + +import me.dpohvar.powernbt.api.NBTCompound; +import me.dpohvar.powernbt.api.NBTList; +import me.dpohvar.powernbt.api.NBTManager; + +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; + +public class boss_key { + + // 3D coordinates of the location + public int x, y, z, count, offset; + public World world = Bukkit.getWorld("DIM100"); + NBTManager NBT_manager = me.dpohvar.powernbt.PowerNBT.getApi(); + + // Constructor to initialize the fields + public boss_key(int x, int y, int z, int count, int offset) { + this.x = x; + this.y = y; + this.z = z; + this.count = count; + this.offset = offset; + } + + // Getters and setters for all fields + public int get_x() { return this.x; } + public int get_y() { return this.y; } + public int get_z() { return this.z; } + public int get_item_count() { return this.count; } + public int get_offset() { return this.offset; } + + public void reset() { + Block plate = world.getBlockAt(x, y, z); + + // Clear the plate's NBT data + NBTCompound plate_data = NBT_manager.read(plate); + plate_data.remove("FoodItem"); + NBT_manager.write(plate, plate_data); + } + public void place() { + Block plate = world.getBlockAt(x, y, z); + + // Create the item NBTCompound + NBTCompound item = new NBTCompound(); + item.put("id", Material.getMaterial("LOTR_ITEMUTUMNOKEY").getId()); + item.put("Damage", (short) 1); + item.put("Count", (byte) count); + + // Read the plate's NBT data + NBTCompound plate_data = NBT_manager.read(plate); + + // Set the FoodItem and PlateEmpty tags of the plate + plate_data.put("FoodItem", item); + plate_data.put("PlateEmpty", (byte) 0); + + // Write the modified NBT data back to the plate + NBT_manager.write(plate, plate_data); + } +} diff --git a/src/main/java/com/zivilon/shadowhold/chest_list_generator.java b/src/main/java/com/zivilon/shadowhold/chest_list_generator.java new file mode 100644 index 0000000..369cb13 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/chest_list_generator.java @@ -0,0 +1,207 @@ +package com.zivilon.shadowhold; + +import org.bukkit.Material; +import org.bukkit.block.BlockFace; + +import com.zivilon.shadowhold.shadowhold_chest; +import com.zivilon.shadowhold.Shadowhold; + +public class chest_list_generator { + + public Shadowhold shadowhold; + + public chest_list_generator(Shadowhold shadowhold) { + this.shadowhold = shadowhold; + generate_chests(); + } + + public void generate_chests() { + shadowhold.add_chest(-18306, 8, 19200, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18310, 8, 19203, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18314, 8, 19200, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 8, 19195, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 8, 19195, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 8, 19189, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18298, 7, 19189, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18308, 8, 19183, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 8, 19183, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18305, 9, 19173, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESLABSINGLE5"), (byte) 12); + shadowhold.add_chest(-18305, 7, 19173, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18305, 9, 19181, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESLABSINGLE5"), (byte) 12); + shadowhold.add_chest(-18305, 7, 19181, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18289, 9, 19181, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESLABSINGLE5"), (byte) 12); + shadowhold.add_chest(-18289, 7, 19181, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18289, 9, 19180, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESLABSINGLE5"), (byte) 12); + shadowhold.add_chest(-18289, 7, 19180, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18289, 9, 19174, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESLABSINGLE5"), (byte) 12); + shadowhold.add_chest(-18289, 7, 19174, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18289, 9, 19173, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESLABSINGLE5"), (byte) 12); + shadowhold.add_chest(-18289, 7, 19173, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18312, 8, 19171, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 8, 19171, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 8, 19158, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 8, 19158, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 8, 19142, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18310, 8, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18315, 8, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18315, 8, 19130, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEROTTENSLABSINGLE"), (byte) 8); + shadowhold.add_chest(-18317, 9, 19133, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEROTTENSLABSINGLE"), (byte) 8); + shadowhold.add_chest(-18317, 9, 19134, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEROTTENSLABSINGLE"), (byte) 8); + shadowhold.add_chest(-18317, 7, 19133, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18317, 7, 19134, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18321, 8, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18321, 8, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18327, 8, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18333, 8, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18333, 8, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18339, 8, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18339, 8, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18348, 8, 19139, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSANGMARBRICK"), (byte) 5); + shadowhold.add_chest(-18345, 8, 19138, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEPILLAR2"), (byte) 4); + shadowhold.add_chest(-18342, 8, 19139, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSANGMARBRICK"), (byte) 4); + shadowhold.add_chest(-18351, 8, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18351, 8, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18356, 8, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 8, 19142, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 8, 19147, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18368, 7, 19147, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18364, 7, 19144, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18365, 7, 19144, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18364, 7, 19150, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18365, 7, 19150, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18354, 8, 19152, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 8, 19152, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 8, 19157, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 8, 19157, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 8, 19170, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 8, 19170, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18376, 8, 19176, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 8, 19182, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 8, 19182, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18347, 7, 19189, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18348, 8, 19190, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSROTTEN"), (byte) 4); + shadowhold.add_chest(-18350, 8, 19190, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSROTTEN"), (byte) 5); + shadowhold.add_chest(-18367, 7, 19192, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18359, 7, 19194, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18359, 7, 19198, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18367, 7, 19198, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18367, 7, 19200, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18347, 7, 19193, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18348, 8, 19196, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSROTTEN"), (byte) 4); + shadowhold.add_chest(-18350, 8, 19196, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSROTTEN"), (byte) 5); + shadowhold.add_chest(-18355, 8, 19203, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18351, 8, 19201, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18341, 10, 19178, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18341, 16, 19178, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18341, 16, 19194, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18358, 15, 19187, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 15, 19182, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18369, 14, 19182, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18358, 15, 19176, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 15, 19170, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 15, 19161, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 15, 19151, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18365, 14, 19150, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18362, 14, 19149, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18354, 15, 19146, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 15, 19146, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 15, 19142, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 15, 19138, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 15, 19138, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18346, 15, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18346, 15, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18340, 15, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18339, 14, 19133, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18338, 14, 19134, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18338, 14, 19136, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18331, 15, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18327, 15, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18322, 15, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18316, 15, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18316, 15, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18313, 16, 19144, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSANGMARBRICK"), (byte) 6); + shadowhold.add_chest(-18312, 16, 19145, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSANGMARBRICK"), (byte) 5); + shadowhold.add_chest(-18312, 14, 19145, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18313, 14, 19144, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18310, 15, 19139, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESTAIRSANGMARBRICK"), (byte) 7); + shadowhold.add_chest(-18307, 14, 19140, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18307, 14, 19141, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18307, 14, 19143, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18307, 14, 19144, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18308, 15, 19147, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19147, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19152, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 15, 19152, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19157, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19161, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19177, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 15, 19177, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19183, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18300, 14, 19184, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18303, 16, 19181, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEROTTENSLABSINGLE"), (byte) 8); + shadowhold.add_chest(-18304, 16, 19181, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEROTTENSLABSINGLE"), (byte) 8); + shadowhold.add_chest(-18303, 14, 19181, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18304, 14, 19181, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19189, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 15, 19189, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 15, 19195, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 15, 19195, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 15, 19201, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19196, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 21, 19196, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19190, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 21, 19184, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18319, 21, 19187, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 21, 19178, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19178, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19173, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19169, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18299, 20, 19174, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18301, 20, 19156, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18301, 20, 19158, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19160, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19156, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18313, 21, 19154, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18313, 21, 19148, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18301, 20, 19153, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18301, 20, 19152, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18305, 20, 19149, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18308, 21, 19146, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18312, 21, 19146, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18308, 21, 19142, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18310, 21, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18315, 21, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18315, 20, 19133, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18321, 21, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18321, 21, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18327, 21, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18327, 21, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18333, 21, 19146, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEPILLAR2"), (byte) 4); + shadowhold.add_chest(-18339, 21, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18339, 21, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18345, 21, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18345, 21, 19125, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESLABSINGLE9"), (byte) 12); + shadowhold.add_chest(-18351, 21, 19140, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18351, 21, 19144, BlockFace.WEST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 20, 19137, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18354, 20, 19135, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18354, 20, 19133, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18354, 20, 19131, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18356, 20, 19130, BlockFace.EAST, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18358, 20, 19131, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18358, 20, 19133, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18358, 20, 19135, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18358, 20, 19137, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + shadowhold.add_chest(-18358, 21, 19142, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 21, 19147, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 21, 19147, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 21, 19152, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18358, 21, 19152, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 21, 19157, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 21, 19162, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 21, 19167, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 21, 19172, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18354, 21, 19177, BlockFace.NORTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILEBRICK2"), (byte) 0); + shadowhold.add_chest(-18365, 20, 19176, BlockFace.SOUTH, Material.getMaterial("LOTR_TILECHESTSTONE"), Material.getMaterial("LOTR_TILESMOOTHSTONE"), (byte) 0); + } +} diff --git a/src/main/java/com/zivilon/shadowhold/commands/shadowhold_command.java b/src/main/java/com/zivilon/shadowhold/commands/shadowhold_command.java new file mode 100644 index 0000000..505a7b3 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/commands/shadowhold_command.java @@ -0,0 +1,88 @@ +package com.zivilon.shadowhold.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.ChatColor; + +import com.zivilon.shadowhold.Shadowhold; +import com.zivilon.shadowhold.shadowhold_pillars; +import com.zivilon.shadowhold.listeners.damage_listener; + +public class shadowhold_command implements CommandExecutor { + + private Shadowhold shadowhold; + private damage_listener listener; + private shadowhold_pillars pillars; + + public shadowhold_command(Shadowhold shadowhold, damage_listener listener, shadowhold_pillars pillars) { + this.shadowhold = shadowhold; + this.listener = listener; + this.pillars = pillars; + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + if (!sender.hasPermission("shadowhold.admin")) { + sender.sendMessage(ChatColor.RED + "You do not have permission to use this command."); + return true; + } + + if (args.length == 0) { + sender.sendMessage("You must specify an action: place, remove, reset, aggressive."); + return true; + } + + boolean debug_flag = false; + boolean silent_flag = false; + int argument_offset = 0; // this offset helps us handle the arguments correctly + + // Iterate over flags + for (; argument_offset < args.length; argument_offset++) { + if (args[argument_offset].startsWith("-")) { + debug_flag |= args[argument_offset].contains("d"); + silent_flag |= args[argument_offset].contains("s"); + } else { + break; + } + } + + String action = args[0 + argument_offset].toLowerCase(); + + switch (action) { + case "chest_place": + shadowhold.place_chest(); + if (!silent_flag) sender.sendMessage("Chests placed."); + break; + case "chest_reset": + shadowhold.remove_chests(); + if (!silent_flag) sender.sendMessage("Chests removed."); + break; + case "key_place": + shadowhold.place_key(); + if (!silent_flag) sender.sendMessage("Key placed."); + break; + case "key_reset": + shadowhold.reset_keys(); + if (!silent_flag) sender.sendMessage("Keys reset."); + break; + case "pillar_reset": + pillars.reset(); + if (!silent_flag) sender.sendMessage("Pillars reset."); + break; + case "bloodguard_reset": + shadowhold.set_bloodguard_passive(true); + if (!silent_flag) sender.sendMessage(ChatColor.GREEN + "The bloodguard passive has been reset!"); + break; + case "bloodguard_aggressive": + listener.set_aggressive(); + if (!silent_flag) sender.sendMessage(ChatColor.GREEN + "The bloodguard are now aggressive!"); + break; + default: + sender.sendMessage("Invalid action. Valid actions are: place, remove. reset, aggressive"); + break; + } + + return true; + } +} diff --git a/src/main/java/com/zivilon/shadowhold/key_list_generator.java b/src/main/java/com/zivilon/shadowhold/key_list_generator.java new file mode 100644 index 0000000..8ee3785 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/key_list_generator.java @@ -0,0 +1,36 @@ +package com.zivilon.shadowhold; + +import org.bukkit.Material; +import org.bukkit.block.BlockFace; + +import com.zivilon.shadowhold.shadowhold_chest; +import com.zivilon.shadowhold.Shadowhold; + +public class key_list_generator { + + public Shadowhold shadowhold; + + public key_list_generator(Shadowhold shadowhold) { + this.shadowhold = shadowhold; + generate_keys(); + } + + public void generate_keys() { + shadowhold.add_key(-18400, 8, 19257, 44, 1); + shadowhold.add_key(-18390, 8, 19254, 92, 2); + shadowhold.add_key(-18386, 9, 19254, 60, 1); + shadowhold.add_key(-18386, 8, 19268, 60, 1); + shadowhold.add_key(-18394, 14, 19269, 60, 1); + shadowhold.add_key(-18406, 9, 19265, 60, 1); + shadowhold.add_key(-18407, 10, 19253, 60, 1); + shadowhold.add_key(-18398, 8, 19262, 44, 1); + shadowhold.add_key(-18402, 16, 19276, 60, 1); + shadowhold.add_key(-18388, 19, 19267, 60, 1); + shadowhold.add_key(-18389, 18, 19262, 60, 1); + shadowhold.add_key(-18399, 16, 19273, 44, 1); + } +} +// 44 for half block +// 60 for one block +// 76 for one and half blocks +// 92 for two blocks diff --git a/src/main/java/com/zivilon/shadowhold/listeners/damage_listener.java b/src/main/java/com/zivilon/shadowhold/listeners/damage_listener.java new file mode 100644 index 0000000..dca773b --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/listeners/damage_listener.java @@ -0,0 +1,109 @@ +package com.zivilon.shadowhold.listeners; + +import me.dpohvar.powernbt.api.NBTCompound; +import me.dpohvar.powernbt.api.NBTList; +import me.dpohvar.powernbt.api.NBTManager; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import java.util.List; +import java.util.ArrayList; +import java.util.stream.Collectors; + +import com.zivilon.shadowhold.Shadowhold; + +public class damage_listener implements Listener { + + public final Shadowhold shadowhold; + public final NBTManager NBT_manager = me.dpohvar.powernbt.PowerNBT.getApi(); + public final double radius = 50; // Define radius + public final double small_x1 = -18358.5; + public final double small_x2 = -18342; + public final double small_y1 = 5; + public final double small_y2 = 20; + public final double small_z1 = 19237; + public final double small_z2 = 19243; + + public damage_listener(Shadowhold shadowhold) { + this.shadowhold = shadowhold; + } + + @EventHandler + public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { + boolean bloodguard_passive = shadowhold.get_bloodguard_passive(); + Entity entity = event.getEntity(); + if (entity instanceof LivingEntity) { + LivingEntity livingEntity = (LivingEntity) entity; + // check if the entity has the custom NBT tag "shadowhold_section_3_bloodguard" + NBTCompound nbt = NBT_manager.read(livingEntity); + NBTCompound forgeData = nbt.getCompound("ForgeData"); + if (forgeData == null || forgeData.get("CustomId") == null) return; + if (String.valueOf(forgeData.get("CustomId")).equals("shadowhold_section_3_bloodguard_melee") || String.valueOf(forgeData.get("CustomId")).equals("shadowhold_section_3_bloodguard_ranged")) { + if (bloodguard_passive) { + set_aggressive(); + } + Entity damager = event.getDamager(); + if (damager instanceof Player) { + Player player = (Player) damager; + if ((player.getLocation().getX() <= small_x2 && player.getLocation().getX() >= small_x1) && (player.getLocation().getY() <= small_y2 && player.getLocation().getY() >= small_y1) && (player.getLocation().getZ() <= small_z2 && player.getLocation().getZ() >= small_z1)) { + event.setCancelled(true); + } + } + } + } + } + +public void set_aggressive() { + // create a new list of entities to modify, including the damaged entity + World world = Bukkit.getWorld("DIM100"); + List entitiesToModify = getNearbyEntities(world, -18364, 14, 19237, radius); + + for (Entity entityToModify : entitiesToModify) { + NBTCompound entityNBT = NBT_manager.read(entityToModify); + NBTCompound entityForgeData = entityNBT.getCompound("ForgeData"); + if (entityForgeData != null) { // Check if entityForgeData is not null + Object customId = entityForgeData.get("CustomId"); + if (customId != null) { + double speed = "shadowhold_section_3_bloodguard_melee".equals(String.valueOf(customId)) ? 0.25 : + "shadowhold_section_3_bloodguard_ranged".equals(String.valueOf(customId)) ? 0.2 : -1; + + if(speed != -1) { + NBTList attributes = entityNBT.getList("Attributes"); + for (Object attribute : attributes) { + NBTCompound attributeCompound = (NBTCompound) attribute; + if (String.valueOf(attributeCompound.get("Name")).equals("generic.movementSpeed")) { + attributeCompound.put("Base", speed); + break; + } + } + entityNBT.put("NPCPassive", 0); + NBT_manager.write(entityToModify, entityNBT); + } + } + } + } + + // set bloodguard_passive to false + shadowhold.set_bloodguard_passive(false); + shadowhold.getServer().dispatchCommand(shadowhold.getServer().getConsoleSender(), "fakeplayer_run vart run shadowhold:section_3_bloodguard_aggressive"); // Runs script shadowhold:section_3_bloodguard_aggressive as a fake player since scripts cannot be ran as console. +} + + public List getNearbyEntities(World world, double x, double y, double z, double radius) { + List result = new ArrayList<>(); + double radiusSquared = radius * radius; + + for (Entity entity : world.getEntities()) { + if (entity.getLocation().distanceSquared(new Location(world, x, y, z)) <= radiusSquared) { + result.add(entity); + } + } + return result; + } + +} diff --git a/src/main/java/com/zivilon/shadowhold/listeners/key_click_listener.java b/src/main/java/com/zivilon/shadowhold/listeners/key_click_listener.java new file mode 100644 index 0000000..59d18f6 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/listeners/key_click_listener.java @@ -0,0 +1,43 @@ +package com.zivilon.shadowhold.listeners; + +import org.bukkit.event.Event; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.Material; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; + +import com.zivilon.shadowhold.Shadowhold; + +public class key_click_listener implements Listener { + + public Shadowhold shadowhold; + + public key_click_listener(Shadowhold shadowhold) { + this.shadowhold = shadowhold; + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + // Check if the player is right-clicking a block + if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null) { + Location clicked_location = event.getClickedBlock().getLocation(); + + // Check if the block is a possible key location + if (shadowhold.is_location(clicked_location)) { + // Check if the block holds a key + if (shadowhold.has_key(clicked_location)) { + // Remove the key from the block + shadowhold.remove_key(); + + // Give the player the key item with the session UUID + Player player = event.getPlayer(); + player.sendMessage("You have been given a key!"); + shadowhold.give(player); + } + } + } + } +} diff --git a/src/main/java/com/zivilon/shadowhold/listeners/key_listener.java b/src/main/java/com/zivilon/shadowhold/listeners/key_listener.java new file mode 100644 index 0000000..3afbda0 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/listeners/key_listener.java @@ -0,0 +1,72 @@ +package com.zivilon.shadowhold.listeners; + +import me.dpohvar.powernbt.api.NBTCompound; +import me.dpohvar.powernbt.api.NBTManager; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import java.util.Objects; + +import com.zivilon.shadowhold.Shadowhold; + +public class key_listener implements Listener { + public final Shadowhold shadowhold; + public final Location doorLocation = new Location(Bukkit.getWorld("DIM100"), -18334, 10, 19206); + public final NBTManager NBT_manager = me.dpohvar.powernbt.PowerNBT.getApi(); + + public key_listener(Shadowhold shadowhold) { + this.shadowhold = shadowhold; + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + + // Check if the player right-clicked the door block + if (event.getClickedBlock() != null && event.getClickedBlock().getLocation().equals(doorLocation)) { + Player player = event.getPlayer(); + ItemStack itemInHand = player.getInventory().getItemInHand(); + // Only try to read NBT data if there is an item in hand + if (itemInHand != null && itemInHand.getType() != Material.AIR) { + // Read the item's NBT data + NBTCompound itemData = NBT_manager.read(itemInHand); + + + // Check if the item has the ShadowholdKeyID tag + if (itemData != null && itemData.containsKey("ShadowholdKeyID")) { + String keyId = itemData.getString("ShadowholdKeyID"); + if (keyId != null && shadowhold.getSessionKeyUUID() != null && keyId.equals(shadowhold.getSessionKeyUUID().toString())) { + // Remove the key from the player's inventory, run the command and set the session key UUID to null + player.getInventory().removeItem(itemInHand); + shadowhold.getServer().dispatchCommand(shadowhold.getServer().getConsoleSender(), "fakeplayer_run vart run shadowhold:section_2_main_door_open"); + } else { + if(shadowhold.getSessionKeyUUID() == null) { + player.sendMessage("§cAn internal error occurred, please contact an administrator!"); + } else { + player.sendMessage("§7This is not the correct key!"); + } + } + } else { + player.sendMessage("§7You need to find a key to open this."); + } + } else { + player.sendMessage("§7You need to find a key to open this."); + } + } + + + // Check if the player right-clicked the selected chest + if (event.getClickedBlock() != null && shadowhold.get_selected_chest() != null && + event.getClickedBlock().getLocation().equals(shadowhold.get_selected_chest().getLocation())) { + // Run the command and set the selected chest to null + shadowhold.getServer().dispatchCommand(shadowhold.getServer().getConsoleSender(), "fakeplayer_run vart run shadowhold:section_2_key_found"); + shadowhold.clear_selected_chest(); + } + + } +} diff --git a/src/main/java/com/zivilon/shadowhold/listeners/pillar_listener.java b/src/main/java/com/zivilon/shadowhold/listeners/pillar_listener.java new file mode 100644 index 0000000..e3c6506 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/listeners/pillar_listener.java @@ -0,0 +1,72 @@ +package com.zivilon.shadowhold.listeners; + +import org.bukkit.Bukkit; +import org.bukkit.event.Event; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.Material; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.inventory.ItemStack; +import org.bukkit.block.Block; + +import me.dpohvar.powernbt.api.NBTCompound; +import me.dpohvar.powernbt.api.NBTManager; + +import com.zivilon.shadowhold.Shadowhold; +import com.zivilon.shadowhold.shadowhold_pillars; + +public class pillar_listener implements Listener { + + public Shadowhold shadowhold; + public shadowhold_pillars pillars; + public final NBTManager NBT_manager = me.dpohvar.powernbt.PowerNBT.getApi(); + + public pillar_listener(Shadowhold shadowhold, shadowhold_pillars pillars) { + this.shadowhold = shadowhold; + this.pillars = pillars; + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + Player player = event.getPlayer(); + Action action = event.getAction(); + ItemStack item = event.getItem(); + + // Check if the player right-clicked a block + if (action == Action.RIGHT_CLICK_BLOCK) { + Block block = event.getClickedBlock(); + + // Check if the block is a pillar + if (block.getType() == Material.getMaterial("LOTR_TILEGULDURILBRICK")) { + // Check if the player is holding a key + if (item != null && item.getType() == Material.getMaterial("LOTR_ITEMUTUMNOKEY")) { + // Check if the key has the correct NBT tag + NBTCompound compound = NBT_manager.read(item); + if (compound.getString("ShadowholdBossKeyID").equals(shadowhold.getSessionKeyUUID().toString())) { + player.getInventory().setItemInHand(null); + Location block_location = block.getLocation(); + Location pillarNW = new Location(Bukkit.getWorld("DIM100"), -18397d, 13d, 19262d); + Location pillarSW = new Location(Bukkit.getWorld("DIM100"), -18397d, 14d, 19267d); + Location pillarSE = new Location(Bukkit.getWorld("DIM100"), -18393d, 14d, 19267d); + Location pillarNE = new Location(Bukkit.getWorld("DIM100"), -18393d, 13d, 19262d); + if(block_location.equals(pillarNW)) { + pillars.use_key(1, player); + } + else if(block_location.equals(pillarNE)) { + pillars.use_key(2, player); + } + else if(block_location.equals(pillarSE)) { + pillars.use_key(3, player); + } + else if(block_location.equals(pillarSW)) { + pillars.use_key(4, player); + } + } + } + } + } + } +} diff --git a/src/main/java/com/zivilon/shadowhold/shadowhold_chest.java b/src/main/java/com/zivilon/shadowhold/shadowhold_chest.java new file mode 100644 index 0000000..0560334 --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/shadowhold_chest.java @@ -0,0 +1,100 @@ +package com.zivilon.shadowhold; + +import me.dpohvar.powernbt.api.NBTCompound; +import me.dpohvar.powernbt.api.NBTList; +import me.dpohvar.powernbt.api.NBTManager; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Chest; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; + +import java.util.UUID; + +public class shadowhold_chest { + public int x, y, z; // Coordinates + public BlockFace direction; // Chest direction + public Material chest_type; // Type of the chest + public Material block_below_material; // Material of the block below + public byte block_below_data; // Data value of the block below + public World world = Bukkit.getWorld("DIM100"); + + NBTManager NBT_manager = me.dpohvar.powernbt.PowerNBT.getApi(); + + public shadowhold_chest(int x, int y, int z, BlockFace direction, Material chest_type, Material block_below_material, byte block_below_data) { + this.x = x; + this.y = y; + this.z = z; + this.direction = direction; + this.chest_type = chest_type; + this.block_below_material = block_below_material; + this.block_below_data = block_below_data; + + + } + + public Location getLocation() { + return new Location(world, x, y, z); + } + + public void place(UUID sessionKeyUUID) { + Block chest = world.getBlockAt(x, y, z); + chest.setType(chest_type); + + Block block_below = world.getBlockAt(x, y-1, z); + block_below.setType(Material.getMaterial("LOTR_TILEORESTORAGE")); + block_below.setData((byte)10); + + // Create the key item + NBTCompound item = new NBTCompound(); + item.put("id", Material.getMaterial("LOTR_ITEMUTUMNOKEY").getId()); + item.put("Damage", (short) 1); + item.put("Count", (byte) 1); + item.put("Slot", (byte) 13); + + // Create the display NBTCompound + NBTCompound display = new NBTCompound(); + display.put("Name", "§8Shadowhold Key"); + + // Add the lore text + NBTList lore = new NBTList(); + lore.add("§7This key seems to have a slight glow."); + display.put("Lore", lore); + + // Create the tag NBTCompound and add the display and ShadowholdKeyID to it + NBTCompound tag = new NBTCompound(); + tag.put("display", display); + tag.put("ShadowholdKeyID", sessionKeyUUID.toString()); + + // Add the tag to the item + item.put("tag", tag); + + // Insert the item into the chest + NBTCompound chest_data = NBT_manager.read(chest); + NBTList items = chest_data.getList("Items"); + if (items == null) { + items = new NBTList(); + } + items.add(item); + chest_data.put("Items", items); + NBT_manager.write(chest, chest_data); + } + + + public void remove() { + Block chest = world.getBlockAt(x, y, z); + Block block_below = chest.getRelative(BlockFace.DOWN); + + // Clear the chest's NBT data + NBTCompound chest_data = NBT_manager.read(chest); + chest_data.remove("Items"); + NBT_manager.write(chest, chest_data); + + // Set the chest block and the block below back to their original state + chest.setType(chest_type); + block_below.setType(block_below_material); + block_below.setData(block_below_data); + } +} diff --git a/src/main/java/com/zivilon/shadowhold/shadowhold_pillars.java b/src/main/java/com/zivilon/shadowhold/shadowhold_pillars.java new file mode 100644 index 0000000..f91bf1a --- /dev/null +++ b/src/main/java/com/zivilon/shadowhold/shadowhold_pillars.java @@ -0,0 +1,168 @@ +package com.zivilon.shadowhold; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; + +import me.dpohvar.powernbt.api.NBTCompound; +import me.dpohvar.powernbt.api.NBTList; +import me.dpohvar.powernbt.api.NBTManager; + +import java.util.List; + +import com.zivilon.shadowhold.Shadowhold; + +public class shadowhold_pillars { + public Shadowhold shadowhold; + public byte key_count = 0; + public boolean pillarNW = false; + public boolean pillarNE = false; + public boolean pillarSE = false; + public boolean pillarSW = false; + public final NBTManager NBT_manager = me.dpohvar.powernbt.PowerNBT.getApi(); + + public shadowhold_pillars(Shadowhold shadowhold) { + this.shadowhold = shadowhold; + } + + public void depower_boss(Player player) { + List nearbyEntities = player.getNearbyEntities(50.0, 50.0, 50.0); + + for (Entity entity : nearbyEntities) { + if(entity.getType() == EntityType.valueOf("LOTR_TORMENTEDELF")) { + NBTCompound nbt = NBT_manager.read(entity); + if(nbt.containsKey("CustomName") && nbt.getString("CustomName").equals("§8Shadowhold Elf")) { + switch (key_count) { + case 1: + ((NBTCompound)((NBTCompound)nbt.getList("Equipment").get(3)).get("tag")).put("RobesColor", 8947848); + remove_strong4(nbt); + break; + case 2: + ((NBTCompound)((NBTCompound)nbt.getList("Equipment").get(2)).get("tag")).put("RobesColor", 8947848); + remove_strong4(nbt); + break; + case 3: + ((NBTCompound)((NBTCompound)nbt.getList("Equipment").get(1)).get("tag")).put("RobesColor", 8947848); + remove_strong4(nbt); + break; + case 4: + nbt.put("Invulnerable", (byte)0); + remove_strong4(nbt); + break; + } + + NBT_manager.write(entity, nbt); + } + } + } + } + + public void remove_strong4(NBTCompound nbt) { + NBTList inv_list = nbt.getList("NPCItemsInv"); + NBTCompound item = (NBTCompound) inv_list.get(1); // Directly access item at index 1 + if (item.getCompound("tag").containsKey("LOTREnch")) { + NBTList enchants_list = item.getCompound("tag").getList("LOTREnch"); + if (enchants_list.contains("strong4")) { + enchants_list.remove("strong4"); + } + } + NBTList equipment_list = nbt.getList("Equipment"); + NBTCompound held_item = (NBTCompound) equipment_list.get(0); // Directly access item at index 0 + if (held_item.containsKey("tag") && held_item.getCompound("tag").containsKey("LOTREnch")) { + NBTList enchants_list2 = held_item.getCompound("tag").getList("LOTREnch"); + if (enchants_list2.contains("strong4")) { + enchants_list2.remove("strong4"); + } + } + } + + + + + + // useKey will be called when a player right-clicks a pillar block with a valid key + public void use_key(int pillar, Player player) { + + switch (pillar) { + case 1: // NW + pillarNW = true; + set_NW(true); + break; + case 2: // NE + pillarNE = true; + set_NE(true); + break; + case 3: // SE + pillarSE = true; + set_SE(true); + break; + case 4: // SW + pillarSW = true; + set_SW(true); + break; + } + + key_count++; + depower_boss(player); + if (key_count < 4) { + shadowhold.reset_keys(); + shadowhold.place_key(); + } + } + public void set_NW(boolean bool) { + World world = Bukkit.getWorld("DIM100"); + Block block = world.getBlockAt(-18397, 13, 19262); + if (bool) { + block.setType(Material.getMaterial("LOTR_TILEBRICK2")); + block.setData((byte)11); + } else { + block.setType(Material.getMaterial("LOTR_TILEGULDURILBRICK")); + block.setData((byte)9); + } + } + public void set_NE(boolean bool) { + World world = Bukkit.getWorld("DIM100"); + Block block = world.getBlockAt(-18393, 13, 19262); + if (bool) { + block.setType(Material.getMaterial("LOTR_TILEBRICK2")); + block.setData((byte)11); + } else { + block.setType(Material.getMaterial("LOTR_TILEGULDURILBRICK")); + block.setData((byte)9); + } + } + public void set_SE(boolean bool) { + World world = Bukkit.getWorld("DIM100"); + Block block = world.getBlockAt(-18393, 14, 19267); + if (bool) { + block.setType(Material.getMaterial("LOTR_TILEBRICK2")); + block.setData((byte)11); + } else { + block.setType(Material.getMaterial("LOTR_TILEGULDURILBRICK")); + block.setData((byte)9); + } + } + public void set_SW(boolean bool) { + World world = Bukkit.getWorld("DIM100"); + Block block = world.getBlockAt(-18397, 14, 19267); + if (bool) { + block.setType(Material.getMaterial("LOTR_TILEBRICK2")); + block.setData((byte)11); + } else { + block.setType(Material.getMaterial("LOTR_TILEGULDURILBRICK")); + block.setData((byte)9); + } + } + public void reset() { + set_NW(false); + set_NE(false); + set_SW(false); + set_SE(false); + key_count = 0; + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..25b9c37 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,8 @@ +main: com.zivilon.shadowhold.Shadowhold +name: Shadowhold_patches +author: Shinare +version: 1.0 +commands: + shadowhold: + description: Main command for Shadowhold patches. Manages Section 2 key placement and aggression reset. + Usage: /shadowhold \ No newline at end of file