org.inventivetalent.apihelper.APIManager Java Examples
The following examples show how to use
org.inventivetalent.apihelper.APIManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NickNamerPlugin.java From NickNamer with MIT License | 6 votes |
@Override public void onLoad() { String javaVersion = System.getProperty("java.version"); String[] javaVersionParts = javaVersion.split("\\."); int major = Integer.parseInt(javaVersionParts[0]); int minor = Integer.parseInt(javaVersionParts[1]); boolean aboveOr8 = major > 1 || major == 1 && minor >= 8; getLogger().info("Java Version: " + javaVersion); if (!aboveOr8) { getLogger().severe("Please use Java 8 or higher (is " + javaVersionParts[1] + ")"); } APIManager.require(PacketListenerAPI.class, this); APIManager.registerAPI(new NickNamerAPI(), this); }
Example #2
Source File: StaffPlus.java From StaffPlus with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { plugin = this; saveDefaultConfig(); permission = new PermissionHandler(); message = new MessageCoordinator(); options = new Options(); APIManager.initAPI(PacketListenerAPI.class); start(System.currentTimeMillis()); }
Example #3
Source File: StaffPlus.java From StaffPlus with GNU General Public License v3.0 | 5 votes |
private void stop() { saveUsers(); tasks.cancel(); APIManager.disableAPI(PacketListenerAPI.class); for(Player player : Bukkit.getOnlinePlayers()) { modeCoordinator.removeMode(player); vanishHandler.removeVanish(player); } versionProtocol = null; permission = null; message = null; options = null; languageFile = null; userManager = null; securityHandler = null; cpsHandler = null; freezeHandler = null; gadgetHandler = null; reviveHandler = null; vanishHandler = null; chatHandler = null; ticketHandler = null; cmdHandler = null; modeCoordinator = null; infractionCoordinator = null; alertCoordinator = null; tasks = null; }
Example #4
Source File: PacketListenerPlugin.java From PacketListenerAPI with MIT License | 5 votes |
@Override public void onEnable() { if (!packetListenerAPI.injected) { getLogger().warning("Injection failed. Disabling..."); Bukkit.getPluginManager().disablePlugin(this); return; } try { SpigetUpdate updater = new SpigetUpdate(this, 2930); updater.setUserAgent("PacketListenerAPI/" + getDescription().getVersion()).setVersionComparator(VersionComparator.SEM_VER_SNAPSHOT); updater.checkForUpdate(new UpdateCallback() { @Override public void updateAvailable(String s, String s1, boolean b) { getLogger().info("There is a new version available: https://r.spiget.org/2930"); } @Override public void upToDate() { getLogger().info("Plugin is up-to-date"); } }); } catch (Exception e) { e.printStackTrace(); } new Metrics(this, 225); //Initialize this API if the plugin got enabled APIManager.initAPI(PacketListenerAPI.class); }
Example #5
Source File: PacketListenerAPI.java From PacketListenerAPI with MIT License | 5 votes |
@Override public void init(Plugin plugin) { //Register our events APIManager.registerEvents(this, this); logger.info("Adding channels for online players..."); for (Player player : Bukkit.getOnlinePlayers()) { channelInjector.addChannel(player); } }
Example #6
Source File: NickNamerAPI.java From NickNamer with MIT License | 5 votes |
@Override public void init(Plugin plugin) { APIManager.initAPI(PacketListenerAPI.class); APIManager.registerEvents(this, this); nickManager = new SimpleNickManager(plugin); // uuidResolver = new UUIDResolver(plugin, 3600000/* 1 hour */); PacketHandler.addHandler(packetListener = new PacketListener(plugin)); }
Example #7
Source File: StaffPlus.java From StaffPlus with GNU General Public License v3.0 | 4 votes |
@Override public void onLoad() { APIManager.require(PacketListenerAPI.class, this); }
Example #8
Source File: PacketListenerPlugin.java From PacketListenerAPI with MIT License | 4 votes |
@Override public void onLoad() { //Register this API if the plugin gets loaded APIManager.registerAPI(packetListenerAPI, this); }
Example #9
Source File: PacketListenerPlugin.java From PacketListenerAPI with MIT License | 4 votes |
@Override public void onDisable() { //Disable this API if the plugin was enabled APIManager.disableAPI(PacketListenerAPI.class); }
Example #10
Source File: NickNamerAPI.java From NickNamer with MIT License | 4 votes |
@Override public void load() { APIManager.require(PacketListenerAPI.class, null); }
Example #11
Source File: NickNamerAPI.java From NickNamer with MIT License | 4 votes |
@Override public void disable(Plugin plugin) { PacketHandler.removeHandler(packetListener); APIManager.disableAPI(PacketListenerAPI.class); }
Example #12
Source File: NickNamerPlugin.java From NickNamer with MIT License | 4 votes |
@Override public void onEnable() { instance = this; APIManager.initAPI(PacketListenerAPI.class); APIManager.initAPI(NickNamerAPI.class); Bukkit.getPluginManager().registerEvents(this, this); saveDefaultConfig(); reload(); if (featureCommandGeneral) { PluginAnnotations.COMMAND.registerCommands(this, generalCommands = new GeneralCommands(this)); } else { getLogger().info("General commands disabled"); } if (featureCommandNick) { PluginAnnotations.COMMAND.registerCommands(this, nickCommands = new NickCommands(this)); } else { getLogger().info("Nick commands disabled"); } if (featureCommandSkin) { PluginAnnotations.COMMAND.registerCommands(this, skinCommands = new SkinCommands(this)); } else { getLogger().info("Skin commands disabled"); } if (bungeecord) { if (Bukkit.getOnlineMode()) { getLogger().warning("Bungeecord is enabled, but server is in online mode!"); } Bukkit.getMessenger().registerIncomingPluginChannel(this, channelIdentifier, this); Bukkit.getMessenger().registerOutgoingPluginChannel(this, channelIdentifier); } //Replace the default NickManager new PluginNickManager(this); switch (storageType.toLowerCase()) { case "temporary": getLogger().info("Using temporary storage"); break; case "local": initStorageLocal(); break; case "sql": getLogger().info("Using SQL storage (" + sqlUser + "@" + sqlAddress + ")"); initStorageSQL(); break; case "redis": throw new RuntimeException("Redis storage is currently not supported."); // getLogger().info("Using Redis storage (" + redisHost + ":" + redisPort + ")"); // initStorageRedis(); // break; } new Metrics(this); spigetUpdate = new SpigetUpdate(this, 5341).setUserAgent("NickNamer/" + getDescription().getVersion()).setVersionComparator(VersionComparator.SEM_VER_SNAPSHOT); spigetUpdate.checkForUpdate(new UpdateCallback() { @Override public void updateAvailable(String s, String s1, boolean b) { getLogger().info("A new version is available (" + s + "). Download it from https://r.spiget.org/5341"); } @Override public void upToDate() { getLogger().info("The plugin is up-to-date."); } }); if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) { getLogger().info("Registering placeholders."); new NickNamerPlaceholders().register(); } ; }
Example #13
Source File: NickNamerPlugin.java From NickNamer with MIT License | 4 votes |
@Override public void onDisable() { APIManager.disableAPI(NickNamerAPI.class); }