Skip to content

Commit

Permalink
feat: add permission-based teleport warmup (#682)
Browse files Browse the repository at this point in the history
* Add permission based tp cooldowns

* Add permission based tp cooldowns

* Move permission warmup logic to OnlineUser
  • Loading branch information
WuzzyLV authored Aug 22, 2024
1 parent de070e0 commit ecc180e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public TimedTeleport toTimedTeleport() throws IllegalStateException {

return new TimedTeleport(
executor, onlineTeleporter, target, type,
plugin.getSettings().getGeneral().getTeleportWarmupTime(),
onlineTeleporter.getMaxTeleportWarmup(plugin.getSettings().getGeneral().getTeleportWarmupTime()),
updateLastPosition, actions, plugin
);
}
Expand Down
14 changes: 14 additions & 0 deletions common/src/main/java/net/william278/huskhomes/user/OnlineUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,20 @@ public int getMaxPublicHomes(final int defaultPublicHomes, final boolean stack)
}
}

/**
* Get the largest permission node value for teleport warmup.
*
* @param defaultTeleportWarmup the default teleport warmup time, if no perms are set
* @return the largest permission node value for teleport warmup
*/
public int getMaxTeleportWarmup(final int defaultTeleportWarmup) {
final List<Integer> homes = getNumericalPermissions("huskhomes.teleport_warmup.");
if (homes.isEmpty()) {
return defaultTeleportWarmup;
}
return homes.get(0);
}

/**
* Get the number of free home slots this user may set.
*
Expand Down

0 comments on commit ecc180e

Please sign in to comment.