diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index 71c421b..78ad97a 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -32,6 +32,7 @@ public class Chairs extends JavaPlugin { public boolean autoRotate, signCheck, permissions, notifyplayer, opsOverridePerms; public boolean invertedStairCheck, seatOccupiedCheck, invertedStepCheck, perItemPerms, ignoreIfBlockInHand; public boolean sitEffectsEnabled; + public boolean authmelogincorrection; public double sittingHeight, sittingHeightAdj, distance; public int maxChairWidth; public int sitMaxHealth; @@ -182,6 +183,8 @@ public class Chairs extends JavaPlugin { opsOverridePerms = getConfig().getBoolean("ops-override-perms"); ignoreIfBlockInHand = getConfig().getBoolean("ignore-if-block-in-hand"); + authmelogincorrection = getConfig().getBoolean("authme-loginlocation-correction"); + sitEffectsEnabled = getConfig().getBoolean("sit-effects.enabled", false); sitEffectInterval = getConfig().getInt("sit-effects.interval",20); sitMaxHealth = getConfig().getInt("sit-effects.healing.max-percent",100); diff --git a/src/com/cnaude/chairs/EventListener.java b/src/com/cnaude/chairs/EventListener.java index c76ea49..1d2c901 100644 --- a/src/com/cnaude/chairs/EventListener.java +++ b/src/com/cnaude/chairs/EventListener.java @@ -14,6 +14,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.material.Stairs; import org.bukkit.material.Step; @@ -54,6 +55,27 @@ public class EventListener implements Listener { } + @EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) + public void onJoin(PlayerJoinEvent e) + { + if (!plugin.authmelogincorrection) + { + return; + } + + Player player = e.getPlayer(); + Location loc = player.getLocation(); + if (Double.isNaN(loc.getY())) + { + loc = player.getBedSpawnLocation(); + if (loc == null) + { + loc = player.getWorld().getSpawnLocation(); + } + player.teleport(loc); + } + } + @EventHandler(priority=EventPriority.LOWEST) public void onPlayerQuit(PlayerQuitEvent event) { diff --git a/src/config.yml b/src/config.yml index 37c9a4b..3a6c9d8 100644 --- a/src/config.yml +++ b/src/config.yml @@ -31,6 +31,7 @@ valid-signs: - WALL_SIGN - SIGN_POST - ITEM_FRAME +authme-loginlocation-correction: false auto-rotate: true max-chair-width: 3 sign-check: false diff --git a/target/Chairs.jar b/target/Chairs.jar index 7a440f3..3b353df 100644 Binary files a/target/Chairs.jar and b/target/Chairs.jar differ