Add authme login location correction
If enabled it will teleport player home or to spawn if his location is invalid.
This commit is contained in:
parent
fe81cd81e1
commit
45f715b786
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user