Do not player try to unsit before unsit is actually finished
This commit is contained in:
parent
c13318bcab
commit
2638e2c1c8
@ -1,5 +1,7 @@
|
|||||||
package com.cnaude.chairs;
|
package com.cnaude.chairs;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -40,6 +42,7 @@ public class EventListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashSet<String> queueUnsit = new HashSet<String>();
|
||||||
@EventHandler(priority=EventPriority.LOWEST)
|
@EventHandler(priority=EventPriority.LOWEST)
|
||||||
public void onExitVehicle(VehicleExitEvent e)
|
public void onExitVehicle(VehicleExitEvent e)
|
||||||
{
|
{
|
||||||
@ -49,16 +52,21 @@ public class EventListener implements Listener {
|
|||||||
if (plugin.sit.containsKey(player.getName()))
|
if (plugin.sit.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
if (!queueUnsit.contains(player.getName()))
|
||||||
|
{
|
||||||
|
queueUnsit.add(player.getName());
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
queueUnsit.remove(player.getName());
|
||||||
plugin.unSitPlayer(player, false);
|
plugin.unSitPlayer(player, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true)
|
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true)
|
||||||
public void onBlockBreak(BlockBreakEvent event)
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
|
Loading…
Reference in New Issue
Block a user