diff --git a/lib/WHIMC-Observations-2.5.0.jar b/lib/WHIMC-Observations-2.5.0.jar deleted file mode 100644 index 1ab80d0..0000000 Binary files a/lib/WHIMC-Observations-2.5.0.jar and /dev/null differ diff --git a/lib/WHIMC-Observations-2.6.3.jar b/lib/WHIMC-Observations-2.6.3.jar new file mode 100644 index 0000000..be66e09 Binary files /dev/null and b/lib/WHIMC-Observations-2.6.3.jar differ diff --git a/lib/WHIMC-ScienceTools-2.4.4.jar b/lib/WHIMC-ScienceTools-2.4.11.jar similarity index 93% rename from lib/WHIMC-ScienceTools-2.4.4.jar rename to lib/WHIMC-ScienceTools-2.4.11.jar index 4484022..57fd46b 100644 Binary files a/lib/WHIMC-ScienceTools-2.4.4.jar and b/lib/WHIMC-ScienceTools-2.4.11.jar differ diff --git a/pom.xml b/pom.xml index 844bb91..0f5214e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 edu.whimc WHIMC-OverworldAgent - 2.1.0 + 2.2.1 WHIMC Overworld Agent Defines overworld agent traits @@ -14,12 +14,14 @@ spigot-repo https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + false + true playpro-repo https://maven.playpro.com - + codemc-repo https://repo.codemc.io/repository/maven-public/ @@ -33,11 +35,6 @@ dmulloy2-repo https://repo.dmulloy2.net/repository/public/ - - - jitpack.io - https://jitpack.io - papermc @@ -68,7 +65,7 @@ org.spigotmc spigot-api - 1.13.2-R0.1-SNAPSHOT + 1.18.2-R0.1-SNAPSHOT provided @@ -92,15 +89,15 @@ net.citizensnpcs citizens-main - 2.0.31-SNAPSHOT + 2.0.33-SNAPSHOT jar provided - com.comphenix.protocol + net.dmulloy2 ProtocolLib - 4.8.0 + 5.3.0 provided @@ -108,14 +105,14 @@ WHIMC-ScienceTools system 2.4.4 - ${pom.basedir}/lib/WHIMC-ScienceTools-2.4.4.jar + ${pom.basedir}/lib/WHIMC-ScienceTools-2.4.11.jar edu.whimc WHIMC-Observations system - 2.5.0 - ${pom.basedir}/lib/WHIMC-Observations-2.5.0.jar + 2.6.3 + ${pom.basedir}/lib/WHIMC-Observations-2.6.3.jar edu.whimc @@ -133,9 +130,9 @@ - com.github.PikaMug.Quests - quests-main - 4.0.8 + me.pikamug.quests + quests-api + 5.0.0-rc.3 provided diff --git a/src/main/java/edu/whimc/overworld_agent/commands/subcommands/DestroyAgentsCommand.java b/src/main/java/edu/whimc/overworld_agent/commands/subcommands/DestroyAgentsCommand.java index 03c6b12..af3a50e 100644 --- a/src/main/java/edu/whimc/overworld_agent/commands/subcommands/DestroyAgentsCommand.java +++ b/src/main/java/edu/whimc/overworld_agent/commands/subcommands/DestroyAgentsCommand.java @@ -3,6 +3,8 @@ import edu.whimc.overworld_agent.OverworldAgent; import edu.whimc.overworld_agent.commands.AbstractSubCommand; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.api.npc.NPCRegistry; +import net.citizensnpcs.api.CitizensAPI; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -35,26 +37,42 @@ protected boolean onCommand(CommandSender sender, String[] args) { return true; } String playerName = args[0]; - if (playerName.equalsIgnoreCase(ALL)){ - for (Map.Entry entry : npcs.entrySet()){ - NPC npc = entry.getValue(); - npc.destroy(); + if (playerName.equalsIgnoreCase(ALL)) { + if (npcs.isEmpty()) { + sender.sendMessage("There are no agents to destroy."); + return true; } - plugin.removeAgents(); - sender.sendMessage("All agents were destroyed"); - } else { - if(Bukkit.getPlayer(playerName) != null){ - NPC npc = npcs.get(playerName); - if(npc != null) { - npc.destroy(); - plugin.removeAgent(playerName); - sender.sendMessage(npc.getName() + " was destroyed"); - } else { - sender.sendMessage("Player does not have an agent"); + + for (NPC npc : new ArrayList<>(npcs.values())) { + if (npc == null) continue; + + if (npc.isSpawned()) { + npc.despawn(); } + npc.destroy(); } + + plugin.removeAgents(); + sender.sendMessage("All agents were destroyed."); + return true; } + // Single player destroy - we do NOT require the player to be online + NPC npc = npcs.get(playerName); + + if (npc == null) { + sender.sendMessage("Player " + playerName + " does not have an agent."); + return true; + } + + if (npc.isSpawned()) { + npc.despawn(); + } + + npc.destroy(); + plugin.removeAgent(playerName); + + sender.sendMessage(npc.getName() + " was destroyed."); return true; } diff --git a/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/Dialogue.java b/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/Dialogue.java index 7d3d95d..f8afda9 100644 --- a/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/Dialogue.java +++ b/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/Dialogue.java @@ -10,9 +10,9 @@ import edu.whimc.overworld_agent.utils.Utils; import edu.whimc.sciencetools.models.sciencetool.ScienceTool; import edu.whimc.sciencetools.models.sciencetool.ScienceToolMeasureEvent; -import me.blackvein.quests.Objective; -import me.blackvein.quests.Quest; -import me.blackvein.quests.Quests; +//import me.blackvein.quests.Objective; +//import me.blackvein.quests.Quest; +//import me.blackvein.quests.Quests; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.trait.FollowTrait; diff --git a/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/SignMenuFactory.java b/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/SignMenuFactory.java index 513e336..8f21fb0 100644 --- a/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/SignMenuFactory.java +++ b/src/main/java/edu/whimc/overworld_agent/dialoguetemplate/SignMenuFactory.java @@ -6,6 +6,7 @@ import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.wrappers.BlockPosition; +import java.lang.reflect.InvocationTargetException; import edu.whimc.overworld_agent.utils.Utils; import java.util.Map; import java.util.UUID; @@ -17,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.List; import java.util.Objects; @@ -98,7 +98,7 @@ public void open(Player player) { location = player.getLocation(); location.setY(location.getBlockY() - 4); - player.sendBlockChange(location, Material.SIGN.createBlockData()); + player.sendBlockChange(location, Material.OAK_SIGN.createBlockData()); player.sendSignChange( location, text.stream().map(Utils::color).collect(Collectors.toList()).toArray(new String[4]) @@ -107,11 +107,7 @@ public void open(Player player) { PacketContainer openSign = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.OPEN_SIGN_EDITOR); BlockPosition position = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()); openSign.getBlockPositionModifier().write(0, position); - try { - ProtocolLibrary.getProtocolManager().sendServerPacket(player, openSign); - } catch (InvocationTargetException exception) { - exception.printStackTrace(); - } + ProtocolLibrary.getProtocolManager().sendServerPacket(player, openSign); inputs.put(player.getUniqueId(), this); }