geforkt von Mirrors/Paper
SPIGOT-4880: Potion effects with unknown names.
Dieser Commit ist enthalten in:
Ursprung
fe1199caa5
Commit
3057b72c7d
@ -84,6 +84,10 @@ public class CraftPotionEffectType extends PotionEffectType {
|
||||
return "CONDUIT_POWER";
|
||||
case 30:
|
||||
return "DOLPHINS_GRACE";
|
||||
case 31:
|
||||
return "BAD_OMEN";
|
||||
case 32:
|
||||
return "HERO_OF_THE_VILLAGE";
|
||||
default:
|
||||
return "UNKNOWN_EFFECT_TYPE_" + getId();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.MobEffect;
|
||||
import net.minecraft.server.MobEffectList;
|
||||
import net.minecraft.server.PotionRegistry;
|
||||
@ -30,4 +31,20 @@ public class PotionTest extends AbstractTestingBase {
|
||||
|
||||
assertEquals(effects.entrySet().size(), PotionType.values().length - /* PotionTypes with no/shared Effects */ 6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEffectType() {
|
||||
for (MobEffectList nms : IRegistry.MOB_EFFECT) {
|
||||
MinecraftKey key = IRegistry.MOB_EFFECT.getKey(nms);
|
||||
|
||||
int id = MobEffectList.getId(nms);
|
||||
PotionEffectType bukkit = PotionEffectType.getById(id);
|
||||
|
||||
assertNotNull("No Bukkit type for " + key, bukkit);
|
||||
assertFalse("No name for " + key, bukkit.getName().contains("UNKNOWN"));
|
||||
|
||||
PotionEffectType byName = PotionEffectType.getByName(bukkit.getName());
|
||||
assertEquals("Same type not returned by name " + key, bukkit, byName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren