[Demonstration 1]

[Buggy Method]
public World getWorld(String worldName) {
    org.spongepowered.api.world.World world = this.game.getServer().getWorld(worldName).orNull();
    if (world == null) {
        logger.warning("World " + worldName + " does not exist");
        return null;
    }
    return new World(world);
}

[Buggy Hunk]
org.spongepowered.api.world.World world = this.game.getServer().getWorld(worldName).orNull();

[Patch]
org.spongepowered.api.world.World world = this.game.getServer().getWorld(worldName).orElse(null);

[Demonstration 2]

[Buggy Method]
public static void main(String[] args) throws Exception {
    //		test();
    loadNativeLibs();
    initUncaughtExceptionHandler();
    /* Initialize the Game */
    Game game = Game.getInstance();
    game.init();
    /* Construct a new World */
    World world = new World("world_1");
    game.setWorld(world);
    world.getWorldProvider().load();
    /* Load the Player */
    Player player = new Player(world.getWorldProvider().getSpawnPoint());
    player.load();
    world.setPlayer(player);
    /* Start the Game */
    game.startGameLoop();
}

[Buggy Hunk]
World world = new World("world_1");

[Patch]
World world = new World("world_1", game);

[Demonstration 3]

[Buggy Method]
@Override
public void startGame(int worldId, int playerId, Session session) {
    if (checkGameStartedAlready(worldId, playerId)) {
        LOG.debug("World {} already started for player {}", worldId, playerId);
        return;
    }
    Set<Integer> players = playerWorldMap.get(worldId);
    if (players != null) {
        LOG.debug("World {} running already.", worldId);
        engine.startGame(playerId, worldId);
        LOG.debug("Adding player {} to playerWorldMap", playerId);
        players.add(playerId);
        LOG.debug("player-world map:" + playerWorldMap.toString());
        LOG.debug("Adding session for player {}", playerId);
        playerSessionMap.put(playerId, session);
        LOG.debug("player-session map:" + playerSessionMap.toString());
    } else {
        // start new world
        engine.startGame(playerId, worldId);
        Broadcaster b = new Broadcaster();
        b.setWorldId(worldId);
        b.setEngine(engine);
        Runner runner = new Runner();
        runner.setBroadCaster(b);
        LOG.debug("Starting new Runner for worldId {}", worldId);
        ScheduledFuture future = scheduledExecutorService.scheduleAtFixedRate(runner, 3, 1000L, TimeUnit.MILLISECONDS);
        // register world, player, future and session
        Set<Integer> newPlayerSet = new HashSet<>();
        newPlayerSet.add(playerId);
        LOG.debug("Adding player {} to world", playerId);
        playerWorldMap.put(worldId, newPlayerSet);
        LOG.debug("player-world map:" + playerWorldMap.toString());
        LOG.debug("Adding session for player {}", playerId);
        playerSessionMap.put(playerId, session);
        LOG.debug("player-session map:" + playerSessionMap.toString());
        LOG.debug("Adding future for world {}", worldId);
        worldFutureMap.put(worldId, future);
        LOG.debug("future-world map:" + worldFutureMap.toString());
    }
}

[Buggy Hunk]
engine.startGame(playerId,worldId);

[Patch]
engine.addPlayer2World(playerId,worldId);