org.bukkit.World#setTime ( )源码实例Demo

下面列出了org.bukkit.World#setTime ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UHC   文件: PermadayCommand.java
@Override
protected boolean runCommand(CommandSender sender, OptionSet options) {
    List<World> worlds = worldsSpec.values(options);

    if (worlds.size() == 0) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(messages.getRaw("provide world"));
            return true;
        }

        worlds = Lists.newArrayList(((Player) sender).getWorld());
    }

    final boolean on = !options.has(turnOff);

    for (final World world : worlds) {
        if (on) {
            world.setGameRuleValue(DO_DAYLIGHT_CYCLE_GAMERULE, "false");
            world.setTime(SUN_OVERHEAD_TIME);
        } else {
            world.setGameRuleValue(DO_DAYLIGHT_CYCLE_GAMERULE, "true");
        }

        final String message = messages.evalTemplate(
                on ? "on notification" : "off notification",
                ImmutableMap.of("world", world.getName())
        );

        for (final Player player : world.getPlayers()) {
            player.sendMessage(message);
        }
    }

    sender.sendMessage(messages.evalTemplate(
            on ? "on completed" : "off completed",
            ImmutableMap.of("count", worlds.size())
    ));

    return true;
}
 
源代码2 项目: BetonQuest   文件: TimeEvent.java
@Override
protected Void execute(String playerID) {
    World world = PlayerConverter.getPlayer(playerID).getWorld();
    long time = amount;
    if (add) {
        time += world.getTime();
    }
    world.setTime(time % 24000);
    return null;
}
 
源代码3 项目: UhcCore   文件: PermaKillListener.java
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e){
    World world = getGameManager().getLobby().getLoc().getWorld();
    world.setTime(world.getTime() + 12000);
}
 
源代码4 项目: UhcCore   文件: EnablePermanentDayThread.java
@Override
public void run() {
    World overWorld = Bukkit.getWorld(GameManager.getGameManager().getConfiguration().getOverworldUuid());
    VersionUtils.getVersionUtils().setGameRuleValue(overWorld, "doDaylightCycle", "false");
    overWorld.setTime(6000);
}
 
源代码5 项目: VoxelGamesLibv2   文件: TimeFeature.java
@Override
public void enable() {
    World world = getPhase().getFeature(MapFeature.class).getWorld();
    world.setGameRuleValue("doDaylightCycle", shouldChange + "");
    world.setTime(time);
}
 
源代码6 项目: VoxelGamesLibv2   文件: NoTimeChangeFeature.java
@Override
public void enable() {
    World w = getPhase().getFeature(MapFeature.class).getWorld();
    w.setTime(time);
    w.setGameRuleValue("doDaylightCycle", "false");
}