Skip to content

Commit

Permalink
Added permission node tbteleport.player.shop - default True
Browse files Browse the repository at this point in the history
Added permission node tbteleport.admin.setshop - default OP
Added permission node tbteleport.admin.cooldowns - default OP
Added /shop - sends player to shop for current world
Added /setshop - Sets current world /shop location to current location
Added /setTTeleCooldown - Enables, disables and sets the timer for /wild cooldowns.

Modified /setworldspawn to also save to config.yml for use with send to spawn on join.
Modified /tp <player> <player> - Should no longer error if run from console.
  • Loading branch information
ShakeforProtein committed May 25, 2019
1 parent d0cc558 commit d0d2018
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,11 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
Player p = (Player) sender;

String world = p.getWorld().getName();
double x = p.getLocation().getX();
double y = p.getLocation().getY();
double z = p.getLocation().getZ();
float pitch = p.getLocation().getPitch();
float yaw = p.getLocation().getYaw();

pl.getConfig().set("shop." + p.getWorld().getName() + ".world", world);
pl.getConfig().set("shop." + p.getWorld().getName() + ".x", x);
pl.getConfig().set("shop." + p.getWorld().getName() + ".y", y);
pl.getConfig().set("shop." + p.getWorld().getName() + ".z", z);
pl.getConfig().set("shop." + p.getWorld().getName() + ".pitch", pitch);
pl.getConfig().set("shop." + p.getWorld().getName() + ".yaw", yaw);
pl.getConfig().set("shop." + p.getWorld().getName() + ".location", p.getLocation());

sender.sendMessage(pl.badge + p.getWorld().getName() + "Shop set successfully, don't forget to run /ttelesaveconfig");
}
else{
sender.sendMessage(pl.err + "This command can only be run as a player");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
else{
if(args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("false")){
pl.getConfig().set("useCooldowns", args[0]);
if(args[0].equalsIgnoreCase("true")) {
sender.sendMessage(pl.badge + "useCooldowns enabled successfully, don't forget to run /ttelesaveconfig");
}
else if(args[0].equalsIgnoreCase("false")){
sender.sendMessage(pl.badge + "useCooldowns disabled successfully, don't forget to run /ttelesaveconfig");
}
}
else if (pl.isInteger(args[0])){
pl.getConfig().set("CommandDelay", args[0]);
sender.sendMessage(pl.badge + "CommandDelay set to " + args[0] + " successfully, don't forget to run /ttelesaveconfig");
}
else{
sender.sendMessage(pl.err + "Invalid input. Please use /setttelecooldown <true|false|integer>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
spawns.set("spawns." + name + ".yaw", yaw);

pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".world", world);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".x", x);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".y", y);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".z", z);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".pitch", pitch);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".yaw", yaw);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".location", p.getLocation());
sender.sendMessage(pl.badge + "onJoinSpawn set successfully, don't forget to run /ttelesaveconfig");


try {
spawns.save(spawnsYml);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
Player p = (Player) sender;

if (pl.getConfig().isSet("shop." + p.getWorld().getName() + ".world")) {
String world = pl.getConfig().getString("shop." + p.getWorld().getName() + ".world");
int x = Math.toIntExact(pl.getConfig().getInt("shop." + p.getWorld().getName() + ".x"));
int y = Math.toIntExact(pl.getConfig().getInt("shop." + p.getWorld().getName() + ".y"));
int z = Math.toIntExact(pl.getConfig().getInt("shop." + p.getWorld().getName() + ".z"));
float pitch = Math.toIntExact(pl.getConfig().getInt("shop." + p.getWorld().getName() + ".pitch"));
float yaw = Math.toIntExact(pl.getConfig().getInt("shop." + p.getWorld().getName() + ".yaw"));
Location shopLoc = new Location(Bukkit.getWorld(world), x, y, z, pitch, yaw);
p.teleport(shopLoc);
Location shopLoc = (Location) pl.getConfig().get("shop." + p.getWorld().getName() + ".location");
pl.shakeTP(p, shopLoc);
}
} else {
sender.sendMessage(pl.err + "This command can only be run by a player.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ private Location findSafeBlock(World w, CommandSender sender) {

Location landOn = w.getBlockAt(X, (Y + 2), Z).getLocation();
landOn.add(0.5,0,0.5);
pl.setCooldown((Player) sender);
if(pl.getConfig().getBoolean("useCooldown")) {
pl.setCooldown((Player) sender);
}
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', pl.getConfig().getString("wild.messages.success")).replace("{COORDS}", X + "," + Y + "," + Z));
if(pl.getConfig().get("wild.cost") != null){
int cost = pl.getConfig().getInt("wild.cost");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,8 @@ public boolean onPlayerJoin(PlayerJoinEvent e) {
public void run() {
System.out.println("Send to spawn triggered");
String world = pl.getConfig().getString("onJoinSpawn." + e.getPlayer().getWorld().getName() + ".world");
int x = Math.toIntExact(pl.getConfig().getInt("onJoinSpawn." + e.getPlayer().getWorld().getName() + ".x"));
int y = Math.toIntExact(pl.getConfig().getInt("onJoinSpawn." + e.getPlayer().getWorld().getName() + ".y"));
int z = Math.toIntExact(pl.getConfig().getInt("onJoinSpawn." + e.getPlayer().getWorld().getName() + ".z"));
float pitch = Math.toIntExact(pl.getConfig().getInt("onJoinSpawn." + e.getPlayer().getWorld().getName() + ".pitch"));
float yaw = Math.toIntExact(pl.getConfig().getInt("onJoinSpawn." + e.getPlayer().getWorld().getName() + ".yaw"));
Location spawnLoc = new Location(Bukkit.getWorld(world), x, y, z, pitch, yaw);
e.getPlayer().teleport(spawnLoc);
Location spawnLoc = (Location) pl.getConfig().get("onJoinSpawn." + e.getPlayer().getWorld().getName() + ".location");
pl.shakeTP(e.getPlayer(), spawnLoc);

}
}, 40L);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ password: ''
transferTable: 'treeboTeleport_serverTransfer'

CommandDelay: 15
useCooldown: false

isHubServer: false

Expand Down

0 comments on commit d0d2018

Please sign in to comment.