package zoruafan.foxanticheat.manager.hooks; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; import zoruafan.foxanticheat.FoxAddition; import zoruafan.foxanticheat.api.FoxAdditionAPI; import zoruafan.foxanticheat.manager.FilesManager; public class mcMMOManager { private final FilesManager file; FoxAdditionAPI api = FoxAddition.getAPI(); public mcMMOManager(final FilesManager files) { this.file = files; } public boolean isTreeFeller(Player e) { if (!file.getConfig().getBoolean("hooks.mcmmo.faster", true)) { if (WorldBlacklist.isWorldBlacklisted(e.getWorld())) { Bukkit.getLogger().warning("[FA] [mcMMO] The player is in a blacklisted world!"); return false; } if (WorldGuardUtils.isWorldGuardLoaded()) { if (!WorldGuardManager.getInstance().hasMainFlag(e)) { Bukkit.getLogger().warning("[FA] [mcMMO] The player has in a worldguard don't allowed!"); return false; } } if (!UserManager.hasPlayerDataKey(e) || e.getGameMode() == GameMode.CREATIVE) { Bukkit.getLogger().warning("[FA] [mcMMO] The player is in gamemode or don't has data key!"); return false; } ItemStack i = e.getInventory().getItemInHand(); if(!i.getType().name().toLowerCase().contains("axe")) { Bukkit.getLogger().warning("[FA] [mcMMO] The hand of the player is not an axe!"); return false; } } if ((UserManager.getPlayer(e) == null)) { Bukkit.getLogger().warning("[FA] [mcMMO] The obtain of a player is null!"); return false; } McMMOPlayer mP = UserManager.getPlayer(e); if (mP == null) { Bukkit.getLogger().warning("[FA] [mcMMO] 'mP' returned a null value!"); return false; } Boolean en = mP.getAbilityMode(SuperAbilityType.TREE_FELLER); api.verboseNotify("[FA] McMMO (TREE_FELLER) returned: "+en); return en; } public boolean isSuperBreaker(Player e) { if (!file.getConfig().getBoolean("hooks.mcmmo.faster", true)) { if (WorldBlacklist.isWorldBlacklisted(e.getWorld())) { Bukkit.getLogger().warning("[FA] [mcMMO] The player is in a blacklisted world!"); return false; } if (WorldGuardUtils.isWorldGuardLoaded()) { if (!WorldGuardManager.getInstance().hasMainFlag(e)) { Bukkit.getLogger().warning("[FA] [mcMMO] The player has in a worldguard don't allowed!"); return false; } } if (!UserManager.hasPlayerDataKey(e) || e.getGameMode() == GameMode.CREATIVE) { Bukkit.getLogger().warning("[FA] [mcMMO] The player is in gamemode or don't has data key!"); return false; } ItemStack i = e.getInventory().getItemInHand(); if(!i.getType().name().toLowerCase().contains("axe")) { Bukkit.getLogger().warning("[FA] [mcMMO] The hand of the player is not an axe!"); return false; } } if ((UserManager.getPlayer(e) == null)) { Bukkit.getLogger().warning("[FA] [mcMMO] The obtain of a player is null!"); return false; } McMMOPlayer mP = UserManager.getPlayer(e); if (mP == null) { Bukkit.getLogger().warning("[FA] [mcMMO] 'mP' returned a null value!"); return false; } Boolean en = mP.getAbilityMode(SuperAbilityType.SUPER_BREAKER); api.verboseNotify("[FA] McMMO (TREE_FELLER) returned: "+en); return en; } }