From 7684164f23be66ad9cfe6e9d42470f4032613052 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 8 Aug 2022 19:19:01 +0200 Subject: [PATCH] Waypoints command --- .../net/Indyuce/mmocore/api/player/PlayerData.java | 2 +- .../command/rpg/admin/AdminCommandTreeNode.java | 2 +- .../command/rpg/admin/WaypointCommandTreeNode.java | 14 +++++++------- .../mmocore/skill/cast/listener/KeyCombos.java | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 399369ac..7609fb6b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -601,7 +601,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } public void lockWaypoint(Waypoint waypoint) { - waypoints.remove(waypoint); + waypoints.remove(waypoint.getId()); } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java index 721c8f47..55f2a327 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java @@ -28,7 +28,7 @@ public class AdminCommandTreeNode extends CommandTreeNode { addChild(new PointsCommandTreeNode("attr-realloc", this, PlayerData::setAttributeReallocationPoints, PlayerData::giveAttributeReallocationPoints, PlayerData::getAttributeReallocationPoints)); addChild(new PointsCommandTreeNode("skill-realloc", this, PlayerData::setSkillReallocationPoints, PlayerData::giveSkillReallocationPoints, PlayerData::getSkillReallocationPoints)); addChild(new PointsCommandTreeNode("skill-tree-realloc", this, PlayerData::setSkillTreeReallocationPoints, PlayerData::giveSkillTreeReallocationPoints, PlayerData::getSkillTreeReallocationPoints)); - + addChild(new WaypointCommandTreeNode(this)); for (PlayerResource res : PlayerResource.values()) addChild(new ResourceCommandTreeNode(res.name().toLowerCase(), this, res)); } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/WaypointCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/WaypointCommandTreeNode.java index 01daddbf..28a8c5fb 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/WaypointCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/WaypointCommandTreeNode.java @@ -18,10 +18,10 @@ public class WaypointCommandTreeNode extends CommandTreeNode { public WaypointCommandTreeNode(CommandTreeNode parent) { super(parent, "waypoint"); addChild(new ActionCommandTreeNode(this, "unlock", - (playerData, waypoint) -> !playerData.getWaypoints().contains(waypoint) + (playerData, waypoint) -> !playerData.hasWaypoint(waypoint) , (playerData, waypoint) -> playerData.unlockWaypoint(waypoint))); addChild(new ActionCommandTreeNode(this, "lock", - (playerData, waypoint) -> playerData.getWaypoints().contains(waypoint) + (playerData, waypoint) -> playerData.hasWaypoint(waypoint) , (playerData, waypoint) -> playerData.lockWaypoint(waypoint))); } @@ -49,21 +49,21 @@ public class WaypointCommandTreeNode extends CommandTreeNode { @Override public CommandResult execute(CommandSender sender, String[] args) { - Player player = Bukkit.getPlayer(args[0]); + Player player = Bukkit.getPlayer(args[3]); if (player == null) { - sender.sendMessage(ChatColor.RED + "Could not find the player called " + args[0] + "."); + sender.sendMessage(ChatColor.RED + "Could not find the player called " + args[3] + "."); return CommandResult.FAILURE; } - Waypoint waypoint = MMOCore.plugin.waypointManager.get(args[1]); + Waypoint waypoint = MMOCore.plugin.waypointManager.get(args[4]); if (waypoint == null) { - sender.sendMessage(ChatColor.RED + "Could not find the waypoint called " + args[1] + "."); + sender.sendMessage(ChatColor.RED + "Could not find the waypoint called " + args[4] + "."); return CommandResult.FAILURE; } PlayerData playerData = PlayerData.get(player); if (!check.apply(playerData, waypoint)) { - sender.sendMessage(ChatColor.RED + "The waypoint " + args[1] + "is already in this state."); + sender.sendMessage(ChatColor.RED + "The waypoint " + args[4] + " is already in this state."); return CommandResult.FAILURE; } change.accept(playerData, waypoint); diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java index 04600530..2525bf3a 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java +++ b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java @@ -171,8 +171,8 @@ public class KeyCombos implements Listener { CustomSkillCastingHandler(PlayerData caster) { super(caster, 10); - if (!caster.getProfess().getCombos().isEmpty()) { - classCombos = caster.getProfess().getCombos(); + if (!caster.getProfess().getKeyCombos().isEmpty()) { + classCombos = caster.getProfess().getKeyCombos(); classLongestCombo = caster.getProfess().getLongestCombo(); } else { classCombos = combos;