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


Java PlayerBedEnterEvent.setCancelled方法代码示例

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


在下文中一共展示了PlayerBedEnterEvent.setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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);
        }
    }
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:11,代码来源:ToolBox.java

示例9: 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 (inWorld(e.getPlayer())) {
        if (actionAllowed(e.getPlayer(),e.getBed().getLocation(), SettingsFlag.BED)) {
            return;
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:16,代码来源:IslandGuard.java

示例10: onPlayerBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
/**
 * Triggered everytime a player right clicks on a bed.
 * @param e
 */
@EventHandler
public void onPlayerBedEnter(PlayerBedEnterEvent e)
{
	e.getPlayer().sendMessage(ChatColor.DARK_PURPLE + "Pas le temps de dormir !");
	e.setCancelled(true);
}
 
开发者ID:Elarcis,项目名称:Scapegoat,代码行数:11,代码来源:Running.java

示例11: 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!");
		}
	}
}
 
开发者ID:timvisee,项目名称:simple-survival-games,代码行数:35,代码来源:SSGPlayerListener.java

示例12: onPlayerBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerBedEnter(PlayerBedEnterEvent event)
{
	event.setCancelled(true);
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:6,代码来源:PlayerInteractListener.java

示例13: onBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler
public void onBedEnter(final PlayerBedEnterEvent event) {
	if (!this.frozenPlayers.isEmpty() && !event.isCancelled() && this.frozenPlayers.containsKey(event.getPlayer().getUniqueId())) {
		event.setCancelled(true);
	}
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:7,代码来源:FreezeComponent.java

示例14: PlayerBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void PlayerBedEnter(final PlayerBedEnterEvent event)
{
	if (!plugin.isLoggedIn(event.getPlayer()))
		event.setCancelled(true);
}
 
开发者ID:ST-DDT,项目名称:CrazyLogin,代码行数:7,代码来源:DynamicPlayerListener.java

示例15: onPlayerBedEnter

import org.bukkit.event.player.PlayerBedEnterEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
    if (listenerService.shouldCancelEvent(event)) {
        event.setCancelled(true);
    }
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:7,代码来源:PlayerListener.java


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