Waypoints command

This commit is contained in:
Ka0rX 2022-08-08 19:19:01 +02:00
parent 57e56ddd86
commit 7684164f23
4 changed files with 11 additions and 11 deletions

View File

@ -601,7 +601,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
}
public void lockWaypoint(Waypoint waypoint) {
waypoints.remove(waypoint);
waypoints.remove(waypoint.getId());
}

View File

@ -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));
}

View File

@ -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);

View File

@ -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;