Java 类org.bukkit.event.player.PlayerChangedWorldEvent 实例源码

项目:RPGInventory    文件:InventoryListener.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldChanged(PlayerChangedWorldEvent event) {
    Player player = event.getPlayer();
    if (!InventoryManager.playerIsLoaded(player)) {
        if (InventoryManager.isAllowedWorld(player.getWorld())) {
            InventoryManager.initPlayer(player, InventoryManager.isAllowedWorld(event.getFrom()));
        }

        return;
    }

    if (!InventoryManager.isAllowedWorld(player.getWorld())) {
        InventoryManager.unloadPlayerInventory(player);
    } else {
        if (InventoryManager.get(player).hasPet()) {
            PetManager.respawnPet(player);
        }
    }
}
项目:DragonEggDrop    文件:RespawnListeners.java   
@EventHandler
public void onPlayerSwitchWorlds(PlayerChangedWorldEvent event) {
    World world = event.getPlayer().getWorld();
    if (world.getEnvironment() != Environment.THE_END) return;

    EndWorldWrapper worldWrapper = manager.getWorldWrapper(world);

    // Start the respawn countdown if joining an empty world
    if (plugin.getConfig().getBoolean("respawn-on-join", false)) {
        if (world.getPlayers().size() > 1 || worldWrapper.isRespawnInProgress()
                || world.getEntitiesByClass(EnderDragon.class).size() == 0) 
            return;

        manager.getWorldWrapper(world).startRespawn(RespawnType.JOIN);
    }

    // Reset end crystal states just in case something went awry
    if (!worldWrapper.isRespawnInProgress()) {
        world.getEntitiesByClass(EnderCrystal.class).forEach(e -> {
            e.setInvulnerable(false);
            e.setBeamTarget(null);
        });
    }
}
项目:BukkitOldCombatMechanics    文件:ModuleDisableElytra.java   
@EventHandler (priority = EventPriority.HIGHEST)
public void onWorldChange(PlayerChangedWorldEvent e){
    Player p = e.getPlayer();
    World w = p.getWorld();
    if(!isEnabled(w)) return;

    PlayerInventory inv = p.getInventory();

    ItemStack chestplate = inv.getChestplate();

    if(chestplate == null || chestplate.getType() != Material.ELYTRA) return;

    inv.setChestplate(new ItemStack(Material.AIR));

    if(inv.firstEmpty() != -1)
        inv.addItem(chestplate);
    else
        w.dropItem(p.getLocation(), chestplate);
}
项目:BukkitOldCombatMechanics    文件:ModuleAttackCooldown.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onWorldChange(PlayerChangedWorldEvent e) {
    Player player = e.getPlayer();
    World world = player.getWorld();

    double GAS = module().getDouble("generic-attack-speed");

    AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
    double baseValue = attribute.getBaseValue();

    if(!Config.moduleEnabled("disable-attack-cooldown", world))
        GAS = 4; //If module is disabled, set attack speed to 1.9 default

    if(baseValue!=GAS){
        attribute.setBaseValue(GAS);
        player.saveData();
    }
}
项目:WorldGuardExtraFlagsPlugin    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerChangedWorldEvent(PlayerChangedWorldEvent event)
{
    Player player = event.getPlayer();

    if (WorldGuardExtraFlagsPlugin.isEssentialsEnable()) //Essentials how dare u do this to me!?!
    {
        if (!WorldGuardUtils.hasBypass(player))
        {
            if (player.getGameMode() != GameMode.CREATIVE && !WorldGuardExtraFlagsPlugin.getEssentialsPlugin().getUser(player).isAuthorized("essentials.fly"))
            {
                //Essentials now turns off flight, fuck him

                try
                {
                    player.setAllowFlight(WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getSessionManager().get(player).getHandler(FlyFlag.class).getCurrentValue());
                }
                catch(Exception ignored)
                {

                }
            }
        }
    }
}
项目:Statz    文件:WorldsChangedListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onWorldSwitch(final PlayerChangedWorldEvent event) {

    final PlayerStat stat = PlayerStat.WORLDS_CHANGED;

    // Get player
    final Player player = (Player) event.getPlayer();

    // Do general check
    if (!plugin.doGeneralCheck(player, stat))
        return;

    // Update value to new stat.
    plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat,
            StatzUtil.makeQuery("uuid", player.getUniqueId().toString(), "value", 1, "world",
                    event.getFrom().getName(), "destWorld", player.getWorld().getName()));

}
项目:SonarPet    文件:PetOwnerListener.java   
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent event) {
    final Player p = event.getPlayer();
    final IPet pi = EchoPet.getManager().getPet(p);
    if (pi != null) {
        EchoPet.getManager().saveFileData("autosave", pi);
        EchoPet.getSqlManager().saveToDatabase(pi, false);
        EchoPet.getManager().removePet(pi, false);
        new BukkitRunnable() {

            @Override
            public void run() {
                EchoPet.getManager().loadPets(p, false, false, false);
            }

        }.runTaskLater(EchoPet.getPlugin(), 20L);
    }
}
项目:BloodMoon    文件:ChatMessageListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
    Player player = event.getPlayer();
    World world = player.getWorld();
    PluginConfig worldConfig = plugin.getConfig(world);

    if (plugin.isFeatureEnabled(world, Feature.CHAT_MESSAGE)) {
        String message = worldConfig.getString(Config.FEATURE_CHAT_MESSAGE_START_MESSAGE);

        if (!message.isEmpty()) {
            if (plugin.isActive(world)) {
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
            }
        }
    }
}
项目:SuperVanish    文件:WorldChangeEvent.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldChange(PlayerChangedWorldEvent e) {
    try {
        final Player p = e.getPlayer();
        if (!plugin.getVanishStateMgr().isVanished(p.getUniqueId()))
            return;
        // check auto-reappear option
        if (plugin.getSettings().getBoolean("VanishStateFeatures.ReappearOnWorldChange")
                || plugin.getSettings().getBoolean("VanishStateFeatures.CheckPermissionOnWorldChange")
                && !CommandAction.VANISH_SELF.checkPermission(p, plugin)) {
            plugin.getVisibilityChanger().showPlayer(p);
        }
    } catch (Exception er) {
        plugin.logException(er);
    }
}
项目:buildinggame    文件:MainScoreboardWorldChange.java   
/**
    * Handles the main scoreboard for players switching worlds
    *
    * @param e an event representing a player who switched between worlds
    * @see PlayerChangedWorldEvent
    * @since 3.1.1
    */
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent e) {
    YamlConfiguration config = SettingsManager.getInstance().getConfig();

    Player player = e.getPlayer();
    MainScoreboardManager manager = MainScoreboardManager.getInstance();

    if (!config.getBoolean("scoreboards.main.enable"))
        return;

    if (config.getStringList("scoreboards.main.worlds.enable").contains(player.getWorld().getName()))
        //show scoreboard and other stuff
        manager.register(player);
    else if (config.getStringList("scoreboards.main.worlds.enable").contains(e.getFrom().getName())) {
        //show scoreboard and other stuff
        manager.remove(player);
        player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
    }
}
项目:HoloAPI    文件:HoloListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onWorldChange(PlayerChangedWorldEvent event) {
    final Player player = event.getPlayer();
    for (final Hologram h : HoloAPI.getManager().getAllHolograms().keySet()) {
        if (player.getLocation().getWorld().getName().equals(h.getWorldName()) && h.getVisibility().isVisibleTo(player, h.getSaveId())) {
            if (h instanceof AnimatedHologram && !((AnimatedHologram) h).isAnimating()) {
                ((AnimatedHologram) h).animate();
            }
            h.show(player, true);
        } else if (event.getFrom().getName().equals(h.getWorldName()) && h.getLocationFor(player) != null) {
            new BukkitRunnable() {
                @Override
                public void run() {
                    h.clear(player);
                }
            }.runTaskLater(HoloAPI.getCore(), 20L);
        }
    }
}
项目:SwornPermissions    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChangedWorld(PlayerChangedWorldEvent event)
{
    Player player = event.getPlayer();
    User user = plugin.getPermissionHandler().getUser(player);
    if (user == null)
    {
        player.sendMessage(plugin.getPrefix() + FormatUtil.format("Failed to get a user instance! Contact an administrator!"));
        return;
    }

    user = plugin.getPermissionHandler().moveWorld(player, event.getFrom(), player.getWorld());

    boolean force = plugin.getConfig().getBoolean("forceUpdate.worldChange", false);
    user.updatePermissions(player, force);
}
项目:AlmuraForgeBridge    文件:PlayerListener.java   
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event) {
    Bukkit.getScheduler().scheduleAsyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
        @Override
        public void run() {
            final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
            ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res);

            for (Player player : Bukkit.getServer().getOnlinePlayers()) {
                ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
                TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer()));
                TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player));
            }
        }
    }, 20L);
}
项目:Stoa    文件:ZoneListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldSwitch(PlayerChangedWorldEvent event) {
    // Only continue if the player is a character
    Player player = event.getPlayer();
    PlayerModel playerSave = PlayerUtil.fromPlayer(player);

    // Leaving a disabled world
    if (ZoneUtil.isNoStoaWorld(event.getFrom()) && !ZoneUtil.isNoStoaWorld(player.getWorld())) {
        if (playerSave.getCharacter() != null) {
            playerSave.saveMortalInventory(player);
            playerSave.getCharacter().applyToPlayer(player);
        }
        player.sendMessage(ChatColor.YELLOW + "Demigods is enabled in this world.");
    }
    // Entering a disabled world
    else if (!ZoneUtil.isNoStoaWorld(event.getFrom()) && ZoneUtil.isNoStoaWorld(player.getWorld())) {
        if (playerSave.getCharacter() != null) playerSave.setToMortal();
        player.sendMessage(ChatColor.GRAY + "Demigods is disabled in this world.");
    }
}
项目:GoogleAnalyticsPlugin    文件:GoogleAnalyticsEventListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangedWorld(PlayerChangedWorldEvent event){
    if(enableEventEnter) {
        try {
            Player player = event.getPlayer();

            if(!player.hasPermission("googleanalyticsplugin.ignore")) {
                String worldName = player.getLocation().getWorld().getName();

                plugin.getTracker().TrackAction(getClientName(plugin, player), getClientId(player), getClientIP(player.getAddress().getAddress()), player.getName(), "Enter", worldName);
            }
        }
        catch(Exception e) {
            plugin.getLogger().warning("Event Listener Error: " + e.getMessage());
        }
    }
}
项目:tregmine    文件:WarpListener.java   
@EventHandler
public void onWarp(PlayerChangedWorldEvent e) {

    Player p = e.getPlayer();

    if(p.getWorld().getName() != "Christmas"){
        return;
    }

    plugin.getConfig().set("player." + p.getName() + ".warp", plugin.getConfig().getBoolean("player." + p.getName() + ".warp"));
    plugin.saveConfig();

    if(plugin.getConfig().getBoolean("whitelist.warp.status") == true
            && plugin.getConfig().getBoolean("player." + p.getName() + ".warp") == false){
        World world = Bukkit.getServer().getWorld(plugin.getConfig().getString("portal" + ".returnWorld"));
        p.teleport(world.getSpawnLocation());
        p.sendMessage(ChatColor.RED + plugin.getConfig().getString("whitelist.warp.message"));
    }
}
项目:Demigods3    文件:ZoneListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldSwitch(PlayerChangedWorldEvent event) {
    // Only continue if the player is a character
    Player player = event.getPlayer();
    DemigodsPlayer playerSave = DemigodsPlayer.of(player);

    // Leaving a disabled world
    if (Zones.isNoDemigodsWorld(event.getFrom()) && !Zones.isNoDemigodsWorld(player.getWorld())) {
        if (playerSave.getCharacter() != null) {
            playerSave.saveMortalInventory(player);
            playerSave.getCharacter().applyToPlayer(player);
        }
        player.sendMessage(ChatColor.YELLOW + "Demigods is enabled in this world.");
    }
    // Entering a disabled world
    else if (!Zones.isNoDemigodsWorld(event.getFrom()) && Zones.isNoDemigodsWorld(player.getWorld())) {
        if (playerSave.getCharacter() != null) playerSave.setToMortal();
        player.sendMessage(ChatColor.GRAY + "Demigods is disabled in this world.");
    }
}
项目:ScoreboardStats    文件:PlayerListener.java   
/**
 * Check if the player moves in a scoreboard disabled world
 *
 * @param worldChange the teleport event
 * @see com.github.games647.scoreboardstats.RefreshTask
 */
//ignore cancelled events
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onWorldChange(PlayerChangedWorldEvent worldChange) {
    Player player = worldChange.getPlayer();
    //new world
    if (Settings.isActiveWorld(player.getWorld().getName())) {
        //old world
        if (!Settings.isActiveWorld(worldChange.getFrom().getName())) {
            //Activate the scoreboard if it was disabled
            plugin.getRefreshTask().addToQueue(player);
        }
    } else {
        //Disable the scoreboard if the player goes into a disabled world
        plugin.getRefreshTask().remove(player);
        plugin.getScoreboardManager().unregister(player);
    }
}
项目:SpectatorPlus    文件:ServerActionsListener.java   
/**
 * Handles MultiverseInventories & other similar plugins.
 *
 * Disables spectate mode to restore proper inventory before world change; then
 * re-enables spectate mode to restore spectator inventory after world change.
 */
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true)
public void onWorldChange(final PlayerChangedWorldEvent ev)
{
    final Spectator spectator = p.getPlayerData(ev.getPlayer());

    if (spectator.isSpectating())
    {
        spectator.setWasSpectatorBeforeWorldChanged(true);
        spectator.setSpectating(false, null, true, true);

        RunTask.later(new Runnable()
        {
            @Override
            public void run()
            {
                if (spectator.wasSpectatorBeforeWorldChanged())
                {
                    spectator.setSpectating(true, null, true, true);
                    spectator.setWasSpectatorBeforeWorldChanged(false);
                }
            }
        }, 5l);
    }
}
项目:SwornGuns    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangedWorld(PlayerChangedWorldEvent event)
{
    // Updates a player's guns when they change worlds, useful for per-world permissions
    if (plugin.getConfig().getBoolean("updateGunsOnWorldChange", false))
    {
        final Player player = event.getPlayer();

        // This basically ensures that permissions have a chance to
        // load and accounts for async world changed event
        new BukkitRunnable()
        {
            @Override
            public void run()
            {
                GunPlayer gp = plugin.getGunPlayer(player);
                gp.calculateGuns();
            }
        }.runTaskLater(plugin, 20L);
    }
}
项目:SelfMadeRegion    文件:PlayerChangedWorldListener.java   
@EventHandler
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
    Player player = event.getPlayer();
    String halfPath = player.getName().toLowerCase() + "|";

    if (Configuration.players.contains(halfPath + player.getWorld().getName().toLowerCase()) || player.getGameMode() == GameMode.CREATIVE) {
        if (!player.getAllowFlight()) {
            player.setAllowFlight(true);
        }

        return;
    }

    if (Configuration.players.contains(halfPath + event.getFrom().getName().toLowerCase())) {
        if (player.getAllowFlight()) {
            player.setAllowFlight(false);
        }
    }
}
项目:AntiCheat    文件:OrebfuscatorPlayerListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) {
    BlockHitManager.clearHistory(event.getPlayer());

    if (OrebfuscatorConfig.UseProximityHider) {
        ProximityHider.clearBlocksForOldWorld(event.getPlayer());
        ProximityHider.addPlayerToCheck(event.getPlayer(), null);
    }
}
项目:EscapeLag    文件:ChunkUnloader.java   
@EventHandler
public void LeaveWorldCheck(PlayerChangedWorldEvent event) {
    if (ConfigOptimize.chunkUnloader == true && event.getFrom().getPlayers().isEmpty()) {
        Chunk[] loadedChunks = event.getFrom().getLoadedChunks();
        int lcl = loadedChunks.length;
        for (int i = 0; i < lcl; i++) {
            Chunk chunk = loadedChunks[i];
            if (chunk.isLoaded() == true & ChunkKeeper.ShouldKeepList.contains(chunk) == false) {
                chunk.unload();
                ChunkUnloaderTimes++;
            }
        }
    }
}
项目:MCGameInfoPlugin    文件:Plugin.java   
@EventHandler
public void on(PlayerChangedWorldEvent event) {
    if (getConfig().getBoolean("apiOnly") || !enableGameDetector) { return; }
    if (resetPattern.matches(event.getPlayer().getWorld().getName())) {
        getClient().leaveGame(event.getPlayer().getName(), event.getPlayer().getUniqueId());
    } else {
        gamePatterns.stream().filter(pattern ->
                pattern.matches(event.getPlayer().getWorld().getName())).forEach(pattern ->
                getClient().joinGame(event.getPlayer().getName(), event.getPlayer().getUniqueId(), pattern.getGame()));
    }
}
项目:HCFCore    文件:PortalListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onWorldChanged(PlayerChangedWorldEvent event) {
    Player player = event.getPlayer();
    World from = event.getFrom();
    World to = player.getWorld();
    if (from.getEnvironment() != World.Environment.THE_END && to.getEnvironment() == World.Environment.THE_END && player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
        player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
    }
}
项目:HCFCore    文件:PortalListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onWorldChanged(PlayerChangedWorldEvent event) {
    Player player = event.getPlayer();
    World from = event.getFrom();
    World to = player.getWorld();
    if (from.getEnvironment() != World.Environment.THE_END && to.getEnvironment() == World.Environment.THE_END && player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
        player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
    }
}
项目:NametagEdit    文件:NametagHandler.java   
/**
 * Some users may have different permissions per world.
 * If this is enabled, their tag will be reloaded on TP.
 */
@EventHandler
public void onTeleport(final PlayerChangedWorldEvent event) {
    if (!refreshTagOnWorldChange) return;

    new BukkitRunnable() {
        @Override
        public void run() {
            applyTagToPlayer(event.getPlayer());
        }
    }.runTaskLater(plugin, 3);
}
项目:HoloGUIApi    文件:PlayerChangedWorldEventListener.java   
@EventHandler
public void playerChangedWorldEvent(PlayerChangedWorldEvent event)
{
    Player player = event.getPlayer();

    PlayerGUIPage playerGUIContainer = PlayerData.getPlayerData(player).getPlayerGUIPage();
    if(playerGUIContainer != null)
    {
        playerGUIContainer.destroy();
        PlayerData.getPlayerData(player).setPlayerGUIPage(null);
        PlayerData.getPlayerData(player).setPlayerPreviousGUIPage(null);
    }

    for(StationaryGUIDisplayContainer stationaryDisplay : holoGUI.getStationaryDisplays())
    {
        if(stationaryDisplay.playerInRange(player))
        {
            if(!stationaryDisplay.isDisplayingToPlayer(player))//player in range of display but not currently viewing the stationary gui, make gui visible
            {
                stationaryDisplay.display(player);
            }
        }
        else if(stationaryDisplay.isDisplayingToPlayer(player))//player was viewing the stationary gui, but moved out of range. Remove the gui for that player
        {
            stationaryDisplay.destroy(player);
        }
    }
}
项目:SharpSK    文件:ExprEventWorld.java   
@Override
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean arg2, ParseResult result) {
    if (!ScriptLoader.isCurrentEvent(PlayerChangedWorldEvent.class)) {
        return false;
    } else {
        mark = result.mark;
        return true;
    }
}
项目:SharpSK    文件:ExprEventWorld.java   
@Override
@Nullable
protected World[] get(Event e) {
    if (e.getEventName().equals("PlayerChangedWorldEvent")) {
        if (mark == 0) {
            return new World[] { ((PlayerChangedWorldEvent) e).getPlayer().getWorld() };
        } else if (mark == 1) {
            return new World[] { ((PlayerChangedWorldEvent) e).getPlayer().getWorld() };
        } else if (mark == -1) {
            return new World[] { ((PlayerChangedWorldEvent) e).getFrom() };
        }
    }
    return null;
}
项目:SharpSK    文件:ExprEventWorldLoc.java   
@Override
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean arg2, ParseResult result) {
    if (!ScriptLoader.isCurrentEvent(PlayerChangedWorldEvent.class)) {
        Skript.error("This expression can only be used in an \"on world change\" event.",
                ErrorQuality.SEMANTIC_ERROR);
        return false;
    }
    mark = result.mark;
    return true;
}
项目:SharpSK    文件:ExprEventWorldLoc.java   
@Override
@Nullable
protected Location[] get(Event e) {
    if (mark == 0) {
        return new Location[] { ((PlayerChangedWorldEvent) e).getPlayer().getLocation() };
    } else if (mark == 1) {
        return new Location[] { ((PlayerChangedWorldEvent) e).getPlayer().getLocation() };
    } else if (mark == -1) {
        return new Location[] { ((PlayerChangedWorldEvent) e).getFrom().getSpawnLocation() };
    }
    return null;
}
项目:QuestManager    文件:QuestManager.java   
@EventHandler
public void onPlayerJoin(PlayerChangedWorldEvent e) {
    if (QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getWorlds().contains(
            e.getPlayer().getWorld().getName())) {
        //if they're coming to a quest world, make sure we have a player for them
        QuestManagerPlugin.questManagerPlugin.getPlayerManager().getPlayer(
                e.getPlayer().getUniqueId());
    }
}
项目:Skellett    文件:ExprWorldChangeFrom.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(PlayerChangedWorldEvent.class)) {
        Skript.error("You can not use PastWorld expression in any event but world change event!");
        return false;
    }
    return true;
}
项目:BloodMoon    文件:NetherSkyListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onChangeWorlds(PlayerChangedWorldEvent event) {
    World world = event.getPlayer().getWorld();

    if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.NETHER_SKY)) {
        this.sendWorldEnvironment(event.getPlayer(), Environment.NETHER);
    }
}
项目:BloodMoon    文件:TexturePackListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
    Player player = event.getPlayer();
    World from = event.getFrom();
    World to = player.getWorld();
    PluginConfig worldConfig = plugin.getConfig(to);

    if (plugin.isFeatureEnabled(to, Feature.TEXTURE_PACK)) {
        if (!plugin.isActive(from) && plugin.isActive(to)) {
            player.setResourcePack(worldConfig.getString(Config.FEATURE_TEXTURE_PACK_BLOODMOON));
        } else if (plugin.isActive(from) && !plugin.isActive(to)) {
            player.setResourcePack(worldConfig.getString(Config.FEATURE_TEXTURE_PACK_NORMAL));
        }
    }
}
项目:BloodMoon    文件:PlaySoundListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
    World world = event.getPlayer().getWorld();

    if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.PLAY_SOUND)) {
        playSound(world, event.getPlayer());
    }
}
项目:SuperVanish    文件:NightVision.java   
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent e) {
    Player p = e.getPlayer();
    if (!plugin.getVanishStateMgr().isVanished(p.getUniqueId()))
        return;
    sendAddPotionEffect(p, new PotionEffect(PotionEffectType.NIGHT_VISION,
            INFINITE_POTION_EFFECT_LENGTH, 0));
}
项目:BedwarsRel    文件:PlayerListener.java   
@EventHandler
public void onSwitchWorld(PlayerChangedWorldEvent change) {
  Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(change.getPlayer());
  if (game != null) {
    if (game.getState() == GameState.RUNNING) {
      if (!game.getCycle().isEndGameRunning()) {
        if (!game.getPlayerSettings(change.getPlayer()).isTeleporting()) {
          game.playerLeave(change.getPlayer(), false);
        } else {
          game.getPlayerSettings(change.getPlayer()).setTeleporting(false);
        }
      }
    } else if (game.getState() == GameState.WAITING) {
      if (!game.getPlayerSettings(change.getPlayer()).isTeleporting()) {
        game.playerLeave(change.getPlayer(), false);
      } else {
        game.getPlayerSettings(change.getPlayer()).setTeleporting(false);
      }
    }
  }

  if (!BedwarsRel.getInstance().isHologramsEnabled()
      || BedwarsRel.getInstance().getHolographicInteractor() == null) {
    return;
  }

  BedwarsRel.getInstance().getHolographicInteractor().updateHolograms(change.getPlayer());
}
项目:AIOJetpacks    文件:AIOPlugin.java   
@EventHandler
public void onPlayerChangedWorld(final PlayerChangedWorldEvent e)
{
    AIOPlugin.getInstance().getJetpackManager().removeJetpackItemForPlayer(e.getPlayer());
    // Run this after 20 ticks because some plugins are updating variables
    this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
        @Override
        public void run()
        {
            AIOPlugin.getInstance().getJetpackManager().checkJetpackItemForPlayer(e.getPlayer());
        }
    }, 20);
}