Skip to content

Commit

Permalink
Fix disable-enchantment not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Aericio committed Sep 29, 2023
1 parent 4b6e44e commit bd18618
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DaPigGuy/PiggyCustomEnchants/CustomEnchantManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ public static function unregisterEnchantment(int|CustomEnchant $id): void
self::$plugin->getLogger()->debug("Custom Enchantment '" . $enchant->getDisplayName() . "' unregistered with id " . $enchant->getId());
unset(self::$enchants[$id]);

$property = new ReflectionProperty(EnchantmentIdMap::class, "enchToId");
$property = new ReflectionProperty(EnchantmentIdMap::class, "enumToId");
$property->setAccessible(true);
$value = $property->getValue(EnchantmentIdMap::getInstance());
unset($value[spl_object_id(EnchantmentIdMap::getInstance()->fromId($id))]);
$property->setValue(EnchantmentIdMap::getInstance(), $value);

$property = new ReflectionProperty(EnchantmentIdMap::class, "idToEnch");
$property = new ReflectionProperty(EnchantmentIdMap::class, "idToEnum");
$property->setAccessible(true);
$value = $property->getValue(EnchantmentIdMap::getInstance());
unset($value[$id]);
Expand Down

0 comments on commit bd18618

Please sign in to comment.