From fb403977f2ea6bdbed327d144cea61744c77de1c Mon Sep 17 00:00:00 2001 From: David Berdik Date: Thu, 27 Dec 2018 21:50:29 -0500 Subject: [PATCH] Conversion of legacy Minecraft materials to 1.13 materials --- src/net/theprogrammersworld/herobrine/AI/AICore.java | 2 +- .../herobrine/AI/cores/BuildStuff.java | 2 +- .../herobrine/AI/cores/BuryPlayer.java | 2 +- .../herobrine/AI/cores/Pyramid.java | 2 +- .../theprogrammersworld/herobrine/AI/cores/Signs.java | 2 +- .../herobrine/AI/extensions/GraveyardWorld.java | 2 +- src/net/theprogrammersworld/herobrine/Herobrine.java | 2 +- .../herobrine/listeners/BlockListener.java | 8 ++++---- .../herobrine/listeners/PlayerListener.java | 2 +- .../herobrine/misc/BlockChanger.java | 2 +- .../theprogrammersworld/herobrine/misc/ItemName.java | 2 +- .../herobrine/nms/entity/CustomZombie.java | 10 +++++----- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/net/theprogrammersworld/herobrine/AI/AICore.java b/src/net/theprogrammersworld/herobrine/AI/AICore.java index 1cb70a5..974fd77 100644 --- a/src/net/theprogrammersworld/herobrine/AI/AICore.java +++ b/src/net/theprogrammersworld/herobrine/AI/AICore.java @@ -397,7 +397,7 @@ public class AICore { } public ItemStack createAncientSword() { - ItemStack item = new ItemStack(Material.GOLD_SWORD); + ItemStack item = new ItemStack(Material.matchMaterial("GOLD_SWORD")); String name = "Ancient Sword"; ArrayList lore = new ArrayList(); lore.add("AncientSword"); diff --git a/src/net/theprogrammersworld/herobrine/AI/cores/BuildStuff.java b/src/net/theprogrammersworld/herobrine/AI/cores/BuildStuff.java index a00c68f..273f253 100644 --- a/src/net/theprogrammersworld/herobrine/AI/cores/BuildStuff.java +++ b/src/net/theprogrammersworld/herobrine/AI/cores/BuildStuff.java @@ -119,7 +119,7 @@ public class BuildStuff extends Core { final int chance = randgen.nextInt(100); if (chance > 70) { if (Herobrine.getPluginCore().getSupport().checkBuild(world.getBlockAt(x, y, z).getLocation())) { - world.getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH_ON); + world.getBlockAt(x, y, z).setType(Material.matchMaterial("REDSTONE_TORCH_ON")); } } } diff --git a/src/net/theprogrammersworld/herobrine/AI/cores/BuryPlayer.java b/src/net/theprogrammersworld/herobrine/AI/cores/BuryPlayer.java index bb4a3a8..64a8572 100644 --- a/src/net/theprogrammersworld/herobrine/AI/cores/BuryPlayer.java +++ b/src/net/theprogrammersworld/herobrine/AI/cores/BuryPlayer.java @@ -98,7 +98,7 @@ public class BuryPlayer extends Core { final Location loc = new Location(world, X, Y, Z); final Location signloc = new Location(world, X, Y, Z - 2); final Block signblock = signloc.add(0.0, 0.0, 0.0).getBlock(); - signblock.setType(Material.SIGN_POST); + signblock.setType(Material.matchMaterial("SIGN_POST")); final Sign sign = (Sign) signblock.getState(); sign.setLine(1, playername); sign.update(); diff --git a/src/net/theprogrammersworld/herobrine/AI/cores/Pyramid.java b/src/net/theprogrammersworld/herobrine/AI/cores/Pyramid.java index 1d4a7e9..ef559d1 100644 --- a/src/net/theprogrammersworld/herobrine/AI/cores/Pyramid.java +++ b/src/net/theprogrammersworld/herobrine/AI/cores/Pyramid.java @@ -230,7 +230,7 @@ public class Pyramid extends Core { world.getBlockAt(X, Y + 1, Z - 1).setType(mainMat); world.getBlockAt(X, Y + 1, Z - 1).setType(mainMat); world.getBlockAt(X, Y + 2, Z).setType(mainMat); - world.getBlockAt(X, Y + 3, Z).setType(Material.REDSTONE_TORCH_ON); + world.getBlockAt(X, Y + 3, Z).setType(Material.matchMaterial("REDSTONE_TORCH_ON")); } } } diff --git a/src/net/theprogrammersworld/herobrine/AI/cores/Signs.java b/src/net/theprogrammersworld/herobrine/AI/cores/Signs.java index 06f934f..c307e13 100644 --- a/src/net/theprogrammersworld/herobrine/AI/cores/Signs.java +++ b/src/net/theprogrammersworld/herobrine/AI/cores/Signs.java @@ -64,7 +64,7 @@ public class Signs extends Core { final Block signblock = loc.add(0.0, 0.0, 0.0).getBlock(); final Block undersignblock = signblock.getLocation().subtract(0.0, 1.0, 0.0).getBlock(); if (Herobrine.isAllowedBlock(signblock.getType()) && !Herobrine.isAllowedBlock(undersignblock.getType())) { - signblock.setType(Material.SIGN_POST); + signblock.setType(Material.matchMaterial("SIGN_POST")); final Sign sign = (Sign) signblock.getState(); sign.setLine(1, Herobrine.getPluginCore().getConfigDB().useSignMessages.get(randmsg)); sign.setRawData((byte) BlockChanger.getPlayerBlockFace(ploc).ordinal()); diff --git a/src/net/theprogrammersworld/herobrine/AI/extensions/GraveyardWorld.java b/src/net/theprogrammersworld/herobrine/AI/extensions/GraveyardWorld.java index 893386d..17fb7d8 100644 --- a/src/net/theprogrammersworld/herobrine/AI/extensions/GraveyardWorld.java +++ b/src/net/theprogrammersworld/herobrine/AI/extensions/GraveyardWorld.java @@ -13,7 +13,7 @@ public class GraveyardWorld { final Location loc = new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), 0.0, 3.0, 0.0); for (int x = -50; x <= 50; ++x) { for (int z = -50; z <= 50; ++z) { - loc.getWorld().getBlockAt(x, 3, z).setType(Material.MYCEL); + loc.getWorld().getBlockAt(x, 3, z).setType(Material.matchMaterial("MYCEL")); } } final int MainX = -10; diff --git a/src/net/theprogrammersworld/herobrine/Herobrine.java b/src/net/theprogrammersworld/herobrine/Herobrine.java index 1cf8cc7..559d55f 100644 --- a/src/net/theprogrammersworld/herobrine/Herobrine.java +++ b/src/net/theprogrammersworld/herobrine/Herobrine.java @@ -250,7 +250,7 @@ public class Herobrine extends JavaPlugin implements Listener { } public static boolean isAllowedBlock(final Material mat) { - if(mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA + if(mat == Material.WATER || mat == Material.matchMaterial("STATIONARY_WATER") || mat == Material.LAVA || mat == Material.matchMaterial("STATIONARY_LAVA") || mat == Material.ICE || mat == Material.PACKED_ICE) return false; else diff --git a/src/net/theprogrammersworld/herobrine/listeners/BlockListener.java b/src/net/theprogrammersworld/herobrine/listeners/BlockListener.java index 8c654dc..b1b6ae5 100644 --- a/src/net/theprogrammersworld/herobrine/listeners/BlockListener.java +++ b/src/net/theprogrammersworld/herobrine/listeners/BlockListener.java @@ -61,16 +61,16 @@ public class BlockListener implements Listener { .getType() == Material.GOLD_BLOCK) && (block.getWorld() .getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() + 1) - .getType() == Material.REDSTONE_TORCH_ON) + .getType() == Material.matchMaterial("REDSTONE_TORCH_ON")) && (block.getWorld() .getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() - 1) - .getType() == Material.REDSTONE_TORCH_ON) + .getType() == Material.matchMaterial("REDSTONE_TORCH_ON")) && (block.getWorld() .getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY(), blockloc.getBlockZ()) - .getType() == Material.REDSTONE_TORCH_ON) + .getType() == Material.matchMaterial("REDSTONE_TORCH_ON")) && (block.getWorld() .getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY(), blockloc.getBlockZ()) - .getType() == Material.REDSTONE_TORCH_ON) + .getType() == Material.matchMaterial("REDSTONE_TORCH_ON")) && Herobrine.getPluginCore().getConfigDB().UseTotem && !AICore.isTotemCalled) { if (!Herobrine.getPluginCore().getSupport().checkBuild(blockloc)) { event.getPlayer().sendMessage("§c[Herobrine] You can't summon the Herobrine in protect zone!"); diff --git a/src/net/theprogrammersworld/herobrine/listeners/PlayerListener.java b/src/net/theprogrammersworld/herobrine/listeners/PlayerListener.java index 1596669..af8b304 100644 --- a/src/net/theprogrammersworld/herobrine/listeners/PlayerListener.java +++ b/src/net/theprogrammersworld/herobrine/listeners/PlayerListener.java @@ -113,7 +113,7 @@ public class PlayerListener implements Listener { if ((event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null) && (event.getClickedBlock().getType() == Material.JUKEBOX)) { final ItemStack item = event.getPlayer().getInventory().getItemInMainHand(); final Jukebox block = (Jukebox) event.getClickedBlock().getState(); - if (!block.isPlaying() && (item.getType() == Material.RECORD_11)) { + if (!block.isPlaying() && (item.getType() == Material.matchMaterial("RECORD_11"))) { Herobrine.getPluginCore().getAICore(); if (!AICore.isDiscCalled) { final Player player = event.getPlayer(); diff --git a/src/net/theprogrammersworld/herobrine/misc/BlockChanger.java b/src/net/theprogrammersworld/herobrine/misc/BlockChanger.java index 6e15006..49bc92a 100644 --- a/src/net/theprogrammersworld/herobrine/misc/BlockChanger.java +++ b/src/net/theprogrammersworld/herobrine/misc/BlockChanger.java @@ -95,7 +95,7 @@ public class BlockChanger { public static void PlaceSkull(final Location loc, final String name) { final int chance = new Random().nextInt(7); final Block b = loc.getBlock(); - b.setType(Material.SKULL); + b.setType(Material.matchMaterial("SKULL")); final Skull skull = (Skull) b.getState(); skull.setSkullType(SkullType.PLAYER); skull.setOwner(name); diff --git a/src/net/theprogrammersworld/herobrine/misc/ItemName.java b/src/net/theprogrammersworld/herobrine/misc/ItemName.java index 16bb7c5..c37e636 100644 --- a/src/net/theprogrammersworld/herobrine/misc/ItemName.java +++ b/src/net/theprogrammersworld/herobrine/misc/ItemName.java @@ -56,7 +56,7 @@ public class ItemName { } public static ItemStack CreateSkull(final String data) { - final ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal()); + final ItemStack skull = new ItemStack(Material.matchMaterial("SKULL_ITEM"), 1, (short) SkullType.PLAYER.ordinal()); final SkullMeta skullmeta = (SkullMeta) skull.getItemMeta(); skullmeta.setOwner(data); skullmeta.setDisplayName(ChatColor.RESET + data); diff --git a/src/net/theprogrammersworld/herobrine/nms/entity/CustomZombie.java b/src/net/theprogrammersworld/herobrine/nms/entity/CustomZombie.java index 9a01901..7ef608e 100644 --- a/src/net/theprogrammersworld/herobrine/nms/entity/CustomZombie.java +++ b/src/net/theprogrammersworld/herobrine/nms/entity/CustomZombie.java @@ -32,11 +32,11 @@ public class CustomZombie extends EntityZombie implements CustomEntity { getAttributeInstance(GenericAttributes.maxHealth).setValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP")); setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP")); setCustomName("Artifact Guardian"); - ((Zombie) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.GOLD_SWORD, 1)); - ((Zombie) getBukkitEntity()).getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1)); - ((Zombie) getBukkitEntity()).getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1)); - ((Zombie) getBukkitEntity()).getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS, 1)); - ((Zombie) getBukkitEntity()).getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1)); + ((Zombie) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.matchMaterial("GOLD_SWORD"), 1)); + ((Zombie) getBukkitEntity()).getEquipment().setHelmet(new ItemStack(Material.matchMaterial("GOLD_HELMET"), 1)); + ((Zombie) getBukkitEntity()).getEquipment().setChestplate(new ItemStack(Material.matchMaterial("GOLD_CHESTPLATE"), 1)); + ((Zombie) getBukkitEntity()).getEquipment().setLeggings(new ItemStack(Material.matchMaterial("GOLD_LEGGINGS"), 1)); + ((Zombie) getBukkitEntity()).getEquipment().setBoots(new ItemStack(Material.matchMaterial("GOLD_BOOTS"), 1)); getBukkitEntity().teleport(loc); }