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.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 z = FUtil.random(-10000, 10000);
int y = player.getWorld().getHighestBlockYAt(x, z);
Location location = new Location(player.getLocation().getWorld(), x, y, z);
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.");
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())
{
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("- armorstands");
msg("- clearonjoin");
msg("- tpronjoin");
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);
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
{
return false;
@ -195,7 +201,7 @@ public class Command_toggle extends FreedomCommand
{
return Arrays.asList(
"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();

View File

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

View File

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