mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Fire off an event when we reload configs, so all plugins can too!
This commit is contained in:
parent
4c4fd08dc8
commit
52f8476907
@ -1,11 +1,14 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
|
||||
|
||||
public class ReloadCommand extends MultiverseCommand {
|
||||
|
||||
@ -21,10 +24,21 @@ public class ReloadCommand extends MultiverseCommand {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
sender.sendMessage("Reloading Multiverse-Core config.yml and worlds.yml");
|
||||
sender.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
|
||||
this.plugin.loadConfigs();
|
||||
this.plugin.loadWorlds(true);
|
||||
sender.sendMessage("Reload Complete!");
|
||||
|
||||
// Create the event
|
||||
List<String> configsLoaded = new ArrayList<String>();
|
||||
configsLoaded.add("Multiverse-Core - config.yml");
|
||||
configsLoaded.add("Multiverse-Core - worlds.yml");
|
||||
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
|
||||
this.plugin.getServer().getPluginManager().callEvent(configReload);
|
||||
for(String s : configReload.getAllConfigsLoaded()) {
|
||||
sender.sendMessage(s);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Reload Complete!");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
public class MVConfigReloadEvent extends Event {
|
||||
private static final long serialVersionUID = 3647950355746345397L;
|
||||
private List<String> configsLoaded;
|
||||
|
||||
public MVConfigReloadEvent(List<String> configsLoaded) {
|
||||
super("MVTeleport");
|
||||
this.configsLoaded = configsLoaded;
|
||||
}
|
||||
|
||||
public void addConfig(String config) {
|
||||
this.configsLoaded.add(config);
|
||||
}
|
||||
|
||||
public List<String> getAllConfigsLoaded() {
|
||||
return this.configsLoaded;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user