geforkt von Mirrors/Paper
Rebase (Update) from upstream SpigotMC
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66 Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
Dieser Commit ist enthalten in:
Ursprung
e5cafd752b
Commit
a0e810eaf9
@ -20,4 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void updateInventory();
|
||||
|
||||
/**
|
||||
--
|
||||
--
|
||||
1.8.4.2
|
||||
|
||||
|
@ -5,24 +5,6 @@ Subject: [PATCH] mc-dev imports
|
||||
|
||||
Imported files which are only modified by Spigot, not upstream. Files here should be completely unmodified aside from trivial changes such as adding throws statements to ensure proper compilation. You may need to add unrelated files in order to ensure a compilable result in the face of synthetic methods.
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -0,0 +0,0 @@
|
||||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>org.spigotmc</groupId>
|
||||
+ <artifactId>sneaky-throw</artifactId>
|
||||
+ <version>1.0</version>
|
||||
+ <scope>system</scope>
|
||||
+ <systemPath>${project.basedir}/../SneakyThrow.jar</systemPath>
|
||||
+ </dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
diff --git a/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
@ -4212,6 +4194,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return new WorldGenVillageStart(this.c, this.b, i, j, this.f);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/SneakyThrow.java b/src/main/java/org/spigotmc/SneakyThrow.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/SneakyThrow.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+public class SneakyThrow
|
||||
+{
|
||||
+
|
||||
+ public static void sneaky(Throwable t)
|
||||
+ {
|
||||
+ throw SneakyThrow.<RuntimeException>superSneaky( t );
|
||||
+ }
|
||||
+
|
||||
+ private static <T extends Throwable> T superSneaky(Throwable t) throws T
|
||||
+ {
|
||||
+ throw (T) t;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/resources/org/spigotmc/SneakyThrow.class b/src/main/resources/org/spigotmc/SneakyThrow.class
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
@ -38,6 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private final Proxy proxy;
|
||||
+ private final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
+ private ByteArrayInputStream inputStream;
|
||||
+ private InputStream errorStream;
|
||||
+ private boolean outClosed = false;
|
||||
+
|
||||
+ private static final Cache<String, String> cache = CacheBuilder.newBuilder()
|
||||
@ -95,37 +96,57 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ .append( "," );
|
||||
+ }
|
||||
+ }
|
||||
+ missingUsers.deleteCharAt( missingUsers.length() - 1 ).append( "]" );
|
||||
+ HttpURLConnection connection;
|
||||
+ if ( proxy == null )
|
||||
+ if ( missingUsers.length() > 1 )
|
||||
+ {
|
||||
+ connection = (HttpURLConnection) cachedStreamHandler.getDefaultConnection( url );
|
||||
+ missingUsers.deleteCharAt( missingUsers.length() - 1 ).append( "]" );
|
||||
+ }
|
||||
+ if ( missingUsers.length() > 2 )
|
||||
+ {
|
||||
+ HttpURLConnection connection;
|
||||
+ if ( proxy == null )
|
||||
+ {
|
||||
+ connection = (HttpURLConnection) cachedStreamHandler.getDefaultConnection( url );
|
||||
+ } else
|
||||
+ {
|
||||
+ connection = (HttpURLConnection) cachedStreamHandler.getDefaultConnection( url, proxy );
|
||||
+ }
|
||||
+ connection.setRequestMethod( "POST" );
|
||||
+ connection.setRequestProperty( "Content-Type", "application/json" );
|
||||
+ connection.setDoInput( true );
|
||||
+ connection.setDoOutput( true );
|
||||
+ OutputStream out = connection.getOutputStream();
|
||||
+ out.write( missingUsers.toString().getBytes( Charsets.UTF_8 ) );
|
||||
+ out.flush();
|
||||
+ out.close();
|
||||
+ JsonArray newUsers = new JsonParser().parse( new InputStreamReader( connection.getInputStream(), Charsets.UTF_8 ) ).getAsJsonArray();
|
||||
+ for ( JsonElement user : newUsers )
|
||||
+ {
|
||||
+ JsonObject u = user.getAsJsonObject();
|
||||
+ cache.put( u.get( "name" ).getAsString(), u.toString() );
|
||||
+ reply.append( u.toString() ).append( "," );
|
||||
+ }
|
||||
+ responseCode = connection.getResponseCode();
|
||||
+ errorStream = connection.getErrorStream();
|
||||
+ } else
|
||||
+ {
|
||||
+ connection = (HttpURLConnection) cachedStreamHandler.getDefaultConnection( url, proxy );
|
||||
+ responseCode = HTTP_OK;
|
||||
+ }
|
||||
+ connection.setRequestMethod( "POST" );
|
||||
+ connection.setRequestProperty( "Content-Type", "application/json" );
|
||||
+ connection.setDoInput( true );
|
||||
+ connection.setDoOutput( true );
|
||||
+ OutputStream out = connection.getOutputStream();
|
||||
+ out.write( missingUsers.toString().getBytes( Charsets.UTF_8 ) );
|
||||
+ out.flush();
|
||||
+ out.close();
|
||||
+ JsonArray newUsers = new JsonParser().parse( new InputStreamReader( connection.getInputStream(), Charsets.UTF_8 ) ).getAsJsonArray();
|
||||
+ for ( JsonElement user : newUsers )
|
||||
+ if ( reply.length() > 1 )
|
||||
+ {
|
||||
+ JsonObject u = user.getAsJsonObject();
|
||||
+ cache.put( u.get( "name" ).getAsString(), u.toString() );
|
||||
+ reply.append( u.toString() ).append( "," );
|
||||
+ reply.deleteCharAt( reply.length() - 1 );
|
||||
+ }
|
||||
+ reply.deleteCharAt( reply.length() - 1 );
|
||||
+ inputStream = new ByteArrayInputStream( reply.append( "]" ).toString().getBytes( Charsets.UTF_8 ) );
|
||||
+ }
|
||||
+ return inputStream;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public InputStream getErrorStream()
|
||||
+ {
|
||||
+ return errorStream;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public OutputStream getOutputStream() throws IOException
|
||||
+ {
|
||||
+ if ( outClosed )
|
||||
@ -154,6 +175,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+public class CachedStreamHandlerFactory implements URLStreamHandlerFactory
|
||||
+{
|
||||
+ public static boolean isSet = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public URLStreamHandler createURLStreamHandler(String protocol)
|
||||
+ {
|
||||
@ -275,10 +298,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ private static void globalAPICache()
|
||||
+ {
|
||||
+ if ( getBoolean( "settings.global-api-cache", false ) )
|
||||
+ if ( getBoolean( "settings.global-api-cache", false ) && !CachedStreamHandlerFactory.isSet )
|
||||
+ {
|
||||
+ Bukkit.getLogger().info( "Global API cache enabled - All requests to Mojang's API will be " +
|
||||
+ "handled by Spigot" );
|
||||
+ CachedStreamHandlerFactory.isSet = true;
|
||||
+ URL.setURLStreamHandlerFactory(new CachedStreamHandlerFactory());
|
||||
+ }
|
||||
+ }
|
||||
|
@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thinkofdeath@spigotmc.org>
|
||||
Date: Sat, 30 Aug 2014 18:36:32 +0100
|
||||
Subject: [PATCH] Fix a missed rename in WorldGenGroundBush
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldGenGroundBush.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
|
||||
@@ -0,0 +0,0 @@ public class WorldGenGroundBush extends WorldGenTrees {
|
||||
this.a = j;
|
||||
}
|
||||
|
||||
- public boolean a(World world, Random random, int i, int j, int k) {
|
||||
+ public boolean generate(World world, Random random, int i, int j, int k) { // Spigot
|
||||
Block block;
|
||||
|
||||
while (((block = world.getType(i, j, k)).getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) && j > 0) {
|
||||
--
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren