Server::setSpawnLocation()

Discussion in 'Plugin Development' started by azoundria, Jan 27, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    azoundria

    Okay, so there appears to be a Server::getSpawnLocation().

    Is anyone planning to let plugins adjust the spawn point? (Yes I checked the todo list.)
     
  2. Offline

    yottabyte

    Here's how the General plugin does it:


    Code:
            server.m = (int)Math.ceil(player.getLocation().getX());
            server.o = (int)Math.ceil(player.getLocation().getZ());
     
  3. Offline

    azoundria

    Before I go through some more hours of frustration, let me confirm. So I would do:

    The m and o variables in the server class are public, and anyone can set them?
    --- merged: Feb 1, 2011 8:19 AM ---
    Okay I'm very lost. There doesn't appear to be any variable 'm' in Server. Can anyone else help me with this please?
     
  4. Offline

    robhol

    Apparently so. However, directly modifying or referencing the minecraft server is rarely considered a good idea. At best, it would be a temporary solution. The reason is that the minecraft server is obfuscated - and that obfuscation is reapplied for every new version, so anything that references it would have to be adjusted.
     
  5. Offline

    azoundria

    How do mods like Essentials set the spawn point?
     
  6. Offline

    Mixcoatl

    There is no supported way in Bukkit right now to set the spawn point. Essentials uses the same mechanism described above.
     
  7. Offline

    azoundria

    Can anyone help me understand the above mechanism?

    I do not care if my code breaks later. I only need to run it once/week. So I should be able to fix it in time.
    --- merged: Feb 3, 2011 8:29 AM ---
    For all curious, here is the code that Essentials uses:

    Code:
                    WorldServer handle = ((CraftWorld)player.getWorld()).getHandle();
                    handle.spawnX = player.getLocation().getBlockX();
                    handle.spawnY = player.getLocation().getBlockY();
                    handle.spawnZ = player.getLocation().getBlockZ();
    Thanks for all your help guys.
     
Thread Status:
Not open for further replies.

Share This Page