當前位置: 首頁>>代碼示例>>Java>>正文


Java Player.resetPlayerTime方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Player.resetPlayerTime方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.resetPlayerTime方法的具體用法?Java Player.resetPlayerTime怎麽用?Java Player.resetPlayerTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.resetPlayerTime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stop

import org.bukkit.entity.Player; //導入方法依賴的package包/類
/**
 * Stops the tutorial for the given player.
 *
 * @param id The UUID of the player.
 * @param interrupted {@code true} if the tutorial is stopped because it was interrupted
 *                    using {@link #stopForAll(String)}, {@link #stop(UUID)} or if the
 *                    user disconnected.
 */
void stop(UUID id, final Boolean interrupted) // package-private
{
	if (!isWatchingTutorial(id)) return;

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

	if (player != null)
	{
		// The player can now move.
		player.setFlySpeed(0.1f);
		player.setFlying(false);
		player.setAllowFlight(false);

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

		player.resetPlayerTime();
	}

	try
	{
		viewers.get(id).cancel();
	}
	catch (IllegalStateException ignored) {}

	viewers.remove(id);

	onTutorialEnds(player, interrupted);
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:42,代碼來源: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


注:本文中的org.bukkit.entity.Player.resetPlayerTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。