Fix Anvil Name repairing yet again.
This commit is contained in:
parent
64c01e168a
commit
cbcf1b810c
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.5.0
|
version: 3.5.0a
|
||||||
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.
|
||||||
|
@ -2415,24 +2415,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//This means we don't rename the item and copy over the old name, since
|
//This means we don't rename the item and copy over the old name, since
|
||||||
//They are repairing it.
|
//They are repairing it.
|
||||||
String oldname = ev.getInventory().getItem(0).getItemMeta().getDisplayName();
|
String oldname = ev.getInventory().getItem(0).getItemMeta().getDisplayName();
|
||||||
ItemMeta m = ev.getResult().getItemMeta();
|
ItemMeta m = ev.getInventory().getItem(2).getItemMeta();
|
||||||
m.setDisplayName(oldname);
|
m.setDisplayName(oldname);
|
||||||
ev.getResult().setItemMeta(m);
|
ev.getInventory().getItem(2).setItemMeta(m);
|
||||||
/*//It's possible we may have to fix the color code for this item. Check the first two characters.
|
} else {
|
||||||
String oldname = ev.getInventory().getItem(0).getItemMeta().getDisplayName();
|
/*if (ev.getResult()!=null &&
|
||||||
String strippedname = ChatColor.stripColor(oldname);
|
ev.getInventory().getItem(0)!=null &&
|
||||||
String colorcodes = oldname.replace(strippedname, "");
|
ev.getInventory().getItem(0).getItemMeta().hasDisplayName()) {
|
||||||
if (colorcodes.length()==2) {
|
String oldname = ev.getInventory().getItem(0).getItemMeta().getDisplayName();
|
||||||
colorcodes=colorcodes.substring(1);
|
String strippedname = ChatColor.stripColor(oldname);
|
||||||
} else
|
String colorcodes = oldname.replace(strippedname, "");
|
||||||
if (colorcodes.length()==4) {
|
ItemMeta m = ev.getResult().getItemMeta();
|
||||||
colorcodes=Character.toString(colorcodes.charAt(1))+Character.toString(colorcodes.charAt(3));
|
m.setDisplayName(strippedname.replace(colorcodes, ""));
|
||||||
}
|
ev.getResult().setItemMeta(m);
|
||||||
log("Color codes are: <"+colorcodes+">. Length is "+colorcodes.length(),4);
|
}*/
|
||||||
//ev.getWhoClicked().sendMessage(ChatColor.getByChar(colorcodes)+"This is the color.");
|
|
||||||
ItemMeta m = ev.getResult().getItemMeta();
|
|
||||||
m.setDisplayName(ChatColor.getByChar(colorcodes)+m.getDisplayName().replaceFirst(colorcodes, ""));
|
|
||||||
ev.getResult().setItemMeta(m);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user