Start cleaning up the mess we've made of our listeners.

This commit is contained in:
GJ 2013-01-24 11:45:40 -05:00
parent 29d796b6af
commit ab677e941d
4 changed files with 183 additions and 98 deletions

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.listeners;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -17,14 +16,13 @@ import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginDescriptionFile;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.general.XprateCommand; import com.gmail.nossr50.commands.general.XprateCommand;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent; import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
@ -32,7 +30,6 @@ import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.runnables.BleedTimer; import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.skills.AbilityType;
import com.gmail.nossr50.skills.SkillType; import com.gmail.nossr50.skills.SkillType;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.fishing.Fishing; import com.gmail.nossr50.skills.fishing.Fishing;
@ -42,6 +39,7 @@ import com.gmail.nossr50.skills.repair.Salvage;
import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Item; import com.gmail.nossr50.util.Item;
import com.gmail.nossr50.util.MOTD;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
@ -62,13 +60,12 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) { public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile profile = Users.getProfile(player);
if (Misc.isNPC(player)) { if (Misc.isNPC(player, profile)) {
return; return;
} }
PlayerProfile profile = Users.getProfile(player);
if (profile.getGodMode() && !Permissions.mcgod(player)) { if (profile.getGodMode() && !Permissions.mcgod(player)) {
profile.toggleGodMode(); profile.toggleGodMode();
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden")); player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
@ -87,11 +84,11 @@ public class PlayerListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerFish(PlayerFishEvent event) { public void onPlayerFish(PlayerFishEvent event) {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
int shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (Misc.isNPC(player)) {
return;
}
if (Permissions.fishing(player)) { if (Permissions.fishing(player)) {
State state = event.getState(); State state = event.getState();
@ -102,13 +99,7 @@ public class PlayerListener implements Listener {
break; break;
case CAUGHT_ENTITY: case CAUGHT_ENTITY:
if (!(event.getCaught() instanceof LivingEntity)) {
return;
}
if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) >= shakeUnlockLevel && Permissions.shakeMob(player)) {
Fishing.shakeMob(event); Fishing.shakeMob(event);
}
break; break;
default: default:
@ -124,8 +115,14 @@ public class PlayerListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLogin(PlayerLoginEvent event) { public void onPlayerLogin(PlayerLoginEvent event) {
if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC Player player = event.getPlayer();
Users.addUser(event.getPlayer()).getProfile().actualizeRespawnATS();
/* We can't use the other check here because a profile hasn't been created yet.*/
if (player == null || player.hasMetadata("NPC")) {
return;
}
Users.addUser(player).getProfile().actualizeRespawnATS();
} }
/** /**
@ -137,12 +134,12 @@ public class PlayerListener implements Listener {
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (Misc.isNPC(player)) {
return;
}
/* GARBAGE COLLECTION */ /* GARBAGE COLLECTION */
BleedTimer.bleedOut(player); //Bleed it out
//Bleed it out
BleedTimer.bleedOut(player);
} }
/** /**
@ -154,82 +151,43 @@ public class PlayerListener implements Listener {
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (Misc.isNPC(player)) {
return;
}
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) { if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix"); PluginDescriptionFile pluginDescription = plugin.getDescription();
MOTD motd = new MOTD(player);
player.sendMessage(LocaleLoader.getString("MOTD.Version", new Object[] {plugin.getDescription().getVersion()})); motd.displayVersion(pluginDescription.getVersion());
motd.displayHardcoreSettings();
if (Config.getInstance().getHardcoreEnabled()) { motd.displayXpPerks();
if (Config.getInstance().getHardcoreVampirismEnabled()) { motd.displayCooldownPerks();
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.VampireOn")); motd.displayActivationPerks();
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Stats", new Object[] {Config.getInstance().getHardcoreDeathStatPenaltyPercentage()})); motd.displayLuckyPerks();
player.sendMessage(LocaleLoader.getString("MOTD.Vampire.Stats", new Object[] {Config.getInstance().getHardcoreVampirismStatLeechPercentage()})); motd.displayWebsite(pluginDescription.getWebsite());
}
else {
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.VampireOff"));
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Stats", new Object[] {Config.getInstance().getHardcoreDeathStatPenaltyPercentage()}));
}
} }
if (Permissions.xpQuadruple(player)) { //TODO: MAKE THIS SUCK LESS. THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 4 }) }));
}
else if (Permissions.xpTriple(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 3 }) }));
}
else if (Permissions.xpDoubleAndOneHalf(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 2.5 }) }));
}
else if (Permissions.xpDouble(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 2 }) }));
}
else if (Permissions.xpOneAndOneHalf(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 1.5 }) }));
}
if (Permissions.cooldownsHalved(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/2" }) }));
}
else if (Permissions.cooldownsThirded(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/3" }) }));
}
else if (Permissions.cooldownsQuartered(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/4" }) }));
}
if (Permissions.activationTwelve(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 12 }) }));
}
else if (Permissions.activationEight(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 8 }) }));
}
else if (Permissions.activationFour(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 4 }) }));
}
if (Permissions.luckyAcrobatics(player) || Permissions.luckyArchery(player) || Permissions.luckyAxes(player) || Permissions.luckyFishing(player) || Permissions.luckyHerbalism(player) || Permissions.luckyMining(player) || Permissions.luckyRepair(player) || Permissions.luckySwords(player) || Permissions.luckyTaming(player) || Permissions.luckyUnarmed(player) || Permissions.luckyWoodcutting(player) || Permissions.luckySmelting(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc.login") }));
}
player.sendMessage(LocaleLoader.getString("MOTD.Website", new Object[] {plugin.getDescription().getWebsite()}));
}
//THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY
if (XprateCommand.isXpEventRunning()) { if (XprateCommand.isXpEventRunning()) {
player.sendMessage(LocaleLoader.getString("XPRate.Event", new Object[] {Config.getInstance().xpGainMultiplier})); player.sendMessage(LocaleLoader.getString("XPRate.Event", new Object[] {Config.getInstance().xpGainMultiplier}));
} }
} }
/**
* Monitor PlayerRespawn events.
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC Player player = event.getPlayer();
PlayerProfile profile = Users.getProfile(event.getPlayer()); PlayerProfile profile = Users.getProfile(player);
if (profile != null) { if (Misc.isNPC(player, profile)) {
profile.actualizeRespawnATS(); return;
} }
profile.actualizeRespawnATS();
} }
/** /**
@ -363,12 +321,9 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerChat(AsyncPlayerChatEvent event) { public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
if (profile == null) { if (Misc.isNPC(player, profile)) {
return; return;
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -139,16 +140,12 @@ public class Fishing {
*/ */
public static void processResults(PlayerFishEvent event) { public static void processResults(PlayerFishEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player == null)
return;
PlayerProfile profile = Users.getProfile(player);
getFishingResults(player, event); getFishingResults(player, event);
Item theCatch = (Item) event.getCaught(); Item theCatch = (Item) event.getCaught();
if (theCatch.getItemStack().getType() != Material.RAW_FISH) { if (theCatch.getItemStack().getType() != Material.RAW_FISH) {
int lootTier = Fishing.getFishingLootTier(profile); int lootTier = Fishing.getFishingLootTier(Users.getProfile(player));
int specificChance = 1; int specificChance = 1;
boolean enchanted = false; boolean enchanted = false;
ItemStack fishingResults = theCatch.getItemStack(); ItemStack fishingResults = theCatch.getItemStack();
@ -224,6 +221,18 @@ public class Fishing {
* The event to modify * The event to modify
*/ */
public static void shakeMob(PlayerFishEvent event) { public static void shakeMob(PlayerFishEvent event) {
Entity caughtEntity = event.getCaught();
if (!(caughtEntity instanceof LivingEntity)) {
return;
}
Player player = event.getPlayer();
if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) < Fishing.shakeUnlockLevel || !Permissions.shakeMob(player)) {
return;
}
int randomChance = 100; int randomChance = 100;
//TODO: Invert this so it matches the rest of our lucky checks... //TODO: Invert this so it matches the rest of our lucky checks...
@ -231,7 +240,7 @@ public class Fishing {
randomChance = 125; randomChance = 125;
} }
final Player player = event.getPlayer();
final PlayerProfile profile = Users.getProfile(player); final PlayerProfile profile = Users.getProfile(player);
int lootTier = getFishingLootTier(profile); int lootTier = getFishingLootTier(profile);

View File

@ -0,0 +1,112 @@
package com.gmail.nossr50.util;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillType;
public class MOTD {
private Player player;
private String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
public MOTD(Player player) {
this.player = player;
}
/**
* Display version info.
* @param version The plugin version
*/
public void displayVersion(String version) {
player.sendMessage(LocaleLoader.getString("MOTD.Version", new Object[] {version}));
}
/**
* Display Hardcore Mode settings.
*/
public void displayHardcoreSettings() {
if (Config.getInstance().getHardcoreEnabled()) {
if (Config.getInstance().getHardcoreVampirismEnabled()) {
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.VampireOn"));
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Stats", new Object[] {Config.getInstance().getHardcoreDeathStatPenaltyPercentage()}));
player.sendMessage(LocaleLoader.getString("MOTD.Vampire.Stats", new Object[] {Config.getInstance().getHardcoreVampirismStatLeechPercentage()}));
}
else {
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.VampireOff"));
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Stats", new Object[] {Config.getInstance().getHardcoreDeathStatPenaltyPercentage()}));
}
}
}
/**
* Display XP perks.
*/
public void displayXpPerks() {
if (Permissions.xpQuadruple(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 4 }) }));
}
else if (Permissions.xpTriple(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 3 }) }));
}
else if (Permissions.xpDoubleAndOneHalf(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 2.5 }) }));
}
else if (Permissions.xpDouble(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 2 }) }));
}
else if (Permissions.xpOneAndOneHalf(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 1.5 }) }));
}
}
/**
* Display cooldown perks.
*/
public void displayCooldownPerks() {
if (Permissions.cooldownsHalved(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/2" }) }));
}
else if (Permissions.cooldownsThirded(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/3" }) }));
}
else if (Permissions.cooldownsQuartered(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/4" }) }));
}
}
/**
* Display activiation perks.
*/
public void displayActivationPerks() {
if (Permissions.activationTwelve(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 12 }) }));
}
else if (Permissions.activationEight(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 8 }) }));
}
else if (Permissions.activationFour(player)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 4 }) }));
}
}
/**
* Display "lucky" perks.
*/
public void displayLuckyPerks() {
for (SkillType skill : SkillType.values()) {
if (Permissions.lucky(player, skill)) {
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc.login") }));
return;
}
}
}
/**
* Display website info.
* @param website The plugin website
*/
public void displayWebsite(String website) {
player.sendMessage(LocaleLoader.getString("MOTD.Website", new Object[] {website}));
}
}

View File

@ -17,6 +17,7 @@ import org.bukkit.plugin.PluginManager;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
@ -89,6 +90,14 @@ public class Misc {
return false; return false;
} }
public static boolean isNPC(Player player, PlayerProfile profile) {
if (player == null || profile == null || player.hasMetadata("NPC")) {
return true;
}
return false;
}
public static void sendSkillMessage(Player player, String message) { public static void sendSkillMessage(Player player, String message) {
for (Player otherPlayer : player.getWorld().getPlayers()) { for (Player otherPlayer : player.getWorld().getPlayers()) {
if (otherPlayer != player && Misc.isNear(player.getLocation(), otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) { if (otherPlayer != player && Misc.isNear(player.getLocation(), otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {