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


Java TeleportCause.NETHER_PORTAL属性代码示例

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


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

示例1: onPlayerTeleport

@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,代码行数:11,代码来源:OrebfuscatorPlayerListener.java

示例2: onPlayerTeleport

@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
    TeleportCause cause = event.getCause();
    
    if(cause == null || cause != TeleportCause.NETHER_PORTAL) return;
    
    Player player = event.getPlayer();
    
    Flag flag = this.GetFlagInstanceAtLocation(event.getFrom(), player);
    if(flag == null) return;
    
    event.setCancelled(true);
    player.performCommand(flag.parameters);
}
 
开发者ID:BigScary,项目名称:GriefPreventionFlags,代码行数:15,代码来源:FlagDef_NetherPortalPlayerCommand.java

示例3: onPlayerTeleport

@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
    TeleportCause cause = event.getCause();
    
    if(cause == null || cause != TeleportCause.NETHER_PORTAL) return;
    
    Location from = event.getFrom();
    if(from.getBlock().getType() != Material.PORTAL)
    {
        event.setCancelled(true);
        return;
    }
    
    Player player = event.getPlayer();
    
    Flag flag = this.GetFlagInstanceAtLocation(from, player);
    if(flag == null) return;
    
    event.setCancelled(true);
    String [] commandLines = flag.parameters.replace("%name%", player.getName()).replace("%uuid%", player.getUniqueId().toString()).split(";");
    for(String commandLine : commandLines)
    {
        GPFlags.AddLogEntry("Nether portal command: " + commandLine);
        Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), commandLine);
    }
}
 
开发者ID:BigScary,项目名称:GriefPreventionFlags,代码行数:27,代码来源:FlagDef_NetherPortalConsoleCommand.java

示例4: b

public void b(int i) {
    if (this.dimension == 1 && i == 1) {
        this.a((Statistic) AchievementList.D);
        this.world.kill(this);
        this.viewingCredits = true;
        this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
    } else {
        if (this.dimension == 0 && i == 1) {
            this.a((Statistic) AchievementList.C);
            // CraftBukkit start - Rely on custom portal management
            /*
            ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();

            if (chunkcoordinates != null) {
                this.playerConnection.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
            }

            i = 1;
            */
            // CraftBukkit end
        } else {
            this.a((Statistic) AchievementList.y);
        }

        // CraftBukkit start
        TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
        this.server.getPlayerList().changeDimension(this, i, cause);
        // CraftBukkit end
        this.lastSentExp = -1;
        this.bQ = -1.0F;
        this.bR = -1;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:33,代码来源:EntityPlayer.java

示例5: b

public void b(int i) {
    if (this.dimension == 1 && i == 1) {
        this.a((Statistic) AchievementList.C);
        this.world.kill(this);
        this.viewingCredits = true;
        this.playerConnection.sendPacket(new Packet70Bed(4, 0));
    } else {
        if (this.dimension == 0 && i == 1) {
            this.a((Statistic) AchievementList.B);
            // CraftBukkit start - Rely on custom portal management
            /*
            ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();

            if (chunkcoordinates != null) {
                this.playerConnection.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
            }

            i = 1;
            */
            // CraftBukkit end
        } else {
            this.a((Statistic) AchievementList.x);
        }

        // CraftBukkit start
        TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
        this.server.getPlayerList().changeDimension(this, i, cause);
        // CraftBukkit end
        this.lastSentExp = -1;
        this.bP = -1.0F;
        this.bQ = -1;
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:33,代码来源:EntityPlayer.java

示例6: onPlayerTeleport

@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
	Player p = event.getPlayer();
	
	if(um.isPlaying(p.getName())) {
		if(event.getCause() == TeleportCause.END_PORTAL || event.getCause() == TeleportCause.COMMAND || event.getCause() == TeleportCause.NETHER_PORTAL) {
			event.setCancelled(true);
		}
	}
}
 
开发者ID:maker56,项目名称:UltimateSurvivalGames,代码行数:10,代码来源:PlayerListener.java

示例7: travelToDimension

public void travelToDimension(int p_71027_1_)
{
    if (this.dimension == 1 && p_71027_1_ == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && p_71027_1_ == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            ChunkCoordinates chunkcoordinates = this.mcServer.worldServerForDimension(p_71027_1_).getEntrancePortalLocation();

            if (chunkcoordinates != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)chunkcoordinates.posX, (double)chunkcoordinates.posY, (double)chunkcoordinates.posZ, 0.0F, 0.0F);
            }

            p_71027_1_ = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        // CraftBukkit start
        TeleportCause cause = (this.dimension == 1 || p_71027_1_ == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, p_71027_1_, cause); // Cauldron
        // CraftBukkit end
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:37,代码来源:EntityPlayerMP.java

示例8: c

@Nullable
public Entity c(int i) {
    //this.ck = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
    if (this.dimension == 1 && i == 1) {
        this.ck = true; // CraftBukkit - Moved down from above
        this.world.kill(this);
        if (!this.viewingCredits) {
            this.viewingCredits = true;
            if (this.a(AchievementList.D)) {
                this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
            } else {
                this.b((Statistic) AchievementList.D);
                this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 1.0F));
            }
        }

        return this;
    } else {
        if (this.dimension == 0 && i == 1) {
            this.b((Statistic) AchievementList.C);
            i = 1;
        } else {
            this.b((Statistic) AchievementList.y);
        }

        // CraftBukkit start
        TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
        this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this
        // CraftBukkit end
        this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
        this.lastSentExp = -1;
        this.lastHealthSent = -1.0F;
        this.cc = -1;
        return this;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:36,代码来源:EntityPlayer.java

示例9: onPlayerUsePortal

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
public void onPlayerUsePortal(final PlayerPortalEvent event) {
    this.plugin.entering(this.getClass(), "onPlayerUsePortal", "player=" + event.getPlayer().getName() + ";from=" + NLocation.toString(event.getFrom()) + ";to=" + NLocation.toString(event.getTo()));

    final GeneralWorld world = this.plugin.getWorlds().get(event.getFrom().getWorld().getName());
    if (GeneralWorld.WorldType.isStock(world)) {
        return;
    }

    if (world.getType() == WorldType.ADDITIONAL) {
        final AdditionalWorld additionalWorld = (AdditionalWorld)world;
        if (event.getCause() == TeleportCause.NETHER_PORTAL && !additionalWorld.hasNether()) {
            event.setCancelled(true);
            this.plugin.exiting(this.getClass(), "onPlayerUsePortal", "doesn't have required subworld (nether)");
            return;
        } else if (event.getCause() == TeleportCause.END_PORTAL && !additionalWorld.hasEnd()) {
            event.setCancelled(true);
            this.plugin.exiting(this.getClass(), "onPlayerUsePortal", "doesn't have required subworld (end)");
            return;
        }
    }

    final PortalEventResult result = this.handlePortalEvent(event.getFrom(), event.getCause(), event.getPortalTravelAgent());
    if (result == null) {
        return;
    }
    if (result.destination != null) {
        event.setTo(result.destination);
    }
    if (result.useTravelAgent) {
        event.useTravelAgent(true);
    }
    if (result.cancelEvent) {
        event.setCancelled(true);
    }

    this.plugin.exiting(this.getClass(), "onPlayerUsePortal");
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:38,代码来源:NListener.java

示例10: c

public void c(int i) {
    if (this.dimension == 1 && i == 1) {
        this.a((Statistic) AchievementList.C);
        this.world.kill(this);
        this.viewingCredits = true;
        this.playerConnection.sendPacket(new Packet70Bed(4, 0));
    } else {
        if (this.dimension == 1 && i == 0) {
            this.a((Statistic) AchievementList.B);
            // CraftBukkit start - Rely on custom portal management
            /*
            ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();

            if (chunkcoordinates != null) {
                this.playerConnection.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
            }

            i = 1;
            */
            // CraftBukkit end
        } else {
            this.a((Statistic) AchievementList.x);
        }

        // CraftBukkit start
        TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
        this.server.getPlayerList().changeDimension(this, i, cause);
        // CraftBukkit end
        this.lastSentExp = -1;
        this.cm = -1;
        this.cn = -1;
    }
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:33,代码来源:EntityPlayer.java

示例11: onEntityUsePortal

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
public void onEntityUsePortal(final EntityPortalEvent event) {
    this.plugin.entering(this.getClass(), "onEntityUsePortal", "entity=" + event.getEntityType() + ";from=" + NLocation.toString(event.getFrom()) + ";to=" + NLocation.toString(event.getTo()));

    if (event.getEntityType() == EntityType.ENDER_DRAGON) {
        this.plugin.exiting(this.getClass(), "onEntityUsePortal", "EnderDragon should really stay in the End!");
        event.setCancelled(true);
        return;
    }

    final GeneralWorld world = this.plugin.getWorlds().get(event.getFrom().getWorld().getName());
    if (GeneralWorld.WorldType.isStock(world)) {
        this.plugin.exiting(this.getClass(), "onEntityUsePortal", "Stock world!");
        return;
    }

    // Build a fake TeleportCause based on From and To locations
    PlayerTeleportEvent.TeleportCause cause = null;
    final Block block = event.getFrom().getBlock();
    switch (block.getType()) {
        case PORTAL:
            cause = PlayerTeleportEvent.TeleportCause.NETHER_PORTAL;
            break;
        case ENDER_PORTAL:
            cause = PlayerTeleportEvent.TeleportCause.END_PORTAL;
            break;
        default:
            this.plugin.debug("Strange block found: " + block.getType() + ", trying to find a portal block near the Location");
            for (final BlockFace face : blockFaces) {
                if (block.getRelative(face).getType() == Material.PORTAL) {
                    cause = PlayerTeleportEvent.TeleportCause.NETHER_PORTAL;
                    this.plugin.debug("Found a Nether Portal block at " + NLocation.toString(block.getRelative(face).getLocation()));
                    break;
                } else if (block.getRelative(face).getType() == Material.ENDER_PORTAL) {
                    cause = PlayerTeleportEvent.TeleportCause.END_PORTAL;
                    this.plugin.debug("Found an End Portal block at " + NLocation.toString(block.getRelative(face).getLocation()));
                    break;
                }
            }
            if (cause == null) {
                cause = PlayerTeleportEvent.TeleportCause.PLUGIN;
            }
            break;
    }

    if (world.getType() == WorldType.ADDITIONAL) {
        final AdditionalWorld additionalWorld = (AdditionalWorld)world;
        if (cause == TeleportCause.NETHER_PORTAL && !additionalWorld.hasNether()) {
            event.setCancelled(true);
            this.plugin.exiting(this.getClass(), "onEntityUsePortal", "doesn't have required subworld (nether)");
            return;
        } else if (cause == TeleportCause.END_PORTAL && !additionalWorld.hasEnd()) {
            event.setCancelled(true);
            this.plugin.exiting(this.getClass(), "onEntityUsePortal", "doesn't have required subworld (end)");
            return;
        }
    }

    final PortalEventResult result = this.handlePortalEvent(event.getFrom(), cause, event.getPortalTravelAgent());
    if (result == null) {
        this.plugin.exiting(this.getClass(), "onEntityUsePortal", "result is null");
        return;
    }
    if (result.destination != null) {
        event.setTo(result.destination);
    }
    if (result.useTravelAgent) {
        event.useTravelAgent(true);
    }
    if (result.cancelEvent) {
        event.setCancelled(true);
    }

    this.plugin.exiting(this.getClass(), "onEntityUsePortal");
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:75,代码来源:NListener.java


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