Unsit player on teleport
This commit is contained in:
parent
6f077baebd
commit
16fce317a1
@ -147,11 +147,11 @@ public class Chairs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
},100);
|
},100);
|
||||||
}
|
}
|
||||||
protected void unSitPlayer(final Player player)
|
protected void unSitPlayer(final Player player, boolean ignoretp)
|
||||||
{
|
{
|
||||||
player.eject();
|
player.eject();
|
||||||
final Location tploc = sitstopteleportloc.get(player.getName());
|
final Location tploc = sitstopteleportloc.get(player.getName());
|
||||||
if (tploc != null)
|
if (tploc != null && !ignoretp)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.material.Stairs;
|
import org.bukkit.material.Stairs;
|
||||||
import org.bukkit.material.Step;
|
import org.bukkit.material.Step;
|
||||||
import org.bukkit.material.WoodenStep;
|
import org.bukkit.material.WoodenStep;
|
||||||
@ -49,7 +50,16 @@ public class EventListener implements Listener {
|
|||||||
if (plugin.sit.containsKey(player.getName()))
|
if (plugin.sit.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
plugin.savePlayerSitstoploc(player.getName());
|
plugin.savePlayerSitstoploc(player.getName());
|
||||||
plugin.unSitPlayer(player);
|
plugin.unSitPlayer(player,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true)
|
||||||
|
public void onTeleport(PlayerTeleportEvent e)
|
||||||
|
{
|
||||||
|
if (plugin.sit.containsKey(e.getPlayer().getName()))
|
||||||
|
{
|
||||||
|
plugin.unSitPlayer(e.getPlayer(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +70,7 @@ public class EventListener implements Listener {
|
|||||||
if (plugin.sitblock.containsKey(b))
|
if (plugin.sitblock.containsKey(b))
|
||||||
{
|
{
|
||||||
Player player = Bukkit.getPlayerExact(plugin.sitblock.get(b));
|
Player player = Bukkit.getPlayerExact(plugin.sitblock.get(b));
|
||||||
plugin.unSitPlayer(player);
|
plugin.unSitPlayer(player,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class PacketListener {
|
|||||||
//just eject player if he is sitting on chair
|
//just eject player if he is sitting on chair
|
||||||
if (pluginInstance.sit.containsKey(player.getName()))
|
if (pluginInstance.sit.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
pluginInstance.unSitPlayer(player);
|
pluginInstance.unSitPlayer(player,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public class PacketListener {
|
|||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if (pluginInstance.sit.containsKey(player.getName()))
|
if (pluginInstance.sit.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
pluginInstance.unSitPlayer(player);
|
pluginInstance.unSitPlayer(player,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user