Move eject code
This commit is contained in:
parent
244a453390
commit
c110202161
@ -113,15 +113,22 @@ public class Chairs extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<String, Entity> sit = new HashMap<String, Entity>();
|
||||
public HashMap<Block, String> sitblock = new HashMap<Block, String>();
|
||||
public HashMap<String, Block> sitblockbr = new HashMap<String, Block>();
|
||||
protected HashMap<String, Entity> sit = new HashMap<String, Entity>();
|
||||
protected HashMap<Block, String> sitblock = new HashMap<Block, String>();
|
||||
protected HashMap<String, Block> sitblockbr = new HashMap<String, Block>();
|
||||
protected HashMap<String, Location> sitstopteleportloc = new HashMap<String, Location>();
|
||||
protected void ejectPlayer(Player player)
|
||||
{
|
||||
player.eject();
|
||||
unSit(player);
|
||||
}
|
||||
protected void unSit(Player player) {
|
||||
if (sit.containsKey(player.getName()))
|
||||
{
|
||||
sit.get(player.getName()).remove();
|
||||
sitblock.remove(sitblockbr.get(player.getName()));
|
||||
sitblockbr.remove(player.getName());
|
||||
sitstopteleportloc.remove(player.getName());
|
||||
sit.remove(player.getName());
|
||||
if (notifyplayer && !msgStanding.isEmpty()) {
|
||||
player.sendMessage(msgStanding);
|
||||
|
@ -60,8 +60,7 @@ public class EventListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
if (plugin.sit.containsKey(player.getName()))
|
||||
{
|
||||
player.eject();
|
||||
plugin.unSit(player);
|
||||
plugin.ejectPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,10 +70,8 @@ public class EventListener implements Listener {
|
||||
Block b = event.getBlock();
|
||||
if (plugin.sitblock.containsKey(b))
|
||||
{
|
||||
String playername = plugin.sitblock.get(b);
|
||||
Player player = Bukkit.getPlayerExact(playername);
|
||||
player.eject();
|
||||
plugin.unSit(player);
|
||||
Player player = Bukkit.getPlayerExact(plugin.sitblock.get(b));
|
||||
plugin.ejectPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,7 @@ public class PacketListener {
|
||||
//just eject player if he is sitting on chair
|
||||
if (pluginInstance.sit.containsKey(player.getName()))
|
||||
{
|
||||
player.eject();
|
||||
pluginInstance.unSit(player);
|
||||
pluginInstance.ejectPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user