本文整理汇总了Java中org.spongepowered.api.event.game.GameReloadEvent类的典型用法代码示例。如果您正苦于以下问题:Java GameReloadEvent类的具体用法?Java GameReloadEvent怎么用?Java GameReloadEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameReloadEvent类属于org.spongepowered.api.event.game包,在下文中一共展示了GameReloadEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@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 Throwables.propagate(e);
}
}
示例2: onGameReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onGameReload(GameReloadEvent event) {
if (this.cleanLocksTask != null) {
this.cleanLocksTask.cancel();
}
unregisterListeners();
config.reloadConfig();
storageHandler.reloadTables();
loadConfigurationData();
registerListeners(true);
registerTasks();
logger.info("Latch has been successfully reloaded.");
}
示例3: onGameReloadEvent
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onGameReloadEvent(GameReloadEvent event) {
// Close db sessions
if (this.persistenceService != null && this.persistenceService.getSessionFactory().isOpen()) {
this.persistenceService.getSessionFactory().close();
}
if (this.setupConfigs() && this.setupDatabase()) {
if (!this.loaded) {
this.load();
this.registerListeners();
this.registerCommands();
}
this.getLogger().info(String.format("%s was reloaded.", Destinations.NAME));
} else {
this.getLogger().error(String.format("There was an error reloading %s.", Destinations.NAME));
}
}
示例4: onReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@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);
}
示例5: onReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@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");
}
}
示例6: reload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void reload(GameReloadEvent event) throws Exception {
Cause cause = Cause.source(this).build();
// Unregistering everything
GameStoppingEvent gameStoppingEvent = SpongeEventFactory.createGameStoppingEvent(cause);
stop(gameStoppingEvent);
// Starting over
GameInitializationEvent gameInitializationEvent = SpongeEventFactory.createGameInitializationEvent(cause);
init(gameInitializationEvent);
logger.info("Reloaded successfully!");
}
示例7: onGameReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onGameReload(@Nullable final GameReloadEvent event) {
this.logger.info("Reloading...");
this.settings.Load(this.configfullpath, this);
Tools.Backpack_unlockall(this);
this.logger.info("Reloaded!");
}
示例8: onReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onReload(GameReloadEvent event) {
// Unregistering everything
onStop();
// Starting over
onInit();
onLoadComplete();
logger.info("Reloaded successfully!");
}
示例9: onReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onReload(GameReloadEvent evt){
logger.info("Reloading...");
try {
load();
} catch (IOException | ObjectMappingException e) {
logger.error("Failed to load or create config-file!", e);
return;
}
startUpdateTask();
}
示例10: onReloadEvent
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onReloadEvent(GameReloadEvent event) {
try {
reload();
} catch (IOException | ObjectMappingException e) {
e.printStackTrace();
}
}
示例11: onReloadPlugins
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onReloadPlugins(GameReloadEvent event) {
//reload config
initConfig();
//reload messages
initMessages();
}
示例12: onReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onReload(GameReloadEvent event) {
cfgLoader = new ConfigLoader(this);
if (cfgLoader.loadConfig()) cclConfig = cfgLoader.getCclConfig();
if (cfgLoader.loadMessages()) messages = cfgLoader.getMessagesConfig();
for (Task task : tasks) {
task.cancel();
}
tasks = new ArrayList<>();
Task.Builder builder = getGame().getScheduler().createTaskBuilder();
tasks.add(builder.execute(new ItemClearer())
.async()
.delay(cclConfig.interval, TimeUnit.MINUTES)
.interval(cclConfig.interval, TimeUnit.MINUTES)
.name("CatClearLag Item Remover")
.submit(this));
cclConfig.warnings.forEach((d) ->
tasks.add(builder.execute(new ItemClearingWarning(((cclConfig.interval * 60) - d)))
.async()
.delay(d, TimeUnit.SECONDS)
.interval(cclConfig.interval, TimeUnit.MINUTES)
.name("CatClearLag Removal Warnings")
.submit(this)));
tasks.add(builder.execute(new EntityChecker())
.async()
.delay(cclConfig.limits.entityCheckInterval, TimeUnit.MINUTES)
.interval(cclConfig.limits.entityCheckInterval, TimeUnit.MINUTES)
.name("CatClearLag hostile checker")
.submit(this));
}
示例13: onReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onReload(GameReloadEvent event) throws IOException, ObjectMappingException {
reloadConfig();
// Send Messages to console and player
event.getCause().first(Player.class).ifPresent(p -> p.sendMessage(Messages.get().plugin.reloadSuccess.t()));
logger.info("Reloaded PlaceholderAPI");
}
示例14: onGameReload
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onGameReload(GameReloadEvent event) {
LibConfig.loadConfig();
if (LibConfig.useLanguagePack()) {
this.languageManager.fetch(this.logger);
}
}
示例15: onReloadPlugins
import org.spongepowered.api.event.game.GameReloadEvent; //导入依赖的package包/类
@Listener
public void onReloadPlugins(GameReloadEvent event) {
try {
reload();
} catch (IOException e) {
e.printStackTrace();
}
}