mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-24 03:05:17 +01:00
set all listeners to use checkAuth method.
This commit is contained in:
parent
14f187c32d
commit
2cea7387c9
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme;
|
package fr.xephi.authme;
|
||||||
|
|
||||||
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||||
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
||||||
@ -107,6 +108,23 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Move to a Manager
|
||||||
|
public static boolean checkAuth(Player player) {
|
||||||
|
if (player == null || Utils.isUnrestricted(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String name = player.getName().toLowerCase();
|
||||||
|
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!plugin.database.isAuthAvailable(name)) {
|
||||||
|
if (!Settings.isForcedRegistrationEnabled) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isUnrestricted(Player player) {
|
public static boolean isUnrestricted(Player player) {
|
||||||
return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName()));
|
return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName()));
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,6 @@ package fr.xephi.authme.listener;
|
|||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.Utils;
|
import fr.xephi.authme.Utils;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
@ -21,51 +18,15 @@ public class AuthMeBlockListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
if (event.getPlayer() == null) {
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (Utils.isUnrestricted(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
if (event.getPlayer() == null) {
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (Utils.isUnrestricted(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,26 +21,8 @@ public class AuthMeChestShopListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPreTransaction(PreTransactionEvent event) {
|
public void onPreTransaction(PreTransactionEvent event) {
|
||||||
if (event.getClient() == null) {
|
if (Utils.checkAuth(event.getClient()))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Player player = event.getClient();
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (Utils.isUnrestricted(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!plugin.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setCancelled(TransactionOutcome.OTHER);
|
event.setCancelled(TransactionOutcome.OTHER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@ package fr.xephi.authme.listener;
|
|||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.Utils;
|
import fr.xephi.authme.Utils;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -22,30 +20,15 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
if (!(entity instanceof Player)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isUnrestricted((Player) entity)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Utils.isNPC(entity))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
String name = player.getName().toLowerCase();
|
if (Utils.checkAuth(player)) {
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player.setFireTicks(0);
|
player.setFireTicks(0);
|
||||||
event.setDamage(0.0);
|
event.setDamage(0.0);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -53,28 +36,15 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onEntityTarget(EntityTargetEvent event) {
|
public void onEntityTarget(EntityTargetEvent event) {
|
||||||
if (event.getTarget() == null)
|
|
||||||
return;
|
|
||||||
Entity entity = event.getTarget();
|
Entity entity = event.getTarget();
|
||||||
if (!(entity instanceof Player)) {
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isNPC(entity))
|
if (Utils.checkAuth((Player) entity)) {
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = (Player) entity;
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setTarget(null);
|
event.setTarget(null);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -82,75 +52,40 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onDmg(EntityDamageByEntityEvent event) {
|
public void onDmg(EntityDamageByEntityEvent event) {
|
||||||
Entity entity = event.getDamager();
|
Entity entity = event.getDamager();
|
||||||
|
|
||||||
if (entity == null || !(entity instanceof Player)) {
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) entity;
|
if (Utils.checkAuth((Player) entity)) {
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (!(entity instanceof Player)) {
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isNPC(entity))
|
if (Utils.checkAuth((Player) entity)) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = (Player) entity;
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void entityRegainHealthEvent(EntityRegainHealthEvent event) {
|
public void entityRegainHealthEvent(EntityRegainHealthEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (!(entity instanceof Player)) {
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isNPC(entity))
|
if (Utils.checkAuth((Player) entity)) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = (Player) entity;
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setAmount(0.0);
|
event.setAmount(0.0);
|
||||||
@ -159,49 +94,29 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onEntityInteract(EntityInteractEvent event) {
|
public void onEntityInteract(EntityInteractEvent event) {
|
||||||
if (!(event.getEntity() instanceof Player)) {
|
Entity entity = event.getEntity();
|
||||||
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
if (Utils.checkAuth((Player) entity)) {
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (Utils.isUnrestricted(player) || Utils.isNPC(player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onLowestEntityInteract(EntityInteractEvent event) {
|
public void onLowestEntityInteract(EntityInteractEvent event) {
|
||||||
if (!(event.getEntity() instanceof Player)) {
|
Entity entity = event.getEntity();
|
||||||
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
if (Utils.checkAuth((Player) entity)) {
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (Utils.isUnrestricted(player) || Utils.isNPC(player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,26 +45,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkAuth(Player player) {
|
|
||||||
if (player == null) return true;
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
if (Utils.isUnrestricted(player)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!plugin.database.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleChat(AsyncPlayerChatEvent event) {
|
private void handleChat(AsyncPlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!checkAuth(player)) {
|
if (!Utils.checkAuth(player)) {
|
||||||
String cmd = event.getMessage().split(" ")[0];
|
String cmd = event.getMessage().split(" ")[0];
|
||||||
if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) {
|
if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -83,7 +66,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String msg = event.getMessage();
|
String msg = event.getMessage();
|
||||||
@ -135,7 +118,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (checkAuth(player))
|
if (Utils.checkAuth(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Settings.isMovementAllowed) {
|
if (!Settings.isMovementAllowed) {
|
||||||
@ -410,21 +393,21 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerConsumeItem(PlayerItemConsumeEvent event) {
|
public void onPlayerConsumeItem(PlayerItemConsumeEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -432,7 +415,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
||||||
final Player player = (Player) event.getPlayer();
|
final Player player = (Player) event.getPlayer();
|
||||||
if (checkAuth(player))
|
if (Utils.checkAuth(player))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -456,7 +439,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
if (!(event.getWhoClicked() instanceof Player))
|
if (!(event.getWhoClicked() instanceof Player))
|
||||||
return;
|
return;
|
||||||
if (checkAuth((Player) event.getWhoClicked()))
|
if (Utils.checkAuth((Player) event.getWhoClicked()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -467,7 +450,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
if (!(damager instanceof Player)) {
|
if (!(damager instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (checkAuth((Player) damager))
|
if (Utils.checkAuth((Player) damager))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -475,28 +458,28 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
|
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onSignChange(SignChangeEvent event) {
|
public void onSignChange(SignChangeEvent event) {
|
||||||
if (checkAuth(event.getPlayer()))
|
if (Utils.checkAuth(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -504,7 +487,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (checkAuth(player))
|
if (Utils.checkAuth(player))
|
||||||
return;
|
return;
|
||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
Location spawn = plugin.getSpawnLocation(player);
|
Location spawn = plugin.getSpawnLocation(player);
|
||||||
@ -524,7 +507,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
if (plugin.authmePermissible(player, "authme.bypassforcesurvival"))
|
if (plugin.authmePermissible(player, "authme.bypassforcesurvival"))
|
||||||
return;
|
return;
|
||||||
if (checkAuth(player))
|
if (Utils.checkAuth(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
|
Loading…
Reference in New Issue
Block a user