mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-10 09:31:47 +01:00
Refactor logging out of Messenger.
This removes the logging capabilities from Messenger and replaces all references to them with proper logging via Bukkit's PluginLogger that all plugins have.
This commit is contained in:
parent
c979c0643f
commit
5d6a7768e8
@ -253,7 +253,7 @@ public class ArenaClass
|
||||
String perm = entry.getKey() + ":" + entry.getValue();
|
||||
String player = p.getName();
|
||||
|
||||
Messenger.warning("[PERM00] Failed to attach permission '" + perm + "' to player '" + player + " with class " + this.configName
|
||||
pa.getPlugin().getLogger().warning("[PERM00] Failed to attach permission '" + perm + "' to player '" + player + " with class " + this.configName
|
||||
+ "'.\nPlease verify that your class permissions are well-formed.");
|
||||
}
|
||||
}
|
||||
@ -358,7 +358,7 @@ public class ArenaClass
|
||||
try {
|
||||
arena.getInventoryManager().restoreInv(p);
|
||||
} catch (Exception e) {
|
||||
Messenger.severe("Failed to give " + p.getName() + " their own items: " + e.getMessage());
|
||||
am.getPlugin().getLogger().severe("Failed to give " + p.getName() + " their own items: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ public class ArenaImpl implements Arena
|
||||
inventoryManager.clearInventory(p);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Messenger.severe("Failed to store inventory for player " + p.getName() + "!");
|
||||
plugin.getLogger().severe("Failed to store inventory for player " + p.getName() + "!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1035,7 +1035,7 @@ public class ArenaImpl implements Arena
|
||||
inventoryManager.clearCache(p);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Messenger.severe("Failed to restore inventory for player " + p.getName() + "!");
|
||||
plugin.getLogger().severe("Failed to restore inventory for player " + p.getName() + "!");
|
||||
}
|
||||
rewardManager.grantRewards(p);
|
||||
|
||||
@ -1239,7 +1239,7 @@ public class ArenaImpl implements Arena
|
||||
{
|
||||
if (classes.isEmpty())
|
||||
{
|
||||
Messenger.info("Player '" + p.getName() + "' has no class permissions!");
|
||||
plugin.getLogger().info("Player '" + p.getName() + "' has no class permissions!");
|
||||
playerLeave(p);
|
||||
return;
|
||||
}
|
||||
@ -1271,7 +1271,7 @@ public class ArenaImpl implements Arena
|
||||
String perm = entry.getKey() + ":" + entry.getValue();
|
||||
String name = p.getName();
|
||||
|
||||
Messenger.warning("[PERM01] Failed to remove permission attachment '" + perm + "' from player '" + name
|
||||
plugin.getLogger().warning("[PERM01] Failed to remove permission attachment '" + perm + "' from player '" + name
|
||||
+ "'.\nThis should not be a big issue, but please verify that the player doesn't have any permissions they shouldn't have.");
|
||||
}
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ public class ArenaListener
|
||||
* trying to steal items, if a PlayerDropItemEvent is fired.
|
||||
*/
|
||||
else if (banned.contains(p)) {
|
||||
Messenger.warning("Player " + p.getName() + " tried to steal class items!");
|
||||
plugin.getLogger().warning("Player " + p.getName() + " tried to steal class items!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
||||
classes.put(lowercase, myItems);
|
||||
return myItems;
|
||||
}
|
||||
Messenger.severe("Failed to load class '" + classname + "'.");
|
||||
plugin.getLogger().severe("Failed to load class '" + classname + "'.");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -310,8 +310,8 @@ public class ArenaMasterImpl implements ArenaMaster
|
||||
if (priceItem != null && priceItem.getTypeId() == MobArena.ECONOMY_MONEY_ID) {
|
||||
price = (priceItem.getAmount() + (priceItem.getDurability() / 100D));
|
||||
} else {
|
||||
Messenger.warning("The price for class '" + classname + "' could not be parsed!");
|
||||
Messenger.warning("- expected e.g. '$10', found '" + priceString + "'");
|
||||
plugin.getLogger().warning("The price for class '" + classname + "' could not be parsed!");
|
||||
plugin.getLogger().warning("- expected e.g. '$10', found '" + priceString + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,12 +581,12 @@ public class ArenaMasterImpl implements ArenaMaster
|
||||
if (!worldName.equals("")) {
|
||||
world = plugin.getServer().getWorld(worldName);
|
||||
if (world == null) {
|
||||
Messenger.warning("World '" + worldName + "' for arena '" + arenaname + "' was not found...");
|
||||
plugin.getLogger().warning("World '" + worldName + "' for arena '" + arenaname + "' was not found...");
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
world = plugin.getServer().getWorlds().get(0);
|
||||
Messenger.warning("Could not find the world for arena '" + arenaname + "'. Using default world ('" + world.getName() + "')! Check the config-file!");
|
||||
plugin.getLogger().warning("Could not find the world for arena '" + arenaname + "'. Using default world ('" + world.getName() + "')! Check the config-file!");
|
||||
}
|
||||
|
||||
ConfigUtils.addMissingRemoveObsolete(plugin, "settings.yml", settings);
|
||||
|
@ -175,8 +175,8 @@ public class MASpawnThread implements Runnable
|
||||
e.setHealth(health);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Spigot... *facepalm*
|
||||
Messenger.severe("Can't set health to " + health + ", using default health. If you are running Spigot, set 'maxHealth' higher in your Spigot settings.");
|
||||
Messenger.severe(ex.getLocalizedMessage());
|
||||
plugin.getLogger().severe("Can't set health to " + health + ", using default health. If you are running Spigot, set 'maxHealth' higher in your Spigot settings.");
|
||||
plugin.getLogger().severe(ex.getLocalizedMessage());
|
||||
if (w.getType() == WaveType.BOSS) {
|
||||
((BossWave) w).setBossName("SPIGOT ERROR");
|
||||
} else {
|
||||
@ -331,14 +331,14 @@ public class MASpawnThread implements Runnable
|
||||
|
||||
if (reward == null) {
|
||||
Messenger.tell(p, "ERROR! Problem with rewards. Notify server host!");
|
||||
Messenger.warning("Could not add null reward. Please check the config-file!");
|
||||
plugin.getLogger().warning("Could not add null reward. Please check the config-file!");
|
||||
}
|
||||
else if (reward.getTypeId() == MobArena.ECONOMY_MONEY_ID) {
|
||||
if (plugin.giveMoney(p, reward)) { // Money already awarded here, not needed at end of match as well
|
||||
Messenger.tell(p, Msg.WAVE_REWARD, plugin.economyFormat(reward));
|
||||
}
|
||||
else {
|
||||
Messenger.warning("Tried to add money, but no economy plugin detected!");
|
||||
plugin.getLogger().warning("Tried to add money, but no economy plugin detected!");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -145,7 +145,7 @@ public class MAUtils
|
||||
List<Player> players = new ArrayList<Player>(arena.getPlayersInArena());
|
||||
for (Player p : players) {
|
||||
if (!arena.getWorld().equals(p.getWorld())) {
|
||||
Messenger.info("Player '" + p.getName() + "' is not in the right world. Kicking...");
|
||||
plugin.getLogger().info("Player '" + p.getName() + "' is not in the right world. Kicking...");
|
||||
p.kickPlayer("[MobArena] Cheater! (Warped out of the arena world.)");
|
||||
Messenger.tell(p, "You warped out of the arena world.");
|
||||
continue;
|
||||
@ -167,7 +167,7 @@ public class MAUtils
|
||||
catch (Exception e) {
|
||||
p.kickPlayer("Banned for life! No, but stop trying to cheat in MobArena!");
|
||||
if (plugin != null) {
|
||||
Messenger.warning(p.getName() + " tried to cheat in MobArena and has been kicked.");
|
||||
plugin.getLogger().warning(p.getName() + " tried to cheat in MobArena and has been kicked.");
|
||||
}
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
@ -235,7 +235,7 @@ public class MAUtils
|
||||
buffy.append(", ");
|
||||
}
|
||||
else {
|
||||
Messenger.warning("Tried to do some money stuff, but no economy plugin was detected!");
|
||||
plugin.getLogger().warning("Tried to do some money stuff, but no economy plugin was detected!");
|
||||
return buffy.toString();
|
||||
}
|
||||
continue;
|
||||
@ -330,7 +330,7 @@ public class MAUtils
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Messenger.warning("Couldn't create backup file. Aborting auto-generate...");
|
||||
plugin.getLogger().warning("Couldn't create backup file. Aborting auto-generate...");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -469,7 +469,7 @@ public class MAUtils
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (error) Messenger.warning("Couldn't find backup file for arena '" + name + "'");
|
||||
if (error) plugin.getLogger().warning("Couldn't find backup file for arena '" + name + "'");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.garbagemule.MobArena;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -12,10 +11,6 @@ import com.garbagemule.MobArena.framework.Arena;
|
||||
|
||||
public class Messenger
|
||||
{
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private static final String prefix = "[MobArena] ";
|
||||
|
||||
private Messenger() {}
|
||||
|
||||
public static boolean tell(CommandSender p, String msg) {
|
||||
@ -54,16 +49,4 @@ public class Messenger
|
||||
public static void announce(Arena arena, Msg msg) {
|
||||
announce(arena, msg.toString());
|
||||
}
|
||||
|
||||
public static void info(String msg) {
|
||||
log.info(prefix + msg);
|
||||
}
|
||||
|
||||
public static void warning(String msg) {
|
||||
log.warning(prefix + msg);
|
||||
}
|
||||
|
||||
public static void severe(String msg) {
|
||||
log.severe(prefix + msg);
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,13 @@ import java.io.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
@ -89,7 +91,7 @@ public class MobArena extends JavaPlugin
|
||||
startMetrics();
|
||||
|
||||
// Announce enable!
|
||||
Messenger.info("v" + this.getDescription().getVersion() + " enabled.");
|
||||
getLogger().info("v" + this.getDescription().getVersion() + " enabled.");
|
||||
|
||||
// Check for updates
|
||||
if (getConfig().getBoolean("global-settings.update-notification", false)) {
|
||||
@ -105,8 +107,8 @@ public class MobArena extends JavaPlugin
|
||||
}
|
||||
arenaMaster.resetArenaMap();
|
||||
VersionChecker.shutdown();
|
||||
|
||||
Messenger.info("disabled.");
|
||||
|
||||
getLogger().info("disabled.");
|
||||
}
|
||||
|
||||
public File getPluginFile() {
|
||||
@ -122,7 +124,7 @@ public class MobArena extends JavaPlugin
|
||||
public void reloadConfig() {
|
||||
// Check if the config-file exists
|
||||
if (!configFile.exists()) {
|
||||
Messenger.info("No config-file found, creating default...");
|
||||
getLogger().info("No config-file found, creating default...");
|
||||
saveDefaultConfig();
|
||||
}
|
||||
|
||||
@ -156,7 +158,7 @@ public class MobArena extends JavaPlugin
|
||||
throw new IllegalStateException("Config-file could not be created for some reason! <o>");
|
||||
} catch (IOException e) {
|
||||
// Error reading the file, just re-throw
|
||||
Messenger.severe("There was an error reading the config-file:\n" + e.getMessage());
|
||||
getLogger().severe("There was an error reading the config-file:\n" + e.getMessage());
|
||||
} finally {
|
||||
// Java 6 <3
|
||||
if (in != null) {
|
||||
@ -183,7 +185,7 @@ public class MobArena extends JavaPlugin
|
||||
File file = new File(getDataFolder(), "announcements.yml");
|
||||
try {
|
||||
if (file.createNewFile()) {
|
||||
Messenger.info("announcements.yml created.");
|
||||
getLogger().info("announcements.yml created.");
|
||||
YamlConfiguration yaml = Msg.toYaml();
|
||||
yaml.save(file);
|
||||
return;
|
||||
@ -228,7 +230,7 @@ public class MobArena extends JavaPlugin
|
||||
private void setupVault() {
|
||||
Plugin vaultPlugin = this.getServer().getPluginManager().getPlugin("Vault");
|
||||
if (vaultPlugin == null) {
|
||||
Messenger.warning("Vault was not found. Economy rewards will not work!");
|
||||
getLogger().warning("Vault was not found. Economy rewards will not work!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -237,9 +239,9 @@ public class MobArena extends JavaPlugin
|
||||
|
||||
if (e != null) {
|
||||
economy = e.getProvider();
|
||||
Messenger.info("Vault found; economy rewards enabled.");
|
||||
getLogger().info("Vault found; economy rewards enabled.");
|
||||
} else {
|
||||
Messenger.warning("Vault found, but no economy plugin detected. Economy rewards will not work!");
|
||||
getLogger().warning("Vault found, but no economy plugin detected. Economy rewards will not work!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,7 +249,7 @@ public class MobArena extends JavaPlugin
|
||||
Plugin spells = this.getServer().getPluginManager().getPlugin("MagicSpells");
|
||||
if (spells == null) return;
|
||||
|
||||
Messenger.info("MagicSpells found, loading config-file.");
|
||||
getLogger().info("MagicSpells found, loading config-file.");
|
||||
this.getServer().getPluginManager().registerEvents(new MagicSpellsListener(this), this);
|
||||
}
|
||||
|
||||
@ -264,7 +266,7 @@ public class MobArena extends JavaPlugin
|
||||
Metrics m = new Metrics(this);
|
||||
m.start();
|
||||
} catch (Exception e) {
|
||||
Messenger.warning("y u disable stats :(");
|
||||
getLogger().warning("y u disable stats :(");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.block.Sign;
|
||||
|
||||
import com.garbagemule.MobArena.ArenaPlayer;
|
||||
import com.garbagemule.MobArena.ArenaPlayerStatistics;
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
|
||||
@ -61,7 +60,7 @@ public class Leaderboard
|
||||
}
|
||||
|
||||
if (!(topLeft.getBlock().getState() instanceof Sign)) {
|
||||
Messenger.warning("The leaderboard-node for arena '" + arena.configName() + "' does not point to a sign!");
|
||||
plugin.getLogger().warning("The leaderboard-node for arena '" + arena.configName() + "' does not point to a sign!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -127,7 +126,7 @@ public class Leaderboard
|
||||
|
||||
if (!(state instanceof Sign))
|
||||
{
|
||||
Messenger.severe("Leaderboards for '" + arena.configName() + "' could not be established!");
|
||||
plugin.getLogger().severe("Leaderboards for '" + arena.configName() + "' could not be established!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.garbagemule.MobArena.listeners;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -30,7 +29,7 @@ public class MagicSpellsListener implements Listener
|
||||
File file = new File(plugin.getDataFolder(), "magicspells.yml");
|
||||
if (!file.exists()) {
|
||||
plugin.saveResource("magicspells.yml", false);
|
||||
Messenger.info("magicspells.yml created.");
|
||||
plugin.getLogger().info("magicspells.yml created.");
|
||||
}
|
||||
try {
|
||||
FileConfiguration config = new YamlConfiguration();
|
||||
|
@ -28,7 +28,7 @@ public class ClassChests {
|
||||
|
||||
Block block = loc.getBlock();
|
||||
if (!(block.getState() instanceof InventoryHolder)) {
|
||||
Messenger.warning("Class chest location for class '" + ac.getConfigName() + "' is not a chest!");
|
||||
arena.getPlugin().getLogger().warning("Class chest location for class '" + ac.getConfigName() + "' is not a chest!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -165,7 +165,7 @@ public class ItemParser
|
||||
break;
|
||||
}
|
||||
if (result == null || result.getTypeId() == 0) {
|
||||
Messenger.warning("Failed to parse item: " + item);
|
||||
Bukkit.getLogger().warning("[MobArena] Failed to parse item: " + item);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,10 @@ package com.garbagemule.MobArena.util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
|
||||
public class PotionEffectParser
|
||||
{
|
||||
private static final int TICKS_PER_SECOND = 20;
|
||||
@ -49,7 +48,7 @@ public class PotionEffectParser
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
Messenger.warning("Failed to parse potion effect: " + p);
|
||||
Bukkit.getLogger().warning("[MobArena] Failed to parse potion effect: " + p);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -84,12 +84,12 @@ public class VersionChecker
|
||||
return Integer.parseInt(parts[i]);
|
||||
}
|
||||
|
||||
private static void message(MobArena plugin, final Player player, final String... messages) {
|
||||
private static void message(final MobArena plugin, final Player player, final String... messages) {
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
public void run() {
|
||||
for (String message : messages) {
|
||||
if (player == null) {
|
||||
Messenger.info(message);
|
||||
plugin.getLogger().info(message);
|
||||
} else if (player.isOnline()) {
|
||||
Messenger.tell(player, message);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.garbagemule.MobArena.util.timer;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import com.garbagemule.MobArena.Msg;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.garbagemule.MobArena.waves;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -24,8 +24,8 @@ public class MABoss
|
||||
entity.setHealth(maxHealth);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Spigot... *facepalm*
|
||||
Messenger.severe("Can't set health to " + maxHealth + ", using default health. If you are running Spigot, set 'maxHealth' higher in your Spigot settings.");
|
||||
Messenger.severe(ex.getLocalizedMessage());
|
||||
Bukkit.getLogger().severe("[MobArena] Can't set health to " + maxHealth + ", using default health. If you are running Spigot, set 'maxHealth' higher in your Spigot settings.");
|
||||
Bukkit.getLogger().severe("[MobArena] " + ex.getLocalizedMessage());
|
||||
}
|
||||
this.entity = entity;
|
||||
this.dead = false;
|
||||
|
@ -3,7 +3,6 @@ package com.garbagemule.MobArena.waves;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.waves.enums.*;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -48,7 +47,7 @@ public class WaveManager
|
||||
finalWave = section.getParent().getInt("settings.final-wave", 0);
|
||||
|
||||
if (recurrentWaves.isEmpty()) {
|
||||
Messenger.warning(WaveError.NO_RECURRENT_WAVES.format(arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.NO_RECURRENT_WAVES.format(arena.configName()));
|
||||
|
||||
Wave def = WaveParser.createDefaultWave();
|
||||
recurrentWaves.add(def);
|
||||
|
@ -9,7 +9,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.region.ArenaRegion;
|
||||
import com.garbagemule.MobArena.util.ItemParser;
|
||||
@ -33,14 +32,14 @@ public class WaveParser
|
||||
|
||||
// If the config is null, return the empty set.
|
||||
if (config == null) {
|
||||
Messenger.warning(WaveError.BRANCH_MISSING.format(branch.toString().toLowerCase(), arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.BRANCH_MISSING.format(branch.toString().toLowerCase(), arena.configName()));
|
||||
return result;
|
||||
}
|
||||
|
||||
// If no waves were found, return the empty set.
|
||||
Set<String> waves = config.getKeys(false);
|
||||
if (waves == null) {
|
||||
Messenger.warning(WaveError.BRANCH_MISSING.format(branch.toString().toLowerCase(), arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.BRANCH_MISSING.format(branch.toString().toLowerCase(), arena.configName()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -66,7 +65,7 @@ public class WaveParser
|
||||
WaveType type = WaveType.fromString(t);
|
||||
|
||||
if (type == null) {
|
||||
Messenger.warning(WaveError.INVALID_TYPE.format(t, name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.INVALID_TYPE.format(t, name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -97,7 +96,7 @@ public class WaveParser
|
||||
|
||||
// Check that the result isn't null
|
||||
if (result == null) {
|
||||
Messenger.warning(WaveError.INVALID_WAVE.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.INVALID_WAVE.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -122,10 +121,10 @@ public class WaveParser
|
||||
|
||||
// Recurrent must have priority + frequency, single must have firstWave
|
||||
if (branch == WaveBranch.RECURRENT && (priority == -1 || frequency <= 0)) {
|
||||
Messenger.warning(WaveError.RECURRENT_NODES.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.RECURRENT_NODES.format(name, arena.configName()));
|
||||
return null;
|
||||
} else if (branch == WaveBranch.SINGLE && firstWave <= 0) {
|
||||
Messenger.warning(WaveError.SINGLE_NODES.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.SINGLE_NODES.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -150,7 +149,7 @@ public class WaveParser
|
||||
// Grab the monster map.
|
||||
SortedMap<Integer,MACreature> monsters = getMonsterMap(config);
|
||||
if (monsters == null || monsters.isEmpty()) {
|
||||
Messenger.warning(WaveError.MONSTER_MAP_MISSING.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.MONSTER_MAP_MISSING.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -175,7 +174,7 @@ public class WaveParser
|
||||
private static Wave parseSpecialWave(Arena arena, String name, ConfigurationSection config) {
|
||||
SortedMap<Integer,MACreature> monsters = getMonsterMap(config);
|
||||
if (monsters == null || monsters.isEmpty()) {
|
||||
Messenger.warning(WaveError.MONSTER_MAP_MISSING.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.MONSTER_MAP_MISSING.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -186,7 +185,7 @@ public class WaveParser
|
||||
private static Wave parseSwarmWave(Arena arena, String name, ConfigurationSection config) {
|
||||
MACreature monster = getSingleMonster(config);
|
||||
if (monster == null) {
|
||||
Messenger.warning(WaveError.SINGLE_MONSTER_MISSING.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.SINGLE_MONSTER_MISSING.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -203,7 +202,7 @@ public class WaveParser
|
||||
private static Wave parseSupplyWave(Arena arena, String name, ConfigurationSection config) {
|
||||
SortedMap<Integer,MACreature> monsters = getMonsterMap(config);
|
||||
if (monsters == null || monsters.isEmpty()) {
|
||||
Messenger.warning(WaveError.MONSTER_MAP_MISSING.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.MONSTER_MAP_MISSING.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -220,7 +219,7 @@ public class WaveParser
|
||||
private static Wave parseUpgradeWave(Arena arena, String name, ConfigurationSection config) {
|
||||
Map<String,List<Upgrade>> upgrades = getUpgradeMap(config);
|
||||
if (upgrades == null || upgrades.isEmpty()) {
|
||||
Messenger.warning(WaveError.UPGRADE_MAP_MISSING.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.UPGRADE_MAP_MISSING.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -236,7 +235,7 @@ public class WaveParser
|
||||
private static Wave parseBossWave(Arena arena, String name, ConfigurationSection config) {
|
||||
MACreature monster = getSingleMonster(config);
|
||||
if (monster == null) {
|
||||
Messenger.warning(WaveError.SINGLE_MONSTER_MISSING.format(name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.SINGLE_MONSTER_MISSING.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -252,7 +251,7 @@ public class WaveParser
|
||||
String healthString = config.getString("health");
|
||||
if (healthString == null) {
|
||||
String warning = "No health value found for boss '%s' in arena '%s'. Defaulting to medium.";
|
||||
Messenger.warning(String.format(warning, name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(String.format(warning, name, arena.configName()));
|
||||
result.setHealth(BossHealth.MEDIUM);
|
||||
} else {
|
||||
BossHealth health = BossHealth.fromString(healthString);
|
||||
@ -262,7 +261,7 @@ public class WaveParser
|
||||
int flatHealth = config.getInt("health", 0);
|
||||
if (flatHealth <= 0) {
|
||||
String warning = "Unable to parse health of boss '%s' in arena '%s'. Defaulting to medium. Value was '%s'";
|
||||
Messenger.warning(String.format(warning, name, arena.configName(), healthString));
|
||||
arena.getPlugin().getLogger().warning(String.format(warning, name, arena.configName(), healthString));
|
||||
result.setHealth(BossHealth.MEDIUM);
|
||||
} else {
|
||||
result.setFlatHealth(flatHealth);
|
||||
@ -277,7 +276,7 @@ public class WaveParser
|
||||
for (String ability : parts) {
|
||||
Ability a = AbilityManager.getAbility(ability.trim());
|
||||
if (a == null) {
|
||||
Messenger.warning(WaveError.BOSS_ABILITY.format(ability.trim(), name, arena.configName()));
|
||||
arena.getPlugin().getLogger().warning(WaveError.BOSS_ABILITY.format(ability.trim(), name, arena.configName()));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -380,7 +379,7 @@ public class WaveParser
|
||||
Location spawnpoint = region.getSpawnpoint(spawn.trim());
|
||||
|
||||
if (spawnpoint == null) {
|
||||
Messenger.warning("Spawnpoint '" + spawn + "' in wave '" + name + "' for arena '" + arena.configName() + "' could not be parsed!");
|
||||
arena.getPlugin().getLogger().warning("Spawnpoint '" + spawn + "' in wave '" + name + "' for arena '" + arena.configName() + "' could not be parsed!");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.waves.enums.*;
|
||||
import com.garbagemule.MobArena.MAUtils;
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
|
||||
public class WaveUtils
|
||||
@ -47,7 +46,7 @@ public class WaveUtils
|
||||
Location l = p.getLocation();
|
||||
locs += "(" + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ() + ") ";
|
||||
}
|
||||
Messenger.warning("The following locations in arena '" + arena.configName() + "' are not covered by any spawnpoints:" + locs);
|
||||
plugin.getLogger().warning("The following locations in arena '" + arena.configName() + "' are not covered by any spawnpoints:" + locs);
|
||||
return spawnpoints;
|
||||
}
|
||||
return result;
|
||||
@ -66,7 +65,7 @@ public class WaveUtils
|
||||
{
|
||||
if (!arena.getWorld().equals(p.getWorld()))
|
||||
{
|
||||
Messenger.info("Player '" + p.getName() + "' is not in the right world. Kicking...");
|
||||
arena.getPlugin().getLogger().info("Player '" + p.getName() + "' is not in the right world. Kicking...");
|
||||
p.kickPlayer("[MobArena] Cheater! (Warped out of the arena world.)");
|
||||
continue;
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ import java.util.Map;
|
||||
|
||||
import javax.tools.*;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import com.garbagemule.MobArena.waves.ability.core.*;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class AbilityManager
|
||||
{
|
||||
@ -85,7 +85,7 @@ public class AbilityManager
|
||||
if (ToolProvider.getSystemJavaCompiler() != null) {
|
||||
compileAbilities(javaDir, classDir);
|
||||
} else {
|
||||
Messenger.warning("Found plugins/MobArena/abilities/src/ folder, but no Java compiler. The source files will not be compiled!");
|
||||
Bukkit.getLogger().warning("[MobArena] Found plugins/MobArena/abilities/src/ folder, but no Java compiler. The source files will not be compiled!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,9 +109,9 @@ public class AbilityManager
|
||||
for (String alias : info.aliases()) {
|
||||
abilities.put(alias, cls);
|
||||
}
|
||||
|
||||
|
||||
// Announce custom abilities
|
||||
if (announce) Messenger.info("Loaded custom ability '" + info.name() + "'");
|
||||
if (announce) Bukkit.getLogger().info("[MobArena] Loaded custom ability '" + info.name() + "'");
|
||||
}
|
||||
|
||||
private static void compileAbilities(File javaDir, File classDir) {
|
||||
@ -126,7 +126,7 @@ public class AbilityManager
|
||||
}
|
||||
|
||||
// Notify the console.
|
||||
Messenger.info("Compiling abilities: " + fileListToString(toCompile));
|
||||
Bukkit.getLogger().info("[MobArena] Compiling abilities: " + fileListToString(toCompile));
|
||||
|
||||
// Get the compiler
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
@ -149,7 +149,7 @@ public class AbilityManager
|
||||
fileManager.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Messenger.severe("Compilation step failed...");
|
||||
Bukkit.getLogger().severe("[MobArena] Compilation step failed...");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class AbilityManager
|
||||
for (File javaFile : javaDir.listFiles()) {
|
||||
// Skip if it's not a .java file.
|
||||
if (!javaFile.getName().endsWith(".java")) {
|
||||
Messenger.info("Found invalid ability file: " + javaFile.getName());
|
||||
Bukkit.getLogger().info("[MobArena] Found invalid ability file: " + javaFile.getName());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.garbagemule.MobArena.waves.ability.core;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.waves.MABoss;
|
||||
import com.garbagemule.MobArena.waves.ability.Ability;
|
||||
import com.garbagemule.MobArena.waves.ability.AbilityInfo;
|
||||
import com.garbagemule.MobArena.waves.ability.AbilityUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -42,7 +42,7 @@ public class ObsidianBomb implements Ability
|
||||
loc = b.getLocation();
|
||||
|
||||
if (b.getType() != Material.AIR) {
|
||||
Messenger.warning("Failed to place Obsidian Bomb at: " + target.getLocation());
|
||||
Bukkit.getLogger().warning("[MobArena] Failed to place Obsidian Bomb at: " + target.getLocation());
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user