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
|
||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||
version: 3.5.0
|
||||
version: 3.5.0a
|
||||
commands:
|
||||
money:
|
||||
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
|
||||
//They are repairing it.
|
||||
String oldname = ev.getInventory().getItem(0).getItemMeta().getDisplayName();
|
||||
ItemMeta m = ev.getResult().getItemMeta();
|
||||
ItemMeta m = ev.getInventory().getItem(2).getItemMeta();
|
||||
m.setDisplayName(oldname);
|
||||
ev.getResult().setItemMeta(m);
|
||||
/*//It's possible we may have to fix the color code for this item. Check the first two characters.
|
||||
String oldname = ev.getInventory().getItem(0).getItemMeta().getDisplayName();
|
||||
String strippedname = ChatColor.stripColor(oldname);
|
||||
String colorcodes = oldname.replace(strippedname, "");
|
||||
if (colorcodes.length()==2) {
|
||||
colorcodes=colorcodes.substring(1);
|
||||
} else
|
||||
if (colorcodes.length()==4) {
|
||||
colorcodes=Character.toString(colorcodes.charAt(1))+Character.toString(colorcodes.charAt(3));
|
||||
}
|
||||
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);*/
|
||||
ev.getInventory().getItem(2).setItemMeta(m);
|
||||
} else {
|
||||
/*if (ev.getResult()!=null &&
|
||||
ev.getInventory().getItem(0)!=null &&
|
||||
ev.getInventory().getItem(0).getItemMeta().hasDisplayName()) {
|
||||
String oldname = ev.getInventory().getItem(0).getItemMeta().getDisplayName();
|
||||
String strippedname = ChatColor.stripColor(oldname);
|
||||
String colorcodes = oldname.replace(strippedname, "");
|
||||
ItemMeta m = ev.getResult().getItemMeta();
|
||||
m.setDisplayName(strippedname.replace(colorcodes, ""));
|
||||
ev.getResult().setItemMeta(m);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user