From 6a52f6b8595d44c12e058c25c68ac9bdc1e29a06 Mon Sep 17 00:00:00 2001 From: ShakeforProtein Date: Sat, 23 Oct 2021 08:57:43 +1000 Subject: [PATCH] Update for 117 --- pom.xml | 6 +++--- .../treebotimed/Commands/GiveBlueprint.java | 15 +++++++-------- .../treebotimed/Commands/PasteAtOrigin.java | 6 ++---- .../treebotimed/Listeners/PlaceSchem.java | 17 ++++++----------- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 5af88d0..2226222 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.ShakeforProtein TreeboTimed - 1.0.1 - SpMc1.16.1 - WE7.2.0 + 1.0.2 - SpMc1.17.1 - WE7.2.0 jar TreeboTimed @@ -97,13 +97,13 @@ org.spigotmc spigot - 1.16.1-R0.1-SNAPSHOT + 1.17.1-R0.1-SNAPSHOT provided org.spigotmc spigot-api - 1.16.1-R0.1-SNAPSHOT + 1.17.1-R0.1-SNAPSHOT provided diff --git a/src/main/java/me/shakeforprotein/treebotimed/Commands/GiveBlueprint.java b/src/main/java/me/shakeforprotein/treebotimed/Commands/GiveBlueprint.java index 7f7c8c9..9239574 100644 --- a/src/main/java/me/shakeforprotein/treebotimed/Commands/GiveBlueprint.java +++ b/src/main/java/me/shakeforprotein/treebotimed/Commands/GiveBlueprint.java @@ -1,8 +1,7 @@ package me.shakeforprotein.treebotimed.Commands; import me.shakeforprotein.treebotimed.TreeboTimed; -import net.minecraft.server.v1_16_R1.NBTTagCompound; -import net.minecraft.server.v1_16_R1.NBTTagString; +import net.minecraft.nbt.NBTTagCompound; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -11,7 +10,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -72,7 +71,7 @@ else if (args.length > 2){ itemMeta.setLore(list); blueprint.setItemMeta(itemMeta); - net.minecraft.server.v1_16_R1.ItemStack nmsItem = getNMSItem(blueprint); + net.minecraft.world.item.ItemStack nmsItem = getNMSItem(blueprint); NBTTagCompound nbtCompound = getCompound(nmsItem); Set compoundSet = nbtCompound.getKeys(); StringBuilder sb = new StringBuilder(); @@ -88,17 +87,17 @@ else if (args.length > 2){ } - public net.minecraft.server.v1_16_R1.ItemStack getNMSItem(ItemStack item) { - net.minecraft.server.v1_16_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); + public net.minecraft.world.item.ItemStack getNMSItem(ItemStack item) { + net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); return nmsItem; } - public NBTTagCompound getCompound(net.minecraft.server.v1_16_R1.ItemStack nmsItem) { + public NBTTagCompound getCompound(net.minecraft.world.item.ItemStack nmsItem) { NBTTagCompound nmsCompound = (nmsItem.hasTag()) ? nmsItem.getTag() : new NBTTagCompound(); return nmsCompound; } - public ItemStack getBukkitItem(net.minecraft.server.v1_16_R1.ItemStack nmsItem) { + public ItemStack getBukkitItem(net.minecraft.world.item.ItemStack nmsItem) { ItemStack bukkitItem = CraftItemStack.asBukkitCopy(nmsItem); return bukkitItem; } diff --git a/src/main/java/me/shakeforprotein/treebotimed/Commands/PasteAtOrigin.java b/src/main/java/me/shakeforprotein/treebotimed/Commands/PasteAtOrigin.java index ae7fc9e..61d3a73 100644 --- a/src/main/java/me/shakeforprotein/treebotimed/Commands/PasteAtOrigin.java +++ b/src/main/java/me/shakeforprotein/treebotimed/Commands/PasteAtOrigin.java @@ -14,11 +14,9 @@ import com.sk89q.worldedit.session.ClipboardHolder; import me.shakeforprotein.treebotimed.TreeboTimed; import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; + import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; + import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/me/shakeforprotein/treebotimed/Listeners/PlaceSchem.java b/src/main/java/me/shakeforprotein/treebotimed/Listeners/PlaceSchem.java index 9752a64..2a9bdad 100644 --- a/src/main/java/me/shakeforprotein/treebotimed/Listeners/PlaceSchem.java +++ b/src/main/java/me/shakeforprotein/treebotimed/Listeners/PlaceSchem.java @@ -13,11 +13,11 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.session.ClipboardHolder; import me.shakeforprotein.treebotimed.TreeboTimed; -import net.minecraft.server.v1_16_R1.NBTTagCompound; +import net.minecraft.nbt.NBTTagCompound; import org.bukkit.*; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -44,7 +44,7 @@ private void placeSchem(PlayerInteractEvent e) { if (e.getItem() != null && (e.getItem().getType() == Material.PAPER || e.getItem().getType() == Material.FILLED_MAP)) { if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName() && ChatColor.stripColor(e.getItem().getItemMeta().getDisplayName().toLowerCase()).startsWith("blueprint")) { ItemStack blueprint = e.getItem(); - net.minecraft.server.v1_16_R1.ItemStack nmsBlueprint = getNMSItem(blueprint); + net.minecraft.world.item.ItemStack nmsBlueprint = getNMSItem(blueprint); NBTTagCompound nbtBlueprint = getCompound(nmsBlueprint); if (nbtBlueprint.hasKey("ShakeBlueprint")) { String scmName = nbtBlueprint.getString("ShakeBlueprint"); @@ -58,21 +58,16 @@ private void placeSchem(PlayerInteractEvent e) { } - public net.minecraft.server.v1_16_R1.ItemStack getNMSItem(ItemStack item) { - net.minecraft.server.v1_16_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); + public net.minecraft.world.item.ItemStack getNMSItem(ItemStack item) { + net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); return nmsItem; } - public NBTTagCompound getCompound(net.minecraft.server.v1_16_R1.ItemStack nmsItem) { + public NBTTagCompound getCompound(net.minecraft.world.item.ItemStack nmsItem) { NBTTagCompound nmsCompound = (nmsItem.hasTag()) ? nmsItem.getTag() : new NBTTagCompound(); return nmsCompound; } - public ItemStack getBukkitItem(net.minecraft.server.v1_16_R1.ItemStack nmsItem) { - ItemStack bukkitItem = CraftItemStack.asBukkitCopy(nmsItem); - return bukkitItem; - } - public boolean placeAtPlayer(Player p, String nbtString) { File detailsFile = new File(pl.getDataFolder() + File.separator + "blueprints", nbtString + ".yml");