Event after World Generation

Discussion in 'Plugin Development' started by SecretUser001, Apr 28, 2022.

  1. Offline

    SecretUser001

    Is there an event, that is called after a world finished generating?

    Code example:

    WorldHandler.java:
    Code:
    HashMap<String, Player> playerGames = new HashMap<String, Player>();
    public World createGame(String worldName) {
         WorldCreator creator = new WorldCreator(worldName);
         creator.generator(new ClutchGenerator());
         creator.createWorld();
         return Bukkit.getWorld(worldName);
    } 
    GameCmd.java:
    Code:
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        plugin.getWorldHandler().unloadWorld("game");
        plugin.getWorldHandler().deleteWorld(Bukkit.getWorld("game"));
    
        World gameWorld = plugin.getWorldHandler().createGame("game");
        Main.plugin.getWorldHandler().playerGames.put("game", (Player) sender);
    } 
    WorldEventHandler.java:
    Code:
    @EventHandler
    public void onWorldLoad( /*Event, that gets called, when world finished generating*/ event) {
        Main.plugin.getWorldHandler().playerGames.get(event.getWorld()).teleport(event.getWorld.getSpawnLocation())
    }
     
  2. Offline

    Tim_M

    Have you tried WorldLoadEvent?
     

Share This Page