Version-independent names
Bukkit renamed materials, sounds, particles, potions and enchantments many times between 1.8 and 26.x. EranoAPI has one enum per area with every value of the newest Minecraft by its newest name; on each server it resolves to what that server calls it.
| Enum | What changed | On old servers |
|---|---|---|
EranoMaterial | 1.13 flattening, 14 renames after | 1.8 - 1.12: old name + data value (RED_WOOL → WOOL:14) |
EranoSound | Renamed in 1.9 and 1.13; an interface since 1.21.2 | ENTITY_PLAYER_LEVELUP → LEVEL_UP on 1.8 |
EranoParticle | No API on 1.8, renamed in 1.20.5 | 1.8: EranoAPI sends the packet |
EranoEffect | World effects added over time | tells which server has which |
EranoPotionEffect | Renamed in 1.20.5 | STRENGTH → INCREASE_DAMAGE |
EranoPotionType | Potion items differ in 1.8, 1.9, 1.20.2 | data value, PotionData or the type |
EranoEnchantment | Keys in 1.13, renamed in 1.20.5 | SHARPNESS → DAMAGE_ALL |
Common methods
java
EranoX.NAME.parseX(); // the server's value, null when it doesn't have it
EranoX.NAME.isSupported();
EranoX.match("old_name"); // today's name, older names, minecraft: keys; case-insensitive
EranoX.of(serverValue); // back to the constantMaterials
java
ItemStack wool = EranoMaterial.RED_WOOL.parseItem(16);
EranoMaterial.match("WOOL:14"); // also "minecraft:red_wool", "WOOD_SWORD", "A|B"
EranoMaterial kind = EranoMaterial.of(player.getItemInHand()); // data value included on 1.8
EranoMaterial.GRANITE.setType(block); // STONE:1 on 1.8Sounds
java
EranoSound.ENTITY_PLAYER_LEVELUP.play(player, 1f, 1f); // to one player
EranoSound.ENTITY_GENERIC_EXPLODE.play(location, 1f, 1f); // to everyone nearbySounds Minecraft renamed are matched by the sound files Mojang plays, so BLOCK_NOTE_BLOCK_PLING on 1.8 is exactly 1.8's NOTE_PLING.
Particles
java
EranoParticle.HAPPY_VILLAGER.spawn(location, 10, 0.5, 0.5, 0.5, 0);
EranoParticle.DUST.spawn(location, 1, 0, 0, 0, 0, Color.AQUA); // colored dust, 1.8 too
EranoParticle.BLOCK.spawn(location, 30, 0.3, 0.3, 0.3, 0, EranoMaterial.RED_WOOL);
EranoEffect.STEP_SOUND.play(location, Material.STONE);Data is given the same way on every version and converted: a Color, a Material, an EranoMaterial or an ItemStack; or the server's own type (BlockData, DustOptions).
Potions and enchantments
java
EranoPotionEffect.STRENGTH.apply(player, 200, 1); // Strength II, 10 s
ItemStack potion = EranoPotionType.LONG_SWIFTNESS.parseItem(EranoPotionType.Form.SPLASH, 1);
EranoEnchantment.SHARPNESS.enchant(sword, 2);Reference tables
Every value, when it came and what it was called, generated from Spigot's and Mojang's data: Material.md, Sound.md, Particle.md, Potion.md, Enchantment.md.