nus-yam/ex-repair huggingface dataset:
Program: 11705
Project: 11705
Buggy source:
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf buf,List<Object> list) throws Exception {
  NetCrypto crypto=this.client.cryptoModule();
  ByteBuf decrypt=buf;
  if (crypto != null) {
    decrypt=ctx.alloc().buffer();
    crypto.decrypt(buf,decrypt);
  }
  ByteBuf decompressed=decrypt;
  boolean deflated=false;
  if (this.client.doCompression()) {
    rvint(decrypt);
    int compressedLen=rvint(decrypt);
    if (compressedLen > COMPRESSION_THRESH) {
      decompressed=ctx.alloc().buffer();
      deflated=true;
      byte[] in=arr(decrypt);
      Inflater inflater=INFLATER.get();
      inflater.setInput(in);
      byte[] buffer=new byte[NetClient.BUFFER_SIZE];
      while (!inflater.finished()) {
        int bytes=inflater.inflate(buffer);
        decompressed.writeBytes(buffer,0,bytes);
      }
      inflater.reset();
    }
  }
 else {
    rvint(decompressed);
  }
  int id=rvint(decompressed);
  Class<? extends Packet> cls=PacketRegistry.byId(this.client.state(),Packet.Bound.SERVER,id);
  PacketIn packet=PacketRegistry.make(cls);
  LOGGER.debug("String_Node_Str" + packet.getClass().getSimpleName());
  packet.read(decompressed,this.client);
  if (deflated) {
    decompressed.release();
  }
}

Fixed version (ground truth):
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf buf,List<Object> list) throws Exception {
  NetCrypto crypto=this.client.cryptoModule();
  ByteBuf decrypt=buf;
  if (crypto != null) {
    decrypt=ctx.alloc().buffer();
    crypto.decrypt(buf,decrypt);
  }
  ByteBuf decompressed=decrypt;
  boolean deflated=false;
  if (this.client.doCompression()) {
    rvint(decrypt);
    int compressedLen=rvint(decrypt);
    if (compressedLen > COMPRESSION_THRESH) {
      decompressed=ctx.alloc().buffer();
      deflated=true;
      byte[] in=arr(decrypt);
      Inflater inflater=INFLATER.get();
      inflater.setInput(in);
      byte[] buffer=new byte[NetClient.BUFFER_SIZE];
      while (!inflater.finished()) {
        int bytes=inflater.inflate(buffer);
        decompressed.writeBytes(buffer,0,bytes);
      }
      inflater.reset();
    }
  }
 else {
    rvint(decompressed);
  }
  int id=rvint(decompressed);
  Class<? extends Packet> cls=PacketRegistry.byId(this.client.state(),Packet.Bound.SERVER,id);
  PacketIn packet=PacketRegistry.make(cls);
  LOGGER.debug("String_Node_Str" + packet.getClass().getSimpleName());
  packet.read(decompressed,this.client);
  if (deflated) {
    decompressed.release();
  }
  if (crypto != null) {
    decrypt.release();
  }
}
Program: 11706
Project: 11706
Buggy source:
/** 
 * Writes the section data to the given byte stream.
 * @param buf the buffer to write the section data
 */
public void write(ByteBuf buf){
  buf.writeByte(this.bitsPerBlock);
  wvint(buf,this.palette.size());
  for (  short s : this.palette) {
    wvint(buf,s);
  }
  wvint(buf,this.data.length);
  for (  long l : this.data) {
    buf.writeLong(l);
  }
  buf.writeBytes(this.blockLight);
  buf.writeBytes(this.skyLight);
}

Fixed version (ground truth):
/** 
 * Writes the section data to the given byte stream.
 * @param buf the buffer to write the section data
 */
public void write(ByteBuf buf){
  buf.writeByte(this.bitsPerBlock);
  wvint(buf,this.palette.size());
  ShortArrayList palette;
synchronized (this.palette) {
    palette=this.palette;
  }
  for (int i=0; i < palette.size(); i++) {
    wvint(buf,palette.getShort(i));
  }
  wvint(buf,this.data.length);
  for (  long l : this.data) {
    buf.writeLong(l);
  }
  buf.writeBytes(this.blockLight);
  buf.writeBytes(this.skyLight);
}
Program: 11707
Project: 11707
Buggy source:
/** 
 * Initializes the files and directories, attempts to find the last log file.
 */
public static FileLogger init(Logger next) throws Exception {
  FileLogger logger=new FileLogger(next);
  if (!Files.exists(DIR)) {
    Files.createDirectory(DIR);
  }
  File[] files=DIR.toFile().listFiles();
  if (files != null && files.length > 0) {
    int idx=0;
    File f=null;
    for (    File file : files) {
      String[] split=file.getName().split(IDX_SEPARATOR);
      int i=Integer.parseInt(split[1]);
      if (i > idx) {
        idx=i;
        f=file;
      }
    }
    if (f == null)     throw new RuntimeException();
synchronized (logger.lock) {
      logger.makeNewLog(f.toPath());
    }
  }
 else {
synchronized (logger.lock) {
      logger.makeNewLog(0);
    }
  }
  return logger;
}

Fixed version (ground truth):
/** 
 * Initializes the files and directories, attempts to find the last log file.
 */
public static FileLogger init(Logger next) throws Exception {
  FileLogger logger=new FileLogger(next);
  if (!Files.exists(DIR)) {
    Files.createDirectory(DIR);
  }
  File[] files=DIR.toFile().listFiles();
  if (files != null && files.length > 0) {
    int idx=-1;
    File f=null;
    for (    File file : files) {
      String[] split=file.getName().split(IDX_SEPARATOR);
      int i=Integer.parseInt(split[1]);
      if (i > idx) {
        idx=i;
        f=file;
      }
    }
    if (f == null)     throw new RuntimeException();
synchronized (logger.lock) {
      logger.makeNewLog(f.toPath());
    }
  }
 else {
synchronized (logger.lock) {
      logger.makeNewLog(0);
    }
  }
  return logger;
}
Program: 11708
Project: 11708
Buggy source:
@Override public Collection<Object> values(boolean deep){
  return elements.values().stream().filter(o -> !(o instanceof ConfigSection)).collect(Collectors.toList());
}

Fixed version (ground truth):
@Override public Collection<Object> values(boolean deep){
  LinkedList<Object> set=Lists.newLinkedList();
  elements.values().stream().forEach(o -> {
    if (deep) {
      if (o instanceof ConfigSection) {
        ConfigSection section=(ConfigSection)o;
        set.addAll(section.values(true));
      }
    }
    set.add(o);
  }
);
  return set;
}
Program: 11709
Project: 11709
Buggy source:
@Override public Set<ConfigSection> children(boolean deep){
  return elements.values().stream().filter(o -> o instanceof ConfigSection).map(o -> (ConfigSection)o).collect(Collectors.toSet());
}

Fixed version (ground truth):
@Override public Set<ConfigSection> children(boolean deep){
  HashSet<ConfigSection> set=Sets.newLinkedHashSet();
  elements.values().stream().filter(o -> o instanceof ConfigSection).map(o -> (TridentConfigSection)o).forEach(cs -> {
    set.add(cs);
    if (deep) {
      set.addAll(cs.children(true));
    }
  }
);
  return set;
}
Program: 11710
Project: 11710
Buggy source:
/** 
 * Obtains the chunk at the given location and determines whether a chunk will be generated if it does not exist yet.
 * @param x the x coordinate
 * @param z the z coordinate
 * @param gen {@code true} to generate if non-existant
 * @return the chunk, or {@code null}
 */
public TridentChunk get(int x,int z,boolean gen){
  System.out.printf("String_Node_Str",x,z);
  long key=(long)x << 32 | (long)z;
synchronized (this.lock) {
    TridentChunk chunk=this.chunks.get(key);
    if (chunk == null && gen) {
      chunk=new TridentChunk(this.world,x,z);
      chunk.generate();
      this.chunks.put(key,chunk);
    }
    return chunk;
  }
}

Fixed version (ground truth):
/** 
 * Obtains the chunk at the given location and determines whether a chunk will be generated if it does not exist yet.
 * @param x the x coordinate
 * @param z the z coordinate
 * @param gen {@code true} to generate if non-existant
 * @return the chunk, or {@code null}
 */
public TridentChunk get(int x,int z,boolean gen){
  long key=z >= 0 ? ((long)x << 32) | z : (long)1 << 31 | (((long)x << 32) | 0x7FFFFFFF & z);
synchronized (this.lock) {
    TridentChunk chunk=this.chunks.get(key);
    if (chunk == null && gen) {
      chunk=new TridentChunk(this.world,x,z);
      chunk.generate();
      this.chunks.put(key,chunk);
    }
    return chunk;
  }
}
Program: 11712
Project: 11712
Buggy source:
public int size(){
  return counters.size();
}

Fixed version (ground truth):
/** 
 * Obtains the amount of loaded chunks
 * @return the amount of loaded chunks
 */
public int size(){
  return counters.size();
}
Program: 11713
Project: 11713
Buggy source:
public boolean apply(ChunkLocation location,Consumer<CRefCounter> consumer){
  CRefCounter chunk=counters.get(location);
  if (chunk != null) {
    consumer.accept(chunk);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Obtains the chunk reference counter and applies a transformation function
 * @param location the location or obtain the chunk reference counter
 * @param consumer the transformation function
 * @return {@code true} to indicate that the chunk was successfully retrieved and transformed
 */
public boolean apply(ChunkLocation location,Consumer<CRefCounter> consumer){
  CRefCounter chunk=counters.get(location);
  if (chunk != null) {
    consumer.accept(chunk);
    return true;
  }
  return false;
}
Program: 11714
Project: 11714
Buggy source:
public boolean tryRemove(ChunkLocation location){
  if (location.x() < 7 && location.z() < 7) {
    return true;
  }
  CRefCounter chunk=counters.get(location);
  if (chunk == null) {
    return false;
  }
  if (!chunk.hasStrongRefs()) {
    TridentChunk c=chunk.unwrap();
    if (chunk.hasWeakRefs()) {
    }
    remove(location);
    c.unload();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Attempts to remove the chunk from memory and save it <p>This method returns   {@code false} if:<ul> <li>The chunk is not loaded</li> <li>The chunk still has strong references</li> </ul></p>
 * @param location the location to remove the chunk
 * @return {@code true} to signify that the collection was modified as a result of this operation
 */
public boolean tryRemove(ChunkLocation location){
  if (location.x() < 7 && location.z() < 7) {
    return true;
  }
  CRefCounter chunk=counters.get(location);
  if (chunk == null) {
    return false;
  }
  if (!chunk.hasStrongRefs()) {
    TridentChunk c=chunk.unwrap();
    if (chunk.hasWeakRefs()) {
    }
    remove(location);
    c.unload();
    return true;
  }
  return false;
}
Program: 11715
Project: 11715
Buggy source:
public Set<ChunkLocation> keys(){
  return counters.keySet();
}

Fixed version (ground truth):
/** 
 * Obtains the set of chunk locations that have already been loaded
 * @return the set of loaded chunk locations
 */
public Set<ChunkLocation> keys(){
  return counters.keySet();
}
Program: 11716
Project: 11716
Buggy source:
public TridentChunk get(ChunkLocation location,boolean gen){
  if (gen) {
    return counters.computeIfAbsent(location,k -> CRefCounter.wrap(world.generateChunk(k))).unwrap();
  }
 else {
    CRefCounter refCounter=counters.get(location);
    return refCounter == null ? null : refCounter.unwrap();
  }
}

Fixed version (ground truth):
/** 
 * Obtains the chunk at the given location in the world, generating if given to do so
 * @param location the location to obtain the chunk
 * @param gen      {@code true} to generate a new chunk if no chunk exists
 * @return the chunk at the given location, or {@code null} if it doesn't exist and {@code gen} is false
 */
public TridentChunk get(ChunkLocation location,boolean gen){
  if (gen) {
    return counters.computeIfAbsent(location,k -> CRefCounter.wrap(world.generateChunk(k))).unwrap();
  }
 else {
    CRefCounter refCounter=counters.get(location);
    return refCounter == null ? null : refCounter.unwrap();
  }
}
Program: 11717
Project: 11717
Buggy source:
public Collection<TridentChunk> values(){
  Collection<TridentChunk> chunks=Lists.newArrayList();
  counters.values().stream().forEach(c -> chunks.add(c.unwrap()));
  return chunks;
}

Fixed version (ground truth):
/** 
 * Obtains the chunks that have been loaded into memory
 * @return the collection of loaded in-memory chunks
 */
public Collection<TridentChunk> values(){
  Collection<TridentChunk> chunks=Lists.newArrayList();
  counters.values().stream().forEach(c -> chunks.add(c.unwrap()));
  return chunks;
}
Program: 11718
Project: 11718
Buggy source:
public ChunkHandler(TridentWorld world){
  this.world=world;
}

Fixed version (ground truth):
/** 
 * Creates a new chunk handler to manage the chunks of the provided world
 * @param world the world to manage chunks for
 */
public ChunkHandler(TridentWorld world){
  this.world=world;
}
Program: 11719
Project: 11719
Buggy source:
public void put(TridentChunk chunk){
  counters.put(chunk.location(),CRefCounter.wrap(chunk));
}

Fixed version (ground truth):
/** 
 * Places a chunk into the collection of in-memory chunks
 * @param chunk the chunk to add
 */
public void put(TridentChunk chunk){
  counters.put(chunk.location(),CRefCounter.wrap(chunk));
}
Program: 11720
Project: 11720
Buggy source:
public void remove(ChunkLocation location){
  counters.remove(location);
}

Fixed version (ground truth):
/** 
 * Manually removes the chunk from the collection without running any cleanup code
 * @param location the location to remove the chunk from
 */
public void remove(ChunkLocation location){
  counters.remove(location);
}
Program: 11721
Project: 11721
Buggy source:
@Policy("String_Node_Str") private void clean0(int viewDist,int size){
  Position pos=player.position();
  int x=(int)pos.x() / 16;
  int z=(int)pos.z() / 16;
  int removed=0;
  for (  ChunkLocation location : knownChunks) {
    if (MAX_CHUNKS > (size - removed))     return;
    int cx=location.x();
    int cz=location.z();
    int abs=Math.max(cx,x) - Math.min(cx,x);
    int abs1=Math.max(cz,z) - Math.min(cz,z);
    if (abs >= viewDist || abs1 >= viewDist) {
      player.connection().sendPacket(new PacketPlayOutChunkData(new byte[0],location,true,(short)0));
      knownChunks.remove(location);
      removed++;
    }
  }
}

Fixed version (ground truth):
@Policy("String_Node_Str") private void clean0(int viewDist,int size){
  Position pos=player.position();
  int x=(int)pos.x() / 16;
  int z=(int)pos.z() / 16;
  int removed=0;
  for (  ChunkLocation location : knownChunks) {
    if (MAX_CHUNKS > size - removed)     return;
    int cx=location.x();
    int cz=location.z();
    int abs=Math.max(cx,x) - Math.min(cx,x);
    int abs1=Math.max(cz,z) - Math.min(cz,z);
    if (abs >= viewDist || abs1 >= viewDist) {
      player.connection().sendPacket(new PacketPlayOutChunkData(new byte[0],location,true,(short)0));
      knownChunks.remove(location);
      removed++;
    }
  }
}
Program: 11722
Project: 11722
Buggy source:
public void update(int viewDistance){
  int centX=((int)Math.floor(player.position().x())) >> 4;
  int centZ=((int)Math.floor(player.position().z())) >> 4;
  PacketPlayOutMapChunkBulk bulk=new PacketPlayOutMapChunkBulk();
  HashSet<TridentChunk> set=new HashSet<>();
synchronized (knownChunks) {
    for (int x=(centX - viewDistance / 2); x <= (centX + viewDistance / 2); x+=1) {
      for (int z=(centZ - viewDistance / 2); z <= (centZ + viewDistance / 2); z+=1) {
        for (int i=x - 1; i <= x + 1; i++) {
          for (int j=z - 1; j <= z + 1; j++) {
            ChunkLocation loc=ChunkLocation.create(i,j);
            if (knownChunks.contains(loc))             continue;
            TridentChunk chunk=world.chunkAt(loc,true);
            if (i == x && j == z) {
              set.add(chunk);
            }
          }
        }
      }
    }
    for (    TridentChunk chunk : set) {
      if (knownChunks.add(chunk.location())) {
        bulk.addEntry(chunk.asPacket());
      }
      if (bulk.size() >= 1845152) {
        player.connection().sendPacket(bulk);
        bulk=new PacketPlayOutMapChunkBulk();
      }
    }
    if (bulk.hasEntries()) {
      player.connection().sendPacket(bulk);
    }
  }
}

Fixed version (ground truth):
public void update(int viewDistance){
  int centX=(int)Math.floor(player.position().x()) >> 4;
  int centZ=(int)Math.floor(player.position().z()) >> 4;
  PacketPlayOutMapChunkBulk bulk=new PacketPlayOutMapChunkBulk();
  HashSet<TridentChunk> set=new HashSet<>();
synchronized (knownChunks) {
    for (int x=centX - viewDistance / 2; x <= centX + viewDistance / 2; x+=1) {
      for (int z=centZ - viewDistance / 2; z <= centZ + viewDistance / 2; z+=1) {
        for (int i=x - 1; i <= x + 1; i++) {
          for (int j=z - 1; j <= z + 1; j++) {
            ChunkLocation loc=ChunkLocation.create(i,j);
            if (knownChunks.contains(loc))             continue;
            TridentChunk chunk=world.chunkAt(loc,true);
            if (i == x && j == z) {
              set.add(chunk);
            }
          }
        }
      }
    }
    for (    TridentChunk chunk : set) {
      if (knownChunks.add(chunk.location())) {
        bulk.addEntry(chunk.asPacket());
      }
      if (bulk.size() >= 1845152) {
        player.connection().sendPacket(bulk);
        bulk=new PacketPlayOutMapChunkBulk();
      }
    }
    if (bulk.hasEntries()) {
      player.connection().sendPacket(bulk);
    }
  }
}
Program: 11723
Project: 11723
Buggy source:
public ChunkLocationSet(TridentPlayer player){
  this.player=player;
  this.world=((TridentWorld)player.world());
}

Fixed version (ground truth):
public ChunkLocationSet(TridentPlayer player){
  this.player=player;
  this.world=(TridentWorld)player.world();
}
Program: 11724
Project: 11724
Buggy source:
@Override public void load(){
  ((TridentChunk)world().chunkAt(location(),true)).load(tag);
}

Fixed version (ground truth):
@Override public boolean load(){
  return false;
}
Program: 11725
Project: 11725
Buggy source:
@Override public void generate(){
  load();
}

Fixed version (ground truth):
@Override public void generate(){
  apply();
}
Program: 11726
Project: 11726
Buggy source:
@Override protected void doTick(){
  int distance=viewDistance();
  if (!loggingIn) {
    ThreadsHandler.chunkExecutor().execute(() -> {
      for (int i=0; i < CLEAN_ITERATIONS; i++) {
        if (knownChunks.size() > MAX_CHUNKS)         cleanChunks(distance - i);
      }
    }
);
    if (ticksExisted.get() % 20 == 0) {
      ThreadsHandler.chunkExecutor().execute(() -> sendChunks(distance));
    }
  }
  connection.tick();
}

Fixed version (ground truth):
@Override protected void doTick(){
  int distance=viewDistance();
  if (!loggingIn) {
    ThreadsHandler.chunkExecutor().execute(() -> {
      for (int i=0; i < CLEAN_ITERATIONS; i++) {
        int size=knownChunks.size();
        if (size > MAX_CHUNKS)         cleanChunks(distance - i,size);
      }
    }
);
    if (ticksExisted.get() % 20 == 0) {
      ThreadsHandler.chunkExecutor().execute(() -> sendChunks(distance));
    }
  }
  connection.tick();
}
Program: 11727
Project: 11727
Buggy source:
public void cleanChunks(int viewDist){
  Position pos=position();
  int x=(int)pos.x() / 16;
  int z=(int)pos.z() / 16;
  int count=counter.getAndIncrement();
  int size=knownChunks.size();
  if (count >= size / MAX_PARTITION_SIZE) {
    count=0;
    counter.set(0);
  }
  List<ChunkLocation> partition=Iterators.get(Iterators.partition(knownChunks.iterator(),MAX_PARTITION_SIZE),count);
  for (  ChunkLocation location : partition) {
    int cx=location.x();
    int cz=location.z();
    int abs=Math.max(cx,x) - Math.min(cx,x);
    int abs1=Math.max(cz,z) - Math.min(cz,z);
    if (abs >= viewDist || abs1 >= viewDist) {
      removeChunk(location,true);
    }
  }
}

Fixed version (ground truth):
public void cleanChunks(int viewDist,int size){
  Position pos=position();
  int x=(int)pos.x() / 16;
  int z=(int)pos.z() / 16;
  int removed=0;
  for (  ChunkLocation location : knownChunks) {
    if (MAX_CHUNKS > (size - removed))     return;
    int cx=location.x();
    int cz=location.z();
    int abs=Math.max(cx,x) - Math.min(cx,x);
    int abs1=Math.max(cz,z) - Math.min(cz,z);
    if (abs >= viewDist || abs1 >= viewDist) {
      removeChunk(location,true);
      removed++;
    }
  }
}
Program: 11728
Project: 11728
Buggy source:
@Override public char[][] generateChunkBlocks(final ChunkLocation location,AtomicReferenceArray<Integer> heights){
  final char[][] data=new char[16][ChunkSection.LENGTH];
  final CountDownLatch release=new CountDownLatch(16);
  for (int x=0; x < 16; x++) {
    final int finalX=x;
    executor.execute(() -> {
      for (int z=0; z < 16; z++) {
        final int i=WorldUtils.intScale(0,140,generator.noise(finalX + (location.x() << 4),z + (location.z() << 4))) - 20;
        heights.set(WorldUtils.heightIndex(finalX,z),i - 1);
        for (int y=0; y < i; y++) {
          if (i < 40 && y == (i - 1)) {
            for (int rev=40; rev > i; rev--) {
              data[rev / 16][WorldUtils.blockArrayIndex(finalX,rev % 16,z)]=Substance.WATER.asExtended();
            }
            data[i / 16][WorldUtils.blockArrayIndex(finalX,i % 16,z)]=Substance.CLAY.asExtended();
            continue;
          }
          if (y < i - 1) {
            data[y / 16][WorldUtils.blockArrayIndex(finalX,y % 16,z)]=Substance.DIRT.asExtended();
          }
 else {
            data[y / 16][WorldUtils.blockArrayIndex(finalX,y % 16,z)]=Substance.GRASS.asExtended();
          }
        }
      }
      release.countDown();
    }
);
  }
  try {
    release.await();
  }
 catch (  InterruptedException e) {
    TridentLogger.get().error(e);
    return null;
  }
  return data;
}

Fixed version (ground truth):
@Override public char[][] generateChunkBlocks(final ChunkLocation location,AtomicReferenceArray<Integer> heights){
  final char[][] data=new char[16][ChunkSection.LENGTH];
  final CountDownLatch release=new CountDownLatch(16);
  for (int x=0; x < 16; x++) {
    final int finalX=x;
    executor.execute(() -> {
      for (int z=0; z < 16; z++) {
        final int i=WorldUtils.intScale(0,140,generator.noise(finalX + (location.x() << 4),z + (location.z() << 4))) - 20;
        heights.set(WorldUtils.heightIndex(finalX,z),i);
        if (i < 40) {
          for (int j=i; j <= 40; j++) {
            data[j / 16][WorldUtils.blockArrayIndex(finalX,j % 16,z)]=Substance.WATER.asExtended();
          }
        }
        for (int y=0; y <= i; y++) {
          if (i < 40) {
            if (y == i) {
              data[y / 16][WorldUtils.blockArrayIndex(finalX,y % 16,z)]=Substance.SAND.asExtended();
              continue;
            }
          }
          if (y == i) {
            data[y / 16][WorldUtils.blockArrayIndex(finalX,i % 16,z)]=Substance.GRASS.asExtended();
          }
 else           data[y / 16][WorldUtils.blockArrayIndex(finalX,y % 16,z)]=Substance.DIRT.asExtended();
        }
      }
      release.countDown();
    }
);
  }
  try {
    release.await();
  }
 catch (  InterruptedException e) {
    TridentLogger.get().error(e);
    return null;
  }
  return data;
}
Program: 11729
Project: 11729
Buggy source:
@Override public void handleReceived(ClientConnection connection){
  TridentPlayer player=((PlayerConnection)connection).player();
  World world=player.world();
  StatusType type=StatusType.getStatus((int)this.actionId);
switch (type) {
case RESPAWN:
    PacketPlayOutPlayerRespawn respawn=new PacketPlayOutPlayerRespawn();
  respawn.set("String_Node_Str",(int)world.dimension().asByte()).set("String_Node_Str",(int)world.difficulty().asByte()).set("String_Node_Str",(int)world.defaultGameMode().asByte());
connection.sendPacket(respawn);
break;
case STATISTICS_REQUEST:
PacketPlayOutStatistics statistics=new PacketPlayOutStatistics();
statistics.set("String_Node_Str",null);
connection.sendPacket(statistics);
break;
case OPEN_INVENTORY_ACHEIVEMENT:
break;
default :
TridentLogger.get().error(new IllegalArgumentException("String_Node_Str"));
}
}

Fixed version (ground truth):
@Override public void handleReceived(ClientConnection connection){
  TridentPlayer player=((PlayerConnection)connection).player();
  World world=player.world();
  StatusType type=StatusType.getStatus((int)this.actionId);
switch (type) {
case RESPAWN:
    PacketPlayOutPlayerRespawn respawn=new PacketPlayOutPlayerRespawn();
  respawn.set("String_Node_Str",(int)world.settings().dimension().asByte()).set("String_Node_Str",(int)world.settings().difficulty().asByte()).set("String_Node_Str",(int)world.settings().defaultGameMode().asByte());
connection.sendPacket(respawn);
break;
case STATISTICS_REQUEST:
PacketPlayOutStatistics statistics=new PacketPlayOutStatistics();
statistics.set("String_Node_Str",null);
connection.sendPacket(statistics);
break;
case OPEN_INVENTORY_ACHEIVEMENT:
break;
default :
TridentLogger.get().error(new IllegalArgumentException("String_Node_Str"));
}
}
Program: 11732
Project: 11732
Buggy source:
public TridentWorldLoader(){
  this.opt=new WorldCreateOptions();
}

Fixed version (ground truth):
public TridentWorldLoader(){
  this.opt=new WorldCreateOptions();
  this.opt.generator(DefaultWorldGen.class);
}
Program: 11733
Project: 11733
Buggy source:
@Override public WorldCreateOptions options(){
  return null;
}

Fixed version (ground truth):
@Override public WorldCreateOptions options(){
  return opt;
}
Program: 11734
Project: 11734
Buggy source:
@Override public long seed(){
  return 0;
}

Fixed version (ground truth):
@Override public long seed(){
  return seed;
}
Program: 11735
Project: 11735
Buggy source:
@Override public Difficulty difficulty(){
  return null;
}

Fixed version (ground truth):
@Override public Difficulty difficulty(){
  return difficulty;
}
Program: 11736
Project: 11736
Buggy source:
@Override public LevelType levelType(){
  return null;
}

Fixed version (ground truth):
@Override public LevelType levelType(){
  return levelType;
}
Program: 11737
Project: 11737
Buggy source:
@Override public Dimension dimension(){
  return null;
}

Fixed version (ground truth):
@Override public Dimension dimension(){
  return dimension;
}
Program: 11738
Project: 11738
Buggy source:
public void releaseStrong(){
  strongRefs.decrement();
  if (strongRefs.sum() < 0L)   throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
public void releaseStrong(){
  strongRefs.decrement();
  wrapped.world().chunkHandler().tryRemove(wrapped.location());
  if (strongRefs.sum() < 0L)   throw new IllegalStateException("String_Node_Str");
}
Program: 11739
Project: 11739
Buggy source:
/** 
 * Obtains the amount of loaded chunks
 * @return the amount of loaded chunks
 */
public int size(){
  return counters.size();
}

Fixed version (ground truth):
/** 
 * Obtains the amount of loaded chunks
 * @return the amount of loaded chunks
 */
public int size(){
synchronized (counters) {
    return counters.size();
  }
}
Program: 11740
Project: 11740
Buggy source:
/** 
 * Obtains the chunk reference counter and applies a transformation function
 * @param location the location or obtain the chunk reference counter
 * @param consumer the transformation function
 * @return {@code true} to indicate that the chunk was successfully retrieved and transformed
 */
public boolean apply(ChunkLocation location,Consumer<CRefCounter> consumer){
  CRefCounter chunk=counters.get(location);
  if (chunk != null) {
    consumer.accept(chunk);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Obtains the chunk reference counter and applies a transformation function
 * @param location the location or obtain the chunk reference counter
 * @param consumer the transformation function
 * @return {@code true} to indicate that the chunk was successfully retrieved and transformed
 */
public boolean apply(ChunkLocation location,Consumer<CRefCounter> consumer){
  CRefCounter chunk=get(location);
  if (chunk != null) {
    consumer.accept(chunk);
    return true;
  }
  return false;
}
Program: 11741
Project: 11741
Buggy source:
/** 
 * Attempts to remove the chunk from memory and save it <p>This method returns   {@code false} if:<ul> <li>The chunk is not loaded</li> <li>The chunk still has strong references</li> </ul></p>
 * @param location the location to remove the chunk
 * @return {@code true} to signify that the collection was modified as a result of this operation
 */
public boolean tryRemove(ChunkLocation location){
  if (location.x() < 7 && location.z() < 7) {
    return true;
  }
  CRefCounter chunk=counters.get(location);
  if (chunk == null) {
    return false;
  }
  if (!chunk.hasStrongRefs()) {
    TridentChunk c=chunk.unwrap();
    if (chunk.hasWeakRefs()) {
    }
    remove(location);
    c.unload();
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Attempts to remove the chunk from memory and save it <p>This method returns   {@code false} if:<ul> <li>The chunk is not loaded</li> <li>The chunk still has strong references</li> </ul></p>
 * @param location the location to remove the chunk
 * @return {@code true} to signify that the collection was modified as a result of this operation
 */
public boolean tryRemove(ChunkLocation location){
  if (location.x() < 7 && location.z() < 7) {
    return true;
  }
  CRefCounter chunk=get(location);
  if (chunk == null) {
    return false;
  }
  if (!chunk.hasStrongRefs()) {
    TridentChunk c=chunk.unwrap();
    if (chunk.hasWeakRefs()) {
    }
    c.unload();
    remove(location);
    return true;
  }
  return false;
}
Program: 11742
Project: 11742
Buggy source:
/** 
 * Obtains the set of chunk locations that have already been loaded
 * @return the set of loaded chunk locations
 */
public Set<ChunkLocation> keys(){
  return counters.keySet();
}

Fixed version (ground truth):
/** 
 * Obtains the set of chunk locations that have already been loaded
 * @return the set of loaded chunk locations
 */
public Set<ChunkLocation> keys(){
synchronized (counters) {
    return counters.keySet();
  }
}
Program: 11743
Project: 11743
Buggy source:
/** 
 * Obtains the chunk at the given location in the world, generating if given to do so
 * @param location the location to obtain the chunk
 * @param gen      {@code true} to generate a new chunk if no chunk exists
 * @return the chunk at the given location, or {@code null} if it doesn't exist and {@code gen} is false
 */
public TridentChunk get(ChunkLocation location,boolean gen){
  if (gen) {
    return counters.computeIfAbsent(location,k -> CRefCounter.wrap(world.generateChunk(k))).unwrap();
  }
 else {
    CRefCounter refCounter=counters.get(location);
    return refCounter == null ? null : refCounter.unwrap();
  }
}

Fixed version (ground truth):
/** 
 * Obtains the chunk reference counter at the specified location
 * @param location the location to obtain the counter
 * @return the counter at the location, or {@code null} if it doesn't exist
 */
public CRefCounter get(ChunkLocation location){
synchronized (counters) {
    return counters.get(location);
  }
}
Program: 11744
Project: 11744
Buggy source:
/** 
 * Obtains the chunks that have been loaded into memory
 * @return the collection of loaded in-memory chunks
 */
public Collection<TridentChunk> values(){
  Collection<TridentChunk> chunks=Lists.newArrayList();
  counters.values().stream().forEach(c -> chunks.add(c.unwrap()));
  return chunks;
}

Fixed version (ground truth):
/** 
 * Obtains the chunks that have been loaded into memory
 * @return the collection of loaded in-memory chunks
 */
public Collection<TridentChunk> values(){
  Collection<TridentChunk> chunks=Lists.newArrayList();
synchronized (counters) {
    counters.values().stream().forEach(c -> chunks.add(c.unwrap()));
  }
  return chunks;
}
Program: 11745
Project: 11745
Buggy source:
/** 
 * Places a chunk into the collection of in-memory chunks
 * @param chunk the chunk to add
 */
public void put(TridentChunk chunk){
  counters.put(chunk.location(),CRefCounter.wrap(chunk));
}

Fixed version (ground truth):
/** 
 * Places a chunk into the collection of in-memory chunks
 * @param chunk the chunk to add
 */
public void put(TridentChunk chunk){
synchronized (counters) {
    counters.put(chunk.location(),CRefCounter.wrap(chunk));
  }
}
Program: 11746
Project: 11746
Buggy source:
/** 
 * Manually removes the chunk from the collection without running any cleanup code
 * @param location the location to remove the chunk from
 */
public void remove(ChunkLocation location){
  counters.remove(location);
}

Fixed version (ground truth):
/** 
 * Manually removes the chunk from the collection without running any cleanup code
 * @param location the location to remove the chunk from
 */
public void remove(ChunkLocation location){
synchronized (counters) {
    counters.remove(location);
  }
}
Program: 11747
Project: 11747
Buggy source:
@Policy("String_Node_Str") private void clean0(int viewDist,int size){
  Position pos=player.position();
  int x=(int)pos.x() / 16;
  int z=(int)pos.z() / 16;
  int removed=0;
  for (  ChunkLocation location : knownChunks) {
    if (MAX_CHUNKS > size - removed)     return;
    int cx=location.x();
    int cz=location.z();
    int abs=Math.max(cx,x) - Math.min(cx,x);
    int abs1=Math.max(cz,z) - Math.min(cz,z);
    if (abs >= viewDist || abs1 >= viewDist) {
      player.connection().sendPacket(new PacketPlayOutChunkData(new byte[0],location,true,(short)0));
      knownChunks.remove(location);
      removed++;
    }
  }
}

Fixed version (ground truth):
@Policy("String_Node_Str") private void clean0(int viewDist){
  Position pos=player.position();
  int x=(int)pos.x() / 16;
  int z=(int)pos.z() / 16;
  for (Iterator<ChunkLocation> locs=knownChunks.iterator(); locs.hasNext(); ) {
    ChunkLocation location=locs.next();
    int cx=location.x();
    int cz=location.z();
    int abs=Math.max(cx,x) - Math.min(cx,x);
    int abs1=Math.max(cz,z) - Math.min(cz,z);
    if (abs >= viewDist || abs1 >= viewDist) {
      player.connection().sendPacket(new PacketPlayOutChunkData(new byte[0],location,true,(short)0));
      locs.remove();
      world.chunkHandler().apply(location,CRefCounter::releaseStrong);
    }
  }
}
Program: 11748
Project: 11748
Buggy source:
public void update(int viewDistance){
  int centX=(int)Math.floor(player.position().x()) >> 4;
  int centZ=(int)Math.floor(player.position().z()) >> 4;
  PacketPlayOutMapChunkBulk bulk=new PacketPlayOutMapChunkBulk();
  HashSet<TridentChunk> set=new HashSet<>();
synchronized (knownChunks) {
    for (int x=centX - viewDistance / 2; x <= centX + viewDistance / 2; x+=1) {
      for (int z=centZ - viewDistance / 2; z <= centZ + viewDistance / 2; z+=1) {
        for (int i=x - 1; i <= x + 1; i++) {
          for (int j=z - 1; j <= z + 1; j++) {
            ChunkLocation loc=ChunkLocation.create(i,j);
            if (knownChunks.contains(loc))             continue;
            TridentChunk chunk=world.chunkAt(loc,true);
            if (i == x && j == z) {
              set.add(chunk);
            }
          }
        }
      }
    }
    for (    TridentChunk chunk : set) {
      if (knownChunks.add(chunk.location())) {
        bulk.addEntry(chunk.asPacket());
      }
      if (bulk.size() >= 1845152) {
        player.connection().sendPacket(bulk);
        bulk=new PacketPlayOutMapChunkBulk();
      }
    }
    if (bulk.hasEntries()) {
      player.connection().sendPacket(bulk);
    }
  }
}

Fixed version (ground truth):
public void update(int viewDistance){
  int centX=(int)Math.floor(player.position().x()) >> 4;
  int centZ=(int)Math.floor(player.position().z()) >> 4;
  PacketPlayOutMapChunkBulk bulk=new PacketPlayOutMapChunkBulk();
synchronized (knownChunks) {
    for (int x=centX - viewDistance / 2; x <= centX + viewDistance / 2; x+=1) {
      for (int z=centZ - viewDistance / 2; z <= centZ + viewDistance / 2; z+=1) {
        TridentChunk center=null;
        for (int i=x - 1; i <= x + 1; i++) {
          for (int j=z - 1; j <= z + 1; j++) {
            ChunkLocation loc=ChunkLocation.create(i,j);
            if (knownChunks.contains(loc))             continue;
            TridentChunk chunk=world.chunkAt(loc,true);
            if (i == x && j == z) {
              center=chunk;
            }
          }
        }
        if (center != null) {
          ChunkLocation location=center.location();
          if (!knownChunks.add(location))           continue;
          world.chunkHandler().apply(location,CRefCounter::refStrong);
          bulk.addEntry(center.asPacket());
          if (bulk.size() >= 1845152) {
            player.connection().sendPacket(bulk);
            bulk=new PacketPlayOutMapChunkBulk();
          }
        }
      }
    }
    if (bulk.hasEntries()) {
      player.connection().sendPacket(bulk);
    }
  }
}
Program: 11749
Project: 11749
Buggy source:
public void clean(int distance){
synchronized (knownChunks) {
    for (int i=0; i < CLEAN_ITERATIONS; i++) {
      int size=knownChunks.size();
      if (size > MAX_CHUNKS) {
        clean0(distance,size);
      }
    }
  }
}

Fixed version (ground truth):
public void clean(int distance){
synchronized (knownChunks) {
    for (int i=0; i < CLEAN_ITERATIONS; i++) {
      int size=knownChunks.size();
      if (size > MAX_CHUNKS) {
        clean0(distance);
      }
    }
  }
}
Program: 11750
Project: 11750
Buggy source:
@Override protected void doTick(){
  int distance=viewDistance();
  if (!loggingIn) {
    ThreadsHandler.chunkExecutor().execute(() -> {
      knownChunks.clean(distance);
      knownChunks.update(distance);
    }
);
  }
  connection.tick();
}

Fixed version (ground truth):
@Override protected void doTick(){
  int distance=viewDistance();
  if (!loggingIn) {
    ThreadsHandler.chunkExecutor().execute(() -> {
      if (ticksExisted.get() % 20 == 0) {
        knownChunks.update(distance);
        return;
      }
      knownChunks.clean(distance);
      knownChunks.update(distance);
    }
);
  }
  connection.tick();
}
Program: 11751
Project: 11751
Buggy source:
@Override public void unload(){
  sections.lockFully();
  try {
    world.loader().saveChunk(this);
    world.chunkHandler().remove(location);
  }
  finally {
    sections.release();
  }
}

Fixed version (ground truth):
@Override public void unload(){
  sections.lockFully();
  try {
    ChunkHandler chunkHandler=world.chunkHandler();
    if (chunkHandler.get(location).hasStrongRefs()) {
      return;
    }
    world.loader().saveChunk(this);
    chunkHandler.remove(location);
  }
  finally {
    sections.release();
  }
}
Program: 11753
Project: 11753
Buggy source:
public void doRun() throws InterruptedException {
  long startTime=System.currentTimeMillis();
  this.ticksElapsed.getAndIncrement();
  if (this.pausedTicking) {
    this.calcAndWait(0);
    return;
  }
  if (this.ticksToWait.get() > 0) {
    this.ticksToWait.getAndDecrement();
    this.calcAndWait(0);
    return;
  }
  this.notLostTicksElapsed.getAndIncrement();
  for (  World world : Registered.worlds().values()) {
    TickSync.increment("String_Node_Str" + world.name());
    ((TridentWorld)world).tick();
  }
  ((TridentTaskScheduler)Registered.tasks()).tick();
  TickSync.awaitSync();
  long time;
  while ((time=System.currentTimeMillis() - startTime) < tickLength) {
    Runnable next=TickSync.waitForTask(TimeUnit.NANOSECONDS.convert(time,TimeUnit.NANOSECONDS));
    if (next != null) {
      Registered.plugins().executor().execute(next);
    }
  }
  if (!FINISH_TASKS_LEFT) {
    int left=TickSync.left();
    if (left > 0) {
      TridentLogger.get().warn("String_Node_Str" + left + "String_Node_Str");
    }
  }
 else {
    while (TickSync.left() > 0) {
      Runnable runnable=TickSync.next();
      if (runnable != null)       runnable.run();
    }
  }
  TickSync.reset();
  recentTickLength.add((int)(System.currentTimeMillis() - startTime));
}

Fixed version (ground truth):
public void doRun() throws InterruptedException {
  long startTime=System.currentTimeMillis();
  this.ticksElapsed.getAndIncrement();
  if (this.pausedTicking) {
    this.calcAndWait(0);
    return;
  }
  if (this.ticksToWait.get() > 0) {
    this.ticksToWait.getAndDecrement();
    this.calcAndWait(0);
    return;
  }
  this.notLostTicksElapsed.getAndIncrement();
  for (  World world : TridentWorldLoader.WORLDS.values()) {
    TickSync.increment("String_Node_Str" + world.name());
    ((TridentWorld)world).tick();
  }
  ((TridentTaskScheduler)Registered.tasks()).tick();
  TickSync.awaitSync();
  long time;
  while ((time=System.currentTimeMillis() - startTime) < tickLength) {
    Runnable next=TickSync.waitForTask(TimeUnit.NANOSECONDS.convert(time,TimeUnit.NANOSECONDS));
    if (next != null) {
      Registered.plugins().executor().execute(next);
    }
  }
  if (!FINISH_TASKS_LEFT) {
    int left=TickSync.left();
    if (left > 0) {
      TridentLogger.get().warn("String_Node_Str" + left + "String_Node_Str");
    }
  }
 else {
    while (TickSync.left() > 0) {
      Runnable runnable=TickSync.next();
      if (runnable != null)       runnable.run();
    }
  }
  TickSync.reset();
  recentTickLength.add((int)(System.currentTimeMillis() - startTime));
}
Program: 11754
Project: 11754
Buggy source:
public boolean initLogin(InetSocketAddress address,String name){
synchronized (this) {
    if (loginNames.size() + Registered.players().size() >= Trident.info().maxPlayers()) {
      return false;
    }
    loginNames.put(address,name);
    return true;
  }
}

Fixed version (ground truth):
public boolean initLogin(InetSocketAddress address,String name){
synchronized (this) {
    return loginNames.size() + Registered.players().size() < Trident.info().maxPlayers() && loginNames.put(address,name) == null;
  }
}
Program: 11756
Project: 11756
Buggy source:
@Override protected void doTick(){
  int distance=viewDistance();
  if (!loggingIn)   ThreadsHandler.chunkExecutor().execute(() -> {
    sendChunks(distance);
    for (int i=0; i < CLEAN_ITERATIONS; i++) {
      if (knownChunks.size() > MAX_CHUNKS)       cleanChunks(distance - i);
    }
  }
);
  connection.tick();
  ticksExisted.incrementAndGet();
}

Fixed version (ground truth):
@Override protected void doTick(){
  int distance=viewDistance();
  if (!loggingIn)   ThreadsHandler.chunkExecutor().execute(() -> {
    sendChunks(distance);
    for (int i=0; i < CLEAN_ITERATIONS; i++) {
      if (knownChunks.size() > MAX_CHUNKS)       cleanChunks(distance - i);
    }
  }
);
  if (ticksExisted.get() % 20 == 0) {
    System.out.println(position().block().substance());
  }
  connection.tick();
}
Program: 11757
Project: 11757
Buggy source:
public void sendChunks(int viewDistance){
  int centX=((int)Math.floor(loc.x())) >> 4;
  int centZ=((int)Math.floor(loc.z())) >> 4;
  PacketPlayOutMapChunkBulk bulk=new PacketPlayOutMapChunkBulk();
  for (int x=(centX - viewDistance / 2); x <= (centX + viewDistance / 2); x+=1) {
    for (int z=(centZ - viewDistance / 2); z <= (centZ + viewDistance / 2); z+=1) {
      ChunkLocation location=ChunkLocation.create(x,z);
      if (!knownChunks.add(location))       continue;
      bulk.addEntry(((TridentChunk)world().chunkAt(location,true)).asPacket());
      if (bulk.size() >= 1845152) {
        connection().sendPacket(bulk);
        bulk=new PacketPlayOutMapChunkBulk();
      }
    }
  }
  if (bulk.hasEntries()) {
    connection().sendPacket(bulk);
  }
}

Fixed version (ground truth):
public void sendChunks(int viewDistance){
  int centX=((int)Math.floor(loc.x())) >> 4;
  int centZ=((int)Math.floor(loc.z())) >> 4;
  PacketPlayOutMapChunkBulk bulk=new PacketPlayOutMapChunkBulk();
  HashSet<TridentChunk> set=new HashSet<>();
  for (int x=(centX - viewDistance / 2); x <= (centX + viewDistance / 2); x+=1) {
    for (int z=(centZ - viewDistance / 2); z <= (centZ + viewDistance / 2); z+=1) {
      ChunkLocation location=ChunkLocation.create(x,z);
      if (!knownChunks.add(location))       continue;
      for (int i=x - 1; i <= x + 1; i++) {
        for (int j=z - 1; j <= z + 1; j++) {
          if (knownChunks.add(location)) {
            set.add(((TridentChunk)world().chunkAt(i,j,true)));
          }
        }
      }
      set.add(((TridentChunk)world().chunkAt(location,true)));
    }
  }
  for (  TridentChunk chunk : set) {
    while (!chunk.isGen())     ;
  }
  for (  TridentChunk chunk : set) {
    bulk.addEntry(chunk.asPacket());
    if (bulk.size() >= 1845152) {
      connection().sendPacket(bulk);
      bulk=new PacketPlayOutMapChunkBulk();
    }
  }
  if (bulk.hasEntries()) {
    connection().sendPacket(bulk);
  }
}
Program: 11758
Project: 11758
Buggy source:
private TridentChunk rawChunk(ChunkLocation location){
  TridentChunk chunk=world.chunkAt(location,false);
  if (chunk == null) {
    chunk=new TridentChunk(world,location);
    world.addChunkAt(location,chunk);
  }
  while (chunk.lightPopulated.get() != 0x01)   chunk.generate();
  return chunk;
}

Fixed version (ground truth):
private TridentChunk rawChunk(ChunkLocation location){
  TridentChunk chunk=world.chunkAt(location,false);
  if (chunk == null) {
    chunk=new TridentChunk(world,location);
    world.addChunkAt(location,chunk);
  }
  chunk.generate();
  return chunk;
}
Program: 11759
Project: 11759
Buggy source:
@Override public Block blockAt(Position location){
  if (!location.world().name().equals(this.name()))   throw new IllegalArgumentException("String_Node_Str");
  int x=(int)Math.round(location.x());
  int y=(int)Math.round(location.y());
  int z=(int)Math.round(location.z());
  return this.chunkAt(WorldUtils.chunkLocation(x,z),true).blockAt(x & 15,y,z & 15);
}

Fixed version (ground truth):
@Override public Block blockAt(Position location){
  if (!location.world().name().equals(this.name()))   throw new IllegalArgumentException("String_Node_Str");
  int x=(int)Math.floor(location.x());
  int y=(int)Math.floor(location.y());
  int z=(int)Math.floor(location.z());
  return this.chunkAt(WorldUtils.chunkLocation(x,z),true).blockAt(x & 15,y,z & 15);
}
Program: 11760
Project: 11760
Buggy source:
/** 
 * Performs the shutdown procedure on the server, ending with the exit of the JVM
 */
@Override public void shutdown(){
  TridentLogger.get().log("String_Node_Str");
  try {
    ((Statuses)Registered.statuses()).saveAll();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  TridentLogger.get().log("String_Node_Str");
  ConcurrentTaskExecutor.executors().forEach(ConcurrentTaskExecutor::shutdown);
  TridentLogger.get().log("String_Node_Str");
  for (  Player player : TridentPlayer.players()) {
    ((TridentPlayer)player).kickPlayer("String_Node_Str");
    ((TridentPlayer)player).connection().logout();
  }
  TridentLogger.get().log("String_Node_Str");
  for (  World world : rootWorldLoader.worlds())   ((TridentWorld)world).save();
  TridentLogger.get().log("String_Node_Str");
  ((TridentTaskScheduler)Registered.tasks()).shutdown();
  TridentLogger.get().log("String_Node_Str");
  ThreadsHandler.shutdownAll();
  TridentLogger.get().log("String_Node_Str");
  for (  Plugin plugin : Registered.plugins())   Registered.plugins().disable(plugin);
  TridentLogger.get().log("String_Node_Str");
  TridentStart.close();
  TridentLogger.get().log("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Performs the shutdown procedure on the server, ending with the exit of the JVM
 */
@Override public void shutdown(){
  TridentLogger.get().log("String_Node_Str");
  try {
    ((Statuses)Registered.statuses()).saveAll();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  TridentLogger.get().log("String_Node_Str");
  for (  World world : rootWorldLoader.worlds())   ((TridentWorld)world).save();
  TridentLogger.get().log("String_Node_Str");
  ConcurrentTaskExecutor.executors().forEach(ConcurrentTaskExecutor::shutdown);
  TridentLogger.get().log("String_Node_Str");
  for (  Player player : TridentPlayer.players()) {
    ((TridentPlayer)player).kickPlayer("String_Node_Str");
    ((TridentPlayer)player).connection().logout();
  }
  TridentLogger.get().log("String_Node_Str");
  ((TridentTaskScheduler)Registered.tasks()).shutdown();
  TridentLogger.get().log("String_Node_Str");
  ThreadsHandler.shutdownAll();
  TridentLogger.get().log("String_Node_Str");
  for (  Plugin plugin : Registered.plugins())   Registered.plugins().disable(plugin);
  TridentLogger.get().log("String_Node_Str");
  TridentStart.close();
  TridentLogger.get().log("String_Node_Str");
}