Different worldborder for different world

Discussion in 'Plugin Development' started by GOOST, Sep 12, 2024.

  1. Offline

    GOOST

    The worldborder in the 'main world' (which is the one in the server properties) and the '2nd world''s worldborder is being shared, and by shared, I mean the image is being shared, if I change the worldborder with my own plugin in my '2nd world', the border will not shrink but an invisible border will shrink, and yes, the invisible worldborder works, dmg the player, stops player from placing blocks.


    The visible border in '2nd world' is actually the border in 'main world' and players won't be able to see the 'real border' for '2nd world'.

    So if multiverse has a solution for this problem. Does anyone know about how to solve this problem?





    I used worldborder plugin too, and it does not solve the problem
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    GOOST

    Sorry for late reply

    Code:
     if (currentStep >= steps) {
                            border.setCenter(finalX, finalZ);  // Ensure final position is exactly the target position
                            border.setSize(finalSize, time);  // Ensure final size is set exactly
                            cancel();  // Stop the task
                        } else {
                            double newX = initialX + stepX * currentStep;
                            double newZ = initialZ + stepZ * currentStep;
                            double newSize = initialSize + stepSizeChange * currentStep;
    
                            border.setCenter(newX, newZ);  // Move the border bit by bit
                            border.setSize(newSize);  // Adjust the size bit by bit
    
                            currentStep++;
                        }

    Code:
    @EventHandler
        public void onWorldLoad(WorldLoadEvent event) {
            World world = event.getWorld();
            if (world.getName().equals("world")) {
                WorldBorder border = world.getWorldBorder();
                border.setCenter(0, 0);
                border.setSize(2000);
                Bukkit.getLogger().info("Worldborder for 'world' initialized.");
            }
            if (world.getName().equals("worldKill")) {
                WorldBorder border = world.getWorldBorder();
                border.setCenter(-193.41, 457.43);
                border.setSize(1400);
                Bukkit.getLogger().info("Worldborder for 'worldKill' initialized.");
            }
            debugWorldBorders();
        }
    Here, the world "world" is the native world in the server.properties,
    and the world "worldKill" is the new world I added to the server.
     
  4. Offline

    timtower Administrator Administrator Moderator

    @GOOST Does just setting it work or not?
    Is it just the steps thing that is breaking it?
     
  5. Offline

    GOOST

    @timtower
    Setting it? Like the set center and set size? those work but, the border blue and white thin is not moving in-game, while it is moving
    and the steps thing is working fine

    The code itself works fine, but the problem is that the border is invisible in-game, but still damages players, and prevents players from breaking, and placing blocks.

    I want the players to see the border itself, but the border showing in world "worldKill" is the border from the world "world", while the ACTUAL border is working.

    I know this sounds super confusing, but this is the best I can explain.
     
  6. Offline

    GOOST

    Fixed it. turns out that I forgot to add

    Code:
    player.setWorldBorder(border);
    which.. I thought I did :p
     

Share This Page