Fixed the accidental deletion of ID setting for Item Cubes. Added a

function to get the ID of the viewing item cube.
This commit is contained in:
sigonasr2 2013-11-19 14:11:05 -07:00
parent e00f04bf30
commit c0efc8e9c8
2 changed files with 13 additions and 0 deletions

View File

@ -4739,6 +4739,18 @@ public void payDay(int time)
return false; return false;
} }
public int get_ItemCubeID(ItemStack item_cube) {
if (item_cube.hasItemMeta() && item_cube.getItemMeta().hasLore()) {
//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).contains("ID#")) {
return Integer.valueOf(item_cube.getItemMeta().getLore().get(i).replace("ID#", ""));
}
}
}
return -1;
}
public boolean is_PermanentProperty(String property) { public boolean is_PermanentProperty(String property) {
//This function determines if the certain lore property is supposed to be kept on the item. //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. //Useful for checking what to remove and not remove from lore.

View File

@ -11847,6 +11847,7 @@ implements Listener
Cube cube_type = null; Cube cube_type = null;
int identifier=-1; int identifier=-1;
if (isItemCube(item_cube)) { if (isItemCube(item_cube)) {
identifier = this.plugin.get_ItemCubeID(item_cube);
if (identifier==-1) { if (identifier==-1) {
//This doesn't have an identifier yet. Create a new one. //This doesn't have an identifier yet. Create a new one.
identifier=this.plugin.getConfig().getInt("item-cube-numb"); identifier=this.plugin.getConfig().getInt("item-cube-numb");