Skip to content
Permalink
Browse files

Fixed another missing setWorld for Area

  • Loading branch information...
me4502 committed Jun 13, 2019
1 parent 6554efa commit 9af897b3f46dfec1ca1c13dfd8e726199aee1c79
@@ -241,6 +241,7 @@ private static boolean toggle(ChangedSign sign, boolean save) {
}

copy = CopyManager.getInstance().load(namespace, id);
copy.getRegion().setWorld(BukkitAdapter.adapt(sign.getBlock().getWorld()));
CopyManager.getInstance().paste(copy);
setToggledState(sign, true);
}
@@ -293,6 +294,7 @@ public static boolean toggleCold(ChangedSign sign) {
CopyManager.getInstance().save(namespace, inactiveID, copy);
} else {
copy = CopyManager.getInstance().load(namespace, id);
copy.getRegion().setWorld(BukkitAdapter.adapt(sign.getBlock().getWorld()));
}
CopyManager.getInstance().paste(copy);
setToggledState(sign, true);
@@ -20,6 +20,7 @@
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
@@ -67,24 +68,27 @@
public static String getStringFromItem(ItemStack item) {

StringBuilder builder = new StringBuilder();
builder.append(item.getType().name());
if(item.getDurability() > 0)
builder.append(':').append(item.getDurability());
builder.append(item.getType().getKey().toString());

if(item.hasItemMeta()) {
if(item.getItemMeta().hasEnchants())
for(Entry<Enchantment,Integer> enchants : item.getItemMeta().getEnchants().entrySet())
ItemMeta meta = item.getItemMeta();
if(meta.hasEnchants()) {
for (Entry<Enchantment, Integer> enchants : meta.getEnchants().entrySet()) {
builder.append(';').append(enchants.getKey().getName()).append(':').append(enchants.getValue());
if(item.getItemMeta().hasDisplayName())
builder.append('|').append(item.getItemMeta().getDisplayName());
if(item.getItemMeta().hasLore()) {
if(!item.getItemMeta().hasDisplayName())
}
}
if(meta.hasDisplayName()) {
builder.append('|').append(meta.getDisplayName());
}
if(meta.hasLore()) {
if(!meta.hasDisplayName()) {
builder.append("|$IGNORE");
List<String> list = item.getItemMeta().getLore();
for(String s : list)
}
List<String> list = meta.getLore();
for(String s : list) {
builder.append('|').append(s);
}
}
ItemMeta meta = item.getItemMeta();

if (meta.isUnbreakable()) {
builder.append("/unbreakable:true");
@@ -120,7 +124,9 @@ public static String getStringFromItem(ItemStack item) {
} else if (meta instanceof EnchantmentStorageMeta) {
if(!((EnchantmentStorageMeta) meta).hasStoredEnchants())
for(Entry<Enchantment, Integer> eff : ((EnchantmentStorageMeta) meta).getStoredEnchants().entrySet())
builder.append("/enchant:").append(eff.getKey().getName()).append(';').append(eff.getValue());
builder.append("/enchant:").append(eff.getKey().getKey().toString()).append(';').append(eff.getValue());
} else if (meta instanceof Damageable && ((Damageable) meta).getDamage() > 0) {
builder.append("/damage:").append(((Damageable) meta).getDamage());
}
}

@@ -255,6 +261,11 @@ else if(bits[0].equalsIgnoreCase("color") && meta instanceof LeatherArmorMeta) {
for (String flag : flags) {
meta.addItemFlags(ItemFlag.valueOf(flag));
}
} else if (bits[0].equalsIgnoreCase("damage") && meta instanceof Damageable) {
try {
int damage = Integer.parseInt(bits[1]);
((Damageable) meta).setDamage(damage);
} catch(Exception ignored){}
}
}
rVal.setItemMeta(meta);

0 comments on commit 9af897b

Please sign in to comment.
You can’t perform that action at this time.