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


Java TeleportCause.ENDER_PEARL属性代码示例

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


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

示例1: onPlayerTeleport

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
    if(event.getCause() != TeleportCause.ENDER_PEARL) return;
    
    Flag flag = this.GetFlagInstanceAtLocation(event.getFrom(), event.getPlayer());
    if(flag != null)
    {
        event.setCancelled(true);
    }
    
    flag = this.GetFlagInstanceAtLocation(event.getTo(), event.getPlayer());
    if(flag != null)
    {
        event.setCancelled(true);
    }
}
 
开发者ID:BigScary,项目名称:GriefPreventionFlags,代码行数:17,代码来源:FlagDef_NoEnderPearl.java

示例2: onPlayerTeleport

@Override
public void onPlayerTeleport(PlayerTeleportEvent event, BPPlayer bpPlayer)
{
	TeleportCause cause = event.getCause();
	
	if(cause == TeleportCause.ENDER_PEARL)
	{
		CTFGame game = getGame();
		FlagManager flm = game.getFlagManager();
		
		if(flm.isHoldingFlag(bpPlayer))
		{
			Player player = bpPlayer.getPlayer();
			event.setCancelled(true);
			player.sendMessage(MessageType.OTHER_WARNPEARL.getTranslation().getValue());
		}
	}
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:18,代码来源:CTFListener.java

示例3: callCoarsePlayerMove

/**
 * Fire a CoarsePlayerMoveEvent that wraps the given event, only if it crosses
 * a block boundary, or the PoseFlags change.
 * @param event         The movement event to potentially wrap
 * @return True if the original event was not cancelled, and a coarse event was fired,
 *         and that coarse event was cancelled. In this case, the wrapped event won't
 *         actually be cancelled, but callers should treat it like it is.
 */
private boolean callCoarsePlayerMove(final PlayerMoveEvent event) {
    // Don't fire coarse events for teleports that are not "in-game"
    // e.g. /jumpto command
    if(event instanceof PlayerTeleportEvent) {
        PlayerTeleportEvent teleportEvent = (PlayerTeleportEvent) event;
        if(teleportEvent.getCause() != TeleportCause.ENDER_PEARL &&
           teleportEvent.getCause() != TeleportCause.UNKNOWN) {
            return false;
        }
    }

    // If the movement does not cross a block boundary, and no PoseFlags changed, we don't care about it
    final EntityLocation from = event.getEntityFrom();
    final EntityLocation to = event.getEntityTo();
    if(from.position().coarseEquals(to.position()) && from.poseFlags().equals(to.poseFlags())) {
        return false;
    }

    // Remember whether the original event was already cancelled
    boolean wasCancelled = event.isCancelled();

    CoarsePlayerMoveEvent generalEvent = new CoarsePlayerMoveEvent(event, event.getPlayer(), from, to);
    this.eventBus.callEvent(generalEvent);

    if(!wasCancelled && generalEvent.isCancelled()) {
        // When a coarse event is cancelled, we have our own logic for resetting the
        // player's position, so we un-cancel the event and instead modify its
        // to location to put the player where we want them.
        resetPosition(event);
        return true;
    } else {
        return false;
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:42,代码来源:PlayerMovementListener.java

示例4: onPlayerTeleport

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerTeleport(PlayerTeleportEvent e) {
	final Player player = e.getPlayer();
    if (this.getRemainingServerFrozenMillis() > 0L || this.getRemainingPlayerFrozenMillis(player.getUniqueId()) > 0L) {
    	if(e.getCause() == TeleportCause.ENDER_PEARL) {
    		player.sendMessage(ChatColor.RED + "You may not pearl while frozen!");
    		e.setCancelled(true);
    	}
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:10,代码来源:FreezeCommand.java

示例5: onPlayerTeleport

/**
 * On player teleport.
 * 
 * @param event
 *            the event
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event) {

	Location loc = event.getTo();
	Player player = event.getPlayer();
	PlayerConfEntry entry = playerConf.get(player);
	IDummyLand land;

	// BugFix Citizens plugin
	if (entry == null) {
		return;
	}

	if (!entry.hasTpCancel()) {
		updatePosInfo(event, entry, loc, false);
	} else {
		entry.setTpCancel(false);
	}

	land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(player.getLocation());

	// TP With ender pearl
	if (!playerConf.get(event.getPlayer()).isAdminMod()
			&& event.getCause() == TeleportCause.ENDER_PEARL
			&& !checkPermission(land, player,
					PermissionList.ENDERPEARL_TP.getPermissionType())) {
		messagePermission(player);
		event.setCancelled(true);
	}
}
 
开发者ID:Tabinol,项目名称:Factoid,代码行数:36,代码来源:PlayerListener.java

示例6: onPlayerTeleport

@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
    if (event.getCause() == TeleportCause.ENDER_PEARL || event.getCause() == TeleportCause.PLUGIN) {
        getBackend().logTeleport(event.getPlayer());
    }

    AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
 
开发者ID:Obsidian-Realm,项目名称:AntiCheat-COMPAT,代码行数:8,代码来源:PlayerListener.java

示例7: onPlayerTeleport

@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
	if (event.getCause() == TeleportCause.ENDER_PEARL) {
		if (event.getTo().getY() >= PEARL_MAX_HEIGHT) {
			if (GIVE_BACK_PEARL) {
				event.getPlayer().getInventory().addItem(new ItemStack(Material.ENDER_PEARL, 1));
			}
			event.setCancelled(true);
		}
	}
}
 
开发者ID:UltrahardcoreStats,项目名称:PVPManagerOld,代码行数:11,代码来源:EnderPearlListener.java

示例8: checkLaneMovement

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void checkLaneMovement(final CoarsePlayerMoveEvent event) {
    MatchPlayer player = this.match.getPlayer(event.getPlayer());
    if(player == null ||
       !player.canInteract() ||
       !(player.getParty() instanceof Team) ||
       player.getBukkit().getGameMode() == GameMode.CREATIVE ||
       event.getTo().getY() <= 0) return;

    Region laneRegion = this.lanes.get(player.getParty());
    if(laneRegion == null) return;

    boolean containsFrom = laneRegion.contains(event.getBlockFrom().toVector());
    boolean containsTo = laneRegion.contains(event.getBlockTo().toVector());

    // prevent ender pearling to the other lane
    if(!containsTo && event.getCause() instanceof PlayerTeleportEvent) {
        if(((PlayerTeleportEvent) event.getCause()).getCause() == TeleportCause.ENDER_PEARL) {
            event.setCancelled(true, new TranslatableComponent("match.lane.enderPearl.disabled"));
            return;
        }
    }

    if(this.voidPlayers.contains(player.getPlayerId())) {
        event.getPlayer().setFallDistance(0);
        // they have been marked as "out of lane"
        if(containsTo && !containsFrom) {
            // prevent the player from re-entering the lane
            event.setCancelled(true, new TranslatableComponent("match.lane.reEntry.disabled"));
        } else {
            // if they are going to land on something, teleport them underneith it
            Block under = event.getTo().clone().add(new Vector(0, -1, 0)).getBlock();
            if(under != null && under.getType() != Material.AIR) {
                // teleport them to the lowest block
                Vector safe = getSafeLocationUnder(under);
                EntityLocation safeLocation = event.getPlayer().getEntityLocation();
                safeLocation.setPosition(safe);
                event.setTo(safeLocation);
            }
        }
    } else {
        if(!containsFrom && !containsTo) {
            // they are outside of the lane
            if(isIllegallyOutsideLane(laneRegion, event.getTo())) {
                this.voidPlayers.add(player.getPlayerId());
                event.getPlayer().sendMessage(ChatColor.RED + PGMTranslations.t("match.lane.exit", player));
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:50,代码来源:LaneMatchModule.java

示例9: onPlayerTeleport

@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
	Player player = event.getPlayer();
	PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
	
	//FEATURE: prevent players from using ender pearls to gain access to secured claims
	if(event.getCause() == TeleportCause.ENDER_PEARL && GriefPrevention.instance.config_claims_enderPearlsRequireAccessTrust)
	{
		Claim toClaim = this.dataStore.getClaimAt(player.getLocation(), false, playerData.lastClaim);
		if(toClaim != null)
		{
			playerData.lastClaim = toClaim;
			String noAccessReason = toClaim.allowAccess(player);
			if(noAccessReason != null)
			{
				GriefPrevention.sendMessage(player, TextMode.Err, noAccessReason);
				event.setCancelled(true);
			}
		}
	}
	
	//FEATURE: prevent teleport abuse to win sieges
	
	//these rules only apply to siege worlds only
	if(!GriefPrevention.instance.config_siege_enabledWorlds.contains(player.getWorld())) return;
	
	Location source = event.getFrom();
	Claim sourceClaim = this.dataStore.getClaimAt(source, false, playerData.lastClaim);
	if(sourceClaim != null && sourceClaim.siegeData != null)
	{
		GriefPrevention.sendMessage(player, TextMode.Err, Messages.SiegeNoTeleport);
		event.setCancelled(true);
		return;
	}
	
	Location destination = event.getTo();
	Claim destinationClaim = this.dataStore.getClaimAt(destination, false, null);
	if(destinationClaim != null && destinationClaim.siegeData != null)
	{
		GriefPrevention.sendMessage(player, TextMode.Err, Messages.BesiegedNoTeleport);
		event.setCancelled(true);
		return;
	}
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:45,代码来源:PlayerEventHandler.java


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