org.spongepowered.api.event.game.GameReloadEvent Java Examples
The following examples show how to use
org.spongepowered.api.event.game.GameReloadEvent.
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: UltimateCore.java From UltimateCore with MIT License | 6 votes |
@Listener public void onReload(GameReloadEvent event) { try { Long time = System.currentTimeMillis(); UltimateCore.get().getGeneralConfig().reload(); UltimateCore.get().getCommandsConfig().reload(); UltimateCore.get().getCommandsConfig().postload(); UltimateCore.get().getModulesConfig().reload(); UltimateCore.get().getModulesConfig().postload(); for (Module mod : UltimateCore.get().getModuleService().getModules()) { if (mod.getConfig() != null && mod.getConfig().isPresent()) { mod.getConfig().get().reload(); mod.onReload(event); } } getLanguageService().reload(); time = System.currentTimeMillis() - time; Messages.log(Messages.getFormatted("core.load.reload", "%ms%", time)); } catch (Exception ex) { ErrorLogger.log(ex, "Failed to stop UltimateCore"); } }
Example #2
Source File: VirtualChestPlugin.java From VirtualChest with GNU Lesser General Public License v3.0 | 6 votes |
@Listener public void onReload(GameReloadEvent event) { try { MessageReceiver src = event.getCause().first(CommandSource.class).orElse(Sponge.getServer().getConsole()); src.sendMessage(this.translation.take("virtualchest.reload.start")); this.loadConfig(); this.saveConfig(); src.sendMessage(this.translation.take("virtualchest.reload.finish")); } catch (IOException e) { throw new RuntimeException(e); } }
Example #3
Source File: CommandtimerModule.java From UltimateCore with MIT License | 6 votes |
@Override public void onReload(GameReloadEvent event) { HashMap<Command, Long> cooldowns = new HashMap<>(); HashMap<Command, Long> warmups = new HashMap<>(); CommandsConfig config = UltimateCore.get().getCommandsConfig(); CommentedConfigurationNode node = config.get(); for (Command cmd : UltimateCore.get().getCommandService().getCommands()) { CommentedConfigurationNode cmdnode = node.getNode("commands", cmd.getIdentifier()); if (!cmdnode.getNode("cooldown").isVirtual()) { cooldowns.put(cmd, TimeUtil.parse(cmdnode.getNode("cooldown").getString())); } if (!cmdnode.getNode("warmup").isVirtual()) { warmups.put(cmd, TimeUtil.parse(cmdnode.getNode("warmup").getString())); } } GlobalData.offer(CommandtimerKeys.COOLDOWNS, cooldowns); GlobalData.offer(CommandtimerKeys.WARMUPS, warmups); }
Example #4
Source File: GriefPreventionPlugin.java From GriefPrevention with MIT License | 5 votes |
@Listener(order = Order.LAST) public void onGameReload(GameReloadEvent event) { this.loadConfig(); if (event.getSource() instanceof CommandSource) { sendMessage((CommandSource) event.getSource(), this.messageData.pluginReload.toText()); } }
Example #5
Source File: BlockprotectionModule.java From UltimateCore with MIT License | 5 votes |
@Override public void onReload(GameReloadEvent event) { // try { // Set<BlockState> allowed = new HashSet<>(); // for(String rawbs : config.get().getNode("allowed-blocks", "list").getList(TypeToken.of(String.class))){ // try { // BlockState bs = Sponge.getRegistry().getType(BlockState.class, rawbs).get(); // allowed.add(bs); // }catch (Exception ex){ // Messages.log("Invalid blockstate in allowed blocks of blockprotection: " + rawbs); // } // } // this.allowedSet = allowed; // // Set<BlockState> autolock = new HashSet<>(); // for(String rawbs : config.get().getNode("autolock-blocks", "list").getList(TypeToken.of(String.class))){ // try { // BlockState bs = Sponge.getRegistry().getType(BlockState.class, rawbs).get(); // allowed.add(bs); // }catch (Exception ex){ // Messages.log("Invalid blockstate in allowed blocks of blockprotection: " + rawbs); // } // } // this.autolockSet = autolock; // } catch (ObjectMappingException e) { // e.printStackTrace(); // } }
Example #6
Source File: AutomessageModule.java From UltimateCore with MIT License | 5 votes |
@Override public void onReload(GameReloadEvent event) { //Runnables try { for (Automessage message : config.get().getNode("automessages").getList(TypeToken.of(Automessage.class))) { message.start(); } } catch (ObjectMappingException e) { ErrorLogger.log(e, "Failed to load automessages from config."); } }
Example #7
Source File: RedProtect.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@Listener public void onReloadPlugins(GameReloadEvent event) { for (Player p : Sponge.getGame().getServer().getOnlinePlayers()) { rpvHelper.closeInventory(p); } reload(); logger.success("RedProtect reloaded with success!"); }
Example #8
Source File: SpongePlugin.java From BlueMap with MIT License | 5 votes |
@Listener public void onServerReload(GameReloadEvent evt) { asyncExecutor.execute(() -> { try { Logger.global.logInfo("Reloading..."); bluemap.reload(); Logger.global.logInfo("Reloaded!"); } catch (Exception e) { Logger.global.logError("Failed to load!", e); } }); }
Example #9
Source File: UChat.java From UltimateChat with GNU General Public License v3.0 | 5 votes |
@Listener public void onReloadPlugins(GameReloadEvent event) { try { reload(); } catch (IOException e) { e.printStackTrace(); } }
Example #10
Source File: ChatUILib.java From ChatUI with MIT License | 5 votes |
@Listener public void onGameReload(GameReloadEvent event) { LibConfig.loadConfig(); if (LibConfig.useLanguagePack()) { this.languageManager.fetch(this.logger); } }
Example #11
Source File: EagleFactionsPlugin.java From EagleFactions with MIT License | 5 votes |
@Listener public void onReload(final GameReloadEvent event) { this.configuration.reloadConfiguration(); this.storageManager.reloadStorage(); if(event.getSource() instanceof Player) { Player player = (Player)event.getSource(); player.sendMessage(Text.of(PluginInfo.PLUGIN_PREFIX, Messages.CONFIG_HAS_BEEN_RELOADED)); } }
Example #12
Source File: GriefDefenderPlugin.java From GriefDefender with MIT License | 5 votes |
@Listener(order = Order.LAST) public void onGameReload(GameReloadEvent event) { this.loadConfig(); if (event.getSource() instanceof CommandSource) { sendMessage((CommandSource) event.getSource(), MessageCache.getInstance().PLUGIN_RELOAD); } }
Example #13
Source File: WebAPI.java From Web-API with MIT License | 4 votes |
@Listener public void onReload(GameReloadEvent event) { Optional<Player> p = event.getCause().first(Player.class); logger.info("Reloading " + Constants.NAME + " v" + Constants.VERSION + "..."); cacheService.updatePlugins(); cacheService.updateCommands(); server.stop(); init(p.orElse(null)); server.start(p.orElse(null)); checkForUpdates(); logger.info("Reloaded " + Constants.NAME); }
Example #14
Source File: NuVotifier.java From NuVotifier with GNU General Public License v3.0 | 4 votes |
@Listener public void onGameReload(GameReloadEvent event) { this.reload(); }
Example #15
Source File: ChatUI.java From ChatUI with MIT License | 4 votes |
@Listener public void onGameReload(GameReloadEvent event) { Config.loadConfig(); }
Example #16
Source File: TablistModule.java From UltimateCore with MIT License | 4 votes |
@Override public void onReload(@Nullable GameReloadEvent event) { runnable.clearCache(); }
Example #17
Source File: BloodModule.java From UltimateCore with MIT License | 4 votes |
@Override public void onReload(@Nullable GameReloadEvent event) { BloodEffects.reload(); }
Example #18
Source File: GriefDefenderPlugin.java From GriefDefender with MIT License | 4 votes |
@Listener public void onGameReloadEvent(GameReloadEvent event) { this.loadConfig(); }
Example #19
Source File: Module.java From UltimateCore with MIT License | votes |
/** * Called when the game is reloaded * The config files will automatically be reloaded before this method is called */ default void onReload(@Nullable GameReloadEvent event) { }