當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。