From 8d0540dc662fdd7bd6ce6d39271da937dd7a8aa6 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 16 Nov 2019 16:16:38 -0500 Subject: [PATCH] teleport players to random location on clearonjoin --- .../java/me/totalfreedom/totalfreedommod/LoginProcess.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java index 0613f9b1..c8a6886d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java @@ -11,6 +11,7 @@ import me.totalfreedom.totalfreedommod.playerverification.VPlayer; import me.totalfreedom.totalfreedommod.util.FSync; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; +import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -194,7 +195,13 @@ public class LoginProcess extends FreedomService if (ConfigEntry.ALLOW_CLEAR_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; }