Total Havoc

Discussion in 'Spigot Plugin Development' started by TheShermanTanker, May 20, 2017.

  1. Because I don't use Bungee I substitute it with multi world and yeah






    So I'm making my minigame but the maps work by: when a game starts on a map, the world is renamed to a UUID and a copy of it is pasted into the server folder with the original name and loaded, to prevent running out of maps to play on. Now its chaos trying to track and run the games on multiple worlds and also having to know what map it is, is there a simple way of doing this?
     
  2. I've used world.setAutoSave(false); to prevent the world from automatically saving changes. I believe you can then unload and reload the world and all changes will be reset.
     
    • Like Like x 1
  3. Thats some good advice, but how do I track multiple games in multiple Worlds?
     
  4. You can have an object representing the games. Within this object keep a reference to the respective World associated with this game.

    You can also have a map, where the string would be the world name, then the key would be an array/list/set of these game objects.

    Or if there is only one game per world: <String, Game>
     
  5. Hmm... 1 world = 1map and when the game starts on that map another world loads to take its place so games don't run out...
     
  6. Code (Text):
    UUID uuid;

        //store your stats about it here, deaths, kills, random shit, etc.

        public GameWorld(World world) {
            uuid = UUID.fromString(world.getName());
           
            //register your stats from where you're storing them
        }
       
        //methods here for your stats
     
  7. I am pretty sure World#getName() doesn't return a UUID...
     
  8. You're right. That's why there is UUID#fromString(world#getName())

    He said he's storing a UUID as the world name. He can add them to a hashmap, with UUID, GameWorld (WorldProfile, whatever you want) and add a getWorld() method to return the world, while still having all the data saved from the GameWorld (stats, players, etc.)
     
  9. Rn The system cant recognise what map is what (basically which game is which) and spawns stuff in the wrong places...
     
  10. what are the methods you're using to retrieve the data? can we see your object's class?
     
  11. Use a map. Have a map with UUID as the key and the Game object as the value. Or vice versa, depending if you want to retrieve the game object by UUID, or the UUID by Game object. On game start, place the values into this map. Also, make sure onDisable to loop through all the values in this map and unload the worlds then delete the folders, just to clear up space in the main directory.


    Sent from my iPhone using Tapatalk
     

Share This Page