HgWorldPlugin/src/com/bernard/hgWorld/HgWorldPlugin.java

57 lines
1.7 KiB
Java

package com.bernard.hgWorld;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;
import org.yaml.snakeyaml.Yaml;
import com.bernard.hgWorld.commands.ChestPlacingCommands;
import com.bernard.hgWorld.commands.HgManagerCommand;
import com.bernard.hgWorld.commands.LocationsShowCommands;
import com.bernard.hgWorld.data.HgWorldConfig;
import com.bernard.hgWorld.objects.HgGame;
public class HgWorldPlugin extends JavaPlugin {
public static Map<String, HgWorldConfig> worldsConfig = new HashMap<>();//<NomDuMonde,Config>
public static Map<String, HgGame> games = new HashMap<>();//<NomDuMonde,JeuEnCoursDedans>
public static Yaml yaml = new Yaml();
public EventManager eventManager;
@Override
public void onEnable() {
super.onEnable();
eventManager = new EventManager();
this.getServer().getPluginManager().registerEvents(new ManagmentListener(), this);
this.getServer().getPluginManager().registerEvents(eventManager, this);
this.getCommand("hgshow").setExecutor(new LocationsShowCommands());
this.getCommand("hghide").setExecutor(new LocationsShowCommands());
this.getCommand("chest").setExecutor(new ChestPlacingCommands());
this.getCommand("unchest").setExecutor(new ChestPlacingCommands());
this.getCommand("hg").setExecutor(new HgManagerCommand());
}
@Override
public void onDisable() {
// TODO Auto-generated method stub
super.onDisable();
}
public static HgWorldConfig getWorldConfig(World world){
if(!HgWorldPlugin.worldsConfig.containsKey(world.getName()))HgWorldPlugin.worldsConfig.put(world.getName(), new HgWorldConfig());
return HgWorldPlugin.worldsConfig.get(world.getName());
}
}