当前位置: 首页>>代码示例>>Java>>正文


Java PlayerBedEnterEvent类代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerBedEnterEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerBedEnterEvent类的具体用法?Java PlayerBedEnterEvent怎么用?Java PlayerBedEnterEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlayerBedEnterEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerBedEnterEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()));

}
 
开发者ID:Staartvin,项目名称:Statz,代码行数:18,代码来源:EnteredBedsListener.java

示例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);
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:17,代码来源:PlayerListener.java

示例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());
            }
        }
    }
}
 
开发者ID:Vanillacraft,项目名称:vanillacraft,代码行数:24,代码来源:HomeCommand.java

示例4: OnPlayerBedEnterEvent

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
public void OnPlayerBedEnterEvent(PlayerBedEnterEvent event) {
	
	Resident resident = CivGlobal.getResident(event.getPlayer().getName());

	if (resident == null) {
		event.setCancelled(true);
		return;
	}
			
	coord.setFromLocation(event.getPlayer().getLocation());
	Camp camp = CivGlobal.getCampFromChunk(coord);
	if (camp != null) {
		if (!camp.hasMember(event.getPlayer().getName())) {
			CivMessage.sendError(event.getPlayer(), "You cannot sleep in a camp you do not belong to.");
			event.setCancelled(true);
			return;
		}
	}		
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:20,代码来源:BlockListener.java

示例5: onPlayerBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
/**
 * On player bed enter.
 * 
 * @param event
 *            the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBedEnter(PlayerBedEnterEvent event) {

	if (!playerConf.get(event.getPlayer()).isAdminMod()) {
		IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
				event.getBed().getLocation());

		if ((land instanceof ILand && ((ILand) land).isBanned(event
				.getPlayer()))
				|| (!checkPermission(land, event.getPlayer(),
						PermissionList.SLEEP.getPermissionType()))) {
			messagePermission(event.getPlayer());
			event.setCancelled(true);
		}
	}
}
 
开发者ID:Tabinol,项目名称:Factoid,代码行数:23,代码来源:PlayerListener.java

示例6: onPlayerInteractEvent

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerInteractEvent(PlayerInteractEvent event)
{
	Player p = event.getPlayer();
	if(event.getClickedBlock() != null)
	{
			if(event.getClickedBlock().getType() == Material.BED_BLOCK && event.getAction() == Action.RIGHT_CLICK_BLOCK)
			{
				if(plugin.isActiveBedAtDay() && netminecraftclass != null)
				{
				Location loc = event.getClickedBlock().getLocation();
				netminecraftclass.inBed(p, loc);
				Bukkit.getPluginManager().callEvent(new PlayerBedEnterEvent(p,event.getClickedBlock()));
				// bloc msg "You can sleep only at night"
				event.setCancelled(true);
				}
			}
	}
}
 
开发者ID:como89,项目名称:SleepingPlus,代码行数:20,代码来源:PlayerEvent.java

示例7: onPlayerBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW)
public void onPlayerBedEnter(final PlayerBedEnterEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Check world
    if (Util.inWorld(e.getPlayer())) {
        if (actionAllowed(e.getPlayer(),e.getBed().getLocation(), SettingsFlag.BED)) {
            return;
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:16,代码来源:IslandGuard.java

示例8: Sleep

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
@EventHandler
public void Sleep(PlayerBedEnterEvent e){
	if(rs.getPlayerData(e.getPlayer())==null)return;
	PlayerData pd=rs.getPlayerData(e.getPlayer());
	pd.setSleep(true,1);
	pd.setBed(e.getBed());
	e.setCancelled(false);
	return;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:10,代码来源:SleepEvent.java

示例9: onBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
@EventHandler
public void onBedEnter(PlayerBedEnterEvent evt) {
    if (!evt.getBed().getWorld().equals(Core.getMainWorld()))
        return;

    updateBeds();

    if (!MetadataManager.updateCooldownSilently(evt.getPlayer(), "bedSpam", 20 * 60 * 5))
        Bukkit.broadcastMessage(ChatColor.GREEN.toString() + getLeftPlayers() + ChatColor.GRAY
                + " players need to enter a bed to skip the night.");
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:12,代码来源:SleepMechanics.java

示例10: onPlayerSleep

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerSleep(PlayerBedEnterEvent event) {
	if (_moon.isActive()) {
		event.setCancelled(true);
		event.getPlayer().sendMessage(ChatColor.YELLOW + "You cannot sleep during a " + ChatColor.DARK_RED + " BLOOD MOON!");
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:8,代码来源:MonsterSpawnListener.java

示例11: 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);
    
    if(isInList(e.getPlayer()) && e.getPlayer().getHealth()<e.getPlayer().getMaxHealth()){//回血
        new BukkitRunnable(){
            @Override
            public void run(){
                if(e.getPlayer().getHealth()<e.getPlayer().getMaxHealth()&&e.getPlayer().isSleeping()){
                    e.getPlayer().setHealth(e.getPlayer().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;
    }
}
 
开发者ID:D0048,项目名称:CraftPlugins,代码行数:30,代码来源:Blockode.java

示例12: 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;
    }
}
 
开发者ID:D0048,项目名称:CraftPlugins,代码行数:31,代码来源:Blockode.java

示例13: 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 + ""));
	}
}
 
开发者ID:JoelGodOfwar,项目名称:SinglePlayerSleep,代码行数:37,代码来源:PluginBase.java

示例14: onPlayerBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
    World world = event.getPlayer().getWorld();

    if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.SPAWN_ON_SLEEP)) {
        PluginConfig worldConfig = plugin.getConfig(world);
        String mobName = ListUtils.getRandom(worldConfig.getStringList(Config.FEATURE_SPAWN_ON_SLEEP_SPAWN));
        EntityType creatureType = EntityType.fromName(mobName.toUpperCase());

        if (creatureType != null) {
            //world.spawn(location, creatureType.getEntityClass(), SpawnReason.NATURAL);
            world.spawnEntity(event.getPlayer().getLocation(), creatureType);
        }
    }
}
 
开发者ID:Samistine,项目名称:BloodMoon,代码行数:16,代码来源:SpawnOnSleepListener.java

示例15: onEnteringBed

import org.bukkit.event.player.PlayerBedEnterEvent; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onEnteringBed(final BedEnterHook hook) {
    PlayerBedEnterEvent event =
            new PlayerBedEnterEvent(new CanaryPlayer(hook.getPlayer()), new CanaryBlock(hook.getBed()));
    event.setCancelled(hook.isCanceled());
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        hook.setCanceled();
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:11,代码来源:CanaryPlayerListener.java


注:本文中的org.bukkit.event.player.PlayerBedEnterEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。