From 9c48b96f183c56954c6c7880f04a1db2e16d6e9f Mon Sep 17 00:00:00 2001 From: ASangarin Date: Thu, 10 Sep 2020 21:37:24 +0200 Subject: [PATCH] Changed the way default waypoints work. All default waypoints will be unlocked regardless of playerdata, no matter what. --- .../java/net/Indyuce/mmocore/api/player/PlayerData.java | 2 +- .../mmocore/command/rpg/admin/ResetCommandTreeNode.java | 2 -- .../java/net/Indyuce/mmocore/manager/WaypointManager.java | 6 ------ .../mmocore/manager/data/yaml/YAMLPlayerDataManager.java | 1 - 4 files changed, 1 insertion(+), 10 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 fb339145..28e57d9a 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -308,7 +308,7 @@ public class PlayerData extends OfflinePlayerData { } public boolean hasWaypoint(Waypoint waypoint) { - return waypoints.contains(waypoint.getId()); + return waypoint.isDefault() || waypoints.contains(waypoint.getId()); } public void unlockWaypoint(Waypoint waypoint) { diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java index 2d7242dc..05a55872 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java @@ -91,8 +91,6 @@ public class ResetCommandTreeNode extends CommandTreeNode { PlayerData data = PlayerData.get(player); data.getWaypoints().clear(); - MMOCore.plugin.waypointManager.getAll().stream().filter(waypoint -> waypoint.isDefault()) - .forEach(waypoint -> data.unlockWaypoint(waypoint)); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java b/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java index 008387d0..29ee1bc8 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java @@ -3,9 +3,7 @@ package net.Indyuce.mmocore.manager; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; -import java.util.Set; import java.util.logging.Level; -import java.util.stream.Collectors; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; @@ -29,10 +27,6 @@ public class WaypointManager { return waypoints.values(); } - public Set getDefault() { - return getAll().stream().filter(waypoint -> waypoint.isDefault()).collect(Collectors.toSet()); - } - public boolean has(String id) { return waypoints.containsKey(id); } diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java index e99b4070..1abc3906 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java @@ -46,7 +46,6 @@ public class YAMLPlayerDataManager extends PlayerDataManager { data.getQuestData().updateBossBar(); if (config.contains("waypoints")) data.getWaypoints().addAll(config.getStringList("waypoints")); - MMOCore.plugin.waypointManager.getDefault().forEach(waypoint -> data.getWaypoints().add(waypoint.getId())); if (config.contains("friends")) config.getStringList("friends").forEach(str -> data.getFriends().add(UUID.fromString(str))); if (config.contains("skill"))