Teleport player to spawn if he logged in with nan location
This commit is contained in:
parent
e17944f6cc
commit
d5bfae0d2f
@ -21,6 +21,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import com.cnaude.chairs.commands.ChairsCommand;
|
||||
import com.cnaude.chairs.commands.ChairsIgnoreList;
|
||||
import com.cnaude.chairs.listeners.NANLoginListener;
|
||||
import com.cnaude.chairs.listeners.TrySitEventListener;
|
||||
import com.cnaude.chairs.listeners.TryUnsitEventListener;
|
||||
import com.cnaude.chairs.sitaddons.ChairEffects;
|
||||
@ -50,13 +51,11 @@ public class Chairs extends JavaPlugin {
|
||||
|
||||
|
||||
private PlayerSitData psitdata;
|
||||
public PlayerSitData getPlayerSitData()
|
||||
{
|
||||
public PlayerSitData getPlayerSitData() {
|
||||
return psitdata;
|
||||
}
|
||||
private Class<?> vehiclearrowclass;
|
||||
protected Class<?> getVehicleArrowClass()
|
||||
{
|
||||
protected Class<?> getVehicleArrowClass() {
|
||||
return vehiclearrowclass;
|
||||
}
|
||||
|
||||
@ -96,6 +95,7 @@ public class Chairs extends JavaPlugin {
|
||||
if (sitPickupEnabled) {
|
||||
chairEffects.startPickup();
|
||||
}
|
||||
getServer().getPluginManager().registerEvents(new NANLoginListener(), this);
|
||||
getServer().getPluginManager().registerEvents(new TrySitEventListener(this, ignoreList), this);
|
||||
getServer().getPluginManager().registerEvents(new TryUnsitEventListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new CommandRestrict(this), this);
|
||||
|
19
src/com/cnaude/chairs/listeners/NANLoginListener.java
Normal file
19
src/com/cnaude/chairs/listeners/NANLoginListener.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.cnaude.chairs.listeners;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public class NANLoginListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (Double.isNaN(player.getLocation().getY())) {
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user