diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index aa562a4..9c848b5 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 2772411..5bfdf22 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.8.6c +version: 3.8.6d commands: money: description: Tells the player the amount of money they are holding. @@ -116,4 +116,9 @@ commands: description: Turns an item into a set. usage: /make_set_item permission: TwosideKeeper.makesetitem + permission-message: No permissions! + craft: + description: Displays the crafting recipe for a custom item. Press Tab after typing /craft to see options. + usage: /craft ITEM + permission: TwosideKeeper.money permission-message: No permissions! \ No newline at end of file diff --git a/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java b/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java index 326a24b..4db97a6 100644 --- a/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java +++ b/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java @@ -2,7 +2,7 @@ package sig.plugin.TwosideKeeper; import org.bukkit.ChatColor; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -40,10 +40,10 @@ public class ActionBarBuffUpdater{ effectString.append(ChatColor.WHITE+"➠"); } else if (pet.equals(PotionEffectType.POISON) || - (pet.equals(PotionEffectType.BLINDNESS) && (p instanceof Monster))) { + (pet.equals(PotionEffectType.BLINDNESS) && (p instanceof LivingEntity && !(p instanceof Player)))) { effectString.append(ChatColor.YELLOW+"☣"); } else - if ((pet.equals(PotionEffectType.UNLUCK) && p instanceof Monster)) { + if ((pet.equals(PotionEffectType.UNLUCK) && (p instanceof LivingEntity && !(p instanceof Player)))) { effectString.append(ChatColor.DARK_RED+"☠"); } else if (pet.equals(PotionEffectType.SLOW)) { diff --git a/src/sig/plugin/TwosideKeeper/Artifact.java b/src/sig/plugin/TwosideKeeper/Artifact.java index 3d4f3d5..c8b9917 100644 --- a/src/sig/plugin/TwosideKeeper/Artifact.java +++ b/src/sig/plugin/TwosideKeeper/Artifact.java @@ -70,7 +70,7 @@ public class Artifact { i=new ItemStack(Material.AIR); break; } - return convert(setName(i,type),type,true); + return convert(setName(i,type),type,true).clone(); } public static ItemStack setName(ItemStack i, ArtifactItem type) { ItemMeta m = i.getItemMeta(); @@ -226,7 +226,7 @@ public class Artifact { m.setLore(lore); m.setDisplayName(ChatColor.BOLD+"Base Artifact "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe"); newitem.setItemMeta(m); - return newitem; + return newitem.clone(); } else { ItemStack newitem = convert(new ItemStack(Material.STAINED_GLASS_PANE,1,(short)item.getDataValue())); @@ -237,7 +237,7 @@ public class Artifact { m.setLore(lore); m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" Artifact "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe"); newitem.setItemMeta(m); - return newitem; + return newitem.clone(); } } diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index b640f4d..230b09e 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -339,9 +339,9 @@ public class CustomDamage { } } } - if (getDamagerEntity(damager) instanceof Monster) { - Monster m = (Monster)getDamagerEntity(damager); - MonsterStructure md = MonsterStructure.getMonsterStructure(m); + if (getDamagerEntity(damager) instanceof LivingEntity) { + LivingEntity m = (Monster)getDamagerEntity(damager); + LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m); md.SetTarget(target); } increaseStrikerSpeed(p); @@ -501,7 +501,7 @@ public class CustomDamage { } public static void appendDebuffsToName(LivingEntity target) { - if (target instanceof Monster) { + if (target instanceof LivingEntity) { if (target.getCustomName()==null) { //Setup name. target.setCustomName(GenericFunctions.CapitalizeFirstLetters(target.getType().name().replace("_", " "))); @@ -549,8 +549,8 @@ public class CustomDamage { private static void triggerEliteBreakEvent(LivingEntity target) { if (target instanceof Monster && - TwosideKeeper.monsterdata.containsKey(target.getUniqueId())) { - MonsterStructure ms = MonsterStructure.getMonsterStructure((Monster)target); + TwosideKeeper.livingentitydata.containsKey(target.getUniqueId())) { + LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure((LivingEntity)target); if (ms.getElite()) { boolean exists=false; for (int i=0;i finallist = new ArrayList(); List nearby = target.getNearbyEntities(2, 2, 2); for (int i=0;i monsterlist = GenericFunctions.getNearbyMobs(m.getLocation(), 10); + List monsterlist = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(10, 10, 10)); mobcount=monsterlist.size()-1; TwosideKeeper.log("Detected mob count: "+mobcount, 5); if (mobcount>0) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index a47d44f..7dc08da 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -54,7 +54,7 @@ import sig.plugin.TwosideKeeper.AwakenedArtifact; import sig.plugin.TwosideKeeper.CustomDamage; import sig.plugin.TwosideKeeper.EliteMonster; import sig.plugin.TwosideKeeper.MonsterController; -import sig.plugin.TwosideKeeper.MonsterStructure; +import sig.plugin.TwosideKeeper.LivingEntityStructure; import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeperAPI; @@ -2388,8 +2388,8 @@ public class GenericFunctions { stackamt=1; } //Modify the color of the name of the monster. - if (ent instanceof Monster) { - Monster m = (Monster)ent; + if (ent instanceof LivingEntity) { + LivingEntity m = (LivingEntity)ent; m.setCustomNameVisible(true); if (m.getCustomName()!=null) { m.setCustomName(getDeathMarkColor(stackamt)+ChatColor.stripColor(GenericFunctions.getDisplayName(m))); @@ -2412,8 +2412,8 @@ public class GenericFunctions { } public static void ResetMobName(LivingEntity ent) { - if (ent instanceof Monster) { - Monster m = (Monster)ent; + if (ent instanceof LivingEntity) { + LivingEntity m = (LivingEntity)ent; m.setCustomNameVisible(false); if (m.getCustomName()!=null) { m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m))); @@ -2861,10 +2861,10 @@ public class GenericFunctions { return true; } } - } - if (entity instanceof Monster) { - Monster m = (Monster)entity; - MonsterStructure md = MonsterStructure.getMonsterStructure(m); + } else + if (entity instanceof LivingEntity) { + LivingEntity m = (LivingEntity)entity; + LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m); if (damager!=null) { if (damager instanceof Projectile) { if (CustomDamage.getDamagerEntity(damager)!=null) { @@ -2892,11 +2892,6 @@ public class GenericFunctions { } } } - if ((entity instanceof LivingEntity) && - !(entity instanceof Monster) && - !(entity instanceof Player)) { - return true; - } TwosideKeeper.log("Returning false... "+TwosideKeeper.getServerTickTime(), 5); return false; } @@ -2911,10 +2906,10 @@ public class GenericFunctions { } else { pd.hitlist.remove(p.getUniqueId()); } - } - if (entity instanceof Monster) { - Monster m = (Monster)entity; - MonsterStructure md = MonsterStructure.getMonsterStructure(m); + } else + if (entity instanceof LivingEntity) { + LivingEntity m = (LivingEntity)entity; + LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m); if (damager!=null) { if (damager instanceof Player) { Player p = (Player)damager; @@ -2945,9 +2940,9 @@ public class GenericFunctions { pd.hitlist.put(p.getUniqueId(), TwosideKeeper.getServerTickTime()); } } else - if (entity instanceof Monster) { - Monster m = (Monster)entity; - MonsterStructure md = MonsterStructure.getMonsterStructure(m); + if (entity instanceof LivingEntity) { + LivingEntity m = (LivingEntity)entity; + LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m); if (damager!=null) { if (damager instanceof Projectile) { if (CustomDamage.getDamagerEntity(damager)!=null) { @@ -3363,7 +3358,8 @@ public class GenericFunctions { } public static void deAggroNearbyTargets(Player p) { - List monsters = getNearbyMobs(p.getLocation(),8); + //List monsters = getNearbyMobs(p.getLocation(),8); + List monsters = CustomDamage.trimNonMonsterEntities(p.getNearbyEntities(8, 8, 8)); for (Monster m : monsters) { if (m.getTarget()!=null && m.getTarget().equals(p) && @@ -3497,7 +3493,7 @@ public class GenericFunctions { GlowAPI.setGlowing(m, color, p); } }*/ - MonsterStructure.getMonsterStructure(m).setGlobalGlow(color); + LivingEntityStructure.getLivingEntityStructure(m).setGlobalGlow(color); } public static void DealDamageToNearbyPlayers(Location l, double basedmg, int range, boolean knockup, double knockupamt, Entity damager, String reason, boolean truedmg) { @@ -3521,8 +3517,8 @@ public class GenericFunctions { //We cleared the non-living entities, deal damage to the rest. double origdmg = basedmg; for (Entity e : ents) { - if (e instanceof Monster) { - Monster m = (Monster)e; + if (e instanceof LivingEntity && !e.equals(damager)) { + LivingEntity m = (LivingEntity)e; if (enoughTicksHavePassed(m,(Player)damager)) { basedmg=origdmg; if (isLineDrive) { @@ -3547,12 +3543,12 @@ public class GenericFunctions { } } - public static List getNearbyMobs(Location l, int range) { + public static List getNearbyMobs(Location l, int range) { Collection ents = l.getWorld().getNearbyEntities(l, range, range, range); - List monsterlist = new ArrayList(); + List monsterlist = new ArrayList(); for (Entity e : ents) { - if ((e instanceof Monster)) { - monsterlist.add((Monster)e); + if ((e instanceof LivingEntity)) { + monsterlist.add((LivingEntity)e); } } return monsterlist; @@ -3570,7 +3566,7 @@ public class GenericFunctions { } public static boolean isEliteMonster(Monster m) { - MonsterStructure md = MonsterStructure.getMonsterStructure(m); + LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m); return md.getElite(); } @@ -4026,7 +4022,9 @@ public class GenericFunctions { p.playSound(p.getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f); final Location newpos=new Location(p.getWorld(),xpos,ypos,zpos); double dmgdealt=CustomDamage.getBaseWeaponDamage(weaponused, p, null); - List monsters = getNearbyMobs(newpos, 2); + //List monsters = getNearbyMobs(newpos, 2); + List ents = new ArrayList(newpos.getWorld().getNearbyEntities(newpos, 2, 2, 2)); + List monsters = CustomDamage.trimNonMonsterEntities(ents); for (int i=0;i ents = ent.getNearbyEntities(range, range, range); int count=0; for (Entity e : ents) { - if (e instanceof Monster && !e.equals(ent)) { + if (e instanceof LivingEntity && !(e instanceof Player) && !e.equals(ent)) { count++; } } return count; } - public static boolean isIsolatedTarget(Monster m, Player p) { - return ((GlowAPI.isGlowing(m, p) && - GlowAPI.getGlowColor(m, p).equals(Color.WHITE)) || - GenericFunctions.GetNearbyMonsterCount(m, 12)==0) && + public static boolean isIsolatedTarget(LivingEntity m, Player p) { + return (GenericFunctions.GetNearbyMonsterCount(m, 12)==0) && PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER; } public static boolean isSpecialGlowMonster(Monster m) { - return MonsterStructure.getMonsterStructure(m).isLeader || - MonsterStructure.getMonsterStructure(m).isElite; + return LivingEntityStructure.getLivingEntityStructure(m).isLeader || + LivingEntityStructure.getLivingEntityStructure(m).isElite; } public static boolean isSuppressed(Entity ent) { @@ -4187,9 +4183,9 @@ public class GenericFunctions { if (!TwosideKeeper.suppressed_entities.contains(ent)) { TwosideKeeper.suppressed_entities.add(ent); } - if (ent instanceof Monster) { + if (ent instanceof LivingEntity) { //MonsterStructure.getMonsterStructure((Monster)ent).setGlobalGlow(GlowAPI.Color.BLACK); - MonsterStructure.getMonsterStructure((Monster)ent).UpdateGlow(); + LivingEntityStructure.getLivingEntityStructure((LivingEntity)ent).UpdateGlow(); } else { GlowAPI.setGlowing(ent, GlowAPI.Color.BLACK, Bukkit.getOnlinePlayers()); } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java index 9f3dfda..beffb94 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java @@ -12,7 +12,6 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; import net.md_5.bungee.api.ChatColor; import sig.plugin.TwosideKeeper.TwosideKeeper; @@ -29,7 +28,7 @@ public class Habitation { // Returns false if the new starting location is not allowed. public boolean addNewStartingLocation(LivingEntity l) { - if (l instanceof Monster) { + if (l instanceof LivingEntity) { String hash = getLocationHash(l.getLocation()); if (locationhashes.containsKey(hash)) { int spawnamt = locationhashes.get(hash); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/InventoryManagement.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/InventoryManagement.java new file mode 100644 index 0000000..b4fab31 --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/InventoryManagement.java @@ -0,0 +1,16 @@ +package sig.plugin.TwosideKeeper.HelperStructures.Common; + +import java.util.HashMap; + +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class InventoryManagement { + public static void transferInventoryToInventory(Inventory from, Inventory to) { + HashMap remaining = to.addItem(from.getContents()); + from.clear(); + for (int i=0;i lore = new ArrayList(); + lore.add("An unsigned check. "+ChatColor.YELLOW+"Right-click"); + lore.add("the check while holding it to"); + lore.add("write a value and sign the check."); + m.setLore(lore); + check.setItemMeta(m); + return check; + } + + private static ShapelessRecipe EmpowerTierRecipe() { + ShapelessRecipe upgraderecipe = new ShapelessRecipe(Artifact.createArtifactItem(ArtifactItem.DIVINE_BASE)); + upgraderecipe.addIngredient(Material.NETHER_STAR); + upgraderecipe.addIngredient(Material.CLAY_BALL); + return upgraderecipe; + } + + private static ShapelessRecipe DecreaseTierRecipe() { + ItemStack newitem = Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE); + newitem.setAmount(2); + ShapelessRecipe upgraderecipe = new ShapelessRecipe(newitem); + upgraderecipe.addIngredient(Material.SUGAR); + return upgraderecipe; + } + + private static ShapelessRecipe IncreaseTierRecipe() { + ItemStack newitem = Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE); + ShapelessRecipe upgraderecipe = new ShapelessRecipe(newitem); + upgraderecipe.addIngredient(2,Material.SUGAR); + return upgraderecipe; + } + + @SuppressWarnings("deprecation") + private static ShapelessRecipe FinalRecipe() { + ShapelessRecipe newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.PICKAXE.getDataValue()))); + newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.PICKAXE.getDataValue()); + newrecipe.addIngredient(Material.SUGAR); + newrecipe.addIngredient(Material.MAGMA_CREAM); + newrecipe.addIngredient(Material.CLAY_BALL); + return newrecipe; + } + + @SuppressWarnings("deprecation") + private static ShapelessRecipe BaseRecipe() { + ShapelessRecipe newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.CHESTPLATE.getDataValue()))); + newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.CHESTPLATE.getDataValue()); + newrecipe.addIngredient(Material.CLAY_BALL); + return newrecipe; + } + + @SuppressWarnings("deprecation") + private static ShapelessRecipe CoreRecipe() { + ShapelessRecipe newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.SHOVEL.getDataValue()))); + newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.SHOVEL.getDataValue()); + newrecipe.addIngredient(Material.MAGMA_CREAM); + return newrecipe; + } + + @SuppressWarnings("deprecation") + private static ShapelessRecipe EssenceRecipe() { + ShapelessRecipe newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.SWORD.getDataValue()))); + newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.SWORD.getDataValue()); + newrecipe.addIngredient(Material.SUGAR); + return newrecipe; + } + + @SuppressWarnings("deprecation") + private static ShapelessRecipe UpgradeRecipe(int i) { + ShapelessRecipe upgrade_recipe = new ShapelessRecipe(ArtifactItemType.SWORD.getTieredItem(i)); + upgrade_recipe.addIngredient(Material.STAINED_GLASS_PANE, ArtifactItemType.SWORD.getDataValue()); + upgrade_recipe.addIngredient(ArtifactItemType.SWORD.getTieredItem(i).getType(),-1); + return upgrade_recipe; + } + + @SuppressWarnings("deprecation") + private static ShapelessRecipe SlabReconstructionRecipe() { + ShapelessRecipe plank_construction_recipe = new ShapelessRecipe(new ItemStack(Material.WOOD,1,(byte)2)); + plank_construction_recipe.addIngredient(2, Material.getMaterial(126), (short)2); + return plank_construction_recipe; + } + + @SuppressWarnings("deprecation") + private static ShapedRecipe WoolRecolorRecipe() { + ShapedRecipe wool_recolor_recipe = new ShapedRecipe(new ItemStack(Material.WOOL,8,(short)4)); + wool_recolor_recipe.shape("wxy","zda","bce"); + wool_recolor_recipe.setIngredient('w', Material.WOOL, (short)2); + wool_recolor_recipe.setIngredient('x', Material.WOOL, (short)4); + wool_recolor_recipe.setIngredient('y', Material.WOOL, (short)6); + wool_recolor_recipe.setIngredient('z', Material.WOOL, (short)8); + wool_recolor_recipe.setIngredient('a', Material.WOOL, (short)10); + wool_recolor_recipe.setIngredient('b', Material.WOOL, (short)12); + wool_recolor_recipe.setIngredient('c', Material.WOOL, (short)14); + wool_recolor_recipe.setIngredient('e', Material.WOOL, (short)11); + wool_recolor_recipe.setIngredient('d', Material.getMaterial(351), (short)4); + return wool_recolor_recipe; + } + + private static ShapedRecipe HardenedRecipe(Material name, Material resource, String line1, String line2, String line3) { + ItemStack blockarmorpc = HardenedPiece(name); + + ShapedRecipe BlockArmor = new ShapedRecipe(blockarmorpc); + BlockArmor.shape(line1,line2,line3); + BlockArmor.setIngredient('a', resource); + return BlockArmor; + } + + public static ItemStack HardenedPiece(Material item) { + ItemStack blockarmorpc = new ItemStack(item); + return GenericFunctions.addHardenedItemBreaks(blockarmorpc, 5, true); + } + + private static ShapedRecipe ArrowQuiverRecipe() { + ShapedRecipe ArrowQuiver = new ShapedRecipe(ArrowQuiver()); + ArrowQuiver.shape("xle","lsl","xlx"); + ArrowQuiver.setIngredient('s', Material.SPECTRAL_ARROW); + ArrowQuiver.setIngredient('l', Material.LEATHER); + ArrowQuiver.setIngredient('e', Material.EMERALD_BLOCK); + + + return ArrowQuiver; + } + + public static ItemStack ArrowQuiver() { + ItemStack arrow_quiver = new ItemStack(Material.TIPPED_ARROW); + + List arrow_quiver_lore = new ArrayList(); + arrow_quiver_lore.add("A quiver that holds many arrows."); + arrow_quiver_lore.add(ChatColor.GRAY+"Arrows Remaining: "+ChatColor.YELLOW+"5"); + ItemMeta arrow_quiver_meta=arrow_quiver.getItemMeta(); + arrow_quiver_meta.setLore(arrow_quiver_lore); + arrow_quiver_meta.setDisplayName(ChatColor.BLUE+"Arrow Quiver"); + arrow_quiver.setItemMeta(arrow_quiver_meta); + + arrow_quiver.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 5); + + arrow_quiver.setAmount(1); + return arrow_quiver; + } + + private static ShapelessRecipe DuplicateEnderItemCubeRecipe() { + ShapelessRecipe ItemCube1 = new ShapelessRecipe(CustomRecipe.ENDER_ITEM_CUBE_DUPLICATE.setCustomRecipeItem(new ItemStack(Material.ENDER_CHEST,2))); + ItemCube1.addIngredient(Material.ENDER_CHEST); + ItemCube1.addIngredient(Material.NETHER_STAR); + return ItemCube1; + } + + private static ShapedRecipe EnderItemCubeRecipe() { + ShapedRecipe ItemCube = new ShapedRecipe(EnderItemCube()); + ItemCube.shape("ooo","ece","ooo"); + ItemCube.setIngredient('o', Material.OBSIDIAN); + ItemCube.setIngredient('e', Material.EMERALD); + ItemCube.setIngredient('c', Material.ENDER_CHEST); + return ItemCube; + } + + public static ItemStack EnderItemCube() { + return EnderItemCube(1); + } + + public static ItemStack EnderItemCube(int amt) { + ItemStack item_ItemCube = new ItemStack(Material.ENDER_CHEST); + item_ItemCube.setAmount(amt); + ItemMeta item_ItemCube_meta=item_ItemCube.getItemMeta(); + List item_ItemCube_lore = new ArrayList(); + item_ItemCube_lore.add("A storage container that can"); + item_ItemCube_lore.add("be carried around. "+ChatColor.GOLD+"Open by"); + item_ItemCube_lore.add(ChatColor.GOLD+"right-clicking."); + item_ItemCube_meta.setLore(item_ItemCube_lore); + item_ItemCube_meta.setDisplayName("Ender Item Cube"); + item_ItemCube.setItemMeta(item_ItemCube_meta); + return item_ItemCube.clone(); + } + + @SuppressWarnings("deprecation") + private static ShapedRecipe LargeItemCubeRecipe() { + ItemStack item_ItemCube = LargeItemCube(); + + ShapedRecipe ItemCube = new ShapedRecipe(item_ItemCube); + ItemCube.shape("ppp","gcg","ppp"); + ItemCube.setIngredient('p', Material.WOOD, -1); + ItemCube.setIngredient('g', Material.GOLD_BLOCK); + ItemCube.setIngredient('c', Material.CHEST); + return ItemCube; + } + + public static ItemStack LargeItemCube() { + ItemStack item_ItemCube = new ItemStack(Material.STORAGE_MINECART); + ItemMeta item_ItemCube_meta=item_ItemCube.getItemMeta(); + List item_ItemCube_lore = new ArrayList(); + item_ItemCube_lore.add("A storage container that can"); + item_ItemCube_lore.add("be carried around. "+ChatColor.GOLD+"Open by"); + item_ItemCube_lore.add(ChatColor.GOLD+"right-clicking."); + item_ItemCube_meta.setLore(item_ItemCube_lore); + item_ItemCube_meta.setDisplayName("Large Item Cube"); + item_ItemCube.setItemMeta(item_ItemCube_meta); + return item_ItemCube.clone(); + } + + @SuppressWarnings("deprecation") + private static ShapedRecipe ItemCubeRecipe() { + ItemStack item_ItemCube = ItemCube(); + + ShapedRecipe ItemCube = new ShapedRecipe(item_ItemCube); + ItemCube.shape("ppp","pcp","ppp"); + ItemCube.setIngredient('p', Material.WOOD, -1); + ItemCube.setIngredient('c', Material.CHEST); + return ItemCube; + } + + public static ItemStack ItemCube() { + ItemStack item_ItemCube = new ItemStack(Material.CHEST); + List item_ItemCube_lore = new ArrayList(); + item_ItemCube_lore.add("A storage container that can"); + item_ItemCube_lore.add("be carried around. "+ChatColor.GOLD+"Open by"); + item_ItemCube_lore.add(ChatColor.GOLD+"right-clicking."); + ItemMeta item_ItemCube_meta=item_ItemCube.getItemMeta(); + item_ItemCube_meta.setLore(item_ItemCube_lore); + item_ItemCube_meta.setDisplayName("Item Cube"); + item_ItemCube.setItemMeta(item_ItemCube_meta); + return item_ItemCube.clone(); + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index de16be1..0f4702f 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -629,6 +629,7 @@ public class Loot { m.setDisplayName(set_name); item.setItemMeta(m); } + item = addEnchantments(item,hardened); return item; } diff --git a/src/sig/plugin/TwosideKeeper/MonsterStructure.java b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java similarity index 76% rename from src/sig/plugin/TwosideKeeper/MonsterStructure.java rename to src/sig/plugin/TwosideKeeper/LivingEntityStructure.java index 63997f8..8fa6c47 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterStructure.java +++ b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java @@ -11,21 +11,21 @@ import org.inventivetalent.glow.GlowAPI; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; -public class MonsterStructure { +public class LivingEntityStructure { public LivingEntity target; public String original_name=""; - public Monster m; + public LivingEntity m; public boolean isLeader=false; public boolean isElite=false; public HashMap hitlist = new HashMap(); public HashMap glowcolorlist = new HashMap(); - public MonsterStructure(Monster m) { + public LivingEntityStructure(LivingEntity m) { target=null; original_name=""; this.m=m; } - public MonsterStructure(Monster m, LivingEntity target) { + public LivingEntityStructure(LivingEntity m, LivingEntity target) { this.target=target; original_name=""; this.m=m; @@ -87,7 +87,7 @@ public class MonsterStructure { if (GenericFunctions.isSuppressed(m)) { setGlow(p,GlowAPI.Color.BLACK); } else - if (getLeader() || GenericFunctions.isBossMonster(m)) { + if (getLeader() || (m instanceof Monster && GenericFunctions.isBossMonster((Monster)m))) { setGlow(p,GlowAPI.Color.DARK_RED); } else if (getElite()) { @@ -112,14 +112,14 @@ public class MonsterStructure { } //Either gets a monster structure that exists or creates a new one. - public static MonsterStructure getMonsterStructure(Monster m) { - UUID id = m.getUniqueId(); - if (TwosideKeeper.monsterdata.containsKey(id)) { - return TwosideKeeper.monsterdata.get(id); + public static LivingEntityStructure getLivingEntityStructure(LivingEntity m2) { + UUID id = m2.getUniqueId(); + if (TwosideKeeper.livingentitydata.containsKey(id)) { + return TwosideKeeper.livingentitydata.get(id); } else { - MonsterStructure newstruct = new MonsterStructure(m); - TwosideKeeper.monsterdata.put(id,newstruct); - return TwosideKeeper.monsterdata.get(id); + LivingEntityStructure newstruct = new LivingEntityStructure(m2); + TwosideKeeper.livingentitydata.put(id,newstruct); + return TwosideKeeper.livingentitydata.get(id); } } } diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index 01bf532..d86de64 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -64,7 +64,7 @@ public class MonsterController { //Zombie leaders have faster movement. ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1)); Monster m = (Monster)ent; - MonsterStructure ms = TwosideKeeper.monsterdata.get(ent.getUniqueId()); + LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(ent.getUniqueId()); MonsterDifficulty md = getMonsterDifficulty(m); ms.SetLeader(true); convertMonster(m,md); @@ -745,7 +745,7 @@ public class MonsterController { m.setMaxHealth(800); //Target is 800 HP. m.setHealth(m.getMaxHealth()); TwosideKeeper.log(m.getCustomName()+" health is "+m.getMaxHealth(), 5); - MonsterStructure ms = MonsterStructure.getMonsterStructure(m); + LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m); ms.SetLeader(true); ms.UpdateGlow(); TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5); @@ -771,7 +771,7 @@ public class MonsterController { m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8)); m.setMaxHealth(1200); //Target is 1200 HP. m.setHealth(m.getMaxHealth()); - MonsterStructure ms = MonsterStructure.getMonsterStructure(m); + LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m); ms.SetLeader(true); ms.UpdateGlow(); TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5); @@ -802,12 +802,12 @@ public class MonsterController { if(isZombieLeader(m)) { m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8)); - MonsterStructure ms = MonsterStructure.getMonsterStructure(m); + LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m); ms.SetLeader(true); ms.UpdateGlow(); m.setMaxHealth(1600); //Target is 1600 HP. m.setHealth(m.getMaxHealth()); - MonsterStructure.getMonsterStructure(m).SetLeader(true); + LivingEntityStructure.getLivingEntityStructure(m).SetLeader(true); TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5); } else { m.setMaxHealth(m.getMaxHealth()*4.0); @@ -836,7 +836,7 @@ public class MonsterController { } m.setCustomNameVisible(true); m.setRemoveWhenFarAway(false); - MonsterStructure ms = MonsterStructure.getMonsterStructure(m); + LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m); ms.SetElite(true); ms.UpdateGlow(); m.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(72.0); @@ -855,7 +855,7 @@ public class MonsterController { m.setMaxHealth(400); m.setHealth(m.getMaxHealth()); m.setCustomName("Zombie Leader"); - MonsterStructure ms = MonsterStructure.getMonsterStructure(m); + LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m); ms.SetLeader(true); ms.UpdateGlow(); TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5); @@ -882,7 +882,7 @@ public class MonsterController { { m.setMaxHealth(32000); //Target is 1600 HP. m.setHealth(m.getMaxHealth()); - MonsterStructure ms = MonsterStructure.getMonsterStructure(m); + LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m); ms.SetLeader(true); ms.UpdateGlow(); TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5); @@ -970,7 +970,7 @@ public class MonsterController { return MonsterController.convertMonster(m); } - public static boolean isChargeZombie(Monster m) { + public static boolean isChargeZombie(LivingEntity m) { if ((m.getType()==EntityType.ZOMBIE || m.getType()==EntityType.PIG_ZOMBIE) && MonsterController.getMonsterDifficulty((Monster)m)==MonsterDifficulty.HELLFIRE) { return true; @@ -978,7 +978,7 @@ public class MonsterController { return false; } - public static boolean isUndead(Monster m) { + public static boolean isUndead(LivingEntity m) { if (m.getType()==EntityType.ZOMBIE || m.getType()==EntityType.PIG_ZOMBIE || m.getType()==EntityType.GIANT || @@ -989,9 +989,9 @@ public class MonsterController { return false; } - public static boolean isHellfireSpider(Monster m) { + public static boolean isHellfireSpider(LivingEntity m) { if ((m.getType()==EntityType.SPIDER || m.getType()==EntityType.CAVE_SPIDER) && - MonsterController.getMonsterDifficulty(m)==MonsterDifficulty.HELLFIRE) { + MonsterController.getMonsterDifficulty((Monster)m)==MonsterDifficulty.HELLFIRE) { return true; } return false; diff --git a/src/sig/plugin/TwosideKeeper/Recipes.java b/src/sig/plugin/TwosideKeeper/Recipes.java index 4eeb7cb..9314e37 100644 --- a/src/sig/plugin/TwosideKeeper/Recipes.java +++ b/src/sig/plugin/TwosideKeeper/Recipes.java @@ -18,415 +18,40 @@ import org.bukkit.potion.PotionEffectType; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType; -import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe; public class Recipes { - @SuppressWarnings("deprecation") public static void Initialize_ItemCube_Recipes() { - ItemStack item_ItemCube = new ItemStack(Material.CHEST); - - List item_ItemCube_lore = new ArrayList(); - item_ItemCube_lore.add("A storage container that can"); - item_ItemCube_lore.add("be carried around. "+ChatColor.GOLD+"Open by"); - item_ItemCube_lore.add(ChatColor.GOLD+"right-clicking."); - ItemMeta item_ItemCube_meta=item_ItemCube.getItemMeta(); - item_ItemCube_meta.setLore(item_ItemCube_lore); - item_ItemCube_meta.setDisplayName("Item Cube"); - item_ItemCube.setItemMeta(item_ItemCube_meta); - ShapedRecipe ItemCube = new ShapedRecipe(item_ItemCube); - ItemCube.shape("ppp","pcp","ppp"); - ItemCube.setIngredient('p', Material.WOOD, -1); - ItemCube.setIngredient('c', Material.CHEST); - Bukkit.addRecipe(ItemCube); + Bukkit.addRecipe(TwosideKeeper.ITEM_CUBE_RECIPE); //------------------------------ - item_ItemCube = new ItemStack(Material.STORAGE_MINECART); - item_ItemCube_meta=item_ItemCube.getItemMeta(); - item_ItemCube_meta.setLore(item_ItemCube_lore); - item_ItemCube_meta.setDisplayName("Large Item Cube"); - item_ItemCube.setItemMeta(item_ItemCube_meta); - ItemCube = new ShapedRecipe(item_ItemCube); - ItemCube.shape("ppp","gcg","ppp"); - ItemCube.setIngredient('p', Material.WOOD, -1); - ItemCube.setIngredient('g', Material.GOLD_BLOCK); - ItemCube.setIngredient('c', Material.CHEST); - - Bukkit.addRecipe(ItemCube); + Bukkit.addRecipe(TwosideKeeper.LARGE_ITEM_CUBE_RECIPE); //------------------------------ - item_ItemCube = new ItemStack(Material.ENDER_CHEST); - item_ItemCube_meta=item_ItemCube.getItemMeta(); - item_ItemCube_meta.setLore(item_ItemCube_lore); - item_ItemCube_meta.setDisplayName("Ender Item Cube"); - item_ItemCube.setItemMeta(item_ItemCube_meta); - - ItemCube = new ShapedRecipe(item_ItemCube); - ItemCube.shape("ooo","ece","ooo"); - ItemCube.setIngredient('o', Material.OBSIDIAN); - ItemCube.setIngredient('e', Material.EMERALD); - ItemCube.setIngredient('c', Material.ENDER_CHEST); - Bukkit.addRecipe(ItemCube); + Bukkit.addRecipe(TwosideKeeper.ENDER_ITEM_CUBE_RECIPE); //------------------------------ - ShapelessRecipe ItemCube1 = new ShapelessRecipe(CustomRecipe.ENDER_ITEM_CUBE_DUPLICATE.setCustomRecipeItem(new ItemStack(Material.ENDER_CHEST,2))); - ItemCube1.addIngredient(Material.ENDER_CHEST); - ItemCube1.addIngredient(Material.NETHER_STAR); - Bukkit.addRecipe(ItemCube1); + + Bukkit.addRecipe(TwosideKeeper.DUPLICATE_ENDER_ITEM_CUBE_RECIPE); } public static void Initialize_ArrowQuiver_Recipe() { - ItemStack arrow_quiver = new ItemStack(Material.TIPPED_ARROW); - - List arrow_quiver_lore = new ArrayList(); - arrow_quiver_lore.add("A quiver that holds many arrows."); - arrow_quiver_lore.add(ChatColor.GRAY+"Arrows Remaining: "+ChatColor.YELLOW+"5"); - ItemMeta arrow_quiver_meta=arrow_quiver.getItemMeta(); - arrow_quiver_meta.setLore(arrow_quiver_lore); - arrow_quiver_meta.setDisplayName(ChatColor.BLUE+"Arrow Quiver"); - arrow_quiver.setItemMeta(arrow_quiver_meta); - - arrow_quiver.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 5); - - arrow_quiver.setAmount(1); - - ShapedRecipe ArrowQuiver = new ShapedRecipe(arrow_quiver); - ArrowQuiver.shape("xle","lsl","xlx"); - ArrowQuiver.setIngredient('s', Material.SPECTRAL_ARROW); - ArrowQuiver.setIngredient('l', Material.LEATHER); - ArrowQuiver.setIngredient('e', Material.EMERALD_BLOCK); - - Bukkit.addRecipe(ArrowQuiver); + Bukkit.addRecipe(TwosideKeeper.ARROW_QUIVER_RECIPE); } public static void Initialize_BlockArmor_Recipes() { - ItemStack blockarmorpc = new ItemStack(Material.IRON_HELMET); - - List blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - ItemMeta blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Iron Helmet"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - ShapedRecipe BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("aaa","axa"); - BlockArmor.setIngredient('a', Material.IRON_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.IRON_CHESTPLATE); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Iron Chestplate"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("axa","aaa","aaa"); - BlockArmor.setIngredient('a', Material.IRON_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.IRON_LEGGINGS); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Iron Leggings"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("aaa","axa","axa"); - BlockArmor.setIngredient('a', Material.IRON_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.IRON_BOOTS); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Iron Boots"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("axa","axa"); - BlockArmor.setIngredient('a', Material.IRON_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.GOLD_HELMET); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Gold Helmet"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("aaa","axa"); - BlockArmor.setIngredient('a', Material.GOLD_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.GOLD_CHESTPLATE); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Gold Chestplate"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("axa","aaa","aaa"); - BlockArmor.setIngredient('a', Material.GOLD_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.GOLD_LEGGINGS); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Gold Leggings"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("aaa","axa","axa"); - BlockArmor.setIngredient('a', Material.GOLD_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.GOLD_BOOTS); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Gold Boots"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("axa","axa"); - BlockArmor.setIngredient('a', Material.GOLD_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.DIAMOND_HELMET); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Diamond Helmet"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("aaa","axa"); - BlockArmor.setIngredient('a', Material.DIAMOND_BLOCK); - - Bukkit.addRecipe(BlockArmor); //-------------------------------------------- - blockarmorpc = new ItemStack(Material.DIAMOND_CHESTPLATE); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Diamond Chestplate"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("axa","aaa","aaa"); - BlockArmor.setIngredient('a', Material.DIAMOND_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - blockarmorpc = new ItemStack(Material.DIAMOND_LEGGINGS); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Diamond Leggings"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("aaa","axa","axa"); - BlockArmor.setIngredient('a', Material.DIAMOND_BLOCK); - - Bukkit.addRecipe(BlockArmor); + Bukkit.addRecipe(TwosideKeeper.HARDENED_IRON_HELMET_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_IRON_CHESTPLATE_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_IRON_LEGGINGS_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_IRON_BOOTS_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_DIAMOND_HELMET_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_DIAMOND_CHESTPLATE_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_DIAMOND_LEGGINGS_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_DIAMOND_BOOTS_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_GOLD_HELMET_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_GOLD_CHESTPLATE_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_GOLD_LEGGINGS_RECIPE); + Bukkit.addRecipe(TwosideKeeper.HARDENED_GOLD_BOOTS_RECIPE); //-------------------------------------------- - blockarmorpc = new ItemStack(Material.DIAMOND_BOOTS); - - blockarmorpc_lore = new ArrayList(); - blockarmorpc_lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor"); - blockarmorpc_lore.add(ChatColor.GRAY+"Twice as strong"); - blockarmorpc_lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+"4"); - blockarmorpc_meta=blockarmorpc.getItemMeta(); - blockarmorpc_meta.setLore(blockarmorpc_lore); - blockarmorpc_meta.setDisplayName(ChatColor.BLUE+"Hardened Diamond Boots"); - blockarmorpc.setItemMeta(blockarmorpc_meta); - - BlockArmor = new ShapedRecipe(blockarmorpc); - BlockArmor.shape("axa","axa"); - BlockArmor.setIngredient('a', Material.DIAMOND_BLOCK); - - Bukkit.addRecipe(BlockArmor); - //-------------------------------------------- - } - public static void Initialize_ItemDeconstruction_Recipes() { - ShapelessRecipe decons_recipe = new ShapelessRecipe(new ItemStack(Material.LEATHER,4)); - decons_recipe.addIngredient(Material.LEATHER_BOOTS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.LEATHER,7)); - decons_recipe.addIngredient(Material.LEATHER_LEGGINGS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.LEATHER,8)); - decons_recipe.addIngredient(Material.LEATHER_CHESTPLATE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.LEATHER,5)); - decons_recipe.addIngredient(Material.LEATHER_HELMET); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.WOOD,2)); - decons_recipe.addIngredient(Material.WOOD_SWORD); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.WOOD,3)); - decons_recipe.addIngredient(Material.WOOD_AXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.WOOD,3)); - decons_recipe.addIngredient(Material.WOOD_PICKAXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.WOOD,2)); - decons_recipe.addIngredient(Material.WOOD_HOE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.WOOD,1)); - decons_recipe.addIngredient(Material.WOOD_SPADE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.COBBLESTONE,2)); - decons_recipe.addIngredient(Material.STONE_SWORD); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.COBBLESTONE,3)); - decons_recipe.addIngredient(Material.STONE_AXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.COBBLESTONE,3)); - decons_recipe.addIngredient(Material.STONE_PICKAXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.COBBLESTONE,2)); - decons_recipe.addIngredient(Material.STONE_HOE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.COBBLESTONE,1)); - decons_recipe.addIngredient(Material.STONE_SPADE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,4)); - decons_recipe.addIngredient(Material.IRON_BOOTS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,7)); - decons_recipe.addIngredient(Material.IRON_LEGGINGS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,8)); - decons_recipe.addIngredient(Material.IRON_CHESTPLATE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,5)); - decons_recipe.addIngredient(Material.IRON_HELMET); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,2)); - decons_recipe.addIngredient(Material.IRON_SWORD); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,3)); - decons_recipe.addIngredient(Material.IRON_AXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,3)); - decons_recipe.addIngredient(Material.IRON_PICKAXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,2)); - decons_recipe.addIngredient(Material.IRON_HOE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.IRON_INGOT,1)); - decons_recipe.addIngredient(Material.IRON_SPADE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,4)); - decons_recipe.addIngredient(Material.GOLD_BOOTS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,7)); - decons_recipe.addIngredient(Material.GOLD_LEGGINGS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,8)); - decons_recipe.addIngredient(Material.GOLD_CHESTPLATE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,5)); - decons_recipe.addIngredient(Material.GOLD_HELMET); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,2)); - decons_recipe.addIngredient(Material.GOLD_SWORD); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,3)); - decons_recipe.addIngredient(Material.GOLD_AXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,3)); - decons_recipe.addIngredient(Material.GOLD_PICKAXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,2)); - decons_recipe.addIngredient(Material.GOLD_HOE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.GOLD_INGOT,1)); - decons_recipe.addIngredient(Material.GOLD_SPADE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,4)); - decons_recipe.addIngredient(Material.DIAMOND_BOOTS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,7)); - decons_recipe.addIngredient(Material.DIAMOND_LEGGINGS); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,8)); - decons_recipe.addIngredient(Material.DIAMOND_CHESTPLATE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,5)); - decons_recipe.addIngredient(Material.DIAMOND_HELMET); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,2)); - decons_recipe.addIngredient(Material.DIAMOND_SWORD); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,3)); - decons_recipe.addIngredient(Material.DIAMOND_AXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,3)); - decons_recipe.addIngredient(Material.DIAMOND_PICKAXE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,2)); - decons_recipe.addIngredient(Material.DIAMOND_HOE); - Bukkit.addRecipe(decons_recipe); - decons_recipe = new ShapelessRecipe(new ItemStack(Material.DIAMOND,1)); - decons_recipe.addIngredient(Material.DIAMOND_SPADE); - Bukkit.addRecipe(decons_recipe); } @SuppressWarnings("deprecation") public static void Initialize_WoolRecolor_Recipes() { @@ -582,38 +207,6 @@ public class Recipes { checkrecipe.addIngredient(Material.FEATHER); Bukkit.addRecipe(checkrecipe); } - public static void Initialize_HunterCompass_Recipe() { - ItemStack huntercompass = new ItemStack(Material.COMPASS); - huntercompass.addUnsafeEnchantment(Enchantment.LUCK, 1); - ItemMeta m = huntercompass.getItemMeta(); - m.setDisplayName(ChatColor.RED+"Hunter's Compass"); - List lore = new ArrayList(); - lore.add("A compass for the true hunter."); - lore.add("Legends tell of hunters that have"); - lore.add("come back with great treasures and"); - lore.add("much wealth from following the."); - lore.add("directions of the guided arrow."); - lore.add(""); - lore.add("You may need to calibrate it by"); - lore.add("holding it first."); - lore.add(""); - lore.add("The compass appears to be slightly"); - lore.add("unstable..."); - m.setLore(lore); - huntercompass.setItemMeta(m); - huntercompass.addUnsafeEnchantment(Enchantment.LUCK, 1); - ShapelessRecipe huntercompass_recipe = new ShapelessRecipe(huntercompass); - huntercompass_recipe.addIngredient(Material.COMPASS); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK); - Bukkit.addRecipe(huntercompass_recipe); - } @SuppressWarnings("deprecation") public static void Initialize_CustomArrow_Recipes() { diff --git a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java index 49ec460..d964e55 100644 --- a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java +++ b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java @@ -16,7 +16,6 @@ import org.bukkit.block.Block; import org.bukkit.block.Chest; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 4477fb6..32b916c 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -127,6 +128,7 @@ import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.metadata.FixedMetadataValue; @@ -167,6 +169,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.Habitation; +import sig.plugin.TwosideKeeper.HelperStructures.Common.RecipeLinker; import sig.plugin.TwosideKeeper.Logging.BowModeLogger; import sig.plugin.TwosideKeeper.Logging.LootLogger; import sig.plugin.TwosideKeeper.Logging.MysteriousEssenceLogger; @@ -460,21 +463,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static CustomItem HARDENED_GOLD_BOOTS; public static CustomItem WOOL_RECOLOR; public static CustomItem SLAB_RECONSTRUCTION; - public static CustomItem ARTIFACT_RECIPE_T1; - public static CustomItem ARTIFACT_RECIPE_T2; - public static CustomItem ARTIFACT_RECIPE_T3; - public static CustomItem ARTIFACT_RECIPE_T4; - public static CustomItem ARTIFACT_RECIPE_T5; - public static CustomItem ARTIFACT_RECIPE_T6; - public static CustomItem ARTIFACT_RECIPE_T7; - public static CustomItem ARTIFACT_RECIPE_T8; - public static CustomItem ARTIFACT_RECIPE_T9; - public static CustomItem ARTIFACT_RECIPE_T10; - public static CustomItem ARTIFACT_RECIPE_T11; - public static CustomItem ARTIFACT_RECIPE_T12; - public static CustomItem ARTIFACT_RECIPE_T13; - public static CustomItem ARTIFACT_RECIPE_T14; - public static CustomItem ARTIFACT_RECIPE_T15; + public static ShapelessRecipe ARTIFACT_RECIPE_T1; + public static ShapelessRecipe ARTIFACT_RECIPE_T2; + public static ShapelessRecipe ARTIFACT_RECIPE_T3; + public static ShapelessRecipe ARTIFACT_RECIPE_T4; + public static ShapelessRecipe ARTIFACT_RECIPE_T5; + public static ShapelessRecipe ARTIFACT_RECIPE_T6; + public static ShapelessRecipe ARTIFACT_RECIPE_T7; + public static ShapelessRecipe ARTIFACT_RECIPE_T8; + public static ShapelessRecipe ARTIFACT_RECIPE_T9; + public static ShapelessRecipe ARTIFACT_RECIPE_T10; + public static ShapelessRecipe ARTIFACT_RECIPE_T11; + public static ShapelessRecipe ARTIFACT_RECIPE_T12; + public static ShapelessRecipe ARTIFACT_RECIPE_T13; + public static ShapelessRecipe ARTIFACT_RECIPE_T14; + public static ShapelessRecipe ARTIFACT_RECIPE_T15; public static CustomItem INCREASE_ARTIFACT_CRAFTING_TIER; public static CustomItem DECREASE_ARTIFACT_CRAFTING_TIER; public static CustomItem EMPOWER_ARTIFACT_CRAFTING_ITEM; @@ -487,7 +490,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static ShapedRecipe ITEM_CUBE_RECIPE; public static ShapedRecipe LARGE_ITEM_CUBE_RECIPE; public static ShapedRecipe ENDER_ITEM_CUBE_RECIPE; - public static ShapedRecipe DUPLICATE_ENDER_ITEM_CUBE_RECIPE; + public static ShapelessRecipe DUPLICATE_ENDER_ITEM_CUBE_RECIPE; public static ShapedRecipe ARROW_QUIVER_RECIPE; public static ShapedRecipe HARDENED_IRON_HELMET_RECIPE; public static ShapedRecipe HARDENED_IRON_CHESTPLATE_RECIPE; @@ -502,31 +505,41 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static ShapedRecipe HARDENED_GOLD_LEGGINGS_RECIPE; public static ShapedRecipe HARDENED_GOLD_BOOTS_RECIPE; public static ShapedRecipe WOOL_RECOLOR_RECIPE; - public static ShapedRecipe SLAB_RECONSTRUCTION_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T1_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T2_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T3_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T4_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T5_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T6_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T7_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T8_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T9_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T10_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T11_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T12_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T13_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T14_RECIPE; - public static ShapedRecipe ARTIFACT_RECIPE_T15_RECIPE; - public static ShapedRecipe INCREASE_ARTIFACT_CRAFTING_TIER_RECIPE; - public static ShapedRecipe DECREASE_ARTIFACT_CRAFTING_TIER_RECIPE; - public static ShapedRecipe EMPOWER_ARTIFACT_CRAFTING_ITEM_RECIPE; - public static ShapedRecipe MONEY_CHECK_RECIPE; - public static ShapedRecipe HANDMADE_ARROW_RECIPE; - public static ShapedRecipe DIAMONDTIPPED_ARROW_RECIPE; - public static ShapedRecipe POISON_ARROW_RECIPE; - public static ShapedRecipe TRAPPING_ARROW_RECIPE; - public static ShapedRecipe EXPLODING_ARROW_RECIPE; + public static ShapelessRecipe SLAB_RECONSTRUCTION_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_SWORD_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_AXE_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_PICKAXE_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_SCYTHE_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_BOW_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_SHOVEL_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_HELMET_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_CHESTPLATE_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_LEGGINGS_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_BOOTS_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_FISHING_ROD_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T2_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T3_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T4_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T5_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T6_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T7_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T8_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T9_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T10_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T11_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T12_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T13_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T14_RECIPE; + public static ShapelessRecipe ARTIFACT_RECIPE_T15_RECIPE; + public static ShapelessRecipe INCREASE_ARTIFACT_CRAFTING_TIER_RECIPE; + public static ShapelessRecipe DECREASE_ARTIFACT_CRAFTING_TIER_RECIPE; + public static ShapelessRecipe EMPOWER_ARTIFACT_CRAFTING_ITEM_RECIPE; + public static ShapelessRecipe MONEY_CHECK_RECIPE; + public static ShapelessRecipe HANDMADE_ARROW_RECIPE; + public static ShapelessRecipe DIAMONDTIPPED_ARROW_RECIPE; + public static ShapelessRecipe POISON_ARROW_RECIPE; + public static ShapelessRecipe TRAPPING_ARROW_RECIPE; + public static ShapelessRecipe EXPLODING_ARROW_RECIPE; public static CustomPotion STRENGTHENING_VIAL; public static CustomPotion LIFE_VIAL; public static CustomPotion HARDENING_VIAL; @@ -544,7 +557,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static File filesave; public static HashMap playerdata; - public static HashMap monsterdata; + public static HashMap livingentitydata; public static SpleefManager TwosideSpleefGames; public static WorldShopManager TwosideShops; public static MysteriousEssenceLogger EssenceLogger; //The logger for Essences. @@ -605,18 +618,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener { loadConfig(); - sig.plugin.TwosideKeeper.Recipes.Initialize_ItemCube_Recipes(); - sig.plugin.TwosideKeeper.Recipes.Initialize_ArrowQuiver_Recipe(); - sig.plugin.TwosideKeeper.Recipes.Initialize_BlockArmor_Recipes(); - //sig.plugin.TwosideKeeper.Recipes.Initialize_ItemDeconstruction_Recipes(); - sig.plugin.TwosideKeeper.Recipes.Initialize_WoolRecolor_Recipes(); - sig.plugin.TwosideKeeper.Recipes.Initialize_SlabReconstruction_Recipes(); - sig.plugin.TwosideKeeper.Recipes.Initialize_Artifact_Recipes(); - sig.plugin.TwosideKeeper.Recipes.Initialize_ArtifactHelper_Recipes(); - sig.plugin.TwosideKeeper.Recipes.Initialize_Check_Recipe(); - //sig.plugin.TwosideKeeper.Recipes.Initialize_HunterCompass_Recipe(); - sig.plugin.TwosideKeeper.Recipes.Initialize_CustomArrow_Recipes(); - sig.plugin.TwosideKeeper.Recipes.Initialize_NotchApple_Recipe(); + + CustomItem.InitializeItemRecipes(); + Recipes.Initialize_ItemCube_Recipes(); + Recipes.Initialize_ArrowQuiver_Recipe(); + Recipes.Initialize_BlockArmor_Recipes(); + //Recipes.Initialize_ItemDeconstruction_Recipes(); + Recipes.Initialize_WoolRecolor_Recipes(); + Recipes.Initialize_SlabReconstruction_Recipes(); + Recipes.Initialize_Artifact_Recipes(); + Recipes.Initialize_ArtifactHelper_Recipes(); + Recipes.Initialize_Check_Recipe(); + //Recipes.Initialize_HunterCompass_Recipe(); + Recipes.Initialize_CustomArrow_Recipes(); + Recipes.Initialize_NotchApple_Recipe(); //Bukkit.createWorld(new WorldCreator("ItemCube")); @@ -676,7 +691,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Initialize Player Data structure. playerdata = new HashMap(); banksessions = new HashMap(); - monsterdata = new HashMap(); + livingentitydata = new HashMap(); validsetitems.add(Material.LEATHER_BOOTS); validsetitems.add(Material.LEATHER_CHESTPLATE); @@ -1193,6 +1208,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener { m.setLore(lore); p.getEquipment().getItemInMainHand().setItemMeta(m); return true; + } else + if (cmd.getName().equalsIgnoreCase("craft")) { + Player p = (Player)sender; + if (args.length==0) { + DisplayArguments(p); + } else { + DisplayCraftingRecipe(p,args[0]); + } + return true; } } else { //Implement console/admin version later (Let's you check any name's money.) @@ -1200,7 +1224,31 @@ public class TwosideKeeper extends JavaPlugin implements Listener { return false; } - @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) + private void DisplayCraftingRecipe(Player p, String string) { + RecipeLinker l = RecipeLinker.valueOf(string); + ItemStack[] newarray = Arrays.copyOfRange(l.getRec(), 1, l.getRec().length); + aPlugin.API.viewRecipe(p, l.getRec()[0], newarray); + } + private void DisplayArguments(Player p) { + p.sendMessage(ChatColor.GREEN+"Choose a recipe to view:"); + int j=0; + TextComponent fin = new TextComponent(""); + for (int i=0;i2) { + tc.addExtra("\n"); + j=0; + } + fin.addExtra(tc); + } + p.spigot().sendMessage(fin); + } + + @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void onPlayerCommand(PlayerCommandPreprocessEvent ev) { log(" "+ChatColor.DARK_GRAY+ev.getPlayer().getName()+" is Executing Command: "+ChatColor.GOLD+ev.getMessage(),3); if (ev.getMessage().contains("/time")) { @@ -1741,7 +1789,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void onPlayerInteract(PlayerInteractEntityEvent ev) { log("Clicked with "+ ev.getHand().name(),5); log("Clicked on: "+ev.getRightClicked().getName(),5); - if (ev.getPlayer().getEquipment().getItemInMainHand().getType()==Material.NAME_TAG && (ev.getRightClicked() instanceof Monster)) { + if (ev.getPlayer().getEquipment().getItemInMainHand().getType()==Material.NAME_TAG && (ev.getRightClicked() instanceof LivingEntity)) { //TwosideKeeper.log("Check this out.", 2); Monster m = (Monster)ev.getRightClicked(); //MonsterController.convertMonster(m,md); @@ -1758,7 +1806,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { },1); } - if ((ev.getRightClicked() instanceof Monster) && (ev.getHand()==EquipmentSlot.OFF_HAND) && + if ((ev.getRightClicked() instanceof LivingEntity) && (ev.getHand()==EquipmentSlot.OFF_HAND) && GenericFunctions.isArtifactEquip(ev.getPlayer().getEquipment().getItemInMainHand())) { boolean bursted=false; bursted = performDeathMark(ev.getPlayer(), bursted); @@ -2598,8 +2646,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { List nearby = player.getNearbyEntities(10, 10, 10); boolean reset=false; for (int i=0;i mobs = GenericFunctions.getNearbyMobs(m.getLocation(), 8); + //List mobs = GenericFunctions.getNearbyMobs(m.getLocation(), 8); + List mobs = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(8, 8, 8)); for (Monster m1 : mobs) { if (!m1.equals(m)) { pd.lastassassinatetime=0; @@ -4612,7 +4666,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { log(" Drops "+"["+(drop.size()+originaldroplist.size())+"]: "+ChatColor.GOLD+ChatColor.stripColor(originaldroplist.toString())+ChatColor.WHITE+","+ChatColor.LIGHT_PURPLE+ChatColor.stripColor(drop.toString()),2); } - monsterdata.remove(m.getUniqueId()); + livingentitydata.remove(m.getUniqueId()); chargezombies.remove(m.getUniqueId()); hellfirespiders.remove(m.getUniqueId()); } @@ -5160,10 +5214,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Player p = (Player)arr.getShooter(); LivingEntity checkent = aPlugin.API.getTargetEntity(p, 100); if (checkent!=null && (checkent instanceof Monster)) { - if (!monsterdata.containsKey(checkent.getUniqueId())) { - MonsterStructure newstruct = new MonsterStructure((Monster)checkent); + if (!livingentitydata.containsKey(checkent.getUniqueId())) { + LivingEntityStructure newstruct = new LivingEntityStructure((Monster)checkent); newstruct.SetTarget(p); - monsterdata.put(checkent.getUniqueId(), newstruct); + livingentitydata.put(checkent.getUniqueId(), newstruct); Monster m = (Monster)checkent; if (!m.hasPotionEffect(PotionEffectType.GLOWING)) { m.setTarget(p); diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java index 0f260fd..0361e3f 100644 --- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java +++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java @@ -302,13 +302,13 @@ final class runServerHeartbeat implements Runnable { } private void MaintainMonsterData() { - Set data= TwosideKeeper.monsterdata.keySet(); - TwosideKeeper.log("Size: "+TwosideKeeper.monsterdata.size(), 2); + Set data= TwosideKeeper.livingentitydata.keySet(); + TwosideKeeper.log("Size: "+TwosideKeeper.livingentitydata.size(), 2); for (UUID id : data) { - MonsterStructure ms = TwosideKeeper.monsterdata.get(id); + LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(id); if (!ms.m.isValid()) { //TwosideKeeper.monsterdata.remove(data); - TwosideKeeper.ScheduleRemoval(TwosideKeeper.monsterdata, ms); + TwosideKeeper.ScheduleRemoval(TwosideKeeper.livingentitydata, ms); TwosideKeeper.ScheduleRemoval(data, id); TwosideKeeper.log("Removed Monster Structure for "+id+".", 2); } else { @@ -318,8 +318,8 @@ final class runServerHeartbeat implements Runnable { } } - public void AddEliteStructureIfOneDoesNotExist(MonsterStructure ms) { - if (ms.isElite || MonsterController.getMonsterDifficulty(ms.m)==MonsterDifficulty.ELITE) { + public void AddEliteStructureIfOneDoesNotExist(LivingEntityStructure ms) { + if (ms.isElite || (ms.m instanceof Monster && MonsterController.getMonsterDifficulty((Monster)(ms.m))==MonsterDifficulty.ELITE)) { //Make it glow dark purple. //GenericFunctions.setGlowing(m, GlowAPI.Color.DARK_PURPLE); boolean hasstruct = false; @@ -329,14 +329,15 @@ final class runServerHeartbeat implements Runnable { } } if (!hasstruct) { - TwosideKeeper.elitemonsters.add(new EliteMonster(ms.m)); + TwosideKeeper.elitemonsters.add(new EliteMonster((Monster)(ms.m))); } } } private void randomlyAggroNearbyEndermen(Player p) { - List ents = GenericFunctions.getNearbyMobs(p.getLocation(), 16); - for (Monster m : ents) { + //List ents = GenericFunctions.getNearbyMobs(p.getLocation(), 16); + List ments = CustomDamage.trimNonMonsterEntities(p.getNearbyEntities(16, 16, 16)); + for (Monster m : ments) { if (Math.random()<=0.05 && !m.hasPotionEffect(PotionEffectType.GLOWING)) { m.setTarget(p); }