本文整理汇总了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)
);
}
示例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]);
}
}
示例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;
}
示例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.");
}
示例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.");
}