mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Fixed parties not being loaded at startup
+ minor cleanup
This commit is contained in:
parent
5151be05b9
commit
a8fa625b5c
@ -104,19 +104,19 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public static ChunkManager placeStore;
|
public static ChunkManager placeStore;
|
||||||
public static RepairManager repairManager;
|
public static RepairManager repairManager;
|
||||||
|
|
||||||
/* Jar Stuff */
|
// Jar Stuff
|
||||||
public static File mcmmo;
|
public static File mcmmo;
|
||||||
|
|
||||||
//File Paths
|
// File Paths
|
||||||
private static String mainDirectory;
|
private static String mainDirectory;
|
||||||
private static String flatFileDirectory;
|
private static String flatFileDirectory;
|
||||||
private static String usersFile;
|
private static String usersFile;
|
||||||
private static String modDirectory;
|
private static String modDirectory;
|
||||||
|
|
||||||
//Spout Check
|
// Spout Check
|
||||||
public static boolean spoutEnabled;
|
public static boolean spoutEnabled;
|
||||||
|
|
||||||
//XP Event Check
|
// XP Event Check
|
||||||
private boolean xpEventEnabled = false;
|
private boolean xpEventEnabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,11 +127,12 @@ public class mcMMO extends JavaPlugin {
|
|||||||
p = this;
|
p = this;
|
||||||
setupFilePaths();
|
setupFilePaths();
|
||||||
|
|
||||||
//Force the loading of config files
|
// Force the loading of config files
|
||||||
Config configInstance = Config.getInstance();
|
Config configInstance = Config.getInstance();
|
||||||
TreasuresConfig.getInstance();
|
TreasuresConfig.getInstance();
|
||||||
HiddenConfig.getInstance();
|
HiddenConfig.getInstance();
|
||||||
AdvancedConfig.getInstance();
|
AdvancedConfig.getInstance();
|
||||||
|
PartyManager.loadParties();
|
||||||
|
|
||||||
List<Repairable> repairables = new ArrayList<Repairable>();
|
List<Repairable> repairables = new ArrayList<Repairable>();
|
||||||
|
|
||||||
@ -147,13 +148,13 @@ public class mcMMO extends JavaPlugin {
|
|||||||
CustomBlocksConfig.getInstance();
|
CustomBlocksConfig.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load repair configs, make manager, and register them at this time
|
// Load repair configs, make manager, and register them at this time
|
||||||
RepairConfigManager rManager = new RepairConfigManager(this);
|
RepairConfigManager rManager = new RepairConfigManager(this);
|
||||||
repairables.addAll(rManager.getLoadedRepairables());
|
repairables.addAll(rManager.getLoadedRepairables());
|
||||||
repairManager = RepairManagerFactory.getRepairManager(repairables.size());
|
repairManager = RepairManagerFactory.getRepairManager(repairables.size());
|
||||||
repairManager.registerRepairables(repairables);
|
repairManager.registerRepairables(repairables);
|
||||||
|
|
||||||
//Check if Repair Anvil and Salvage Anvil have different itemID's
|
// Check if Repair Anvil and Salvage Anvil have different itemID's
|
||||||
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()) {
|
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()) {
|
||||||
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
|
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
|
||||||
}
|
}
|
||||||
@ -164,7 +165,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
PluginManager pluginManager = getServer().getPluginManager();
|
PluginManager pluginManager = getServer().getPluginManager();
|
||||||
|
|
||||||
//Register events
|
// Register events
|
||||||
pluginManager.registerEvents(playerListener, this);
|
pluginManager.registerEvents(playerListener, this);
|
||||||
pluginManager.registerEvents(blockListener, this);
|
pluginManager.registerEvents(blockListener, this);
|
||||||
pluginManager.registerEvents(entityListener, this);
|
pluginManager.registerEvents(entityListener, this);
|
||||||
@ -178,7 +179,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
PluginDescriptionFile pdfFile = getDescription();
|
PluginDescriptionFile pdfFile = getDescription();
|
||||||
|
|
||||||
//Setup the leader boards
|
// Setup the leader boards
|
||||||
if (configInstance.getUseMySQL()) {
|
if (configInstance.getUseMySQL()) {
|
||||||
// TODO: Why do we have to check for a connection that hasn't be made yet?
|
// TODO: Why do we have to check for a connection that hasn't be made yet?
|
||||||
Database.checkConnected();
|
Database.checkConnected();
|
||||||
@ -189,26 +190,27 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
Users.addUser(player); //In case of reload add all users back into PlayerProfile
|
Users.addUser(player); // In case of reload add all users back into PlayerProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info("Version " + pdfFile.getVersion() + " is enabled!");
|
getLogger().info("Version " + pdfFile.getVersion() + " is enabled!");
|
||||||
|
|
||||||
BukkitScheduler scheduler = getServer().getScheduler();
|
BukkitScheduler scheduler = getServer().getScheduler();
|
||||||
|
|
||||||
//Schedule Spout Activation 1 second after start-up
|
// Schedule Spout Activation 1 second after start-up
|
||||||
scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20);
|
scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20);
|
||||||
//Periodic save timer (Saves every 10 minutes by default)
|
// Periodic save timer (Saves every 10 minutes by default)
|
||||||
scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(), 0, configInstance.getSaveInterval() * 1200);
|
scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(), 0, configInstance.getSaveInterval() * 1200);
|
||||||
//Regen & Cooldown timer (Runs every second)
|
// Regen & Cooldown timer (Runs every second)
|
||||||
scheduler.scheduleSyncRepeatingTask(this, new SkillMonitor(), 0, 20);
|
scheduler.scheduleSyncRepeatingTask(this, new SkillMonitor(), 0, 20);
|
||||||
//Bleed timer (Runs every two seconds)
|
// Bleed timer (Runs every two seconds)
|
||||||
scheduler.scheduleSyncRepeatingTask(this, new BleedTimer(), 0, 40);
|
scheduler.scheduleSyncRepeatingTask(this, new BleedTimer(), 0, 40);
|
||||||
|
|
||||||
//Old & Powerless User remover
|
// Old & Powerless User remover
|
||||||
int purgeInterval = Config.getInstance().getPurgeInterval();
|
int purgeInterval = Config.getInstance().getPurgeInterval();
|
||||||
|
|
||||||
if (purgeInterval == 0) {
|
if (purgeInterval == 0) {
|
||||||
scheduler.scheduleSyncDelayedTask(this, new UserPurgeTask(), 40); //Start 2 seconds after startup.
|
scheduler.scheduleSyncDelayedTask(this, new UserPurgeTask(), 40); // Start 2 seconds after startup.
|
||||||
}
|
}
|
||||||
else if (purgeInterval > 0) {
|
else if (purgeInterval > 0) {
|
||||||
scheduler.scheduleSyncRepeatingTask(this, new UserPurgeTask(), 0, purgeInterval * 60L * 60L * 20L);
|
scheduler.scheduleSyncRepeatingTask(this, new UserPurgeTask(), 0, purgeInterval * 60L * 60L * 20L);
|
||||||
@ -219,7 +221,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
if (configInstance.getStatsTrackingEnabled()) {
|
if (configInstance.getStatsTrackingEnabled()) {
|
||||||
try {
|
try {
|
||||||
Metrics metrics = new Metrics(this);
|
Metrics metrics = new Metrics(this);
|
||||||
|
|
||||||
Graph graph = metrics.createGraph("Percentage of servers using timings");
|
Graph graph = metrics.createGraph("Percentage of servers using timings");
|
||||||
|
|
||||||
if (pluginManager.useTimings()) {
|
if (pluginManager.useTimings()) {
|
||||||
@ -246,14 +247,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get our ChunkletManager
|
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||||
placeStore = ChunkManagerFactory.getChunkManager();
|
|
||||||
|
|
||||||
// Automatically starts and stores itself
|
new MobStoreCleaner(); // Automatically starts and stores itself
|
||||||
new MobStoreCleaner();
|
Anniversary.createAnniversaryFile(); // Create Anniversary files
|
||||||
|
|
||||||
// Create Anniversary files
|
|
||||||
Anniversary.createAnniversaryFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -309,13 +306,13 @@ public class mcMMO extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
Users.saveAll(); //Make sure to save player information if the server shuts down
|
Users.saveAll(); // Make sure to save player information if the server shuts down
|
||||||
PartyManager.saveParties();
|
PartyManager.saveParties();
|
||||||
getServer().getScheduler().cancelTasks(this); //This removes our tasks
|
getServer().getScheduler().cancelTasks(this); // This removes our tasks
|
||||||
placeStore.saveAll(); //Save our metadata
|
placeStore.saveAll(); // Save our metadata
|
||||||
placeStore.cleanUp(); //Cleanup empty metadata stores
|
placeStore.cleanUp(); // Cleanup empty metadata stores
|
||||||
|
|
||||||
//Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
|
// Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
|
||||||
try {
|
try {
|
||||||
ZipLibrary.mcMMObackup();
|
ZipLibrary.mcMMObackup();
|
||||||
}
|
}
|
||||||
@ -331,8 +328,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
* Register the commands.
|
* Register the commands.
|
||||||
*/
|
*/
|
||||||
private void registerCommands() {
|
private void registerCommands() {
|
||||||
//Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands)
|
// Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands)
|
||||||
//Skills commands
|
// Skills commands
|
||||||
aliasMap.put(LocaleLoader.getString("Acrobatics.SkillName").toLowerCase(), "acrobatics");
|
aliasMap.put(LocaleLoader.getString("Acrobatics.SkillName").toLowerCase(), "acrobatics");
|
||||||
aliasMap.put(LocaleLoader.getString("Archery.SkillName").toLowerCase(), "archery");
|
aliasMap.put(LocaleLoader.getString("Archery.SkillName").toLowerCase(), "archery");
|
||||||
aliasMap.put(LocaleLoader.getString("Axes.SkillName").toLowerCase(), "axes");
|
aliasMap.put(LocaleLoader.getString("Axes.SkillName").toLowerCase(), "axes");
|
||||||
@ -347,8 +344,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
aliasMap.put(LocaleLoader.getString("Unarmed.SkillName").toLowerCase(), "unarmed");
|
aliasMap.put(LocaleLoader.getString("Unarmed.SkillName").toLowerCase(), "unarmed");
|
||||||
aliasMap.put(LocaleLoader.getString("Woodcutting.SkillName").toLowerCase(), "woodcutting");
|
aliasMap.put(LocaleLoader.getString("Woodcutting.SkillName").toLowerCase(), "woodcutting");
|
||||||
|
|
||||||
//Register commands
|
// Register commands
|
||||||
//Skills commands
|
// Skills commands
|
||||||
getCommand("acrobatics").setExecutor(new AcrobaticsCommand());
|
getCommand("acrobatics").setExecutor(new AcrobaticsCommand());
|
||||||
getCommand("archery").setExecutor(new ArcheryCommand());
|
getCommand("archery").setExecutor(new ArcheryCommand());
|
||||||
getCommand("axes").setExecutor(new AxesCommand());
|
getCommand("axes").setExecutor(new AxesCommand());
|
||||||
@ -365,7 +362,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
Config configInstance = Config.getInstance();
|
Config configInstance = Config.getInstance();
|
||||||
|
|
||||||
//mc* commands
|
// mc* commands
|
||||||
if (configInstance.getCommandMCPurgeEnabled()) {
|
if (configInstance.getCommandMCPurgeEnabled()) {
|
||||||
getCommand("mcpurge").setExecutor(new McpurgeCommand());
|
getCommand("mcpurge").setExecutor(new McpurgeCommand());
|
||||||
}
|
}
|
||||||
@ -409,7 +406,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getCommand("skillreset").setExecutor(new SkillResetCommand());
|
getCommand("skillreset").setExecutor(new SkillResetCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Party commands
|
// Party commands
|
||||||
if (configInstance.getCommandAdminChatAEnabled()) {
|
if (configInstance.getCommandAdminChatAEnabled()) {
|
||||||
getCommand("a").setExecutor(new ACommand());
|
getCommand("a").setExecutor(new ACommand());
|
||||||
}
|
}
|
||||||
@ -426,7 +423,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getCommand("ptp").setExecutor(new PtpCommand(this));
|
getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Other commands
|
// Other commands
|
||||||
if (configInstance.getCommandAddXPEnabled()) {
|
if (configInstance.getCommandAddXPEnabled()) {
|
||||||
getCommand("addxp").setExecutor(new AddxpCommand());
|
getCommand("addxp").setExecutor(new AddxpCommand());
|
||||||
}
|
}
|
||||||
@ -449,7 +446,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
|
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
|
||||||
|
|
||||||
//Spout commands
|
// Spout commands
|
||||||
if (configInstance.getCommandXPLockEnabled()) {
|
if (configInstance.getCommandXPLockEnabled()) {
|
||||||
getCommand("xplock").setExecutor(new XplockCommand());
|
getCommand("xplock").setExecutor(new XplockCommand());
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ public final class PartyManager {
|
|||||||
private static String partiesFilePath = mcMMO.p.getDataFolder().getPath() + File.separator + "FlatFileStuff" + File.separator + "parties.yml";
|
private static String partiesFilePath = mcMMO.p.getDataFolder().getPath() + File.separator + "FlatFileStuff" + File.separator + "parties.yml";
|
||||||
private static List<Party> parties = new ArrayList<Party>();
|
private static List<Party> parties = new ArrayList<Party>();
|
||||||
|
|
||||||
|
private PartyManager() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if two players are in the same party.
|
* Check if two players are in the same party.
|
||||||
*
|
*
|
||||||
@ -414,7 +416,7 @@ public final class PartyManager {
|
|||||||
/**
|
/**
|
||||||
* Load party file.
|
* Load party file.
|
||||||
*/
|
*/
|
||||||
private static void loadParties() {
|
public static void loadParties() {
|
||||||
File file = new File(partiesFilePath);
|
File file = new File(partiesFilePath);
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user