类org.bukkit.event.world.WorldLoadEvent源码实例Demo

下面列出了怎么用org.bukkit.event.world.WorldLoadEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Crazy-Crates   文件: BrokeLocationsControl.java
@EventHandler
public void onWorldLoad(WorldLoadEvent e) {
    if (!cc.getBrokeCrateLocations().isEmpty()) {
        int fixedAmount = 0;
        List<BrokeLocation> fixedWorlds = new ArrayList<>();
        for (BrokeLocation brokeLocation : cc.getBrokeCrateLocations()) {
            Location location = brokeLocation.getLocation();
            if (location.getWorld() != null) {
                cc.getCrateLocations().add(new CrateLocation(brokeLocation.getLocationName(), brokeLocation.getCrate(), location));
                fixedWorlds.add(brokeLocation);
                fixedAmount++;
            }
        }
        cc.getBrokeCrateLocations().removeAll(fixedWorlds);
        if (fileManager.isLogging()) {
            System.out.println(fileManager.getPrefix() + "Fixed " + fixedAmount + " broken crate locations.");
            if (cc.getBrokeCrateLocations().isEmpty()) {
                System.out.println(fileManager.getPrefix() + "All broken crate locations have been fixed.");
            }
        }
    }
}
 
源代码2 项目: Carbon   文件: CarbonWorldGenerator.java
@EventHandler()
public void onWorldLoad(WorldLoadEvent evt) {
    //Add populator on world load
    World world = evt.getWorld();
    if (
        plugin.getConfig().getStringList("options.worlds").contains(world.getName()) && (
            !world.getPopulators().contains(dioritePopulator)
            && !world.getPopulators().contains(andesitePopulator)
            && !world.getPopulators().contains(granitePopulator)
        )
    ) {
        Carbon.log.log(Level.INFO, "[Carbon] Editing world: {0}", world.getName());
        Carbon.log.log(Level.INFO, "[Carbon] Adding populator for world: {0}", world.getName());
        world.getPopulators().add(dioritePopulator);
        world.getPopulators().add(andesitePopulator);
        world.getPopulators().add(granitePopulator);
        Carbon.log.log(Level.INFO, "[Carbon] Done editing world: {0}", world.getName());
	}
}
 
源代码3 项目: PGM   文件: WorldProblemListener.java
@EventHandler
public void warnRandomTickRate(WorldLoadEvent event) {
  String str = event.getWorld().getGameRuleValue("randomTickSpeed");
  if (str != null) {
    int value = Integer.parseInt(str);
    if (value > RANDOM_TICK_SPEED_LIMIT) {
      broadcastDeveloperWarning(
          "Gamerule 'randomTickSpeed' is set to "
              + value
              + " for this world (normal value is 3). This may overload the server.");
    }
  }
}
 
源代码4 项目: UltimateChat   文件: UCListener.java
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldLoad(WorldLoadEvent e) {
    if (!UChat.get().getConfig().contains("general.default-channels.worlds." + e.getWorld().getName())) {
        UChat.get().getConfig().set("general.default-channels.worlds." + e.getWorld().getName() + ".channel", UChat.get().getConfig().contains("general.default-channels.default-channel"));
        UChat.get().getConfig().set("general.default-channels.worlds." + e.getWorld().getName() + ".force", false);
    }
}
 
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldLoadEvent(WorldLoadEvent event)
{
	World world = event.getWorld();
	
	this.plugin.getWorldGuardCommunicator().doUnloadChunkFlagCheck(world);
}
 
源代码6 项目: EliteMobs   文件: FindNewWorlds.java
@EventHandler
public void onWorldLoad(WorldLoadEvent event) {

    ValidWorldsConfig validWorldsConfig = new ValidWorldsConfig();
    validWorldsConfig.initializeConfig();
    ConfigValues.validWorldsConfig = validWorldsConfig.configuration;

    if (event.getWorld().getName().equals(ConfigValues.adventurersGuildConfig.getString(AdventurersGuildConfig.GUILD_WORLD_NAME))) {
        NPCInitializer npcInitializer = new NPCInitializer();
    }

}
 
源代码7 项目: DungeonsXL   文件: GlobalProtectionListener.java
@EventHandler
public void onWorldLoad(WorldLoadEvent event) {
    World world = event.getWorld();
    for (Entry<UnloadedProtection, String> entry : new HashSet<>(plugin.getGlobalProtectionCache().getUnloadedProtections().entrySet())) {
        if (world.getName().equals(entry.getValue())) {
            entry.getKey().load(world);
        }
    }
}
 
源代码8 项目: RedProtect   文件: WorldListener.java
@EventHandler(priority = EventPriority.NORMAL)
public void onWorldLoad(WorldLoadEvent e) {
    World w = e.getWorld();
    try {
        RedProtect.get().rm.load(w.getName());
        // RedProtect.get().config.addWorldProperties(w);

        RedProtect.get().reloadConfigs();
        RedProtect.get().logger.warning("World loaded: " + w.getName());
    } catch (Exception ex) {
        RedProtect.get().logger.severe("RedProtect problem on load world:");
        ex.printStackTrace();
    }
}
 
源代码9 项目: UHC   文件: GlobalPVPModule.java
@EventHandler
public void on(WorldLoadEvent event) {
    final World world = event.getWorld();

    if (worlds.worldMatches(world)) {
        world.setPVP(isEnabled());
    }
}
 
源代码10 项目: UHC   文件: DifficultyModule.java
@EventHandler
public void on(WorldLoadEvent event) {
    if (isEnabled()) {
        if (worlds.worldMatches(event.getWorld())) {
            event.getWorld().setDifficulty(Difficulty.HARD);
        }
    }
}
 
源代码11 项目: HoloAPI   文件: WorldListener.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onWorldLoad(WorldLoadEvent event) {
    for (Map.Entry<String, String> entry : new HashMap<>(UNLOADED_HOLOGRAMS).entrySet()) {
        if (entry.getValue().equals(event.getWorld().getName())) {
            HoloAPI.LOG.info("Loading hologram " + entry.getKey() + " into world " + entry.getValue() + ".");
            if (((SimpleHoloManager) HoloAPI.getManager()).loadFromFile(entry.getKey()) != null) {
                UNLOADED_HOLOGRAMS.remove(entry.getKey());
            }
        }
    }
}
 
源代码12 项目: Kettle   文件: CraftServer.java
@Override
public World createWorld(WorldCreator creator) {
    Validate.notNull(creator, "Creator may not be null");

    String name = creator.name();
    ChunkGenerator generator = creator.generator();
    File folder = new File(getWorldContainer(), name);
    World world = getWorld(name);
    WorldType type = WorldType.parseWorldType(creator.type().getName());
    boolean generateStructures = creator.generateStructures();

    if ((folder.exists()) && (!folder.isDirectory())) {
        throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
    }

    if (world != null) {
        return world;
    }

    boolean hardcore = false;

    WorldSettings worldSettings = new WorldSettings(creator.seed(), WorldSettings.getGameTypeById(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
    WorldServer internal = DimensionManager.initDimension(creator, worldSettings);

    pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
    System.out.println("Preparing start region for level " + (console.worldServerList.size() - 1) + " (Seed: " + internal.getSeed() + ")");

    if (internal.getWorld().getKeepSpawnInMemory()) {
        short short1 = 196;
        long i = System.currentTimeMillis();
        for (int j = -short1; j <= short1; j += 16) {
            for (int k = -short1; k <= short1; k += 16) {
                long l = System.currentTimeMillis();

                if (l < i) {
                    i = l;
                }

                if (l > i + 1000L) {
                    int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
                    int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;

                    System.out.println("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
                    i = l;
                }

                BlockPos chunkcoordinates = internal.getSpawnPoint();
                internal.getChunkProvider().loadChunk(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
            }
        }
    }
    pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
    return internal.getWorld();
}
 
源代码13 项目: GlobalWarming   文件: WorldListener.java
@EventHandler(ignoreCancelled = true)
public void onWorldLoad(WorldLoadEvent loadEvent) {
    gw.getLogger().info("Detected world load after GW enabled, triggering automatic climate engine load.");
    ClimateEngine.getInstance().loadWorldClimateEngine(loadEvent.getWorld());
}
 
源代码14 项目: UltimateChat   文件: UCListener.java
@EventHandler
public void onCreateWorld(WorldLoadEvent e) {
    UChat.get().reload();
}
 
源代码15 项目: LagMonitor   文件: ThreadSafetyListener.java
@EventHandler
public void onWorldLoad(WorldLoadEvent worldLoadEvent) {
    checkSafety(worldLoadEvent);
}
 
源代码16 项目: Thermos   文件: CraftServer.java
@Override
public World createWorld(WorldCreator creator) {
    Validate.notNull(creator, "Creator may not be null");

    String name = creator.name();
    ChunkGenerator generator = creator.generator();
    File folder = new File(getWorldContainer(), name);
    World world = getWorld(name);
    net.minecraft.world.WorldType type = net.minecraft.world.WorldType.parseWorldType(creator.type().getName());
    boolean generateStructures = creator.generateStructures();

    if ((folder.exists()) && (!folder.isDirectory())) {
        throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
    }

    if (world != null) {
        return world;
    }

    boolean hardcore = false;
    WorldSettings worldSettings = new WorldSettings(creator.seed(), net.minecraft.world.WorldSettings.GameType.getByID(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
    net.minecraft.world.WorldServer worldserver = DimensionManager.initDimension(creator, worldSettings);

    pluginManager.callEvent(new WorldInitEvent(worldserver.getWorld()));
    net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = true;
    System.out.print("Preparing start region for level " + (console.worlds.size() - 1) + " (Dimension: " + worldserver.provider.dimensionId + ", Seed: " + worldserver.getSeed() + ")"); // Cauldron - log dimension

    if (worldserver.getWorld().getKeepSpawnInMemory()) {
        short short1 = 196;
        long i = System.currentTimeMillis();
        for (int j = -short1; j <= short1; j += 16) {
            for (int k = -short1; k <= short1; k += 16) {
                long l = System.currentTimeMillis();

                if (l < i) {
                    i = l;
                }

                if (l > i + 1000L) {
                    int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
                    int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;

                    System.out.println("Preparing spawn area for " + worldserver.getWorld().getName() + ", " + (j1 * 100 / i1) + "%");
                    i = l;
                }

                net.minecraft.util.ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
                worldserver.theChunkProviderServer.loadChunk(chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4);
            }
        }
    }
    pluginManager.callEvent(new WorldLoadEvent(worldserver.getWorld()));
    net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = false;
    return worldserver.getWorld();
}
 
源代码17 项目: UHC   文件: HealthRegenerationModule.java
@EventHandler
public void on(WorldLoadEvent event) {
    event.getWorld().setGameRuleValue(GAME_RULE, isEnabled() ? "true" : "false");
}
 
源代码18 项目: LagMonitor   文件: ThreadSafetyListener.java
@EventHandler
public void onWorldLoad(WorldLoadEvent worldLoadEvent) {
    checkSafety(worldLoadEvent);
}
 
源代码19 项目: Slimefun4   文件: WorldListener.java
@EventHandler
public void onWorldLoad(WorldLoadEvent e) {
    SlimefunPlugin.getWorldSettingsService().load(e.getWorld());
    BlockStorage.getForcedStorage(e.getWorld());
}
 
源代码20 项目: Shopkeepers   文件: WorldListener.java
@EventHandler(priority = EventPriority.LOWEST)
void onWorldLoad(WorldLoadEvent event) {
	plugin.loadShopkeepersInWorld(event.getWorld());
}
 
 类所在包
 类方法
 同包方法