Merged with remote dev branch.

anvil_rework
sigonasr2 11 years ago
parent 7f57b060ac
commit beabe96e39
  1. 134
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 361
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -289,11 +289,86 @@ public class Main extends JavaPlugin
Sarayn_recycling_center.addChest(new Location(Bukkit.getWorld("world"), 1541, 57, 154)); Sarayn_recycling_center.addChest(new Location(Bukkit.getWorld("world"), 1541, 57, 154));
recycling_center_list.add(Sarayn_recycling_center); recycling_center_list.add(Sarayn_recycling_center);
//Add Recipe for melon slice crafting.
ShapedRecipe melon_slice = new ShapedRecipe(new ItemStack(Material.MELON, 8));
melon_slice.shape("a");
melon_slice.setIngredient('a', Material.MELON_BLOCK);
Bukkit.addRecipe(melon_slice);
//Add wood slab recombining recipes.
ShapedRecipe oak_planks = new ShapedRecipe(new ItemStack(Material.WOOD, 1, (short) 0));
oak_planks.shape("aa");
oak_planks.setIngredient('a', new ItemStack(Material.WOOD_STEP, 1, (short) 0).getData());
Bukkit.addRecipe(oak_planks);
ShapedRecipe spruce_planks = new ShapedRecipe(new ItemStack(Material.WOOD, 1, (short) 1));
spruce_planks.shape("aa");
spruce_planks.setIngredient('a', new ItemStack(Material.WOOD_STEP, 1, (short) 1).getData());
Bukkit.addRecipe(spruce_planks);
ShapedRecipe birch_planks = new ShapedRecipe(new ItemStack(Material.WOOD, 1, (short) 2));
birch_planks.shape("aa");
birch_planks.setIngredient('a', new ItemStack(Material.WOOD_STEP, 1, (short) 2).getData());
Bukkit.addRecipe(birch_planks);
ShapedRecipe jungle_planks = new ShapedRecipe(new ItemStack(Material.WOOD, 1, (short) 3));
jungle_planks.shape("aa");
jungle_planks.setIngredient('a', new ItemStack(Material.WOOD_STEP, 1, (short) 3).getData());
Bukkit.addRecipe(jungle_planks);
//Add non-wood slab recombining recipes.
ShapedRecipe stone = new ShapedRecipe(new ItemStack(Material.STONE, 1));
stone.shape("aa");
stone.setIngredient('a', new ItemStack(Material.STEP, 1, (short) 0).getData());
Bukkit.addRecipe(stone);
ShapedRecipe sandstone = new ShapedRecipe(new ItemStack(Material.SANDSTONE, 1));
sandstone.shape("aa");
sandstone.setIngredient('a', new ItemStack(Material.STEP, 1, (short) 1).getData());
Bukkit.addRecipe(sandstone);
ShapedRecipe cobblestone = new ShapedRecipe(new ItemStack(Material.COBBLESTONE, 1));
cobblestone.shape("aa");
cobblestone.setIngredient('a', new ItemStack(Material.STEP, 1, (short) 3).getData());
Bukkit.addRecipe(cobblestone);
ShapedRecipe bricks = new ShapedRecipe(new ItemStack(Material.BRICK, 1));
bricks.shape("aa");
bricks.setIngredient('a', new ItemStack(Material.STEP, 1, (short) 4).getData());
Bukkit.addRecipe(bricks);
ShapedRecipe stone_bricks = new ShapedRecipe(new ItemStack(Material.SMOOTH_BRICK, 1));
stone_bricks.shape("aa");
stone_bricks.setIngredient('a', new ItemStack(Material.STEP, 1, (short) 5).getData());
Bukkit.addRecipe(stone_bricks);
ShapedRecipe nether_bricks = new ShapedRecipe(new ItemStack(Material.NETHER_BRICK, 1));
nether_bricks.shape("aa");
nether_bricks.setIngredient('a', new ItemStack(Material.STEP, 1, (short) 6).getData());
Bukkit.addRecipe(nether_bricks);
ShapedRecipe nether_quartz = new ShapedRecipe(new ItemStack(Material.QUARTZ_BLOCK, 1));
nether_quartz.shape("aa");
nether_quartz.setIngredient('a', new ItemStack(Material.STEP, 1, (short) 7).getData());
Bukkit.addRecipe(nether_quartz);
//Add Recipes for chain armor crafting.
ShapedRecipe chain_helmet = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET));
chain_helmet.shape("aaa","b b");
chain_helmet.setIngredient('a', Material.IRON_BLOCK);
chain_helmet.setIngredient('b', Material.IRON_INGOT);
Bukkit.addRecipe(chain_helmet);
ShapedRecipe chain_chestplate = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
chain_chestplate.shape("b b","aba","aaa");
chain_chestplate.setIngredient('a', Material.IRON_BLOCK);
chain_chestplate.setIngredient('b', Material.IRON_INGOT);
Bukkit.addRecipe(chain_chestplate);
ShapedRecipe chain_leggings = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS));
chain_leggings.shape("bbb","a a","a a");
chain_leggings.setIngredient('a', Material.IRON_BLOCK);
chain_leggings.setIngredient('b', Material.IRON_INGOT);
Bukkit.addRecipe(chain_leggings);
ShapedRecipe chain_boots = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_BOOTS));
chain_boots.shape("b a","b a");
chain_boots.setIngredient('a', Material.IRON_BLOCK);
chain_boots.setIngredient('a', Material.IRON_INGOT);
Bukkit.addRecipe(chain_boots);
//Add Recipes for new Block armor crafting. //Add Recipes for new Block armor crafting.
ShapedRecipe Melons = new ShapedRecipe(new ItemStack(Material.MELON, 8));
Melons.shape("a");
Melons.setIngredient('a', Material.MELON_BLOCK);
Bukkit.addRecipe(Melons);
ShapedRecipe iron_helmet = new ShapedRecipe(new ItemStack(Material.IRON_HELMET)); ShapedRecipe iron_helmet = new ShapedRecipe(new ItemStack(Material.IRON_HELMET));
iron_helmet.shape("aaa","a a"); iron_helmet.shape("aaa","a a");
iron_helmet.setIngredient('a', Material.IRON_BLOCK); iron_helmet.setIngredient('a', Material.IRON_BLOCK);
@ -342,6 +417,19 @@ public class Main extends JavaPlugin
diamond_boots.shape("a a","a a"); diamond_boots.shape("a a","a a");
diamond_boots.setIngredient('a', Material.DIAMOND_BLOCK); diamond_boots.setIngredient('a', Material.DIAMOND_BLOCK);
Bukkit.addRecipe(diamond_boots); Bukkit.addRecipe(diamond_boots);
// Add Recipe for fireproof Wooden Slab
ItemStack slab = new ItemStack(Material.STEP, 3, (short) 2);
ItemMeta slab_name = slab.getItemMeta();
slab_name.setDisplayName(ChatColor.RESET+"Fireproof Wood Slab");
slab.setItemMeta(slab_name);
ShapedRecipe fireproof_wood_slab = new ShapedRecipe(slab);
fireproof_wood_slab.shape(" a ","bbb");
fireproof_wood_slab.setIngredient('a', Material.SLIME_BALL);
fireproof_wood_slab.setIngredient('b', Material.WOOD_STEP);
Bukkit.addRecipe(fireproof_wood_slab);
// Add Recipes for Item cube crafting.
ItemStack temp = new ItemStack(Material.CHEST); ItemStack temp = new ItemStack(Material.CHEST);
ItemMeta tempmeta = temp.getItemMeta(); ItemMeta tempmeta = temp.getItemMeta();
tempmeta.setDisplayName(ChatColor.YELLOW+"Item Cube"); tempmeta.setDisplayName(ChatColor.YELLOW+"Item Cube");
@ -375,6 +463,23 @@ public class Main extends JavaPlugin
item_cube.setIngredient('b', Material.HOPPER); item_cube.setIngredient('b', Material.HOPPER);
item_cube.setIngredient('c', Material.DIAMOND_BLOCK); item_cube.setIngredient('c', Material.DIAMOND_BLOCK);
Bukkit.addRecipe(item_cube); Bukkit.addRecipe(item_cube);
temp = new ItemStack(Material.ENDER_CHEST);
tempmeta = temp.getItemMeta();
tempmeta.setDisplayName(ChatColor.BLUE+"Ender Item Cube");
templore = new ArrayList<String>();
templore.add(ChatColor.AQUA+"Contains 27 item slots.");
templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"Click on an item and then");
templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"click the Item Cube to store");
templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"it inside. Right-Click the");
templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"Item Cube to view its contents.");
tempmeta.setLore(templore);
temp.setItemMeta(tempmeta);
item_cube = new ShapedRecipe(temp);
item_cube.shape("cac","aba","cac");
item_cube.setIngredient('a', Material.ENDER_CHEST);
item_cube.setIngredient('b', Material.HOPPER);
item_cube.setIngredient('c', Material.EMERALD_BLOCK);
Bukkit.addRecipe(item_cube);
DMGCALC = new DamageAPI(); DMGCALC = new DamageAPI();
//System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath()); //System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath());
@ -518,7 +623,7 @@ public class Main extends JavaPlugin
Farmer_job.addData("POTATO", 0.015, 3, 0); Farmer_job.addData("POTATO", 0.015, 3, 0);
Farmer_job.addData("NETHER WART", 0.015, 3, 0); Farmer_job.addData("NETHER WART", 0.015, 3, 0);
//Farmer_job.addData("PUMPKIN SEEDS", 0.02, 4, 0); //Farmer_job.addData("PUMPKIN SEEDS", 0.02, 4, 0);
//Farmer_job.addData("PUMPKIN", 0.04, 8, 0); Farmer_job.addData("PUMPKIN", 0.04, 8, 0);
Farmer_job.addData("MELON", 0.05, 10, 0); Farmer_job.addData("MELON", 0.05, 10, 0);
Farmer_job.addData("SEEDS", 0.0025, 1, 1); Farmer_job.addData("SEEDS", 0.0025, 1, 1);
Farmer_job.addData("PUMPKIN SEEDS", 0.005, 2, 1); Farmer_job.addData("PUMPKIN SEEDS", 0.005, 2, 1);
@ -632,6 +737,10 @@ public class Main extends JavaPlugin
Blacksmith_job.addData("WEAK DIAMOND HELMET", 1.15, 480, 0); Blacksmith_job.addData("WEAK DIAMOND HELMET", 1.15, 480, 0);
Blacksmith_job.addData("WEAK DIAMOND LEGGINGS", 1.325, 660, 0); Blacksmith_job.addData("WEAK DIAMOND LEGGINGS", 1.325, 660, 0);
Blacksmith_job.addData("WEAK DIAMOND CHESTPLATE", 1.50, 750, 0); Blacksmith_job.addData("WEAK DIAMOND CHESTPLATE", 1.50, 750, 0);
Blacksmith_job.addData("CHAIN BOOTS", 0.375*5, 80*5, 0);
Blacksmith_job.addData("CHAIN HELMET", 0.50*5, 100*5, 0);
Blacksmith_job.addData("CHAIN LEGGINGS", 0.725*5, 140*5, 0);
Blacksmith_job.addData("CHAIN CHESTPLATE", 0.875*5, 175*5, 0);
Blacksmith_job.addData("IRON BOOTS", 0.375*10, 80*10, 0); Blacksmith_job.addData("IRON BOOTS", 0.375*10, 80*10, 0);
Blacksmith_job.addData("IRON HELMET", 0.50*10, 100*10, 0); Blacksmith_job.addData("IRON HELMET", 0.50*10, 100*10, 0);
Blacksmith_job.addData("IRON LEGGINGS", 0.725*10, 140*10, 0); Blacksmith_job.addData("IRON LEGGINGS", 0.725*10, 140*10, 0);
@ -2800,6 +2909,16 @@ public void checkJukeboxes() {
} }
} }
} }
if (items[j].getType()==Material.ENDER_CHEST) {
if (items[j].hasItemMeta() && items[j].getItemMeta().getLore()!=null) {
List<String> loredata = items[j].getItemMeta().getLore();
for (int m=0;m<loredata.size();m++) {
if (loredata.get(m).equalsIgnoreCase(ChatColor.AQUA+"Contains 27 item slots.")) {
value+=10*items[j].getAmount();
}
}
}
}
if (items[j].getType()==Material.COAL) { if (items[j].getType()==Material.COAL) {
value+=0.001d*items[j].getAmount(); value+=0.001d*items[j].getAmount();
} else } else
@ -3880,10 +3999,13 @@ public void payDay(int time)
if (item.getType()==Material.IRON_AXE) {enchant_data=ENCHANTMENT_DATA.iron_axe;} else if (item.getType()==Material.IRON_AXE) {enchant_data=ENCHANTMENT_DATA.iron_axe;} else
if (item.getType()==Material.GOLD_SPADE) {enchant_data=ENCHANTMENT_DATA.golden_shovel;} else if (item.getType()==Material.GOLD_SPADE) {enchant_data=ENCHANTMENT_DATA.golden_shovel;} else
if (item.getType()==Material.GOLD_AXE) {enchant_data=ENCHANTMENT_DATA.golden_axe;} else if (item.getType()==Material.GOLD_AXE) {enchant_data=ENCHANTMENT_DATA.golden_axe;} else
if (item.getType()==Material.CHAINMAIL_HELMET) {enchant_data=ENCHANTMENT_DATA.chain_helmet;} else
if (item.getType()==Material.CHAINMAIL_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.chain_chestplate;} else
if (item.getType()==Material.CHAINMAIL_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.chain_leggings;} else
if (item.getType()==Material.CHAINMAIL_BOOTS) {enchant_data=ENCHANTMENT_DATA.chain_boots;} else
if (item.getType()==Material.IRON_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.iron_leggings;} else if (item.getType()==Material.IRON_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.iron_leggings;} else
if (item.getType()==Material.DIAMOND_SPADE) {enchant_data=ENCHANTMENT_DATA.diamond_shovel;} else if (item.getType()==Material.DIAMOND_SPADE) {enchant_data=ENCHANTMENT_DATA.diamond_shovel;} else
if (item.getType()==Material.GOLD_BOOTS) {enchant_data=ENCHANTMENT_DATA.golden_boots;} else if (item.getType()==Material.GOLD_BOOTS) {enchant_data=ENCHANTMENT_DATA.golden_boots;} else
if (item.getType()==Material.IRON_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.iron_chestplate;} else
if (item.getType()==Material.GOLD_HELMET) {enchant_data=ENCHANTMENT_DATA.golden_helmet;} else if (item.getType()==Material.GOLD_HELMET) {enchant_data=ENCHANTMENT_DATA.golden_helmet;} else
if (item.getType()==Material.IRON_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.iron_chestplate;} else if (item.getType()==Material.IRON_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.iron_chestplate;} else
if (item.getType()==Material.DIAMOND_PICKAXE) {enchant_data=ENCHANTMENT_DATA.diamond_pickaxe;} else if (item.getType()==Material.DIAMOND_PICKAXE) {enchant_data=ENCHANTMENT_DATA.diamond_pickaxe;} else

@ -3647,10 +3647,10 @@ public class PlayerListener
} }
/*if (e.getBlock().getType()==Material.PUMPKIN) { /*if (e.getBlock().getType()==Material.PUMPKIN) {
this.plugin.gainMoneyExp(p,"Farmer",0.00,1); this.plugin.gainMoneyExp(p,"Farmer",0.00,1);
}*/ }
if (e.getBlock().getType()==Material.MELON_BLOCK) { if (e.getBlock().getType()==Material.MELON_BLOCK) {
this.plugin.gainMoneyExp(p,"Farmer",0.10,10); this.plugin.gainMoneyExp(p,"Farmer",0.10,10);
} }*/
} }
boolean hasfortune; boolean hasfortune;
hasfortune = (p.getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)>0)?true:false; hasfortune = (p.getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)>0)?true:false;
@ -4119,9 +4119,41 @@ public class PlayerListener
@EventHandler @EventHandler
public void onItemPrepareCraft(PrepareItemCraftEvent e) { public void onItemPrepareCraft(PrepareItemCraftEvent e) {
CraftingInventory result = e.getInventory(); CraftingInventory result = e.getInventory();
// Disable melon crafting recipe
if (result.getResult().getType()==Material.MELON_BLOCK) { if (result.getResult().getType()==Material.MELON_BLOCK) {
result.setResult(new ItemStack(Material.AIR)); result.setResult(new ItemStack(Material.AIR));
} }
// Increase stairs recipe efficiency
if (result.getResult().getType()==Material.WOOD_STAIRS) {
result.setResult(new ItemStack(Material.WOOD_STAIRS, 8));
}
if (result.getResult().getType()==Material.BIRCH_WOOD_STAIRS) {
result.setResult(new ItemStack(Material.BIRCH_WOOD_STAIRS, 8));
}
if (result.getResult().getType()==Material.SPRUCE_WOOD_STAIRS) {
result.setResult(new ItemStack(Material.SPRUCE_WOOD_STAIRS, 8));
}
if (result.getResult().getType()==Material.JUNGLE_WOOD_STAIRS) {
result.setResult(new ItemStack(Material.JUNGLE_WOOD_STAIRS, 8));
}
if (result.getResult().getType()==Material.BRICK_STAIRS) {
result.setResult(new ItemStack(Material.BRICK_STAIRS, 8));
}
if (result.getResult().getType()==Material.NETHER_BRICK_STAIRS) {
result.setResult(new ItemStack(Material.NETHER_BRICK_STAIRS, 8));
}
if (result.getResult().getType()==Material.QUARTZ_STAIRS) {
result.setResult(new ItemStack(Material.QUARTZ_STAIRS, 8));
}
if (result.getResult().getType()==Material.SANDSTONE_STAIRS) {
result.setResult(new ItemStack(Material.SANDSTONE_STAIRS, 8));
}
if (result.getResult().getType()==Material.SMOOTH_STAIRS) {
result.setResult(new ItemStack(Material.SMOOTH_STAIRS, 8));
}
if (result.getResult().getType()==Material.IRON_HELMET || if (result.getResult().getType()==Material.IRON_HELMET ||
result.getResult().getType()==Material.IRON_CHESTPLATE || result.getResult().getType()==Material.IRON_CHESTPLATE ||
result.getResult().getType()==Material.IRON_LEGGINGS || result.getResult().getType()==Material.IRON_LEGGINGS ||
@ -6588,7 +6620,6 @@ public ItemStack getGoodie() {
p.setFireTicks(0); p.setFireTicks(0);
p.setFoodLevel(20); p.setFoodLevel(20);
p.setRemainingAir(p.getMaximumAir()); p.setRemainingAir(p.getMaximumAir());
p.updateInventory(); //An attempt to fix inventory desyncs.
this.plugin.REVIVE_EFFECT=90; this.plugin.REVIVE_EFFECT=90;
this.plugin.REVIVE_EFFECT_LOC = p.getLocation(); this.plugin.REVIVE_EFFECT_LOC = p.getLocation();
PersistentExplorerList ev = new PersistentExplorerList(p.getName()); PersistentExplorerList ev = new PersistentExplorerList(p.getName());
@ -6601,7 +6632,6 @@ public ItemStack getGoodie() {
final EntityDamageEvent f = e; final EntityDamageEvent f = e;
if (e.getEntity().getType()==EntityType.PLAYER) { if (e.getEntity().getType()==EntityType.PLAYER) {
final Player p = (Player)e.getEntity(); final Player p = (Player)e.getEntity();
//Bukkit.broadcastMessage("Player Damaged: "+p.getHealth()+" HP, -"+p.getLastDamageCause().getDamage()+" damage");
if (e.getCause()==DamageCause.ENTITY_EXPLOSION || e.getCause()==DamageCause.BLOCK_EXPLOSION) { if (e.getCause()==DamageCause.ENTITY_EXPLOSION || e.getCause()==DamageCause.BLOCK_EXPLOSION) {
e.setDamage(e.getDamage()*2); e.setDamage(e.getDamage()*2);
} }
@ -8295,7 +8325,7 @@ public ItemStack getGoodie() {
if (e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().getLore()!=null) { if (e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().getLore()!=null) {
//Check the Lore. //Check the Lore.
for (int i=0;i<e.getItemInHand().getItemMeta().getLore().size();i++) { for (int i=0;i<e.getItemInHand().getItemMeta().getLore().size();i++) {
if (e.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 9 item slots.") || e.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) { if (e.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 9 item slots.") || e.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.") || e.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 27 item slots.")) {
e.setCancelled(true); e.setCancelled(true);
p.updateInventory(); p.updateInventory();
//The intent is to open the inventory. //The intent is to open the inventory.
@ -9581,10 +9611,11 @@ public ItemStack getGoodie() {
if (event.getCursor()!=null) { if (event.getCursor()!=null) {
//Regardless of the inventory, if we try to put it inside a chest, got to try to insert it in there. //Regardless of the inventory, if we try to put it inside a chest, got to try to insert it in there.
if (event.getCurrentItem()!=null) { if (event.getCurrentItem()!=null) {
if (event.getCursor()!=null && event.getCursor().getType()!=Material.AIR && (event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST) && event.getClick()==ClickType.LEFT) { if (event.getCursor()!=null && event.getCursor().getType()!=Material.AIR && (event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST || event.getCurrentItem().getType()==Material.ENDER_CHEST) && event.getClick()==ClickType.LEFT) {
//We have to attempt to insert the item in the Item Cube. //We have to attempt to insert the item in the Item Cube.
boolean largechest=false; boolean largechest=false;
boolean smallchest=false; boolean smallchest=false;
boolean enderchest=false;
int identifier=-1; int identifier=-1;
if (event.getCurrentItem().getItemMeta().getLore()!=null) { if (event.getCurrentItem().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.
@ -9595,6 +9626,9 @@ public ItemStack getGoodie() {
if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) { if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
largechest=true; largechest=true;
} }
if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 27 item slots.")) {
enderchest=true;
}
if (event.getCurrentItem().getItemMeta().getLore().get(i).contains("ID#")) { if (event.getCurrentItem().getItemMeta().getLore().get(i).contains("ID#")) {
identifier=Integer.valueOf(event.getCurrentItem().getItemMeta().getLore().get(i).replace("ID#", "")); identifier=Integer.valueOf(event.getCurrentItem().getItemMeta().getLore().get(i).replace("ID#", ""));
} }
@ -9617,6 +9651,11 @@ public ItemStack getGoodie() {
newlore.add("ID#"+identifier); newlore.add("ID#"+identifier);
meta.setLore(newlore); meta.setLore(newlore);
event.getCurrentItem().setItemMeta(meta); event.getCurrentItem().setItemMeta(meta);
if (enderchest) {
event.getCurrentItem().setAmount(2);
}
} }
if (smallchest) { if (smallchest) {
FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier);
@ -9749,15 +9788,83 @@ public ItemStack getGoodie() {
} }
this.plugin.saveItemCubeConfig(f, identifier); this.plugin.saveItemCubeConfig(f, identifier);
} }
if (enderchest) {
FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier);
if (!f.contains("created")) {
for (int i=0;i<27;i++) {
f.set("item-"+i, new ItemStack(Material.AIR));
}
f.set("item-0", event.getCursor());
event.getCursor().setType(Material.AIR);
f.set("created", Boolean.valueOf(true));
} else {
//If it does exist already, we need to add it to that inventory.
//Try to find a blank slot in there.
//List<ItemStack> items = new ArrayList<ItemStack>();
//We need to see if we have the inventory opened already...If so we have to add it to THAT one.
Inventory thisinven=Bukkit.createInventory(event.getWhoClicked(), 27, "Item Cube #"+identifier);
boolean changeinven=false;
if (event.getInventory().getTitle().contains("Item Cube") && event.getInventory().getTitle().length()>0) {
if (Integer.valueOf(event.getInventory().getTitle().substring(event.getInventory().getTitle().indexOf("#")).replace("#", ""))==identifier) {
thisinven=event.getInventory();
changeinven=true;
}
}
if (!changeinven) {
for (int i=0;i<27;i++) {
//items.add(f.getItemStack("item-"+i));
if (f.contains("item-"+i)) {
thisinven.addItem(f.getItemStack("item-"+i));
}
}
}
int countinven = countSpace(thisinven,event.getCursor());
if (countinven>=event.getCursor().getAmount()) {
//We can simply add it in no problem.
thisinven.addItem(event.getCursor());
for (int i=0;i<thisinven.getContents().length;i++) {
f.set("item-"+i, thisinven.getItem(i));
}
event.setCursor(new ItemStack(Material.AIR));
this.plugin.saveItemCubeConfig(f, identifier);
//Cancel the event here too.
event.setCancelled(true);
return;
} else
if (countinven>0) {
//We can at least fit a few.
int fit = event.getCursor().getAmount()-countinven;
//Leave behind this many.
ItemStack thisitem = event.getCursor(), thisitem2 = event.getCursor();
thisitem.setAmount(fit);
event.setCursor(thisitem);
//Bukkit.getPlayer("sigonasr2").sendMessage("Cursor gets "+thisitem.getAmount());
thisitem2.setAmount(countinven);
thisinven.addItem(thisitem2);
//Bukkit.getPlayer("sigonasr2").sendMessage("Item Cube gets "+thisitem2.getAmount());
for (int i=0;i<thisinven.getContents().length;i++) {
f.set("item-"+i, thisinven.getItem(i));
}
this.plugin.saveItemCubeConfig(f, identifier);
p.updateInventory();
}
else {
//Well, we can't do anything, just treat it as an item swap.
this.plugin.saveItemCubeConfig(f, identifier);
}
}
this.plugin.saveItemCubeConfig(f, identifier);
}
} }
} }
} }
} }
if (event.getInventory().getType()==InventoryType.CRAFTING /*|| event.getInventory().getType()==InventoryType.CHEST*//*Buggy for some reason. We can't open chests in chests.*/) { if (event.getInventory().getType()==InventoryType.CRAFTING /*|| event.getInventory().getType()==InventoryType.CHEST*//*Buggy for some reason. We can't open chests in chests.*/) {
if (event.getCurrentItem()!=null) { if (event.getCurrentItem()!=null) {
if ((event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST) && event.getClick()==ClickType.RIGHT) { if ((event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST || event.getCurrentItem().getType()==Material.ENDER_CHEST) && event.getClick()==ClickType.RIGHT) {
boolean largechest=false; boolean largechest=false;
boolean smallchest=false; boolean smallchest=false;
boolean enderchest=false;
int identifier=-1; int identifier=-1;
if (event.getCurrentItem().getItemMeta().getLore()!=null) { if (event.getCurrentItem().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.
@ -9768,6 +9875,9 @@ public ItemStack getGoodie() {
if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) { if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
largechest=true; largechest=true;
} }
if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 27 item slots.")) {
enderchest=true;
}
if (event.getCurrentItem().getItemMeta().getLore().get(i).contains("ID#")) { if (event.getCurrentItem().getItemMeta().getLore().get(i).contains("ID#")) {
identifier=Integer.valueOf(event.getCurrentItem().getItemMeta().getLore().get(i).replace("ID#", "")); identifier=Integer.valueOf(event.getCurrentItem().getItemMeta().getLore().get(i).replace("ID#", ""));
} }
@ -9790,6 +9900,10 @@ public ItemStack getGoodie() {
newlore.add("ID#"+identifier); newlore.add("ID#"+identifier);
meta.setLore(newlore); meta.setLore(newlore);
event.getCurrentItem().setItemMeta(meta); event.getCurrentItem().setItemMeta(meta);
if (enderchest) {
event.getCurrentItem().setAmount(2);
}
} }
Inventory screen = null; Inventory screen = null;
if (smallchest) { if (smallchest) {
@ -9824,6 +9938,22 @@ public ItemStack getGoodie() {
} }
this.plugin.saveItemCubeConfig(f, identifier); this.plugin.saveItemCubeConfig(f, identifier);
} }
if (enderchest) {
FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier);
if (!f.contains("created")) {
for (int i=0;i<27;i++) {
f.set("item-"+i, new ItemStack(Material.AIR));
}
f.set("created", Boolean.valueOf(true));
}
//List<ItemStack> items = new ArrayList<ItemStack>();
screen=Bukkit.createInventory(event.getWhoClicked(), 27, "Ender Item Cube #"+identifier);
for (int i=0;i<27;i++) {
//items.add(f.getItemStack("item-"+i));
screen.setItem(i, f.getItemStack("item-"+i));
}
this.plugin.saveItemCubeConfig(f, identifier);
}
if (screen!=null) { if (screen!=null) {
event.getWhoClicked().closeInventory(); event.getWhoClicked().closeInventory();
event.getWhoClicked().openInventory(screen); event.getWhoClicked().openInventory(screen);
@ -9837,7 +9967,7 @@ public ItemStack getGoodie() {
if (event.getInventory().getType()==InventoryType.CHEST && !event.getInventory().getName().equalsIgnoreCase("Notification Options")) { if (event.getInventory().getType()==InventoryType.CHEST && !event.getInventory().getName().equalsIgnoreCase("Notification Options")) {
//If we click a chest, make sure it's not the same ID chest. //If we click a chest, make sure it's not the same ID chest.
if (event.getCurrentItem()!=null) { if (event.getCurrentItem()!=null) {
if ((event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST)) { if ((event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST || event.getCurrentItem().getType()==Material.ENDER_CHEST)) {
int identifier=-1; int identifier=-1;
if (event.getCurrentItem().getItemMeta().getLore()!=null) { if (event.getCurrentItem().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.
@ -10016,6 +10146,22 @@ public ItemStack getGoodie() {
this.plugin.gainMoneyExp(p,"Blacksmith",0.35*amount,40*amount); this.plugin.gainMoneyExp(p,"Blacksmith",0.35*amount,40*amount);
crafteditem=true; crafteditem=true;
} }
if (item.getType()==Material.CHAINMAIL_BOOTS) {
this.plugin.gainMoneyExp(p,"Blacksmith",0.375*0.5*amount,80*0.5*amount);
crafteditem=true;
}
if (item.getType()==Material.CHAINMAIL_HELMET) {
this.plugin.gainMoneyExp(p,"Blacksmith",0.50*0.5*amount,100*0.5*amount);
crafteditem=true;
}
if (item.getType()==Material.CHAINMAIL_LEGGINGS) {
this.plugin.gainMoneyExp(p,"Blacksmith",0.725*0.5*amount,140*0.5*amount);
crafteditem=true;
}
if (item.getType()==Material.CHAINMAIL_CHESTPLATE) {
this.plugin.gainMoneyExp(p,"Blacksmith",0.875*0.5*amount,175*0.5*amount);
crafteditem=true;
}
if (item.getType()==Material.IRON_BOOTS) { if (item.getType()==Material.IRON_BOOTS) {
int mult=1; int mult=1;
if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) {
@ -10145,6 +10291,23 @@ public ItemStack getGoodie() {
crafteditem=true; crafteditem=true;
} }
} }
/*if (e.getBlock().getType()==Material.PUMPKIN) {
this.plugin.gainMoneyExp(p,"Farmer",0.00,1);
}
if (e.getBlock().getType()==Material.MELON_BLOCK) {
this.plugin.gainMoneyExp(p,"Farmer",0.10,10);
}*/
if (this.plugin.PlayerinJob(p,"Farmer")) {
boolean crafteditem=false;
if (item.getType()==Material.MELON) {
this.plugin.gainMoneyExp(p,"Farmer",0.10,10);
crafteditem=true;
}
if (item.getType()==Material.PUMPKIN_SEEDS) {
this.plugin.gainMoneyExp(p,"Farmer",0.04,8);
crafteditem=true;
}
}
if (this.plugin.PlayerinJob(p,"Cook")) { if (this.plugin.PlayerinJob(p,"Cook")) {
boolean crafteditem=false; boolean crafteditem=false;
if (item.getType()==Material.BREAD) { if (item.getType()==Material.BREAD) {
@ -11318,109 +11481,71 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
@EventHandler @EventHandler
public void onPlayerDeath(PlayerDeathEvent e) { public void onPlayerDeath(PlayerDeathEvent e) {
//Delay this for 5 ticks. See if Fatal Survivor kicked in in time. (Or you got healed). Player p = e.getEntity();
//Bukkit.broadcastMessage("Player Death: "+e.getEntity().getHealth()+" HP, Last Damage: -"+e.getEntity().getLastDamage()+" from "+e.getEntity().getLastDamageCause());
//If we have Fatal Survivor, use the force! Otherwise, uh, you're dead.
final Player p = e.getEntity();
e.setDeathMessage(e.getDeathMessage().replace(p.getScoreboard().getTeam(p.getName()).getPrefix()+p.getName()+p.getScoreboard().getTeam(p.getName()).getSuffix(),p.getName())); e.setDeathMessage(e.getDeathMessage().replace(p.getScoreboard().getTeam(p.getName()).getPrefix()+p.getName()+p.getScoreboard().getTeam(p.getName()).getSuffix(),p.getName()));
p.getScoreboard().getTeam(p.getName()).setSuffix(""); p.getScoreboard().getTeam(p.getName()).setSuffix("");
boolean survivor=false; for (int i=0;i<this.plugin.explorerlist.size();i++) {
if (this.plugin.PlayerinJob(p, "Explorer")) { if (Bukkit.getPlayer(this.plugin.explorerlist.get(i).player)!=null) {
if (this.plugin.getJobLv("Explorer", p)>=10) { Player p2 =Bukkit.getPlayer(this.plugin.explorerlist.get(i).player);
//Check to see if our "fatal s urvivor" effect is available. if (p.equals(p2)) {
for (int i=0;i<this.plugin.explorers.size();i++) { //This is an explorer in the explorer data.
if (this.plugin.explorers.get(i).event==0 && this.plugin.explorers.get(i).name.compareTo(p.getName())==0) { this.plugin.explorerlist.get(i).wedied=true;
survivor=true;
break;
}
} }
PersistentExplorerList eve = new PersistentExplorerList(p.getName());
eve.event=1;
eve.data=p.getExp();
eve.data2=p.getLevel();
eve.expiretime=Main.SERVER_TICK_TIME+1200;
this.plugin.explorers.add(eve);
if (!survivor) {
final List<ItemStack> drops = e.getDrops();
e.getDrops().clear();
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
for (int i=0;i<drops.size();i++) {
p.getInventory().addItem(drops.get(i));
}
}
},1);
FatalSurvivor(p);
}
}
}
if (survivor || !this.plugin.PlayerinJob(p, "Explorer")) {
//You are dead buddy.
for (int i=0;i<plugin.explorerlist.size();i++) {
if (Bukkit.getPlayer(plugin.explorerlist.get(i).player)!=null) {
Player p2 =Bukkit.getPlayer(plugin.explorerlist.get(i).player);
if (p.equals(p2)) {
//This is an explorer in the explorer data.
plugin.explorerlist.get(i).wedied=true;
}
}
}
if (!plugin.PlayerinJob(p, "Explorer") || (plugin.PlayerinJob(p, "Explorer") && plugin.getJobLv("Explorer", p)<20)) {
double balance = Main.economy.getBalance(p.getName());
double lose = plugin.getConfig().getDouble("losemoney.LoseAmount");
double loseAmount = Main.economy.getBalance(p.getName()) / 100.0D * lose;
String message = "You lost $%amount because you died.";
DecimalFormat df = new DecimalFormat("#0.00");
loseAmount = Double.parseDouble(df.format(loseAmount));
if (Main.economy.has(p.getName(), loseAmount)) {
plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + loseAmount + "$");
Main.economy.withdrawPlayer(p.getName(), loseAmount);
message = message.replaceAll("%amount", String.valueOf(loseAmount));
} else {
plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + balance + "$");
Main.economy.withdrawPlayer(p.getName(), balance);
message = message.replaceAll("%amount", String.valueOf(balance));
}
p.sendMessage(message);
}
if (plugin.PlayerinJob(p,"Explorer")) {
PersistentExplorerList eve = new PersistentExplorerList(p.getName());
eve.event=2;
eve.expiretime=Main.SERVER_TICK_TIME+3600;
plugin.explorers.add(eve);
} }
}
if (!this.plugin.PlayerinJob(p, "Explorer") || (this.plugin.PlayerinJob(p, "Explorer") && this.plugin.getJobLv("Explorer", p)<20)) {
double balance = Main.economy.getBalance(p.getName());
double lose = this.plugin.getConfig().getDouble("losemoney.LoseAmount");
double loseAmount = Main.economy.getBalance(p.getName()) / 100.0D * lose;
String message = "You lost $%amount because you died.";
DecimalFormat df = new DecimalFormat("#0.00"); DecimalFormat df = new DecimalFormat("#0.00");
double deathX = p.getLocation().getX(); loseAmount = Double.parseDouble(df.format(loseAmount));
double deathY = p.getLocation().getY(); if (Main.economy.has(p.getName(), loseAmount)) {
double deathZ = p.getLocation().getZ(); this.plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + loseAmount + "$");
String deathWorld = p.getLocation().getWorld().getName(); Main.economy.withdrawPlayer(p.getName(), loseAmount);
plugin.getAccountsConfig().set(p.getName() + ".deathpointX",Double.valueOf(deathX)); message = message.replaceAll("%amount", String.valueOf(loseAmount));
plugin.getAccountsConfig().set(p.getName() + ".deathpointY",Double.valueOf(deathY));
plugin.getAccountsConfig().set(p.getName() + ".deathpointZ",Double.valueOf(deathZ));
plugin.getAccountsConfig().set(p.getName() + ".deathworld",String.valueOf(deathWorld));
plugin.getAccountsConfig().set(p.getName() + ".revived",Boolean.valueOf(false));
plugin.getAccountsConfig().set(p.getName() + ".revivetime",Long.valueOf(Main.SERVER_TICK_TIME));
plugin.saveAccountsConfig();
double mincost = plugin.getConfig().getDouble("revive-cost-rate");
if (p.getBedSpawnLocation()!=null) {
mincost *= Math.abs(p.getBedSpawnLocation().getX()-deathX)+Math.abs(p.getBedSpawnLocation().getY()-deathY)+Math.abs(p.getBedSpawnLocation().getZ()-deathZ);
} else { } else {
mincost *= Math.abs(Bukkit.getWorld("world").getSpawnLocation().getX()-deathX)+Math.abs(Bukkit.getWorld("world").getSpawnLocation().getY()-deathY)+Math.abs(Bukkit.getWorld("world").getSpawnLocation().getZ()-deathZ); this.plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + balance + "$");
} Main.economy.withdrawPlayer(p.getName(), balance);
double mymoney = plugin.getAccountsConfig().getDouble(p.getName() + ".money"); message = message.replaceAll("%amount", String.valueOf(balance));
double finalcost = (mincost*plugin.getConfig().getDouble("revive-cost-rate")) + (mymoney*plugin.getConfig().getDouble("revive-cost-tax"));
if (plugin.PlayerinJob(p, "Explorer") && plugin.getJobLv("Explorer", p)>=20) {
finalcost*=0.25;
}
if (mymoney>=mincost) {
p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive. To revive, type /revive me.");
} else {
p.sendMessage("You died. You do not have enough money in your bank to revive.");
p.sendMessage("Cost: $"+df.format(finalcost)+". If you want to revive, type "+ChatColor.AQUA+"/revive me"+ChatColor.WHITE+" when you have enough.");
} }
p.sendMessage(message);
} }
if (this.plugin.PlayerinJob(p,"Explorer")) {
PersistentExplorerList eve = new PersistentExplorerList(p.getName());
eve.event=2;
eve.expiretime=Main.SERVER_TICK_TIME+3600;
this.plugin.explorers.add(eve);
}
DecimalFormat df = new DecimalFormat("#0.00");
double deathX = p.getLocation().getX();
double deathY = p.getLocation().getY();
double deathZ = p.getLocation().getZ();
String deathWorld = p.getLocation().getWorld().getName();
this.plugin.getAccountsConfig().set(p.getName() + ".deathpointX",Double.valueOf(deathX));
this.plugin.getAccountsConfig().set(p.getName() + ".deathpointY",Double.valueOf(deathY));
this.plugin.getAccountsConfig().set(p.getName() + ".deathpointZ",Double.valueOf(deathZ));
this.plugin.getAccountsConfig().set(p.getName() + ".deathworld",String.valueOf(deathWorld));
this.plugin.getAccountsConfig().set(p.getName() + ".revived",Boolean.valueOf(false));
this.plugin.getAccountsConfig().set(p.getName() + ".revivetime",Long.valueOf(Main.SERVER_TICK_TIME));
this.plugin.saveAccountsConfig();
double mincost = this.plugin.getConfig().getDouble("revive-cost-rate");
if (p.getBedSpawnLocation()!=null) {
mincost *= Math.abs(p.getBedSpawnLocation().getX()-deathX)+Math.abs(p.getBedSpawnLocation().getY()-deathY)+Math.abs(p.getBedSpawnLocation().getZ()-deathZ);
} else {
mincost *= Math.abs(Bukkit.getWorld("world").getSpawnLocation().getX()-deathX)+Math.abs(Bukkit.getWorld("world").getSpawnLocation().getY()-deathY)+Math.abs(Bukkit.getWorld("world").getSpawnLocation().getZ()-deathZ);
}
double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money");
double finalcost = (mincost*this.plugin.getConfig().getDouble("revive-cost-rate")) + (mymoney*this.plugin.getConfig().getDouble("revive-cost-tax"));
if (this.plugin.PlayerinJob(p, "Explorer") && this.plugin.getJobLv("Explorer", p)>=20) {
finalcost*=0.25;
}
if (mymoney>=mincost) {
p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive. To revive, type /revive me.");
} else {
p.sendMessage("You died. You do not have enough money in your bank to revive.");
p.sendMessage("Cost: $"+df.format(finalcost)+". If you want to revive, type "+ChatColor.AQUA+"/revive me"+ChatColor.WHITE+" when you have enough.");
}
} }
@EventHandler @EventHandler
@ -11693,14 +11818,15 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
} }
if (e.getAction()==Action.RIGHT_CLICK_AIR) { if (e.getAction()==Action.RIGHT_CLICK_AIR) {
boolean largechest=false; boolean largechest=false;
boolean smallchest=false; boolean smallchest=false;
int identifier=-1; boolean enderchest=false;
int identifier=-1;
if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.getMaterial(127))) { if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.getMaterial(127))) {
p.updateInventory(); p.updateInventory();
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.CHEST || p.getItemInHand().getType()==Material.TRAPPED_CHEST)) { if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.CHEST || p.getItemInHand().getType()==Material.TRAPPED_CHEST || p.getItemInHand().getType()==Material.ENDER_CHEST)) {
if (p.getItemInHand().getItemMeta().getLore()!=null) { if (p.getItemInHand().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.
for (int i=0;i<p.getItemInHand().getItemMeta().getLore().size();i++) { for (int i=0;i<p.getItemInHand().getItemMeta().getLore().size();i++) {
@ -11710,6 +11836,9 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
if (p.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) { if (p.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
largechest=true; largechest=true;
} }
if (p.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 27 item slots.")) {
enderchest=true;
}
if (p.getItemInHand().getItemMeta().getLore().get(i).contains("ID#")) { if (p.getItemInHand().getItemMeta().getLore().get(i).contains("ID#")) {
identifier=Integer.valueOf(p.getItemInHand().getItemMeta().getLore().get(i).replace("ID#", "")); identifier=Integer.valueOf(p.getItemInHand().getItemMeta().getLore().get(i).replace("ID#", ""));
} }
@ -11732,6 +11861,10 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
newlore.add("ID#"+identifier); newlore.add("ID#"+identifier);
meta.setLore(newlore); meta.setLore(newlore);
p.getItemInHand().setItemMeta(meta); p.getItemInHand().setItemMeta(meta);
if (enderchest) {
p.getItemInHand().setAmount(2);
}
} }
Inventory screen = null; Inventory screen = null;
if (smallchest) { if (smallchest) {
@ -11766,6 +11899,22 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
} }
this.plugin.saveItemCubeConfig(f, identifier); this.plugin.saveItemCubeConfig(f, identifier);
} }
if (enderchest) {
FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier);
if (!f.contains("created")) {
for (int i=0;i<27;i++) {
f.set("item-"+i, new ItemStack(Material.AIR));
}
f.set("created", Boolean.valueOf(true));
}
//List<ItemStack> items = new ArrayList<ItemStack>();
screen=Bukkit.createInventory(p, 27, "Ender Item Cube #"+identifier);
for (int i=0;i<27;i++) {
//items.add(f.getItemStack("item-"+i));
screen.setItem(i, f.getItemStack("item-"+i));
}
this.plugin.saveItemCubeConfig(f, identifier);
}
if (screen!=null) { if (screen!=null) {
p.closeInventory(); p.closeInventory();
p.openInventory(screen); p.openInventory(screen);

Loading…
Cancel
Save