Fix for the weird 0 issue.

This commit is contained in:
Brianna O'Keefe 2018-11-03 04:20:44 -04:00
parent 8a3b9815ab
commit 7bc52f4dda

View File

@ -1,10 +1,12 @@
package com.songoda.ultimatekits.handlers;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.utils.Debugger;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@ -57,7 +59,7 @@ public class DisplayItemHandler {
i.remove();
return;
}
int inum = Integer.parseInt(i.getItemStack().getItemMeta().getDisplayName()) + 1;
int inum = Integer.parseInt(i.getItemStack().getItemMeta().getDisplayName().replace(String.valueOf(ChatColor.COLOR_CHAR), "")) + 1;
if (inum > list.size()) inum = 1;
ItemStack is = list.get(inum - 1);
@ -67,7 +69,7 @@ public class DisplayItemHandler {
}
ItemMeta meta = is.getItemMeta();
is.setAmount(1);
meta.setDisplayName(Integer.toString(inum));
meta.setDisplayName(TextComponent.convertToInvisibleString(Integer.toString(inum)));
is.setItemMeta(meta);
i.setItemStack(is);
i.setPickupDelay(9999);
@ -78,7 +80,7 @@ public class DisplayItemHandler {
ItemStack is = list.get(0);
is.setAmount(1);
ItemMeta meta = is.getItemMeta();
meta.setDisplayName("0");
meta.setDisplayName(TextComponent.convertToInvisibleString("0"));
is.setItemMeta(meta);
Item item = location.getWorld().dropItem(location.add(0, 1, 0), list.get(0));
Vector vec = new Vector(0, 0, 0);