tpr on join (#153)

This commit is contained in:
Super_ 2019-11-18 16:45:18 -05:00 committed by Robinson Gallego
parent b2305a918b
commit 337a612437
4 changed files with 17 additions and 4 deletions

View File

@ -192,19 +192,24 @@ public class LoginProcess extends FreedomService
player.sendTitle(ChatColor.GRAY + "Welcome to " + ChatColor.YELLOW + "TotalFreedom!", ChatColor.GREEN + "Celebrating 9 years!", 20, 100, 60); player.sendTitle(ChatColor.GRAY + "Welcome to " + ChatColor.YELLOW + "TotalFreedom!", ChatColor.GREEN + "Celebrating 9 years!", 20, 100, 60);
player.setOp(true); player.setOp(true);
if (ConfigEntry.ALLOW_CLEAR_ON_JOIN.getBoolean()) if (ConfigEntry.ALLOW_TPR_ON_JOIN.getBoolean())
{ {
player.getInventory().clear();
int x = FUtil.random(-10000, 10000); int x = FUtil.random(-10000, 10000);
int z = FUtil.random(-10000, 10000); int z = FUtil.random(-10000, 10000);
int y = player.getWorld().getHighestBlockYAt(x, z); int y = player.getWorld().getHighestBlockYAt(x, z);
Location location = new Location(player.getLocation().getWorld(), x, y, z); Location location = new Location(player.getLocation().getWorld(), x, y, z);
player.teleport(location); player.teleport(location);
player.sendMessage(ChatColor.AQUA + "Your inventory has been cleared automatically.");
player.sendMessage(ChatColor.GOLD + "You have been teleported to a random location automatically."); player.sendMessage(ChatColor.GOLD + "You have been teleported to a random location automatically.");
return; return;
} }
if (ConfigEntry.ALLOW_CLEAR_ON_JOIN.getBoolean())
{
player.getInventory().clear();
player.sendMessage(ChatColor.AQUA + "Your inventory has been cleared automatically.");
return;
}
if (!ConfigEntry.SERVER_TABLIST_HEADER.getString().isEmpty()) if (!ConfigEntry.SERVER_TABLIST_HEADER.getString().isEmpty())
{ {
player.setPlayerListHeader(FUtil.colorize(ConfigEntry.SERVER_TABLIST_HEADER.getString()).replace("\\n", "\n")); player.setPlayerListHeader(FUtil.colorize(ConfigEntry.SERVER_TABLIST_HEADER.getString()).replace("\\n", "\n"));

View File

@ -40,6 +40,7 @@ public class Command_toggle extends FreedomCommand
msg("- bells"); msg("- bells");
msg("- armorstands"); msg("- armorstands");
msg("- clearonjoin"); msg("- clearonjoin");
msg("- tpronjoin");
return false; return false;
} }
@ -177,6 +178,11 @@ public class Command_toggle extends FreedomCommand
toggle("The clearing of inventories on join is", ConfigEntry.ALLOW_CLEAR_ON_JOIN); toggle("The clearing of inventories on join is", ConfigEntry.ALLOW_CLEAR_ON_JOIN);
return true; return true;
} }
else if (args[0].equalsIgnoreCase("tpronjoin"))
{
toggle("The random teleporting of players on join is ", ConfigEntry.ALLOW_TPR_ON_JOIN);
return true;
}
else else
{ {
return false; return false;
@ -195,7 +201,7 @@ public class Command_toggle extends FreedomCommand
{ {
return Arrays.asList( return Arrays.asList(
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk", "waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs", "bells", "armorstands", "clearonjoin"); "firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs", "bells", "armorstands", "clearonjoin", "tpronjoin");
} }
return Collections.emptyList(); return Collections.emptyList();

View File

@ -26,6 +26,7 @@ public enum ConfigEntry
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"), ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
ALLOW_MINECARTS (Boolean.class, "allow.minecarts"), ALLOW_MINECARTS (Boolean.class, "allow.minecarts"),
ALLOW_CLEAR_ON_JOIN(Boolean.class, "allow.clearonjoin"), ALLOW_CLEAR_ON_JOIN(Boolean.class, "allow.clearonjoin"),
ALLOW_TPR_ON_JOIN(Boolean.class, "allow.tpronjoin"),
// //
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"), BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
// //

View File

@ -125,6 +125,7 @@ allow:
armorstands: false armorstands: false
minecarts: false minecarts: false
clearonjoin: false clearonjoin: false
tpronjoin: false
# Blocked commands: # Blocked commands:
# #