Fix a bug with Bows.

This commit is contained in:
sigonasr2 2016-06-24 00:19:57 -05:00
parent f453499468
commit e073bcaeaf
4 changed files with 20 additions and 16 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.4 version: 3.4.0
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.

View File

@ -1157,7 +1157,8 @@ public class GenericFunctions {
if (item.getType().toString().contains("SPADE") || if (item.getType().toString().contains("SPADE") ||
item.getType().toString().contains("AXE") || item.getType().toString().contains("AXE") ||
item.getType().toString().contains("SWORD") || item.getType().toString().contains("SWORD") ||
item.getType().toString().contains("HOE")) { item.getType().toString().contains("HOE") ||
item.getType().toString().contains("BOW")) {
return true; return true;
} else { } else {
return false; return false;

View File

@ -1644,7 +1644,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
if (ev.getCurrentItem().hasItemMeta()) { if (ev.getCurrentItem().hasItemMeta()) {
ItemMeta item_meta = ev.getCurrentItem().getItemMeta(); ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
if (item_meta.getDisplayName().contains("Item Cube")) { if (item_meta.getDisplayName()!=null &&
item_meta.getDisplayName().contains("Item Cube")) {
if (ev.isShiftClick()) { if (ev.isShiftClick()) {
ev.setCancelled(true); ev.setCancelled(true);
} else { } else {
@ -3982,18 +3983,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
else else
//We are looking for an artifact recipe.
if (result.getType()==Material.STAINED_GLASS_PANE && Artifact.isArtifact(result)) {
for (int i=0;i<ev.getInventory().getSize();i++) {
if (ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR &&
!Artifact.isArtifact(ev.getInventory().getItem(i))) {
ev.getInventory().setResult(new ItemStack(Material.AIR));
break;
}
}
}
else
//We are looking for an artifact conversion recipe. //We are looking for an artifact conversion recipe.
if ((result.getType()==Material.SUGAR || if ((result.getType()==Material.SUGAR ||
result.getType()==Material.MAGMA_CREAM || result.getType()==Material.MAGMA_CREAM ||
@ -4111,7 +4100,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//We are looking for an artifact piece. //We are looking for an artifact piece.
int items_found=0; int items_found=0;
int slot_found=0; int slot_found=0;
for (int i=0;i<ev.getInventory().getSize();i++) { for (int i=1;i<ev.getInventory().getSize();i++) {
if (ev.getInventory().getItem(i)!=null && if (ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR && ev.getInventory().getItem(i).getType()!=Material.AIR &&
Artifact.isArtifact(ev.getInventory().getItem(i))) { Artifact.isArtifact(ev.getInventory().getItem(i))) {
@ -4121,6 +4110,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
if (items_found==1) { if (items_found==1) {
int tier = ev.getInventory().getItem(slot_found).getEnchantmentLevel(Enchantment.LUCK); int tier = ev.getInventory().getItem(slot_found).getEnchantmentLevel(Enchantment.LUCK);
//log("This is tier "+tier+". Enchantment level of "+ev.getInventory().getItem(slot_found).toString(),2);
//Decompose this into a higher tier of the next item. //Decompose this into a higher tier of the next item.
if (tier<10) { if (tier<10) {
ItemStack newitem = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,(short)ArtifactItemType.valueOf(Artifact.returnRawTool(ev.getInventory().getItem(slot_found).getType())).getDataValue())); ItemStack newitem = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,(short)ArtifactItemType.valueOf(Artifact.returnRawTool(ev.getInventory().getItem(slot_found).getType())).getDataValue()));
@ -4138,6 +4128,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
//We are looking for an artifact recipe.
if (result.getType()==Material.STAINED_GLASS_PANE && Artifact.isArtifact(result)) {
for (int i=0;i<ev.getInventory().getSize();i++) {
if (ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR &&
!Artifact.isArtifact(ev.getInventory().getItem(i))) {
ev.getInventory().setResult(new ItemStack(Material.AIR));
break;
}
}
}//A general clear recipe table check for any non-artifact items.
} }
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)