mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
teleport players to random location on clearonjoin
This commit is contained in:
parent
5c1c06afa0
commit
8d0540dc66
@ -11,6 +11,7 @@ import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
|||||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -194,7 +195,13 @@ public class LoginProcess extends FreedomService
|
|||||||
if (ConfigEntry.ALLOW_CLEAR_ON_JOIN.getBoolean())
|
if (ConfigEntry.ALLOW_CLEAR_ON_JOIN.getBoolean())
|
||||||
{
|
{
|
||||||
player.getInventory().clear();
|
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.AQUA + "Your inventory has been cleared automatically.");
|
||||||
|
player.sendMessage(ChatColor.GOLD + "You have been teleported to a random location automatically.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user