Skip to content

Commit

Permalink
reformat spigot package
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulu13022002 committed Dec 16, 2024
1 parent 7d29c67 commit 57c6836
Show file tree
Hide file tree
Showing 11 changed files with 561 additions and 1,378 deletions.
13 changes: 5 additions & 8 deletions paper-server/src/main/java/org/spigotmc/AsyncCatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

import net.minecraft.server.MinecraftServer;

public class AsyncCatcher
{
public class AsyncCatcher {

public static boolean enabled = true;

public static void catchOp(String reason)
{
if ( AsyncCatcher.enabled && Thread.currentThread() != MinecraftServer.getServer().serverThread )
{
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); // Paper
throw new IllegalStateException( "Asynchronous " + reason + "!" );
public static void catchOp(String reason) {
if (AsyncCatcher.enabled && Thread.currentThread() != MinecraftServer.getServer().serverThread) {
MinecraftServer.LOGGER.error("Thread {} failed main thread check: {}", Thread.currentThread().getName(), reason, new Throwable()); // Paper
throw new IllegalStateException("Asynchronous " + reason + "!");
}
}
}
27 changes: 11 additions & 16 deletions paper-server/src/main/java/org/spigotmc/LimitStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,30 @@
import java.io.InputStream;
import net.minecraft.nbt.NbtAccounter;

public class LimitStream extends FilterInputStream
{
public class LimitStream extends FilterInputStream {

private final NbtAccounter limit;

public LimitStream(InputStream is, NbtAccounter limit)
{
super( is );
public LimitStream(InputStream is, NbtAccounter limit) {
super(is);
this.limit = limit;
}

@Override
public int read() throws IOException
{
this.limit.accountBytes( 1 );
public int read() throws IOException {
this.limit.accountBytes(1);
return super.read();
}

@Override
public int read(byte[] b) throws IOException
{
this.limit.accountBytes( b.length );
return super.read( b );
public int read(byte[] b) throws IOException {
this.limit.accountBytes(b.length);
return super.read(b);
}

@Override
public int read(byte[] b, int off, int len) throws IOException
{
this.limit.accountBytes( len );
return super.read( b, off, len );
public int read(byte[] b, int off, int len) throws IOException {
this.limit.accountBytes(len);
return super.read(b, off, len);
}
}
Loading

0 comments on commit 57c6836

Please sign in to comment.