Don't spam warnings when Mojang's API goes down. (Which happens a lot)

This commit is contained in:
Thinkofdeath 2014-04-09 15:21:59 +01:00
parent 98825a6430
commit 5f03f206c3

View File

@ -1,4 +1,4 @@
From d303eb8ffc3f82badc690c1bad71782f0d5f7b57 Mon Sep 17 00:00:00 2001 From 2734342f54016d2ca4440bd07ed371a6458f5ccc Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com> From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Wed, 9 Apr 2014 13:29:57 +0100 Date: Wed, 9 Apr 2014 13:29:57 +0100
Subject: [PATCH] Convert player heads async Subject: [PATCH] Convert player heads async
@ -112,10 +112,10 @@ index b241cfe..925e017 100644
public Packet getUpdatePacket() { public Packet getUpdatePacket() {
diff --git a/src/main/java/org/spigotmc/HeadConverter.java b/src/main/java/org/spigotmc/HeadConverter.java diff --git a/src/main/java/org/spigotmc/HeadConverter.java b/src/main/java/org/spigotmc/HeadConverter.java
new file mode 100644 new file mode 100644
index 0000000..bc949a1 index 0000000..a284768
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/HeadConverter.java +++ b/src/main/java/org/spigotmc/HeadConverter.java
@@ -0,0 +1,163 @@ @@ -0,0 +1,168 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import com.google.common.base.Charsets; +import com.google.common.base.Charsets;
@ -148,6 +148,7 @@ index 0000000..bc949a1
+ .setNameFormat( "Head Conversion Thread - %1$d" ) + .setNameFormat( "Head Conversion Thread - %1$d" )
+ .build() + .build()
+ ); + );
+ private static boolean hasWarned = false;
+ +
+ public static void convertHead(final TileEntitySkull head) + public static void convertHead(final TileEntitySkull head)
+ { + {
@ -267,7 +268,11 @@ index 0000000..bc949a1
+ e.printStackTrace(); + e.printStackTrace();
+ } catch ( IOException e ) + } catch ( IOException e )
+ { + {
+ Bukkit.getLogger().warning( "Error connecting to Mojang servers, cannot convert player heads" ); + if (!hasWarned)
+ {
+ hasWarned = true;
+ Bukkit.getLogger().warning( "Error connecting to Mojang servers, cannot convert player heads" );
+ }
+ } finally + } finally
+ { + {
+ if ( connection != null ) + if ( connection != null )