Permalink
Browse files

Change Spout Config file to only load if Spout is enabled.

Removed unused imports.
  • Loading branch information...
1 parent b88e076 commit 450e9380922a194df2fe69649ac7f16abfd32ff7 @gmcferrin gmcferrin committed May 23, 2012
@@ -7,8 +7,8 @@
import org.bukkit.command.CommandSender;
import org.getspout.spoutapi.player.SpoutPlayer;
+import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.locale.LocaleLoader;
public class McmmoCommand implements CommandExecutor {
@@ -20,7 +20,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
sender.sendMessage(mcSplit);
if (Config.getInstance().getDonateMessageEnabled()) {
- if (SpoutConfig.getInstance().spoutEnabled && sender instanceof SpoutPlayer) {
+ if (mcMMO.p.spoutEnabled && sender instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) sender;
sPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "mcmmodev@gmail.com", Material.DIAMOND);
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
return true;
}
- if (!SpoutConfig.getInstance().spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
+ if (!plugin.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
@@ -6,6 +6,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
@@ -27,7 +28,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
return true;
}
- if (!SpoutConfig.getInstance().spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
+ if (!mcMMO.p.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
@@ -20,7 +20,6 @@ public SpoutConfig(mcMMO plugin) {
super(plugin, "spout.yml");
}
- public boolean spoutEnabled;
public boolean getShowPowerLevel() { return config.getBoolean("HUD.Show_Power_Level", true); }
public String getMenuKey() { return config.getString("Menu.Key", "KEY_M"); }
@@ -4,7 +4,6 @@
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
@@ -254,7 +253,7 @@ else if (PP.getToolPreparationMode(ToolType.FISTS) && (BlockChecks.canBeGigaDril
}
/* TREE FELLER SOUNDS */
- if (SpoutConfig.getInstance().spoutEnabled && BlockChecks.isLog(block) && PP.getAbilityMode(AbilityType.TREE_FELLER)) {
+ if (plugin.spoutEnabled && BlockChecks.isLog(block) && PP.getAbilityMode(AbilityType.TREE_FELLER)) {
SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
}
@@ -299,7 +298,7 @@ else if (PP.getAbilityMode(AbilityType.BERSERK) && Skills.triggerCheck(player, b
event.setInstaBreak(true);
}
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (plugin.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}
@@ -27,7 +27,6 @@
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.general.XprateCommand;
import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.runnables.RemoveProfileFromMemoryTask;
import com.gmail.nossr50.spout.SpoutStuff;
@@ -143,7 +142,7 @@ public void onPlayerQuit(PlayerQuitEvent event) {
/* GARBAGE COLLECTION */
//Remove Spout Stuff
- if (SpoutConfig.getInstance().spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
+ if (plugin.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
SpoutStuff.playerHUDs.remove(player);
}
@@ -9,7 +9,6 @@
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.RepairConfigManager;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.config.TreasuresConfig;
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
@@ -36,7 +35,6 @@
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -46,8 +44,6 @@
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
public class mcMMO extends JavaPlugin {
@@ -74,6 +70,9 @@
//File Paths
public String mainDirectory, flatFileDirectory, usersFile, leaderboardDirectory, modDirectory;
+ //Spout Check
+ public boolean spoutEnabled;
+
/**
* Things to be run when the plugin is enabled.
*/
@@ -85,7 +84,6 @@ public void onEnable() {
Config configInstance = Config.getInstance();
TreasuresConfig.getInstance();
HiddenConfig.getInstance();
- SpoutConfig.getInstance().load();
List<Repairable> repairables = new ArrayList<Repairable>();
@@ -17,14 +17,15 @@ public SpoutStart(final mcMMO plugin) {
@Override
public void run() {
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
- SpoutConfig.getInstance().spoutEnabled = true;
+ plugin.spoutEnabled = true;
}
else {
- SpoutConfig.getInstance().spoutEnabled = false;
+ plugin.spoutEnabled = false;
}
//Spout Stuff
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (plugin.spoutEnabled) {
+ SpoutConfig.getInstance().load();
SpoutStuff.setupSpoutConfigs();
SpoutStuff.registerCustomEvent();
SpoutStuff.extractFiles(); //Extract source materials
@@ -18,7 +18,6 @@
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.config.TreasuresConfig;
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
@@ -130,7 +129,7 @@ public static void gigaDrillBreaker(Player player, Block block) {
Excavation.excavationProcCheck(block, player);
}
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}
@@ -19,7 +19,6 @@
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
@@ -333,7 +332,7 @@ public static void superBreakerBlockCheck(Player player, Block block) {
miningBlockCheck(player, block);
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}
@@ -378,7 +377,7 @@ public static void superBreakerBlockCheck(Player player, Block block) {
miningBlockCheck(player, block);
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}
@@ -14,7 +14,6 @@
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
@@ -388,7 +387,7 @@ public static void leafBlower(Player player, Block block) {
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
}
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}
@@ -13,7 +13,6 @@
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
@@ -47,7 +46,7 @@ protected static void xpHandler(Player player, PlayerProfile PP, short durabilit
Skills.XpCheckSkill(SkillType.REPAIR, player);
//CLANG CLANG
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (mcMMO.p.spoutEnabled) {
SpoutSounds.playRepairNoise(player, mcMMO.p);
}
}
@@ -243,7 +242,7 @@ public static void placedAnvilCheck(Player player, int anvilID) {
PlayerProfile PP = Users.getProfile(player);
if (!PP.getPlacedAnvil()) {
- if (SpoutConfig.getInstance().spoutEnabled) {
+ if (mcMMO.p.spoutEnabled) {
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
if (sPlayer.isSpoutCraftEnabled()) {
@@ -210,7 +210,7 @@ public static void XpCheckSkill(SkillType skillType, Player player) {
String capitalized = Misc.getCapitalized(skillType.toString());
/* Spout Stuff */
- if (SpoutConfig.getInstance().spoutEnabled && player instanceof SpoutPlayer) {
+ if (mcMMO.p.spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
if (sPlayer.isSpoutCraftEnabled()) {
@@ -235,7 +235,7 @@ public static void XpCheckSkill(SkillType skillType, Player player) {
}
/* Always update XP Bar (Check if no levels were gained first to remove redundancy) */
- if (skillups == 0 && SpoutConfig.getInstance().spoutEnabled && player instanceof SpoutPlayer) {
+ if (skillups == 0 && mcMMO.p.spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) player;
if (sPlayer.isSpoutCraftEnabled()) {
if (SpoutConfig.getInstance().getXPBarEnabled()) {

0 comments on commit 450e938

Please sign in to comment.