當前位置: 首頁>>代碼示例>>Java>>正文


Java PlayerTeleportEvent.getCause方法代碼示例

本文整理匯總了Java中org.bukkit.event.player.PlayerTeleportEvent.getCause方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerTeleportEvent.getCause方法的具體用法?Java PlayerTeleportEvent.getCause怎麽用?Java PlayerTeleportEvent.getCause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.player.PlayerTeleportEvent的用法示例。


在下文中一共展示了PlayerTeleportEvent.getCause方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPearlClip

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
    if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
        Location to = event.getTo();
        if (blockedPearlTypes.contains(to.getBlock().getType())) {
            Player player = event.getPlayer();
            player.sendMessage(ChatColor.YELLOW + "You have been detected trying to pearl glitch, your pearl has been refunded and cooldown wiped.");
            plugin.getTimerManager().getEnderPearlTimer().refund(player);

            event.setCancelled(true);
            return;
        }

        to.setX(to.getBlockX() + 0.5);
        to.setZ(to.getBlockZ() + 0.5);
        event.setTo(to);
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:19,代碼來源:PearlGlitchListener.java

示例2: onPearlClip

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
	if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
		Location to = event.getTo();
		if (blockedPearlTypes.contains(to.getBlock().getType())) {
			Player player = event.getPlayer();
			player.sendMessage(ChatColor.RED + "You cannot pearl there.");
			removeCooldown(player);
			event.setCancelled(true);

			return;
		}
		to.setX(to.getBlockX() + 0.5D);
		to.setZ(to.getBlockZ() + 0.5D);
		event.setTo(to);

	}
}
 
開發者ID:HuliPvP,項目名稱:Chambers,代碼行數:19,代碼來源:EnderpearlListener.java

示例3: onPlayerSwitch

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerSwitch(final PlayerTeleportEvent e) {
    if(RandomCoords.getPlugin().config.getStringList("OnJoinWorlds") == null )  { return; }
    if(e.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || e.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL) {
        return;
    }
    final List<String> list = RandomCoords.getPlugin().config.getStringList("OnJoinWorlds");
    if(list.isEmpty()) { return; }
    if(e.getTo().getWorld() == e.getFrom().getWorld()) { return; }
    if(list.contains(e.getTo().getWorld().getName())) {
        if(e.getTo().getWorld().getPlayers().contains(e.getPlayer())) { return; }
        final Player p = e.getPlayer();
        //coordinates.finalCoordinates(p, 574272099, 574272099, e.getTo().getWorld(), CoordType.JOINWORLD, 0);
        coordinatesManager.randomlyTeleportPlayer(p, e.getTo().getWorld(), coordinatesManager.key, coordinatesManager.key, CoordType.JOINWORLD, 0);

    }


}
 
開發者ID:jolbol1,項目名稱:RandomCoordinatesV2,代碼行數:20,代碼來源:PlayerSwitchWorld.java

示例4: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@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,代碼行數:18,代碼來源:FlagDef_NoEnderPearl.java

示例5: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
    if(event.getCause() != TeleportCause.CHORUS_FRUIT) 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,代碼行數:18,代碼來源:FlagDef_NoChorusFruit.java

示例6: playerTeleportEvent

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler
public void playerTeleportEvent(PlayerTeleportEvent event)
{
	Player player = event.getPlayer();
	
	PlayerGUIPage playerGUIContainer = PlayerData.getPlayerData(player).getPlayerGUIPage();
	if(playerGUIContainer != null)
	{
		if(event.getCause() != PlayerTeleportEvent.TeleportCause.UNKNOWN)
		{
			playerGUIContainer.destroy();
			PlayerData.getPlayerData(player).setPlayerGUIPage(null);
			PlayerData.getPlayerData(player).setPlayerPreviousGUIPage(null);
		}
	}
}
 
開發者ID:Kloudy,項目名稱:HoloGUIApi,代碼行數:17,代碼來源:PlayerTeleportEventListener.java

示例7: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@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,代碼行數:19,代碼來源:CTFListener.java

示例8: on

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void on(PlayerTeleportEvent event) {
    if (!isCurrentlyFrozen(event.getPlayer().getUniqueId())) return;

    Player player = event.getPlayer();

    switch (event.getCause()) {
        case PLUGIN:
            // skip if it was to the same location as currently set, stops
            // resetting particles/metadata on border knockback
            if (event.getTo().equals(getFreezeLocation(player).get())) return;
        case COMMAND:
        case UNKNOWN:
            // set new location and reset particles
            setFreezeLocation(player, event.getTo());
            startParticleSpawning(player, event.getTo());
            potionApplier.addPotions(player);
    }
}
 
開發者ID:Eluinhost,項目名稱:FancyFreeze,代碼行數:20,代碼來源:DefaultFreezer.java

示例9: onTp

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler
public void onTp(PlayerTeleportEvent event) {

    Player player = event.getPlayer();
    PlayerTeleportEvent.TeleportCause cause = event.getCause();

    if (cause.toString().equals("SPECTATE")) {
        if (!player.hasPermission("spectatetp.tp")) {
            event.setCancelled(true);
            if (!deny_message.equals("")) {
                player.sendMessage(deny_message);
            }
        }
    }

}
 
開發者ID:jonthesquirrel,項目名稱:SpectateTP,代碼行數:17,代碼來源:SpectateTP.java

示例10: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true)
private void onPlayerTeleport(PlayerTeleportEvent event) {

    if (event.getFrom() == null || event.getTo() == null)
        return;

    // player teleporting to a different world
    if (!event.getFrom().getWorld().equals(event.getTo().getWorld())) {

        PlayList.clearQueue(event.getPlayer());
    }

    if (event.getCause() != TeleportCause.UNKNOWN) {
        _regionManager.getPlayerWatcher()
                .updatePlayerLocation(event.getPlayer(), event.getTo(), RegionEventReason.TELEPORT);
    }
}
 
開發者ID:JCThePants,項目名稱:NucleusFramework,代碼行數:18,代碼來源:JCGEventListener.java

示例11: PlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void PlayerTeleport(final PlayerTeleportEvent event)
{
	final Player player = event.getPlayer();
	if (plugin.isLoggedIn(player))
	{
		final LoginPlayerData playerdata = plugin.getPlayerData(player);
		if (playerdata != null)
			playerdata.notifyAction();
		return;
	}
	if (playerListener.getMovementBlocker(player) == null)
		return;
	switch (event.getCause())
	{
		case PLUGIN:
			playerListener.setMovementBlocker(player, event.getTo());
		case UNKNOWN:
			return;
		default:
			event.setCancelled(true);
			plugin.sendAuthReminderMessage(event.getPlayer());
	}
}
 
開發者ID:ST-DDT,項目名稱:CrazyLogin,代碼行數:25,代碼來源:DynamicPlayerListener.java

示例12: onStaffTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler
public void onStaffTeleport(PlayerTeleportEvent e) {
	if(e.getCause() == TeleportCause.PLUGIN) {
		XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
		if(xp.isStaff()) {
			if(xp.isVanished()) {
				return;
			} else if(xp.getBukkitPlayer().getGameMode() == GameMode.CREATIVE) {
				return;
			} else {
				if(staff.containsKey(e.getPlayer().getName())) {
					Bukkit.getScheduler().cancelTask(staff.get(e.getPlayer().getName()));
					staff.remove(e.getPlayer().getName());
					staff.put(e.getPlayer().getName(), staffScheduler(e.getPlayer()));
					sendMessage(e.getPlayer(), ChatColor.GRAY + "teleportation safety against damage has been " + ChatColor.GREEN + "enabled!");
				} else {
					staff.put(e.getPlayer().getName(), staffScheduler(e.getPlayer()));
					sendMessage(e.getPlayer(), ChatColor.GRAY + "teleportation safety against damage has been " + ChatColor.GREEN + "enabled!");
				}
			}
		}
	}
}
 
開發者ID:xEssentials,項目名稱:xEssentials-deprecated-bukkit,代碼行數:24,代碼來源:StaffSafeTeleportEvent.java

示例13: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event) {
    if (OrebfuscatorConfig.UseProximityHider) {
        if(event.getCause() != TeleportCause.END_PORTAL
                && event.getCause() != TeleportCause.NETHER_PORTAL
                )
        {
            ProximityHider.addPlayerToCheck(event.getPlayer(), null);
        }
    }
}
 
開發者ID:SamaGames,項目名稱:AntiCheat,代碼行數:12,代碼來源:OrebfuscatorPlayerListener.java

示例14: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
/**
 * Prevent teleporting outside the map
 */
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
    if(event.getCause() == PlayerTeleportEvent.TeleportCause.PLUGIN) {
        double fromY = event.getFrom().getY();
        double toY = event.getTo().getY();

        if((fromY >= 0.0D && fromY < 255.0D) && (toY < 0.0D || toY >= 255.0D)) {
            event.setCancelled(true);
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:15,代碼來源:InternalMatchModule.java

示例15: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //導入方法依賴的package包/類
/**
 * Prevent teleporting outside the border
 */
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
    if(event.getCause() == PlayerTeleportEvent.TeleportCause.PLUGIN) {
        if(WorldBorderUtils.isInsideBorder(event.getFrom()) &&
           !WorldBorderUtils.isInsideBorder(event.getTo())) {
            event.setCancelled(true);
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:13,代碼來源:WorldBorderMatchModule.java


注:本文中的org.bukkit.event.player.PlayerTeleportEvent.getCause方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。