Skip to content

Commit b704466

Browse files
committed
Final waypoint limit fixes
1 parent 22b806b commit b704466

4 files changed

Lines changed: 11 additions & 13 deletions

File tree

src/main/java/me/yarinlevi/waypoints/player/PlayerData.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ public PlayerData(OfflinePlayer player, List<Waypoint> waypoints) {
3030
this.player = player;
3131
this.waypointList.addAll(waypoints);
3232

33-
if (player.isOnline()) {
34-
try {
35-
this.loadLimit();
36-
} catch (PlayerNotLoadedException ignored) {
37-
// no need to load limit as the player can't create waypoints if he is not online.
38-
}
33+
try {
34+
this.loadLimit();
35+
} catch (PlayerNotLoadedException ignored) {
36+
// no need to load limit as the player can't create waypoints if he is not online.
3937
}
4038

4139
Waypoints.getInstance().getPlayerSettingsManager().loadPlayerSettings(this.player.getUniqueId(), this);
@@ -54,8 +52,8 @@ public void loadLimit() throws PlayerNotLoadedException {
5452

5553
FileConfiguration config = Waypoints.getInstance().getConfig();
5654

57-
for (String perm : config.getStringList("total_limits")) {
58-
if (_player.hasPermission(perm)) {
55+
for (String perm : config.getConfigurationSection("total_limits").getKeys(false)) {
56+
if (_player.hasPermission(perm.replaceAll("-", "."))) {
5957
if (limit <= config.getInt("total_limits." + perm)) {
6058
limit = config.getInt("total_limits." + perm);
6159
}

src/main/resources/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ DeathPoints: true
77
# Should public waypoints be available?
88
PublicWaypoints: true
99

10-
# Waypoint limits
10+
# Waypoint limits, replace dots with '-' instead
1111
total_limits:
12-
waypoints.limit.default: 10
13-
waypoints.limit.vip: 15
12+
"waypoints-limit-default": 10
13+
"waypoints-limit-vip": 15
1414

1515
# Configurations for all the trackers available
1616
trackers:

src/main/resources/messages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ setting_change_failed_not_found: "&cSetting change failed! &7Setting &e{1} &7not
2121
setting_toggled: "&7Setting '&e{1}&7' was toggled {2}&7!"
2222
tracker_changed: "&7Tracker updated! now using &b{1}&7!"
2323
create_failed_args: "&cCreate failed! &7Not enough arguments!"
24-
create_failed_exists: "&cCreate failed! &7You already have a waypoint named &b{0}&7!"
24+
create_failed_exists: "&cCreate failed! &7You already have a waypoint named &b{1}&7!"
2525
create_failed_limit: "&cCreate failed! &7You have reached your {1} &7waypoint limit!"
2626
waypoint_created: "&7Created new waypoint &b{1}"
2727
waypoint_deleted: "&7Deleted waypoint &b{1}"

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ commands:
1515
permissions:
1616
qwaypoints.command.spawn:
1717
default: not op
18-
qwaypoints-default:
18+
waypoints.limit.default:
1919
default: not op

0 commit comments

Comments
 (0)