当前位置: 首页>>代码示例>>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;未经允许,请勿转载。