Added is_PermanentProperty() to contain all lore phrases where the

property should not be removed in cases where items need to remove other
lore "bonuses".
master_event
sigonasr2 11 years ago
parent 3b8d4195e4
commit c935896d60
  1. 30
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 32
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  3. 2
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -4118,7 +4118,7 @@ public void payDay(int time)
if (item.hasItemMeta() && item.getItemMeta().getLore()!=null) { if (item.hasItemMeta() && item.getItemMeta().getLore()!=null) {
List<String> thelore = item.getItemMeta().getLore(); List<String> thelore = item.getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (is_PermanentProperty(thelore.get(i))) {
//This is a weak piece. //This is a weak piece.
mult=0.10d; mult=0.10d;
} }
@ -4719,19 +4719,35 @@ public void payDay(int time)
return false; return false;
} }
public boolean is_ItemCube(ItemStack i) { public boolean is_ItemCube(ItemStack item_cube) {
if (i.hasItemMeta() && i.getItemMeta().hasLore() && i.getItemMeta().getLore()!=null) { if (item_cube.hasItemMeta() && item_cube.getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.
for (int j=0;j<i.getItemMeta().getLore().size();j++) { for (int i=0;i<item_cube.getItemMeta().getLore().size();i++) {
if (i.getItemMeta().getLore().get(j).equalsIgnoreCase(ChatColor.AQUA+"Contains 9 item slots.")) { if (item_cube.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 9 item slots.")) {
return true; return true;
} }
if (i.getItemMeta().getLore().get(j).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) { if (item_cube.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
return true;
}
if (item_cube.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 27 item slots.")) {
return true; return true;
} }
} }
}
return false;
}
public boolean is_PermanentProperty(String property) {
//This function determines if the certain lore property is supposed to be kept on the item.
//Useful for checking what to remove and not remove from lore.
List<String> permanent_properties = new ArrayList<String>();
permanent_properties.add(ChatColor.RED+"-400% Durability");
permanent_properties.add(ChatColor.RED+"Duplicated");
if (permanent_properties.contains(property)) {
return true;
} else {
return false;
} }
return false;
} }
public double getEnchantmentNumb(String s) { public double getEnchantmentNumb(String s) {

@ -488,7 +488,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -523,7 +523,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -560,7 +560,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -594,7 +594,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -637,7 +637,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -672,7 +672,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -718,7 +718,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -752,7 +752,7 @@ implements Listener
if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts.
List<String> thelore = e.getItem().getItemMeta().getLore(); List<String> thelore = e.getItem().getItemMeta().getLore();
for (int i=0;i<thelore.size();i++) { for (int i=0;i<thelore.size();i++) {
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(thelore.get(i))) {
ourLore.add(thelore.get(i)); ourLore.add(thelore.get(i));
} }
} }
@ -11836,21 +11836,7 @@ implements Listener
} }
public boolean isItemCube(ItemStack item_cube) { public boolean isItemCube(ItemStack item_cube) {
if (item_cube.hasItemMeta() && item_cube.getItemMeta().getLore()!=null) { return this.plugin.is_ItemCube(item_cube);
//Check to see if the Lore contains anything.
for (int i=0;i<item_cube.getItemMeta().getLore().size();i++) {
if (item_cube.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 9 item slots.")) {
return true;
}
if (item_cube.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 54 item slots.")) {
return true;
}
if (item_cube.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.AQUA+"Contains 27 item slots.")) {
return true;
}
}
}
return false;
} }
public void viewItemCube(Player p, ItemStack item_cube) { public void viewItemCube(Player p, ItemStack item_cube) {

@ -430,7 +430,7 @@ public String convertToItemName(String val) {
for (int i=0;i<p.getItemInHand().getItemMeta().getLore().size();i++) { for (int i=0;i<p.getItemInHand().getItemMeta().getLore().size();i++) {
//Remove all lore when unenchanting. //Remove all lore when unenchanting.
//Do not remove -400% durability. //Do not remove -400% durability.
if (p.getItemInHand().getItemMeta().getLore().get(i).contains(ChatColor.RED+"-400% Durability")) { if (this.plugin.is_PermanentProperty(p.getItemInHand().getItemMeta().getLore().get(i))) {
newlore.add(p.getItemInHand().getItemMeta().getLore().get(i)); newlore.add(p.getItemInHand().getItemMeta().getLore().get(i));
} }
} }

Loading…
Cancel
Save