Added fireproof wood slabs. Added ender cubes.

anvil_rework
Nonoriri 11 years ago committed by EvixCraft user
parent 126a0360de
commit 174481a6c8
  1. 42
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 168
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -338,7 +338,7 @@ public class Main extends JavaPlugin
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, 1));
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);
@ -392,6 +392,19 @@ public class Main extends JavaPlugin
diamond_boots.shape("a a","a a");
diamond_boots.setIngredient('a', Material.DIAMOND_BLOCK);
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);
ItemMeta tempmeta = temp.getItemMeta();
tempmeta.setDisplayName(ChatColor.YELLOW+"Item Cube");
@ -425,6 +438,23 @@ public class Main extends JavaPlugin
item_cube.setIngredient('b', Material.HOPPER);
item_cube.setIngredient('c', Material.DIAMOND_BLOCK);
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();
//System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath());
@ -2850,6 +2880,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) {
value+=0.001d*items[j].getAmount();
} else

@ -4119,9 +4119,41 @@ public class PlayerListener
@EventHandler
public void onItemPrepareCraft(PrepareItemCraftEvent e) {
CraftingInventory result = e.getInventory();
// Disable melon crafting recipe
if (result.getResult().getType()==Material.MELON_BLOCK) {
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 ||
result.getResult().getType()==Material.IRON_CHESTPLATE ||
result.getResult().getType()==Material.IRON_LEGGINGS ||
@ -9579,10 +9611,11 @@ public ItemStack getGoodie() {
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.
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.
boolean largechest=false;
boolean smallchest=false;
boolean enderchest=false;
int identifier=-1;
if (event.getCurrentItem().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything.
@ -9593,6 +9626,9 @@ public ItemStack getGoodie() {
if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
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#")) {
identifier=Integer.valueOf(event.getCurrentItem().getItemMeta().getLore().get(i).replace("ID#", ""));
}
@ -9615,6 +9651,11 @@ public ItemStack getGoodie() {
newlore.add("ID#"+identifier);
meta.setLore(newlore);
event.getCurrentItem().setItemMeta(meta);
if (enderchest) {
event.getCurrentItem().setAmount(2);
}
}
if (smallchest) {
FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier);
@ -9747,15 +9788,83 @@ public ItemStack getGoodie() {
}
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.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 smallchest=false;
boolean enderchest=false;
int identifier=-1;
if (event.getCurrentItem().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything.
@ -9766,6 +9875,9 @@ public ItemStack getGoodie() {
if (event.getCurrentItem().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
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#")) {
identifier=Integer.valueOf(event.getCurrentItem().getItemMeta().getLore().get(i).replace("ID#", ""));
}
@ -9788,6 +9900,10 @@ public ItemStack getGoodie() {
newlore.add("ID#"+identifier);
meta.setLore(newlore);
event.getCurrentItem().setItemMeta(meta);
if (enderchest) {
event.getCurrentItem().setAmount(2);
}
}
Inventory screen = null;
if (smallchest) {
@ -9822,6 +9938,22 @@ public ItemStack getGoodie() {
}
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) {
event.getWhoClicked().closeInventory();
event.getWhoClicked().openInventory(screen);
@ -9835,7 +9967,7 @@ public ItemStack getGoodie() {
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 (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;
if (event.getCurrentItem().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything.
@ -11653,14 +11785,15 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
}
if (e.getAction()==Action.RIGHT_CLICK_AIR) {
boolean largechest=false;
boolean smallchest=false;
int identifier=-1;
boolean smallchest=false;
boolean enderchest=false;
int identifier=-1;
if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.getMaterial(127))) {
p.updateInventory();
e.setCancelled(true);
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) {
//Check to see if the Lore contains anything.
for (int i=0;i<p.getItemInHand().getItemMeta().getLore().size();i++) {
@ -11670,6 +11803,9 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
if (p.getItemInHand().getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
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#")) {
identifier=Integer.valueOf(p.getItemInHand().getItemMeta().getLore().get(i).replace("ID#", ""));
}
@ -11692,6 +11828,10 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
newlore.add("ID#"+identifier);
meta.setLore(newlore);
p.getItemInHand().setItemMeta(meta);
if (enderchest) {
p.getItemInHand().setAmount(2);
}
}
Inventory screen = null;
if (smallchest) {
@ -11726,6 +11866,22 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
}
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) {
p.closeInventory();
p.openInventory(screen);

Loading…
Cancel
Save