forked from Upstream/mmocore
Waypoints command
This commit is contained in:
parent
57e56ddd86
commit
7684164f23
@ -601,7 +601,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void lockWaypoint(Waypoint waypoint) {
|
public void lockWaypoint(Waypoint waypoint) {
|
||||||
waypoints.remove(waypoint);
|
waypoints.remove(waypoint.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class AdminCommandTreeNode extends CommandTreeNode {
|
|||||||
addChild(new PointsCommandTreeNode("attr-realloc", this, PlayerData::setAttributeReallocationPoints, PlayerData::giveAttributeReallocationPoints, PlayerData::getAttributeReallocationPoints));
|
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-realloc", this, PlayerData::setSkillReallocationPoints, PlayerData::giveSkillReallocationPoints, PlayerData::getSkillReallocationPoints));
|
||||||
addChild(new PointsCommandTreeNode("skill-tree-realloc", this, PlayerData::setSkillTreeReallocationPoints, PlayerData::giveSkillTreeReallocationPoints, PlayerData::getSkillTreeReallocationPoints));
|
addChild(new PointsCommandTreeNode("skill-tree-realloc", this, PlayerData::setSkillTreeReallocationPoints, PlayerData::giveSkillTreeReallocationPoints, PlayerData::getSkillTreeReallocationPoints));
|
||||||
|
addChild(new WaypointCommandTreeNode(this));
|
||||||
for (PlayerResource res : PlayerResource.values())
|
for (PlayerResource res : PlayerResource.values())
|
||||||
addChild(new ResourceCommandTreeNode(res.name().toLowerCase(), this, res));
|
addChild(new ResourceCommandTreeNode(res.name().toLowerCase(), this, res));
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ public class WaypointCommandTreeNode extends CommandTreeNode {
|
|||||||
public WaypointCommandTreeNode(CommandTreeNode parent) {
|
public WaypointCommandTreeNode(CommandTreeNode parent) {
|
||||||
super(parent, "waypoint");
|
super(parent, "waypoint");
|
||||||
addChild(new ActionCommandTreeNode(this, "unlock",
|
addChild(new ActionCommandTreeNode(this, "unlock",
|
||||||
(playerData, waypoint) -> !playerData.getWaypoints().contains(waypoint)
|
(playerData, waypoint) -> !playerData.hasWaypoint(waypoint)
|
||||||
, (playerData, waypoint) -> playerData.unlockWaypoint(waypoint)));
|
, (playerData, waypoint) -> playerData.unlockWaypoint(waypoint)));
|
||||||
addChild(new ActionCommandTreeNode(this, "lock",
|
addChild(new ActionCommandTreeNode(this, "lock",
|
||||||
(playerData, waypoint) -> playerData.getWaypoints().contains(waypoint)
|
(playerData, waypoint) -> playerData.hasWaypoint(waypoint)
|
||||||
, (playerData, waypoint) -> playerData.lockWaypoint(waypoint)));
|
, (playerData, waypoint) -> playerData.lockWaypoint(waypoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,21 +49,21 @@ public class WaypointCommandTreeNode extends CommandTreeNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(CommandSender sender, String[] args) {
|
public CommandResult execute(CommandSender sender, String[] args) {
|
||||||
Player player = Bukkit.getPlayer(args[0]);
|
Player player = Bukkit.getPlayer(args[3]);
|
||||||
if (player == null) {
|
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;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Waypoint waypoint = MMOCore.plugin.waypointManager.get(args[1]);
|
Waypoint waypoint = MMOCore.plugin.waypointManager.get(args[4]);
|
||||||
if (waypoint == null) {
|
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;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerData playerData = PlayerData.get(player);
|
PlayerData playerData = PlayerData.get(player);
|
||||||
if (!check.apply(playerData, waypoint)) {
|
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;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
change.accept(playerData, waypoint);
|
change.accept(playerData, waypoint);
|
||||||
|
@ -171,8 +171,8 @@ public class KeyCombos implements Listener {
|
|||||||
|
|
||||||
CustomSkillCastingHandler(PlayerData caster) {
|
CustomSkillCastingHandler(PlayerData caster) {
|
||||||
super(caster, 10);
|
super(caster, 10);
|
||||||
if (!caster.getProfess().getCombos().isEmpty()) {
|
if (!caster.getProfess().getKeyCombos().isEmpty()) {
|
||||||
classCombos = caster.getProfess().getCombos();
|
classCombos = caster.getProfess().getKeyCombos();
|
||||||
classLongestCombo = caster.getProfess().getLongestCombo();
|
classLongestCombo = caster.getProfess().getLongestCombo();
|
||||||
} else {
|
} else {
|
||||||
classCombos = combos;
|
classCombos = combos;
|
||||||
|
Loading…
Reference in New Issue
Block a user