Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
SPIGOT-4727: Fix CraftEvil for legacy plugins
Dieser Commit ist enthalten in:
Ursprung
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
Normale Datei
23
src/test/java/org/bukkit/EvilTest.java
Normale Datei
@ -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();
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren