Finally i got this working.
No more falling through chairs. And even if you fall no Nope kick after dismount.
This commit is contained in:
parent
a6ea5efac6
commit
30d8b724b9
@ -116,11 +116,18 @@ public class Chairs extends JavaPlugin {
|
|||||||
protected void reSitPlayer(final Player player)
|
protected void reSitPlayer(final Player player)
|
||||||
{
|
{
|
||||||
player.eject();
|
player.eject();
|
||||||
sit.get(player.getName()).remove();
|
final Entity prevarrow = sit.get(player.getName());
|
||||||
Block block = sitblockbr.get(player.getName());
|
Block block = sitblockbr.get(player.getName());
|
||||||
Entity arrow = block.getWorld().spawnArrow(block.getLocation().add(0.5, 0, 0.5), new Vector(0, 0, 0), 0, 0);
|
final Entity arrow = block.getWorld().spawnArrow(block.getLocation().add(0.5, 0, 0.5), new Vector(0, 0, 0), 0, 0);
|
||||||
arrow.setPassenger(player);
|
arrow.setPassenger(player);
|
||||||
sit.put(player.getName(), arrow);
|
sit.put(player.getName(), arrow);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
prevarrow.remove();
|
||||||
|
}
|
||||||
|
},40);
|
||||||
}
|
}
|
||||||
protected void ejectPlayer(final Player player)
|
protected void ejectPlayer(final Player player)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ public class PacketListener {
|
|||||||
this.pm = pm;
|
this.pm = pm;
|
||||||
this.pluginInstance = plugin;
|
this.pluginInstance = plugin;
|
||||||
playerDismountListener();
|
playerDismountListener();
|
||||||
|
falledPlayerDismountListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +51,31 @@ public class PacketListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void falledPlayerDismountListener()
|
||||||
|
{
|
||||||
|
pm.getAsynchronousManager().registerAsyncHandler(
|
||||||
|
new PacketAdapter(PacketAdapter
|
||||||
|
.params(pluginInstance, Packets.Client.ENTITY_ACTION)
|
||||||
|
.clientSide()
|
||||||
|
.listenerPriority(ListenerPriority.HIGHEST)
|
||||||
|
.optionIntercept()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(final PacketEvent e)
|
||||||
|
{
|
||||||
|
if (!e.isCancelled())
|
||||||
|
{
|
||||||
|
Player player = e.getPlayer();
|
||||||
|
if (pluginInstance.sit.containsKey(player.getName()))
|
||||||
|
{
|
||||||
|
pluginInstance.ejectPlayer(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).syncStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user