2011-02-06 13:36:11 +01:00
|
|
|
package com.bukkit.mcteam.factions;
|
|
|
|
|
|
|
|
import org.bukkit.event.Event;
|
|
|
|
import org.bukkit.plugin.PluginManager;
|
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
|
|
|
import com.bukkit.mcteam.factions.entities.*;
|
2011-02-07 21:42:14 +01:00
|
|
|
import com.bukkit.mcteam.factions.listeners.FactionsBlockListener;
|
|
|
|
import com.bukkit.mcteam.factions.listeners.FactionsEntityListener;
|
|
|
|
import com.bukkit.mcteam.factions.listeners.FactionsPlayerListener;
|
2011-02-06 13:36:11 +01:00
|
|
|
import com.bukkit.mcteam.factions.util.Log;
|
|
|
|
|
|
|
|
public class Factions extends JavaPlugin {
|
2011-02-13 17:04:06 +01:00
|
|
|
public static Factions factions;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
private final FactionsPlayerListener playerListener = new FactionsPlayerListener(this);
|
|
|
|
private final FactionsEntityListener entityListener = new FactionsEntityListener(this);
|
|
|
|
private final FactionsBlockListener blockListener = new FactionsBlockListener(this);
|
2011-02-13 17:04:06 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDisable() {
|
|
|
|
// TODO Auto-generated method stub
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-02-13 17:04:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onEnable() {
|
|
|
|
Factions.factions = this;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
Log.info("=== INIT START ===");
|
|
|
|
long timeInitStart = System.currentTimeMillis();
|
2011-02-13 17:04:06 +01:00
|
|
|
Log.info("You are running version: "+this.getDescription().getVersion());
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
EM.loadAll();
|
|
|
|
|
|
|
|
// Register events
|
2011-02-13 17:04:06 +01:00
|
|
|
PluginManager pm = this.getServer().getPluginManager();
|
2011-02-12 18:05:05 +01:00
|
|
|
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Event.Priority.Highest, this);
|
2011-02-06 13:36:11 +01:00
|
|
|
pm.registerEvent(Event.Type.PLAYER_COMMAND, this.playerListener, Event.Priority.Normal, this);
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Event.Priority.Normal, this);
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_MOVE, this.playerListener, Event.Priority.Normal, this);
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Event.Priority.Normal, this);
|
|
|
|
pm.registerEvent(Event.Type.ENTITY_DEATH, this.entityListener, Event.Priority.Normal, this);
|
2011-02-13 17:04:06 +01:00
|
|
|
pm.registerEvent(Event.Type.ENTITY_DAMAGED, this.entityListener, Event.Priority.Normal, this);
|
2011-02-06 13:36:11 +01:00
|
|
|
pm.registerEvent(Event.Type.BLOCK_DAMAGED, this.blockListener, Event.Priority.Normal, this);
|
|
|
|
pm.registerEvent(Event.Type.BLOCK_PLACED, this.blockListener, Event.Priority.Normal, this);
|
2011-02-13 09:33:42 +01:00
|
|
|
pm.registerEvent(Event.Type.BLOCK_INTERACT, this.blockListener, Event.Priority.Normal, this);
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
Log.info("=== INIT DONE (Took "+(System.currentTimeMillis()-timeInitStart)+"ms) ===");
|
|
|
|
Log.threshold = Conf.logThreshold;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|