Changed the way default waypoints work.

All default waypoints will be unlocked regardless of playerdata,
no matter what.
This commit is contained in:
ASangarin 2020-09-10 21:37:24 +02:00
parent 1ec270566d
commit 9c48b96f18
4 changed files with 1 additions and 10 deletions

View File

@ -308,7 +308,7 @@ public class PlayerData extends OfflinePlayerData {
} }
public boolean hasWaypoint(Waypoint waypoint) { public boolean hasWaypoint(Waypoint waypoint) {
return waypoints.contains(waypoint.getId()); return waypoint.isDefault() || waypoints.contains(waypoint.getId());
} }
public void unlockWaypoint(Waypoint waypoint) { public void unlockWaypoint(Waypoint waypoint) {

View File

@ -91,8 +91,6 @@ public class ResetCommandTreeNode extends CommandTreeNode {
PlayerData data = PlayerData.get(player); PlayerData data = PlayerData.get(player);
data.getWaypoints().clear(); data.getWaypoints().clear();
MMOCore.plugin.waypointManager.getAll().stream().filter(waypoint -> waypoint.isDefault())
.forEach(waypoint -> data.unlockWaypoint(waypoint));
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} }
} }

View File

@ -3,9 +3,7 @@ package net.Indyuce.mmocore.manager;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -29,10 +27,6 @@ public class WaypointManager {
return waypoints.values(); return waypoints.values();
} }
public Set<Waypoint> getDefault() {
return getAll().stream().filter(waypoint -> waypoint.isDefault()).collect(Collectors.toSet());
}
public boolean has(String id) { public boolean has(String id) {
return waypoints.containsKey(id); return waypoints.containsKey(id);
} }

View File

@ -46,7 +46,6 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
data.getQuestData().updateBossBar(); data.getQuestData().updateBossBar();
if (config.contains("waypoints")) if (config.contains("waypoints"))
data.getWaypoints().addAll(config.getStringList("waypoints")); data.getWaypoints().addAll(config.getStringList("waypoints"));
MMOCore.plugin.waypointManager.getDefault().forEach(waypoint -> data.getWaypoints().add(waypoint.getId()));
if (config.contains("friends")) if (config.contains("friends"))
config.getStringList("friends").forEach(str -> data.getFriends().add(UUID.fromString(str))); config.getStringList("friends").forEach(str -> data.getFriends().add(UUID.fromString(str)));
if (config.contains("skill")) if (config.contains("skill"))