当前位置: 首页>>代码示例>>Java>>正文


Java Player.setPlayerTime方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.setPlayerTime方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setPlayerTime方法的具体用法?Java Player.setPlayerTime怎么用?Java Player.setPlayerTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.setPlayerTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Starts the tutorial for the given player.
 *
 * @param id The UUID of the player.
 */
public void start(UUID id)
{
	if (isWatchingTutorial(id))
	{
		p.getLogger().info(p.getServer().getPlayer(id).getName() + "(" + id + ") is trying to see the tutorial whilst watching it.");
		return;
	}

	Player player = p.getServer().getPlayer(id);

	// The player cannot move anymore (except with our teleportations)
	player.setFlySpeed(0f);
	player.setAllowFlight(true);
	player.setFlying(true);

	// All other players are hidden
	for (Player other : p.getServer().getOnlinePlayers())
	{
		player.hidePlayer(other);
		other.hidePlayer(player);
	}

	// The player's hour is updated, if needed
	if(tutorialHour != null)
	{
		player.setPlayerTime(tutorialHour, false);
	}


	// The tutorial is started
	viewers.put(
			id, p.getServer().getScheduler().runTaskTimer(p, new TutorialRunner(this, id), 10L, 10L)
	);
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:40,代码来源:Tutorial.java

示例2: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
protected void onCommand(CommandSender sender, String[] args) {
    Player p = (Player) sender;

    for (Time t : Time.values()) {
        if (t.name().equalsIgnoreCase(args[0])) {
            p.setPlayerTime(t.getTime(), false);
            p.sendMessage(ChatColor.GOLD + "Time set to " + t.name().toLowerCase() + ".");
            return;
        }
    }

    if(args[0].equalsIgnoreCase("reset")) {
        p.resetPlayerTime();
        sender.sendMessage(ChatColor.GOLD + "Clock synced.");
    } else {
        p.setPlayerTime(Integer.parseInt(args[0]), false);
        sender.sendMessage(ChatColor.GOLD + "Time set to " + ChatColor.RED + args[0]);
    }
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:21,代码来源:CommandPTime.java

示例3: apply

import org.bukkit.entity.Player; //导入方法依赖的package包/类
protected CommandResult apply(VPSender receiver, String label, List<String> args, boolean other, VPSender sender) {
	if(!(receiver instanceof VPPlayer))return CommandResult.FAIL;
	Player player = ((VPPlayer) receiver).getPlayer(); 
	if(value<0 && ! relative){
		if(!player.isPlayerTimeRelative())
			player.resetPlayerTime();
		else
			return CommandResult.CANCELED;
	}else{
		if(!relative && player.getPlayerTimeOffset() == value)
			return CommandResult.CANCELED;
		else
			player.setPlayerTime(value, relative);
	}
	return CommandResult.SUCCESS;
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:17,代码来源:CPTOD.java

示例4: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
protected void onCommand(CommandSender sender, String[] args) throws CommandException {
    if (!(sender instanceof Player)) throw new CommandException(Collections.singletonList("You must be a player to execute this command."));

    Player player = (Player) sender;
    player.setPlayerTime(6000, false);
    player.sendMessage(ChatColor.GREEN + "Set time to day.");
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:9,代码来源:DayCommand.java

示例5: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
protected void onCommand(CommandSender sender, String[] args) throws CommandException {
    if (!(sender instanceof Player)) throw new CommandException(Collections.singletonList("You must be a player to execute this command."));

    Player player = (Player)sender;
    player.setPlayerTime(18000, false);
    player.sendMessage(ChatColor.GREEN + "Set time to night.");
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:9,代码来源:NightCommand.java


注:本文中的org.bukkit.entity.Player.setPlayerTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。