Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.tylercreator.fallensurv.spawnmodifier;
- import java.security.PublicKey;
- import java.util.Random;
- import org.apache.logging.log4j.core.config.plugins.Plugin;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.craftbukkit.Main;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerJoinEvent;
- import me.tylercreator.fallensurv.main;
- public class Spawnmodifier implements Listener{
- @EventHandler
- public void randomspawn(PlayerJoinEvent pj) {
- public static final FileConfiguration config = main.plugin.getConfig();
- int PlayerJoinLocX = pj.getPlayer().getLocation().getBlockX();
- int PlayerJoinLocY = pj.getPlayer().getLocation().getBlockY();
- int PlayerJoinLocZ = pj.getPlayer().getLocation().getBlockZ();
- boolean newplayer = pj.getPlayer().hasPlayedBefore();
- String playername = pj.getPlayer().getName();
- Random random = new Random();
- int low = config.getInt("minimumTeleport");
- int high = config.getInt("maximumTeleport");
- //int low= 250; minimum random value
- //int high= 1750; //max random value
- int resultX = random.nextInt(high-low) + low; //random X function
- int resultZ = random.nextInt(high-low) + low; //random Z function
- Location loc = pj.getPlayer().getLocation().add(resultX, 0, resultZ);
- if(newplayer) {
- Bukkit.getPlayer(playername).sendMessage(ChatColor.AQUA + "Welcome back, remember to watch out for other players...");
- } else {
- pj.getPlayer().teleport(loc);
- Bukkit.getPlayer(playername).sendMessage(ChatColor.RED + "Welcome! This is the FallenSurvivor gamemode!");
- Bukkit.getPlayer(playername).sendMessage(ChatColor.RED + "Read the gamemode mechanics with /fs help");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement