Skip to content

Commit ab6f95d

Browse files
authored
Merge pull request #69 from TheNextLvl-net/teleport-cooldown-bypass
Add permission to bypass teleport cooldown
2 parents cd519e7 + 09a4d37 commit ab6f95d

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ Alternatively, you can use the command:
397397
| `cooldown-allow-movement` | Allows movement during teleport cooldown. |
398398
| `tpa-timeout` | Timeout duration in milliseconds for teleport requests. |
399399

400+
The permission to bypass the teleportation cooldown is `tweaks.teleport.cooldown.bypass`
401+
400402
## Animals Configuration
401403

402404
| Option | Description |

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ paper {
165165

166166
register("tweaks.chat.delete") { this.children = listOf("tweaks.chat.delete.own") }
167167

168+
register("tweaks.teleport.cooldown.bypass") { this.default = BukkitPluginDescription.Permission.Default.OP }
168169

169170
register("tweaks.commands.environmental") {
170171
this.description = "Grants access to all environmental commands"

src/main/java/net/thenextlvl/tweaks/controller/TeleportController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public class TeleportController {
2222

2323
public CompletableFuture<Boolean> teleport(Player player, Location location, PlayerTeleportEvent.TeleportCause cause) {
2424
var cooldown = plugin.config().teleport().cooldown();
25-
if (cooldown <= 0) return player.teleportAsync(location, cause);
25+
if (cooldown <= 0 || player.hasPermission("tweaks.teleport.cooldown.bypass"))
26+
return player.teleportAsync(location, cause);
2627
if (location.equals(teleports.put(player, location)))
2728
return CompletableFuture.failedFuture(new IllegalStateException());
2829
var formatter = DecimalFormat.getInstance(player.locale());

0 commit comments

Comments
 (0)