本文整理汇总了Java中org.bukkit.event.player.PlayerBedEnterEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerBedEnterEvent.getPlayer方法的具体用法?Java PlayerBedEnterEvent.getPlayer怎么用?Java PlayerBedEnterEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerBedEnterEvent
的用法示例。
在下文中一共展示了PlayerBedEnterEvent.getPlayer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBedEnter
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBedEnter(final PlayerBedEnterEvent event) {
final PlayerStat stat = PlayerStat.ENTERED_BEDS;
// Get player
final Player player = (Player) event.getPlayer();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
player.getUniqueId().toString(), "value", 1, "world", player.getWorld().getName()));
}
示例2: onSleep
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler
public void onSleep(PlayerBedEnterEvent bee) {
Player p = bee.getPlayer();
Game g = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(p);
if (g == null) {
return;
}
if (g.getState() == GameState.STOPPED) {
return;
}
bee.setCancelled(true);
}
示例3: onPlayerBedEnter
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerBedEnter(PlayerBedEnterEvent event)
{
Player player = event.getPlayer();
PlayerProfile profile = CoreData.getProfile(player);
if (!event.isCancelled())
{
if (profile.getData("Faction", Faction.class) != null)
{
Faction playerFaction = profile.getData("Faction", Faction.class);
Faction targetFaction = plugin.getCoreMethods().getFaction(event.getBed().getLocation());
if (plugin.getCoreMethods().canSetHome(player, targetFaction, playerFaction))
{
plugin.getCoreMethods().setHomeLocation(player);
}
else
{
plugin.getCoreErrors().timerNotDone(player, "set home", CoreData.getProfile(player).getRemainingDelay(Delay.SETHOME).getFormatted());
}
}
}
}
示例4: onBedEnter
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL,ignoreCancelled = true) //这就是我说的那个监听器了,事件发生时会触发下面这个方法
public void onBedEnter(final PlayerBedEnterEvent e) {
/*new BukkitRunnable(){//保证晚上
@Override
public void run(){
gameworld.setTime(111111);
};
}.runTaskTimer(Bukkit.getPluginManager().getPlugin("blockode"), 0L, 200L);*/
final Damageable playerdg=(Damageable)e.getPlayer();
if(isInList(e.getPlayer()) && playerdg.getHealth()<playerdg.getMaxHealth()){//回血
new BukkitRunnable(){
@Override
public void run(){
if(playerdg.getHealth()<playerdg.getMaxHealth()&&e.getPlayer().isSleeping()){
e.getPlayer().setHealth(playerdg.getHealth()+6);
}
else{
//e.getPlayer().teleport(e.getPlayer().getLocation());
((CraftPlayer) e.getPlayer()).getHandle().a(true, false, false);
e.getBed().setType(Material.AIR);
cancel();
};
}
}.runTaskTimer(Bukkit.getPluginManager().getPlugin("blockode"), 20L, 20L);
}
else{
return;
}
}
示例5: PlayerIsSleeping
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler
public void PlayerIsSleeping(PlayerBedEnterEvent event) throws InterruptedException{
final Player player = event.getPlayer();
final World world = player.getWorld();
//Broadcast to Server
TextComponent message2 = new TextComponent(player.getDisplayName() + " " + lang.get("issleep." + daLang + ""));
TextComponent message = new TextComponent(ChatColorUtils.setColors(getConfig().getString("cancelcolor")) + " [" + lang.get("cancel." + daLang + "") + "]");
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/cancel"));
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("" + lang.get("clickcancel." + daLang + "")).create()));
//this.broadcast(player.getDisplayName() + " is sleeping ");
message2.addExtra(message);
this.broadcast(message2);
//this.broadcast(message);
//player.sendMessage( message );
if(player.hasPermission("sps.hermits")||player.hasPermission("sps.op")){
//Thread.sleep(10000);
if(!isCanceled){
transitionTask = this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
//getLogger().info("runnable");
setDatime(player, world);
}
}, 10 * 20);
}else{
isCanceled = false;
}
//player.sendMessage(ChatColor.RED + "isCanceled=" + isCanceled);
}else if(!player.hasPermission("sps.hermits")||player.hasPermission("sps.op")){
player.sendMessage("" + lang.get("noperm." + daLang + ""));
}
}
示例6: onPlayerBedEnter
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
Player player = event.getPlayer();
NormalAchievements category = NormalAchievements.BEDS;
if (!shouldIncreaseBeTakenIntoAccount(player, category) || isInCooldownPeriod(player, false, category)) {
return;
}
updateStatisticAndAwardAchievementsIfAvailable(player, category, 1);
}
示例7: playerBedEnter
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
private void playerBedEnter(PlayerBedEnterEvent e) {
Player player = e.getPlayer();
if (assignedTools.containsKey(player)) {
Tool tool = assignedTools.get(player);
if (tool.item.equals(player.getItemInHand())) {
e.setCancelled(true);
}
}
}
示例8: onPlayerBedEnter
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
Player p = event.getPlayer();
ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
// Is the current player playing
if(am.isInArena(p)) {
ArenaPlayer ap = am.getPlayer(p);
// Is the player in the lobby of the arena
if(ap.isInLobby()) {
// Has the player a arena spawn assigned
if(ap.hasAssignedAreanSpawn()) {
// Cancel the event and send a status message
event.setCancelled(true);
p.sendMessage(ChatColor.DARK_RED + "You aren't tired enough to enter the bed inside the lobby of an arena!");
}
}
// The player may not sleep
if(ap.isPlaying()) {
event.setCancelled(true);
p.sendMessage(ChatColor.DARK_RED + "You can't sleep while in the arena!");
}
// Is the player an spectators
if(ap.isSpectator()) {
event.setCancelled(true);
ap.sendMessage(ChatColor.DARK_RED + "You can't sleep while spectating!");
}
}
}
示例9: onPlayerEnterBed
import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerEnterBed(PlayerBedEnterEvent event)
{
Player player = event.getPlayer();
SleepPlayer sleepPlayer = manData.getSleepPlayer(player);
if(sleepPlayer != null){
sleepPlayer.inBed();
sleepPlayer.desactiver();
}
}