Adjustments to hardcoded values
This commit is contained in:
parent
a3d5e62aed
commit
6863487ad6
2 changed files with 20 additions and 15 deletions
|
@ -7,9 +7,9 @@ import buttondevteam.presents.architecture.commands.PlayerCommand;
|
||||||
|
|
||||||
@CommandClass(path = "rtp")
|
@CommandClass(path = "rtp")
|
||||||
public class Rtp extends PlayerCommand {
|
public class Rtp extends PlayerCommand {
|
||||||
final coordinate[] places = {
|
private int currentplace = 0;
|
||||||
|
private final coordinate[] teleportLocations = {
|
||||||
new coordinate(-582,72),
|
new coordinate(-582,72),
|
||||||
new coordinate(-772, 140),
|
|
||||||
new coordinate(-838,226),
|
new coordinate(-838,226),
|
||||||
new coordinate(-282, 444), //star island
|
new coordinate(-282, 444), //star island
|
||||||
new coordinate(-654, 202),
|
new coordinate(-654, 202),
|
||||||
|
@ -19,24 +19,27 @@ public class Rtp extends PlayerCommand {
|
||||||
new coordinate(-273, 556),
|
new coordinate(-273, 556),
|
||||||
new coordinate(-737, 217)
|
new coordinate(-737, 217)
|
||||||
};
|
};
|
||||||
int currentplace = 0;
|
|
||||||
@Override
|
|
||||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
|
||||||
coordinate currentCoordinate = places[currentplace];
|
|
||||||
|
|
||||||
player.teleport(player.getWorld().getHighestBlockAt(currentCoordinate.x, currentCoordinate.z).getLocation());
|
|
||||||
|
|
||||||
currentplace = (int) (currentplace + Math.floor(Math.random()*4 - 1)) % places.length;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class coordinate{
|
private class coordinate{
|
||||||
final int x;
|
final int x;
|
||||||
final int z;
|
final int z;
|
||||||
|
|
||||||
public coordinate(int x, int z){
|
coordinate(int x, int z){
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("Teleporting...");
|
||||||
|
coordinate currentCoordinate = teleportLocations[currentplace];
|
||||||
|
|
||||||
|
player.teleport(player.getWorld().getHighestBlockAt(currentCoordinate.x, currentCoordinate.z).getLocation());
|
||||||
|
|
||||||
|
currentplace = (int) (currentplace + Math.floor(Math.random()*5 - 1)) % teleportLocations.length;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,3 +5,5 @@ version: 0.0.1
|
||||||
commands:
|
commands:
|
||||||
hello:
|
hello:
|
||||||
description: A set of Hello World commands and listeners, type in /hello to see subcommands
|
description: A set of Hello World commands and listeners, type in /hello to see subcommands
|
||||||
|
rtp:
|
||||||
|
description: A command that allows players to randomly teleport across the map
|
Loading…
Reference in a new issue