mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
Added tiny listener for sending ground. Removed .setNodamageTime().
This commit is contained in:
@@ -10,6 +10,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import me.Josvth.RandomSpawn.RandomSpawn;
|
||||
|
||||
@@ -21,10 +23,15 @@ public class JoinListener implements Listener{
|
||||
plugin = instance;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event){
|
||||
plugin.sendGround(event.getPlayer(), event.getTo());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event){
|
||||
|
||||
|
||||
Player player = event.getPlayer();
|
||||
String playerName = player.getName();
|
||||
|
||||
@@ -54,12 +61,10 @@ public class JoinListener implements Listener{
|
||||
|
||||
Location spawnLocation = plugin.chooseSpawn(world);
|
||||
|
||||
plugin.sendGround(player, spawnLocation);
|
||||
|
||||
player.teleport(spawnLocation);
|
||||
|
||||
player.setNoDamageTicks(plugin.yamlHandler.config.getInt("nodamagetime",5)*20);
|
||||
|
||||
player.setMetadata("lasttimerandomspawned", new FixedMetadataValue(plugin, System.currentTimeMillis()));
|
||||
|
||||
if (plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns",false)){
|
||||
player.setBedSpawnLocation(spawnLocation);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class RespawnListener implements Listener{
|
||||
|
||||
@@ -54,9 +55,9 @@ public class RespawnListener implements Listener{
|
||||
plugin.sendGround(player, spawnLocation);
|
||||
|
||||
event.setRespawnLocation(spawnLocation);
|
||||
|
||||
player.setNoDamageTicks(plugin.yamlHandler.config.getInt("nodamagetime",5)*20);
|
||||
|
||||
player.setMetadata("lasttimerandomspawned", new FixedMetadataValue(plugin, System.currentTimeMillis()));
|
||||
|
||||
if (plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns",false)){
|
||||
player.setBedSpawnLocation(spawnLocation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user