use of br.net.fabiozumbi12.RedProtect.Bukkit.helpers.PermissionHandler in project RedProtect by FabioZumbi12.
the class RedProtect method onEnable.
public void onEnable() {
try {
plugin = this;
ph = new PermissionHandler();
rm = new RegionManager();
// Init schematic
schematic = new RPSchematics();
// Init config, lang, listeners and flags
startLoad();
logger.info("Loading API...");
this.redProtectAPI = new RedProtectAPI();
logger.info("API Loaded!");
logger.clear("&4 _ _ _ &c _ _ _ _ _ _ _ _ _ __");
logger.clear("&4|_| |_ | \\ &c|_| |_| | | | |_ | | /");
logger.clear("&4| \\ |_ |_/ &c| | \\ |_| | |_ |_ | /");
logger.clear("&a» " + getDescription().getFullName() + " enabled");
logger.clear("");
} catch (Exception e) {
CoreUtil.printJarVersion();
e.printStackTrace();
getServer().setWhitelist(true);
getServer().getOnlinePlayers().forEach(p -> p.kickPlayer("The server has been whitelisted due to an error while loading plugins!"));
this.setEnabled(false);
logger.severe("Due to an error in RedProtect loading, the whitelist has been turned on and every player has been kicked.");
logger.severe("DO NOT LET ANYONE ENTER before fixing the problem, otherwise you risk losing protected regions.");
}
}
use of br.net.fabiozumbi12.RedProtect.Bukkit.helpers.PermissionHandler 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().orElse("0");
instance = this;
commandManager = Sponge.getGame().getCommandManager();
ph = new PermissionHandler();
rm = new RegionManager();
// Init schematic
schematic = new RPSchematics();
// Init config, lang, listeners and flags
startLoad();
if (v.startsWith("7")) {
rpvHelper = (VersionHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.VersionHelper7").newInstance();
Sponge.getGame().getEventManager().registerListeners(container, Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPBlockListener7").newInstance());
} else /*else if (v.startsWith("8")) {
Sponge.getGame().getEventManager().registerListeners(container, Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPBlockListener8").newInstance());
rpvHelper = (VersionHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.VersionHelper8").newInstance();
}*/
{
Sponge.getGame().getEventManager().registerListeners(container, Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.listeners.BlockListenerCompat56").newInstance());
rpvHelper = (VersionHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.helpers.VersionHelper56").newInstance();
}
logger.info("Loading API...");
this.redProtectAPI = new RedProtectAPI();
logger.info("API Loaded!");
logger.info("Sponge version: " + v);
logger.clear("\n" + "&4 _ _ _ &c _ _ _ _ _ _ _ _ _ __\n" + "&4|_| |_ | \\ &c|_| |_| | | | |_ | | / \n" + "&4| \\ |_ |_/ &c| | \\ |_| | |_ |_ | /\n" + "&a¯ Redprotect " + container.getVersion().get() + " enabled\n" + "");
} catch (Exception e) {
CoreUtil.printJarVersion();
e.printStackTrace();
Sponge.getGame().getServer().setHasWhitelist(true);
Sponge.getGame().getServer().getOnlinePlayers().forEach(Player::kick);
logger.severe("Error enabling RedProtect, plugin will shut down.");
logger.severe("Due to an error in RedProtect loading, the whitelist has been turned on and every player has been kicked.");
logger.severe("DO NOT LET ANYONE ENTER before fixing the problem, otherwise you risk losing protected regions.");
}
}
Aggregations