mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
SPIGOT-4727: Fix CraftEvil for legacy plugins
This commit is contained in:
parent
364b6fbb73
commit
93ad381a68
@ -22,6 +22,10 @@ public class CraftEvil {
|
||||
|
||||
static {
|
||||
for (Material material : Material.values()) {
|
||||
if (!material.isLegacy()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Preconditions.checkState(!byId.containsKey(material.getId()), "Duplicate material ID for", material);
|
||||
byId.put(material.getId(), material);
|
||||
}
|
||||
|
23
src/test/java/org/bukkit/EvilTest.java
Normal file
23
src/test/java/org/bukkit/EvilTest.java
Normal file
@ -0,0 +1,23 @@
|
||||
package org.bukkit;
|
||||
|
||||
import org.bukkit.craftbukkit.util.CraftEvil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class EvilTest {
|
||||
|
||||
@Test
|
||||
public void testFrom() {
|
||||
Assert.assertEquals(Material.LEGACY_STONE, CraftEvil.getMaterial(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTo() {
|
||||
Assert.assertEquals(1, CraftEvil.getId(Material.LEGACY_STONE));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testIllegal() {
|
||||
Material.STONE.getId();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user