mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-29 06:06:08 +01:00
Rename maxChecks to maxTries and add command flag
This commit is contained in:
parent
32de0ca58b
commit
b25e38f393
@ -206,6 +206,13 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}));
|
}));
|
||||||
|
addOptionParser(new SimpleOptionParser(array("t", "tries"), (searcher, args) -> {
|
||||||
|
if (args.length > 0) {
|
||||||
|
searcher.setMaxTries(Integer.parseInt(args[0]));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}));
|
||||||
addOptionParser(new AdditionalOptionParser("spawnpoint", "sp"));
|
addOptionParser(new AdditionalOptionParser("spawnpoint", "sp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class RandomSearcher {
|
|||||||
private int minRadius = 0;
|
private int minRadius = 0;
|
||||||
private int maxRadius = Integer.MAX_VALUE;
|
private int maxRadius = Integer.MAX_VALUE;
|
||||||
private boolean generatedOnly = false;
|
private boolean generatedOnly = false;
|
||||||
private int maxChecks = 100;
|
private int maxTries = 100;
|
||||||
private int cooldown;
|
private int cooldown;
|
||||||
private Map<String, String> options = new LinkedHashMap<>();
|
private Map<String, String> options = new LinkedHashMap<>();
|
||||||
|
|
||||||
@ -220,12 +220,12 @@ public class RandomSearcher {
|
|||||||
this.generatedOnly = generatedOnly;
|
this.generatedOnly = generatedOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxChecks() {
|
public int getMaxTries() {
|
||||||
return maxChecks;
|
return maxTries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxChecks(int maxChecks) {
|
public void setMaxTries(int maxTries) {
|
||||||
this.maxChecks = maxChecks;
|
this.maxTries = maxTries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +266,7 @@ public class RandomSearcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkRandom(CompletableFuture<Location> future) {
|
private void checkRandom(CompletableFuture<Location> future) {
|
||||||
if (checks >= maxChecks) {
|
if (checks >= maxTries) {
|
||||||
future.completeExceptionally(new NotFoundException("location"));
|
future.completeExceptionally(new NotFoundException("location"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -359,7 +359,7 @@ public class RandomSearcher {
|
|||||||
", minRadius=" + minRadius +
|
", minRadius=" + minRadius +
|
||||||
", maxRadius=" + maxRadius +
|
", maxRadius=" + maxRadius +
|
||||||
", generatedOnly=" + generatedOnly +
|
", generatedOnly=" + generatedOnly +
|
||||||
", maxChecks=" + maxChecks +
|
", maxTries=" + maxTries +
|
||||||
", cooldown=" + cooldown +
|
", cooldown=" + cooldown +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ commands:
|
|||||||
> -id <id> - The ID to use for the cooldown, uses automatically generated one if not provided
|
> -id <id> - The ID to use for the cooldown, uses automatically generated one if not provided
|
||||||
> -f,-force - teleport even if there is no dirt/grass/sand/gravel, only checks for lava/water/cactus, ignores WorldGuard/Faction regions
|
> -f,-force - teleport even if there is no dirt/grass/sand/gravel, only checks for lava/water/cactus, ignores WorldGuard/Faction regions
|
||||||
> -f,-force [<blocks|regions>] - only ignore blocks or regions
|
> -f,-force [<blocks|regions>] - only ignore blocks or regions
|
||||||
|
> -t,-tries <amount> - the amount of times the plugin should try to find a random location before giving up
|
||||||
> -sp,spawnpoint [force] - set the respawn point of the player to the location he teleported to (force overrides existing spawnpoint)
|
> -sp,spawnpoint [force] - set the respawn point of the player to the location he teleported to (force overrides existing spawnpoint)
|
||||||
/<command> --stat - shows a statistic of the teleports since the last restart
|
/<command> --stat - shows a statistic of the teleports since the last restart
|
||||||
/<command> --reload - reloads the config
|
/<command> --reload - reloads the config
|
||||||
|
Loading…
Reference in New Issue
Block a user