Fix Artifact Item Breaking glitches.
This commit is contained in:
parent
468b298fa7
commit
bbbd38cacd
Binary file not shown.
@ -120,6 +120,9 @@ public class GenericFunctions {
|
|||||||
return breakObscureHardenedItem(item);
|
return breakObscureHardenedItem(item);
|
||||||
} else {
|
} else {
|
||||||
lore.set(i, ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+(break_count-1));
|
lore.set(i, ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+(break_count-1));
|
||||||
|
if ((break_count-1)<0) {
|
||||||
|
break_count=0;
|
||||||
|
}
|
||||||
TwosideKeeper.log("Setting breaks remaining to "+(break_count-1),3);
|
TwosideKeeper.log("Setting breaks remaining to "+(break_count-1),3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +157,7 @@ public class GenericFunctions {
|
|||||||
|
|
||||||
public static ItemStack convertArtifactToDust(ItemStack item) {
|
public static ItemStack convertArtifactToDust(ItemStack item) {
|
||||||
//Add one line of lore to indicate it's broken dust.
|
//Add one line of lore to indicate it's broken dust.
|
||||||
item = addHardenedItemBreaks(item,1);
|
item = addObscureHardenedItemBreaks(item,1);
|
||||||
ItemMeta m = item.getItemMeta();
|
ItemMeta m = item.getItemMeta();
|
||||||
List<String> oldlore = m.getLore();
|
List<String> oldlore = m.getLore();
|
||||||
oldlore.add(0,ChatColor.DARK_BLUE+""+ChatColor.MAGIC+item.getType());
|
oldlore.add(0,ChatColor.DARK_BLUE+""+ChatColor.MAGIC+item.getType());
|
||||||
@ -181,7 +184,16 @@ public class GenericFunctions {
|
|||||||
|
|
||||||
public static ItemStack convertArtifactDustToItem(ItemStack item) {
|
public static ItemStack convertArtifactDustToItem(ItemStack item) {
|
||||||
ItemMeta m = item.getItemMeta();
|
ItemMeta m = item.getItemMeta();
|
||||||
|
long time = TwosideKeeper.getServerTickTime();
|
||||||
List<String> oldlore = m.getLore();
|
List<String> oldlore = m.getLore();
|
||||||
|
for (int i=0;i<oldlore.size();i++) {
|
||||||
|
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
|
||||||
|
//See what the previous time was.
|
||||||
|
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
|
||||||
|
oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (time+12096000<=TwosideKeeper.getServerTickTime()) {
|
||||||
Material gettype = Material.valueOf(ChatColor.stripColor(oldlore.get(0)));
|
Material gettype = Material.valueOf(ChatColor.stripColor(oldlore.get(0)));
|
||||||
oldlore.remove(6);
|
oldlore.remove(6);
|
||||||
oldlore.remove(5);
|
oldlore.remove(5);
|
||||||
@ -194,7 +206,7 @@ public class GenericFunctions {
|
|||||||
for (int i=0;i<oldlore.size();i++) {
|
for (int i=0;i<oldlore.size();i++) {
|
||||||
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
|
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
|
||||||
//See what the previous time was.
|
//See what the previous time was.
|
||||||
long time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
|
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
|
||||||
oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime());
|
oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +215,8 @@ public class GenericFunctions {
|
|||||||
item.setItemMeta(m);
|
item.setItemMeta(m);
|
||||||
item.setType(gettype);
|
item.setType(gettype);
|
||||||
item.setDurability((short)0);
|
item.setDurability((short)0);
|
||||||
item = addHardenedItemBreaks(item,5);
|
item = addObscureHardenedItemBreaks(item,5);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +227,7 @@ public class GenericFunctions {
|
|||||||
public static ItemStack addHardenedItemBreaks(ItemStack item, int breaks, boolean addname) {
|
public static ItemStack addHardenedItemBreaks(ItemStack item, int breaks, boolean addname) {
|
||||||
if (isHardenedItem(item)) {
|
if (isHardenedItem(item)) {
|
||||||
//We can just modify the amount of breaks.
|
//We can just modify the amount of breaks.
|
||||||
|
TwosideKeeper.log("We got here.",2);
|
||||||
return modifyBreaks(item, getHardenedItemBreaks(item)+breaks,false);
|
return modifyBreaks(item, getHardenedItemBreaks(item)+breaks,false);
|
||||||
} else {
|
} else {
|
||||||
//We need to add a new line in regards to making this item hardened. Two lines if it's armor.
|
//We need to add a new line in regards to making this item hardened. Two lines if it's armor.
|
||||||
@ -290,7 +304,7 @@ public class GenericFunctions {
|
|||||||
int breaks_remaining=-1;
|
int breaks_remaining=-1;
|
||||||
int loreline=-1;
|
int loreline=-1;
|
||||||
for (int i=0;i<item_meta.getLore().size();i++) {
|
for (int i=0;i<item_meta.getLore().size();i++) {
|
||||||
TwosideKeeper.log("Line is "+item_meta.getLore().get(i),4);
|
TwosideKeeper.log("Line is "+item_meta.getLore().get(i),3);
|
||||||
TwosideKeeper.log("Checking for "+ChatColor.GRAY+"Breaks Remaining: "+((!isObscure)?ChatColor.YELLOW:ChatColor.MAGIC),4);
|
TwosideKeeper.log("Checking for "+ChatColor.GRAY+"Breaks Remaining: "+((!isObscure)?ChatColor.YELLOW:ChatColor.MAGIC),4);
|
||||||
if (item_meta.getLore().get(i).contains(ChatColor.GRAY+"Breaks Remaining: "+((!isObscure)?ChatColor.YELLOW:ChatColor.MAGIC))) {
|
if (item_meta.getLore().get(i).contains(ChatColor.GRAY+"Breaks Remaining: "+((!isObscure)?ChatColor.YELLOW:ChatColor.MAGIC))) {
|
||||||
TwosideKeeper.log("Line is "+item_meta.getLore().get(i),3);
|
TwosideKeeper.log("Line is "+item_meta.getLore().get(i),3);
|
||||||
@ -359,6 +373,9 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
if (break_count>6) {break_count=6;}
|
if (break_count>6) {break_count=6;}
|
||||||
lore.set(break_line, ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC+(break_count));
|
lore.set(break_line, ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC+(break_count));
|
||||||
|
if ((break_count)<0) {
|
||||||
|
break_count=0;
|
||||||
|
}
|
||||||
TwosideKeeper.log("Setting breaks remaining to "+(break_count),3);
|
TwosideKeeper.log("Setting breaks remaining to "+(break_count),3);
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
item.setItemMeta(m);
|
item.setItemMeta(m);
|
||||||
@ -394,6 +411,9 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
if (break_count>5) {break_count=5;}
|
if (break_count>5) {break_count=5;}
|
||||||
lore.set(break_line, ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC+(break_count));
|
lore.set(break_line, ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC+(break_count));
|
||||||
|
if ((break_count)<0) {
|
||||||
|
break_count=0;
|
||||||
|
}
|
||||||
TwosideKeeper.log("Setting breaks remaining to "+(break_count),3);
|
TwosideKeeper.log("Setting breaks remaining to "+(break_count),3);
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
item.setItemMeta(m);
|
item.setItemMeta(m);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user