Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
SPIGOT-5516: Correct EnchantmentTarget values
Dieser Commit ist enthalten in:
Ursprung
01334e7dcb
Commit
ec4b2b5ef1
41
src/test/java/org/bukkit/enchantments/EnchantmentTargetTest.java
Normale Datei
41
src/test/java/org/bukkit/enchantments/EnchantmentTargetTest.java
Normale Datei
@ -0,0 +1,41 @@
|
||||
package org.bukkit.enchantments;
|
||||
|
||||
import net.minecraft.server.EnchantmentSlotType;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.Item;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class EnchantmentTargetTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
for (EnchantmentSlotType nmsSlot : EnchantmentSlotType.values()) {
|
||||
EnchantmentTarget bukkitTarget;
|
||||
switch (nmsSlot) {
|
||||
case ARMOR_CHEST:
|
||||
bukkitTarget = EnchantmentTarget.ARMOR_TORSO;
|
||||
break;
|
||||
case DIGGER:
|
||||
bukkitTarget = EnchantmentTarget.TOOL;
|
||||
break;
|
||||
default:
|
||||
bukkitTarget = EnchantmentTarget.valueOf(nmsSlot.name());
|
||||
break;
|
||||
}
|
||||
|
||||
Assert.assertNotNull("No bukkit target for slot " + nmsSlot, bukkitTarget);
|
||||
|
||||
for (Item item : IRegistry.ITEM) {
|
||||
Material material = CraftMagicNumbers.getMaterial(item);
|
||||
|
||||
boolean nms = nmsSlot.canEnchant(item);
|
||||
boolean bukkit = bukkitTarget.includes(material);
|
||||
|
||||
Assert.assertEquals("Slot mismatch for " + bukkitTarget + " and " + material, nms, bukkit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren