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


Java PlayerTeleportEvent.isCancelled方法代码示例

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


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

示例1: isAuthorizedFor

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
public boolean isAuthorizedFor(Player base, Location to) {
    if (to == null || to.getWorld() == null) {
        instance.logToFile(getClass(), base.getUniqueId() + " (" + base.getName() + ") is not authorized to teleport to " + to + "!", Level.WARNING);
        return false;
    }

    Helper.refreshChunk(to);
    Helper.updatePosition(base, to);

    if (config.isPatchesForceAllowTeleportation()) {
        return true;
    }

    PlayerTeleportEvent event = new PlayerTeleportEvent(base, base.getLocation(), to, PlayerTeleportEvent.TeleportCause.PLUGIN);
    Bukkit.getPluginManager().callEvent(event);
    return !event.isCancelled();
}
 
开发者ID:RealizedMC,项目名称:Duels,代码行数:18,代码来源:Teleport.java

示例2: onTeleportation

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onTeleportation(final TeleportHook hook) {
    PlayerTeleportEvent event =
            new PlayerTeleportEvent(new CanaryPlayer(hook.getPlayer()), new CanaryLocation(hook.getPlayer()
                    .getLocation(), new CanaryWorld(hook.getDestination().getWorld())), new CanaryLocation(hook
                    .getDestination(), new CanaryWorld(hook.getDestination().getWorld())),
                    TeleportCauseConverter.of(hook.getTeleportReason())) {
                @Override
                public void setFrom(Location from) {
                    super.setFrom(from);
                    // How can you do this in Canary?
                }

                @Override
                public void setTo(Location to) {
                    super.setTo(to);
                    // How can you do this in Canary?
                }
            };
    event.setCancelled(hook.isCanceled());
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        hook.setCanceled();
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:26,代码来源:CanaryPlayerListener.java

示例3: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerTeleport(PlayerTeleportEvent event) {
    if (event.isCancelled()) {
        return;
    }

    Location from = event.getFrom();
    Location to = event.getTo();

    if (from.getWorld().equals(to.getWorld())) {
        return;
    }

    ConsoleLogger.debug("[EVENTS] Player '" + event.getPlayer().getName() + "' going from world '" + from + "' to world '" + to + "'");

    Group groupFrom = groupManager.getGroupFromWorld(from.getWorld().getName());
    Group groupTo = groupManager.getGroupFromWorld(to.getWorld().getName());

    if (groupFrom.equals(groupTo)) {
        return;
    }

    playerManager.addPlayer(event.getPlayer(), groupFrom);
    event.getPlayer().closeInventory();
}
 
开发者ID:Gnat008,项目名称:PerWorldInventory,代码行数:26,代码来源:PlayerTeleportListener.java

示例4: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
   public void onPlayerTeleport(PlayerTeleportEvent e){
   	if (e.isCancelled()) {
           return;
       }
   	
   	final Player p = e.getPlayer();
   	Location lfrom = e.getFrom();
   	Location lto = e.getTo();    	
   	
   	if (e.getCause().equals(PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT)){
   		final Region rfrom = RedProtect.get().rm.getTopRegion(lfrom);
       	final Region rto = RedProtect.get().rm.getTopRegion(lto);
       	
   		if (rfrom != null && !rfrom.canTeleport(p)){
       		RPLang.sendMessage(p, "playerlistener.region.cantuse");
               e.setCancelled(true);    		
       	}
       	if (rto != null && !rto.canTeleport(p)){
       		RPLang.sendMessage(p, "playerlistener.region.cantuse");
               e.setCancelled(true);    		
       	}
   	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:25,代码来源:RPMine19.java

示例5: onTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW)
public void onTeleport(PlayerTeleportEvent event) {
    if (event.isCancelled() || !plugin.isSkyWorld(event.getTo().getWorld())) {
        return;
    }
    final Player player = event.getPlayer();
    boolean isAdmin = player.isOp() || hasPermission(player, "usb.mod.bypassprotection");
    IslandInfo islandInfo = uSkyBlock.getInstance().getIslandInfo(WorldGuardHandler.getIslandNameAt(event.getTo()));
    if (!isAdmin && islandInfo != null && islandInfo.isBanned(player.getUniqueId())) {
        event.setCancelled(true);
        player.sendMessage(tr("\u00a74That player has forbidden you from teleporting to their island."));
    }
    if (!isAdmin && islandInfo != null && islandInfo.isLocked() && !islandInfo.getMembers().contains(player.getName()) && !islandInfo.getTrustees().contains(player.getName())) {
        event.setCancelled(true);
        player.sendMessage(tr("\u00a74That island is \u00a7clocked.\u00a7e No teleporting to the island."));
    }
    if (!event.isCancelled()) {
        final PlayerInfo playerInfo = plugin.getPlayerInfo(player);
        playerInfo.onTeleport(player);
    }
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:PlayerEvents.java

示例6: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=true)
public void onPlayerTeleport(PlayerTeleportEvent event) {
    if(event.isCancelled()) return;

    if (pl.getHandCuffManager().isHandCuffed(event.getPlayer().getUniqueId()) && event.getTo() != tos.get(event.getPlayer().getName())) {
        Location to = pl.getHandCuffManager().getLocation(event.getPlayer().getUniqueId());
        to.setPitch(event.getTo().getPitch());
        to.setYaw(event.getTo().getYaw());

        tos.put(event.getPlayer().getName(), to);
        event.getPlayer().teleport(to);

        if(System.currentTimeMillis() >= pl.getHandCuffManager().getNextMessageTime(event.getPlayer().getUniqueId())) {
            event.getPlayer().sendMessage(ChatColor.RED + "You are handcuffed and cant move!");
            pl.getHandCuffManager().updateNextTime(event.getPlayer().getUniqueId());
        }
    }
}
 
开发者ID:graywolf336,项目名称:Jail,代码行数:19,代码来源:HandCuffListener.java

示例7: onPlayerMove

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerMove(PlayerTeleportEvent event) {
    if (event.isCancelled() || TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver()) return;
    if (region.contains(event.getTo().toVector()) && !region.contains(event.getFrom().toVector()) && (filter == null || filter.evaluate(event.getPlayer(), event.getTo(), event).equals(FilterState.ALLOW))) {
        kit.apply(event.getPlayer());
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:8,代码来源:KitRegion.java

示例8: a

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
public void a(double d0, double d1, double d2, float f, float f1) {
    // CraftBukkit start - Delegate to teleport(Location)
    Player player = this.getPlayer();
    Location from = player.getLocation();
    Location to = new Location(this.getPlayer().getWorld(), d0, d1, d2, f, f1);
    PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.UNKNOWN);
    this.server.getPluginManager().callEvent(event);

    from = event.getFrom();
    to = event.isCancelled() ? from : event.getTo();

    this.teleport(to);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:14,代码来源:PlayerConnection.java

示例9: setPlayerLocation

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
public void setPlayerLocation(double p_147364_1_, double p_147364_3_, double p_147364_5_, float p_147364_7_, float p_147364_8_)
{
    // CraftBukkit start - Delegate to teleport(Location)
    Player player = this.getPlayerB();
    Location from = player.getLocation();
    Location to = new Location(this.getPlayerB().getWorld(), p_147364_1_, p_147364_3_, p_147364_5_, p_147364_7_, p_147364_8_);
    PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.UNKNOWN);
    this.server.getPluginManager().callEvent(event);
    from = event.getFrom();
    to = event.isCancelled() ? from : event.getTo();
    this.teleport(to);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:13,代码来源:NetHandlerPlayServer.java

示例10: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerTeleport(final PlayerTeleportEvent event) {
	if  (!this.frozenPlayers.isEmpty() && !event.isCancelled() && this.frozenPlayers.containsKey(event.getPlayer().getUniqueId())) {
		final Location l = event.getTo();
		final Location3w frozenLoc = this.frozenPlayers.get(event.getPlayer().getUniqueId());
		if (l.getBlockX() != frozenLoc.getBlockX() || l.getBlockY() != frozenLoc.getBlockY() || l.getBlockZ() != frozenLoc.getBlockZ()) {
			event.setCancelled(true);
		}
	}
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:11,代码来源:FreezeComponent.java

示例11: a

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
public void a(Entity entity) {
    if (!this.world.isClientSide && !this.e()) {
        this.g = 100;
        if (this.exitPortal == null && this.world.worldProvider instanceof WorldProviderTheEnd) {
            this.l();
        }

        if (this.exitPortal != null) {
            BlockPosition blockposition = this.exactTeleport ? this.exitPortal : this.k();

            // CraftBukkit start - Fire PlayerTeleportEvent
            if (entity instanceof EntityPlayer) {
                org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity.getBukkitEntity();
                org.bukkit.Location location = new Location(world.getWorld(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
                location.setPitch(player.getLocation().getPitch());
                location.setYaw(player.getLocation().getYaw());

                PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.END_GATEWAY);
                Bukkit.getPluginManager().callEvent(teleEvent);
                if (teleEvent.isCancelled()) {
                    return;
                }

                ((EntityPlayer) entity).playerConnection.teleport(teleEvent.getTo());
                this.i();
                return;

            }
            // CraftBukkit end

            entity.enderTeleportTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
        }

        this.i();
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:37,代码来源:TileEntityEndGateway.java

示例12: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerTeleport(final ExtendedPlayerTeleportEvent ext) {
    final PlayerTeleportEvent event = (PlayerTeleportEvent)ext.getBaseEvent();
    if (!event.isCancelled()) {
        if (!ext.getToRegion().getFlag(Flag.PVP_HIDE) && !ext.getToRegion().getFlag(Flag.PVP) && !ext.getFromRegions().contains(ext.getToRegion())) {
            // Entering PVP Area
            this.getPlugin().sendMessage(event.getPlayer(), MessageId.cuboid_enteringPvpArea, ext.getToRegion().getRegionName());
        } else if (!ext.getFromRegion().getFlag(Flag.PVP_HIDE) && !ext.getFromRegion().getFlag(Flag.PVP) && !ext.getToRegions().contains(ext.getFromRegion())) {
            // Exiting PVP Area
            this.getPlugin().sendMessage(event.getPlayer(), MessageId.cuboid_exitingPvpArea, ext.getFromRegion().getRegionName());
        }
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:14,代码来源:PvpFlagListener.java

示例13: illegalTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void illegalTeleport(PlayerTeleportEvent event) {
	if (!event.getPlayer().getName().equals(player.getName()))
		return;
	if (event.isCancelled() == true)
		return;
	if (player.hasPermission("kidstimeout"))
		return;
	player.sendMessage("Your attempt to escape prison was foiled!");
	event.setCancelled(true);
	return;
}
 
开发者ID:sofar,项目名称:kidstimeout,代码行数:13,代码来源:KidsTimeoutTeleportListener.java

示例14: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    net.minecraft.entity.player.EntityPlayerMP entity = getHandle();

    if (getHealth() == 0 || entity.isDead) {
        return false;
    }

    if (entity.playerNetServerHandler == null || entity.playerNetServerHandler.isDisconnected()) {
        return false;
    }

    // Spigot Start
    // if (entity.vehicle != null || entity.passenger != null) {
    // return false;
    // }
    // Spigot End

    // From = Players current Location
    Location from = this.getLocation();
    // To = Players new Location if Teleport is Successful
    Location to = location;
    // Create & Call the Teleport Event.
    PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause);
    server.getPluginManager().callEvent(event);

    // Return False to inform the Plugin that the Teleport was unsuccessful/cancelled.
    if (event.isCancelled()) {
        return false;
    }
    
    // Spigot Start
    eject();
    leaveVehicle();
    // Spigot End

    // Update the From Location
    from = event.getFrom();
    // Grab the new To Location dependent on whether the event was cancelled.
    to = event.getTo();
    // Grab the To and From World Handles.
    net.minecraft.world.WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle();
    net.minecraft.world.WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle();

    // Close any foreign inventory
    if (getHandle().openContainer != getHandle().inventoryContainer) {
        getHandle().closeScreen();
    }

    // Check if the fromWorld and toWorld are the same.
    if (fromWorld == toWorld) {
        entity.playerNetServerHandler.teleport(to);
    } else {
        server.getHandle().respawnPlayer(entity, toWorld.dimension, cause, to); // Cauldron
    }
    return true;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:58,代码来源:CraftPlayer.java

示例15: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    net.minecraft.entity.player.EntityPlayerMP entity = getHandle();

    if (getHealth() == 0 || entity.isDead) {
        return false;
    }

    if (entity.playerNetServerHandler == null || entity.playerNetServerHandler.isDisconnected()) {
        return false;
    }

    // Spigot Start
    // if (entity.vehicle != null || entity.passenger != null) {
    // return false;
    // }
    // Spigot End

    // From = Players current Location
    Location from = this.getLocation();
    // To = Players new Location if Teleport is Successful
    Location to = location;
    // Create & Call the Teleport Event.
    PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause);
    server.getPluginManager().callEvent(event);

    // Return False to inform the Plugin that the Teleport was unsuccessful/cancelled.
    if (event.isCancelled()) {
        return false;
    }
    
    // Spigot Start
    eject();
    leaveVehicle();
    // Spigot End

    // Update the From Location
    from = event.getFrom();
    // Grab the new To Location dependent on whether the event was cancelled.
    to = event.getTo();
    // Grab the To and From World Handles.
    net.minecraft.world.WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle();
    net.minecraft.world.WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle();

    // Close any foreign inventory
    if (getHandle().openContainer != getHandle().inventoryContainer) {
        getHandle().closeScreen();
    }

    // Check if the fromWorld and toWorld are the same.
    if (fromWorld == toWorld) {
        entity.playerNetServerHandler.teleport(to);
    } else {
        server.getHandle().respawnPlayer(entity, toWorld.dimension, false, to); // Cauldron
    }
    return true;
}
 
开发者ID:CyberdyneCC,项目名称:ThermosRebased,代码行数:58,代码来源:CraftPlayer.java


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