use of br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPWorldListener in project RedProtect by FabioZumbi12.
the class RedProtect method onEnable.
public void onEnable() {
try {
plugin = this;
BossBar = checkBM();
MyChunk = checkMyChunk();
MyPet = checkMyPet();
McMMo = checkMcMMo();
Mc = checkMc();
Vault = checkVault();
SkillAPI = checkSkillAPI();
PvPm = checkPvPm();
Ess = checkEss();
GP = checkGP();
Dyn = checkDyn();
WE = checkWe();
AWE = checkAWe();
SC = checkSP();
Fac = checkFac();
PLib = checkPLib();
PlaceHolderAPI = checkPHAPI();
JarFile = this.getFile();
initVars();
RPConfig.init();
RPLang.init();
rm.loadAll();
OnlineMode = serv.getOnlineMode();
serv.getPluginManager().registerEvents(new RPGlobalListener(), this);
serv.getPluginManager().registerEvents(new RPBlockListener(), this);
serv.getPluginManager().registerEvents(new RPPlayerListener(), this);
serv.getPluginManager().registerEvents(new RPEntityListener(), this);
serv.getPluginManager().registerEvents(new RPWorldListener(), this);
serv.getPluginManager().registerEvents(new RPAddProtection(), this);
version = getBukkitVersion();
logger.debug("Version String: " + version);
if (version >= 180) {
serv.getPluginManager().registerEvents(new RPMine18(), this);
}
if (version >= 190) {
serv.getPluginManager().registerEvents(new RPMine19(), this);
}
getCommand("RedProtect").setExecutor(new RPCommands());
if (Vault) {
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
logger.warning("Vault found, but for some reason cant be used with RedProtect.");
Vault = false;
} else {
econ = rsp.getProvider();
logger.info("Vault found. Hooked.");
}
}
if (PLib) {
logger.info("ProtocolLib found. Hidding Gui Flag item stats.");
}
if (PvPm) {
logger.info("PvPManager found. Hooked.");
}
if (Ess) {
pless = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
logger.info("Essentials found. Hooked.");
}
if (WE) {
logger.info("WorldEdit found. Hooked.");
}
if (AWE) {
logger.info("AsyncWorldEdit found. Hooked.");
}
if (BossBar) {
logger.info("BossbarAPI found. Hooked.");
}
if (MyPet) {
serv.getPluginManager().registerEvents(new MPListener(), this);
logger.info("MyPet found. Hooked.");
}
if (McMMo) {
serv.getPluginManager().registerEvents(new McMMoListener(), this);
logger.info("McMMo found. Hooked.");
}
if (SkillAPI) {
serv.getPluginManager().registerEvents(new SkillAPIListener(), this);
logger.info("SkillAPI found. Hooked.");
}
if (MyChunk) {
logger.sucess("MyChunk found. Ready to convert!");
logger.warning("Use '/rp mychunkconvert' to start MyChunk conversion (This may cause lag during conversion)");
}
if (Mc) {
logger.info("MagicCarpet found. Hooked.");
}
if (SC) {
clanManager = SimpleClans.getInstance().getClanManager();
logger.info("SimpleClans found. Hooked.");
}
if (Dyn && RPConfig.getBool("hooks.dynmap.enable")) {
logger.info("Dynmap found. Hooked.");
logger.info("Loading dynmap markers...");
dynmap = new RPDynmap((DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap"));
logger.info("Dynmap markers loaded!");
}
if (PlaceHolderAPI) {
new RPPlaceHoldersAPI(this).hook();
logger.info("PlaceHolderAPI found. Hooked and registered some chat placeholders.");
}
if (Fac) {
serv.getPluginManager().registerEvents(new RPFactions(), this);
logger.info("Factions found. Hooked.");
}
if (!RPConfig.getString("file-type").equalsIgnoreCase("mysql")) {
RPUtil.ReadAllDB(rm.getAllRegions());
} else {
logger.info("Theres " + rm.getTotalRegionsNum() + " regions on (" + RPConfig.getString("file-type") + ") database!");
}
logger.info("Loading API...");
this.rpAPI = new RedProtectAPI();
logger.info("API Loaded!");
logger.clear("&4 _ _ _ &c _ _ _ _ _ _ _ _ _ __");
logger.clear("&4|_| |_ | \\ &c|_| |_| | | | |_ | | /");
logger.clear("&4| \\ |_ |_/ &c| | \\ |_| | |_ |_ | /");
logger.clear("&a¯ " + pdf.getFullName() + " enabled");
logger.clear("");
if (RPConfig.getBool("update-check.enable")) {
logger.info("Checking for update...");
if (CheckUpdate()) {
logger.sucess("Update available! Use /rp update to download.");
} else {
logger.info("No update available.");
}
}
if (RPConfig.getString("file-type").equals("yml")) {
AutoSaveHandler();
}
} catch (Exception e) {
e.printStackTrace();
if (!RPConfig.getString("file-type").equalsIgnoreCase("mysql")) {
logger.severe("Error enabling RedProtect, plugin will shut down.");
this.disable();
}
}
}
use of br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPWorldListener in project RedProtect by FabioZumbi12.
the class RedProtect method onServerStart.
@Listener
public void onServerStart(GameStartedServerEvent event) {
try {
String v = Sponge.getGame().getPlatform().getContainer(Component.API).getVersion().get();
instance = this;
if (v.startsWith("5") || v.startsWith("6")) {
pvhelp = (RPVHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.RPVHelper56").newInstance();
}
if (v.startsWith("7")) {
pvhelp = (RPVHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.RPVHelper7").newInstance();
}
initVars();
OnlineMode = serv.getOnlineMode();
cmdService.register(container, new RPCommands(), Arrays.asList("redprotect", "rp", "regionp", "regp"));
game.getEventManager().registerListeners(container, new RPGlobalListener());
game.getEventManager().registerListeners(container, new RPBlockListener());
game.getEventManager().registerListeners(container, new RPPlayerListener());
game.getEventManager().registerListeners(container, new RPEntityListener());
game.getEventManager().registerListeners(container, new RPWorldListener());
game.getEventManager().registerListeners(container, new RPMine18());
game.getEventManager().registerListeners(container, new RPAddProtection());
loadRegions();
logger.info("Loading API...");
this.rpAPI = new RedProtectAPI();
logger.info("API Loaded!");
logger.clear("&4 _ _ _ &c _ _ _ _ _ _ _ _ _ __");
logger.clear("&4|_| |_ | \\ &c|_| |_| | | | |_ | | / ");
logger.clear("&4| \\ |_ |_/ &c| | \\ |_| | |_ |_ | /");
logger.clear("&a¯ Redprotect " + container.getVersion().get() + " enabled");
logger.clear("");
} catch (Exception e) {
e.printStackTrace();
logger.severe("Error enabling RedProtect, plugin will shut down.");
}
}
Aggregations