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