gt:         return spawnSettings.containsKey(id) && spawnSettings.get(id);
context: package net.minecraftforge.common;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.BitSet;
  import java.util.Hashtable;
  import java.util.List;
  import java.util.ListIterator;
  import java.util.Map;
  import java.util.Map.Entry;
  import java.util.concurrent.ConcurrentMap;
  
  import org.apache.logging.log4j.Level;
  
  import com.google.common.collect.HashMultiset;
  import com.google.common.collect.Lists;
  import com.google.common.collect.MapMaker;
  import com.google.common.collect.Multiset;
  import cpw.mods.fml.common.FMLCommonHandler;
  import cpw.mods.fml.common.FMLLog;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.server.MinecraftServer;
  import net.minecraft.world.MinecraftException;
  import net.minecraft.world.World;
  import net.minecraft.world.WorldManager;
  import net.minecraft.world.WorldProvider;
  import net.minecraft.world.WorldProviderEnd;
  import net.minecraft.world.WorldProviderHell;
  import net.minecraft.world.WorldProviderSurface;
  import net.minecraft.world.WorldServer;
  import net.minecraft.world.WorldServerMulti;
  import net.minecraft.world.WorldSettings;
  import net.minecraft.world.storage.ISaveHandler;
  import net.minecraft.world.storage.SaveHandler;
  import net.minecraftforge.event.world.WorldEvent;
  
  public class DimensionManager
  {
      private static Hashtable<Integer, Class<? extends WorldProvider>> providers = new Hashtable<Integer, Class<? extends WorldProvider>>();
      private static Hashtable<Integer, Boolean> spawnSettings = new Hashtable<Integer, Boolean>();
      private static Hashtable<Integer, WorldServer> worlds = new Hashtable<Integer, WorldServer>();
      private static boolean hasInit = false;
      private static Hashtable<Integer, Integer> dimensions = new Hashtable<Integer, Integer>();
      private static ArrayList<Integer> unloadQueue = new ArrayList<Integer>();
      private static BitSet dimensionMap = new BitSet(Long.SIZE << 4);
      private static ConcurrentMap<World, World> weakWorldMap = new MapMaker().weakKeys().weakValues().<World,World>makeMap();
      private static Multiset<Integer> leakedWorlds = HashMultiset.create();
  
      public static boolean registerProviderType(int id, Class<? extends WorldProvider> provider, boolean keepLoaded)
      {
          if (providers.containsKey(id))
          {
              return false;
          }
          providers.put(id, provider);
          spawnSettings.put(id, keepLoaded);
          return true;
      }
  
      /**
       * Unregisters a Provider type, and returns a array of all dimensions that are
       * registered to this provider type.
       * If the return size is greater then 0, it is required that the caller either
       * change those dimensions's registered type, or replace this type before the
       * world is attempted to load, else the loader will throw an exception.
       *
       * @param id The provider type ID to unreigster
       * @return An array containing all dimension IDs still registered to this provider type.
       */
      public static int[] unregisterProviderType(int id)
      {
          if (!providers.containsKey(id))
          {
              return new int[0];
          }
          providers.remove(id);
          spawnSettings.remove(id);
  
          int[] ret = new int[dimensions.size()];
          int x = 0;
          for (Map.Entry<Integer, Integer> ent : dimensions.entrySet())
          {
              if (ent.getValue() == id)
              {
                  ret[x++] = ent.getKey();
              }
          }
  
          return Arrays.copyOf(ret, x);
      }
  
      public static void init()
      {
          if (hasInit)
          {
              return;
          }
  
          hasInit = true;
  
          registerProviderType( 0, WorldProviderSurface.class, true);
          registerProviderType(-1, WorldProviderHell.class,    true);
          registerProviderType( 1, WorldProviderEnd.class,     false);
          registerDimension( 0,  0);
          registerDimension(-1, -1);
          registerDimension( 1,  1);
      }
  
      public static void registerDimension(int id, int providerType)
      {
          if (!providers.containsKey(providerType))
          {
              throw new IllegalArgumentException(String.format("Failed to register dimension for id %d, provider type %d does not exist", id, providerType));
          }
          if (dimensions.containsKey(id))
          {
              throw new IllegalArgumentException(String.format("Failed to register dimension for id %d, One is already registered", id));
          }
          dimensions.put(id, providerType);
          if (id >= 0)
          {
              dimensionMap.set(id);
          }
      }
  
      /**
       * For unregistering a dimension when the save is changed (disconnected from a server or loaded a new save
       */
      public static void unregisterDimension(int id)
      {
          if (!dimensions.containsKey(id))
          {
              throw new IllegalArgumentException(String.format("Failed to unregister dimension for id %d; No provider registered", id));
          }
          dimensions.remove(id);
      }
  
      public static boolean isDimensionRegistered(int dim)
      {
          return dimensions.containsKey(dim);
      }
  
      public static int getProviderType(int dim)
      {
          if (!dimensions.containsKey(dim))
          {
              throw new IllegalArgumentException(String.format("Could not get provider type for dimension %d, does not exist", dim));
          }
          return dimensions.get(dim);
      }
  
      public static WorldProvider getProvider(int dim)
      {
          return getWorld(dim).field_73011_w;
      }
  
      public static Integer[] getIDs(boolean check)
      {
          if (check)
          {
              List<World> allWorlds = Lists.newArrayList(weakWorldMap.keySet());
              allWorlds.removeAll(worlds.values());
              for (ListIterator<World> li = allWorlds.listIterator(); li.hasNext(); )
              {
                  World w = li.next();
                  leakedWorlds.add(System.identityHashCode(w));
              }
              for (World w : allWorlds)
              {
                  int leakCount = leakedWorlds.count(System.identityHashCode(w));
                  if (leakCount == 5)
                  {
                      FMLLog.fine("The world %x (%s) may have leaked: first encounter (5 occurences).\n", System.identityHashCode(w), w.func_72912_H().func_76065_j());
                  }
                  else if (leakCount % 5 == 0)
                  {
                      FMLLog.fine("The world %x (%s) may have leaked: seen %d times.\n", System.identityHashCode(w), w.func_72912_H().func_76065_j(), leakCount);
                  }
              }
          }
          return getIDs();
      }
      public static Integer[] getIDs()
      {
          return worlds.keySet().toArray(new Integer[worlds.size()]); //Only loaded dims, since usually used to cycle through loaded worlds
      }
  
      public static void setWorld(int id, WorldServer world)
      {
          if (world != null)
          {
              worlds.put(id, world);
              weakWorldMap.put(world, world);
              MinecraftServer.func_71276_C().worldTickTimes.put(id, new long[100]);
              FMLLog.info("Loading dimension %d (%s) (%s)", id, world.func_72912_H().func_76065_j(), world.func_73046_m());
          }
          else
          {
              worlds.remove(id);
              MinecraftServer.func_71276_C().worldTickTimes.remove(id);
              FMLLog.info("Unloading dimension %d", id);
          }
  
          ArrayList<WorldServer> tmp = new ArrayList<WorldServer>();
          if (worlds.get( 0) != null)
              tmp.add(worlds.get( 0));
          if (worlds.get(-1) != null)
              tmp.add(worlds.get(-1));
          if (worlds.get( 1) != null)
              tmp.add(worlds.get( 1));
  
          for (Entry<Integer, WorldServer> entry : worlds.entrySet())
          {
              int dim = entry.getKey();
              if (dim >= -1 && dim <= 1)
              {
                  continue;
              }
              tmp.add(entry.getValue());
          }
  
          MinecraftServer.func_71276_C().field_71305_c = tmp.toArray(new WorldServer[tmp.size()]);
      }
  
      public static void initDimension(int dim) {
          WorldServer overworld = getWorld(0);
          if (overworld == null)
          {
              throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!");
          }
          try
          {
              DimensionManager.getProviderType(dim);
          }
          catch (Exception e)
          {
              System.err.println("Cannot Hotload Dim: " + e.getMessage());
              return; // If a provider hasn't been registered then we can't hotload the dim
          }
          MinecraftServer mcServer = overworld.func_73046_m();
          ISaveHandler savehandler = overworld.func_72860_G();
          WorldSettings worldSettings = new WorldSettings(overworld.func_72912_H());
  
          WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.func_72912_H().func_76065_j(), dim, worldSettings, overworld, mcServer.field_71304_b));
          world.func_72954_a(new WorldManager(mcServer, world));
          MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
          if (!mcServer.func_71264_H())
          {
              world.func_72912_H().func_76060_a(mcServer.func_71265_f());
          }
  
          mcServer.func_147139_a(mcServer.func_147135_j());
      }
  
      public static WorldServer getWorld(int id)
      {
          return worlds.get(id);
      }
  
      public static WorldServer[] getWorlds()
      {
          return worlds.values().toArray(new WorldServer[worlds.size()]);
      }
  
      public static boolean shouldLoadSpawn(int dim)
      {
          int id = getProviderType(dim);
  