[UtilKlasse] UUIDFetcher - Asynchron & mit Cache - Name/UUID

Hier könnt ihr anderen Leuten helfen, indem ihr Anleitungen oder praktische Codesegmente zur Verfügung stellt.

[UtilKlasse] UUIDFetcher - Asynchron & mit Cache - Name/UUID

Beitragvon Jofkos » So 30. Nov 2014, 00:07

UUIDFetcher
Ich habe hier noch einen UUID Fetcher, der auch Asynchron über einen ThreadPool die UUID's gettet geschrieben: (alternativ Link, Java 7 Version (ungetestet))
Code: Alles auswählen
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3. import java.net.HttpURLConnection;
  4. import java.net.URL;
  5. import java.util.HashMap;
  6. import java.util.Map;
  7. import java.util.UUID;
  8. import java.util.concurrent.ExecutorService;
  9. import java.util.concurrent.Executors;
  10. import java.util.function.Consumer;
  11. import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
  12. import org.bukkit.craftbukkit.libs.com.google.gson.GsonBuilder;
  13. import com.mojang.util.UUIDTypeAdapter;
  14. public class UUIDFetcher {
  15.    
  16.    /**
  17.     * Date when name changes were introduced
  18.     * @see UUIDFetcher#getUUIDAt(String, long)
  19.     */
  20.    public static final long FEBRUARY_2015 = 1422748800000L;
  21.    
  22.    
  23.    private static Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
  24.    
  25.    private static final String UUID_URL = "https://api.mojang.com/users/profiles/minecraft/%s?at=%d";
  26.    private static final String NAME_URL = "https://api.mojang.com/user/profiles/%s/names";
  27.    private static Map<String, UUID> uuidCache = new HashMap<String, UUID>();
  28.    private static Map<UUID, String> nameCache = new HashMap<UUID, String>();
  29.    private static ExecutorService pool = Executors.newCachedThreadPool();
  30.    
  31.    private String name;
  32.    private UUID id;
  33.       
  34.    /**
  35.     * Fetches the uuid asynchronously and passes it to the consumer
  36.     *
  37.     * @param name The name
  38.     * @param action Do what you want to do with the uuid her
  39.     */
  40.    public static void getUUID(String name, Consumer<UUID> action) {
  41.       pool.execute(() -> action.accept(getUUID(name)));
  42.    }
  43.    
  44.    /**
  45.     * Fetches the uuid synchronously and returns it
  46.     *
  47.     * @param name The name
  48.     * @return The uuid
  49.     */
  50.    public static UUID getUUID(String name) {
  51.       return getUUIDAt(name, System.currentTimeMillis());
  52.    }
  53.    
  54.    /**
  55.     * Fetches the uuid synchronously for a specified name and time and passes the result to the consumer
  56.     *
  57.     * @param name The name
  58.     * @param timestamp Time when the player had this name in milliseconds
  59.     * @param action Do what you want to do with the uuid her
  60.     */
  61.    public static void getUUIDAt(String name, long timestamp, Consumer<UUID> action) {
  62.       pool.execute(() -> action.accept(getUUIDAt(name, timestamp)));
  63.    }
  64.    
  65.    /**
  66.     * Fetches the uuid synchronously for a specified name and time
  67.     *
  68.     * @param name The name
  69.     * @param timestamp Time when the player had this name in milliseconds
  70.     * @see UUIDFetcher#FEBRUARY_2015
  71.     */
  72.    public static UUID getUUIDAt(String name, long timestamp) {
  73.       name = name.toLowerCase();
  74.       if (uuidCache.containsKey(name)) {
  75.          return uuidCache.get(name);
  76.       }
  77.       try {
  78.          HttpURLConnection connection = (HttpURLConnection) new URL(String.format(UUID_URL, name, timestamp/1000)).openConnection();
  79.          connection.setReadTimeout(5000);
  80.          UUIDFetcher data = gson.fromJson(new BufferedReader(new InputStreamReader(connection.getInputStream())), UUIDFetcher.class);
  81.          
  82.          uuidCache.put(name, data.id);
  83.          nameCache.put(data.id, data.name);
  84.          return data.id;
  85.       } catch (Exception e) {
  86.          e.printStackTrace();
  87.       }
  88.       
  89.       return null;
  90.    }
  91.    
  92.    /**
  93.     * Fetches the name asynchronously and passes it to the consumer
  94.     *
  95.     * @param uuid The uuid
  96.     * @param action Do what you want to do with the name her
  97.     */
  98.    public static void getName(UUID uuid, Consumer<String> action) {
  99.       pool.execute(() -> action.accept(getName(uuid)));
  100.    }
  101.    /**
  102.     * Fetches the name synchronously and returns it
  103.     *
  104.     * @param uuid The uuid
  105.     * @return The name
  106.     */
  107.    public static String getName(UUID uuid) {
  108.       if (nameCache.containsKey(uuid)) {
  109.          return nameCache.get(uuid);
  110.       }
  111.       try {
  112.          HttpURLConnection connection = (HttpURLConnection) new URL(String.format(NAME_URL, UUIDTypeAdapter.fromUUID(uuid))).openConnection();
  113.          connection.setReadTimeout(5000);
  114.          UUIDFetcher[] nameHistory = gson.fromJson(new BufferedReader(new InputStreamReader(connection.getInputStream())), UUIDFetcher[].class);
  115.          UUIDFetcher currentNameData = nameHistory[nameHistory.length - 1];
  116.          uuidCache.put(currentNameData.name.toLowerCase(), uuid);
  117.          nameCache.put(uuid, currentNameData.name);
  118.          return currentNameData.name;
  119.       } catch (Exception e) {
  120.          e.printStackTrace();
  121.       }
  122.       return null;
  123.    }
  124. }
Verwendung
  • FEBRUARY_2015 - Konstante: Februar 2015 in Millisekunden - Dann wurde das Name-Changing eingeführt
  • String getName(UUID uuid) - Gibt den Namen für die angegebene UUID zurück (synchron)
  • void getName(UUID uuid, Consumer<String> action) - Gibt den Namen für die angegebene UUID über den Consumer zurück (asynchron)
  • UUID getUUID(String name) - Gibt die UUID für den angegebenen Namen zurück (synchron)
  • void getUUID(String name, Consumer<UUID> action) - Gibt die UUID für den angegebenen Namen über den Consumer zurück (asynchron)
  • UUID getUUIDAt(String name, long timestamp) - Gibt die UUID für den angegebenen Namen zum angegebenen Zeitpunkt in Millisekunden zurück (synchron)
  • void getUUIDAt(String name, long timestamp, Consumer<UUID> action) - Gibt die UUID für den angegebenen Namen zum angegebenen Zeitpunkt in Millisekunden über den Consumer zurück (asynchron)

Für Accounts die vor dem Einführen des Namenänderungs Feature erstellt wurden, bekommt man die UUID für den ursprünglichen Namen in dem man die FEBRUARY_2015 an die getUUIDAt Methode übergibt.

Falls ihr Fehler/Bugs findet, bitte meldet sie mir!

Falls ihr eine 1.7.10 CraftBukkit oder Spigot Version benutzt und die Klasse nicht funktioniert, lest das hier.

(Die Klasse benötigt Java 8, die Java 7 Version ist ungetestet)
Zuletzt geändert von Jofkos am Sa 21. Feb 2015, 20:28, insgesamt 21-mal geändert.
Jofkos

...........

..Bild
Benutzeravatar
Jofkos
 
Beiträge: 1537
Registriert: So 16. Jun 2013, 22:45

Re: UUIDFetcher - Asynchron

Beitragvon 4ch3los » So 30. Nov 2014, 02:55

Yeah jofkos ist eben besser als @Summerfeeling :3 <3 :D
Benutzeravatar
4ch3los
 
Beiträge: 24
Registriert: Sa 12. Jul 2014, 14:33

Re: UUIDFetcher - Asynchron

Beitragvon IK_Raptor » So 30. Nov 2014, 09:43

Da war ein Jofkos gestern aber noch fleißig. :3
Benutzeravatar
IK_Raptor
 
Beiträge: 609
Registriert: Mo 12. Aug 2013, 15:37

Re: UUIDFetcher - Asynchron

Beitragvon Summerfeeling » So 30. Nov 2014, 15:35

DJ_4ch3los hat geschrieben:Yeah jofkos ist eben besser als @Summerfeeling :3 <3 :D

Wird daran liegen das ich nicht mit Java 8 programmiere. <3
Grüße
Summerfeeling | Timo
Benutzeravatar
Summerfeeling
 
Beiträge: 1300
Registriert: Sa 15. Jun 2013, 18:43
Wohnort: Viersen

Re: UUIDFetcher - Asynchron

Beitragvon IK_Raptor » So 30. Nov 2014, 15:54

Die Methode ist ebenso auch mit Java 1.7 umsetzbar. :P Die Ausrede gilt hier nicht. ;)
Benutzeravatar
IK_Raptor
 
Beiträge: 609
Registriert: Mo 12. Aug 2013, 15:37

Re: Asynchroner UUIDFetcher mit Cache

Beitragvon Jofkos » Fr 19. Dez 2014, 18:10

Update:
  • Alle Methoden sind nun static, da eine Instanziierung hier nicht viel Sinn ergibt.
  • Version in Java 7 hinzugefügt (nicht ganz so schön wie die in Java 8 :P)
Jofkos

...........

..Bild
Benutzeravatar
Jofkos
 
Beiträge: 1537
Registriert: So 16. Jun 2013, 22:45

Re: Asynchroner UUIDFetcher mit Cache

Beitragvon Jofkos » Mo 5. Jan 2015, 23:09

Update:
  • getName hinzugefügt
  • Auf Gson umgestiegen
  • JavaDocs hinzugefügt
Jofkos

...........

..Bild
Benutzeravatar
Jofkos
 
Beiträge: 1537
Registriert: So 16. Jun 2013, 22:45

Re: Asynchroner UUIDFetcher mit Cache

Beitragvon Twister_21 » Di 6. Jan 2015, 10:52

Ich weiß zwar nicht warum, aber irgendwie funktioniert die Klasse bei mir nicht richtig. Die getUUID()-Methode funktioniert nicht mal im GameProfileBuilder.

Fehlermeldung(mehrere Ausführungen):
Code: Alles auswählen
  1. [10:32:43] [pool-9-thread-1/WARN]: java.lang.NullPointerException
  2. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  3. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  4. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  5. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  6. [10:32:43] [pool-9-thread-1/WARN]:    at java.lang.Thread.run(Thread.java:745)
  7. [10:32:43] [pool-9-thread-1/WARN]: java.lang.NullPointerException
  8. [10:32:43] [pool-9-thread-1/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  9. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  10. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  11. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  12. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  13. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  14. [10:32:43] [pool-9-thread-1/WARN]:    at java.lang.Thread.run(Thread.java:745)
  15. [10:32:43] [pool-9-thread-3/WARN]: java.lang.NullPointerException
  16. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  17. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  18. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  19. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  20. [10:32:43] [pool-9-thread-3/WARN]:    at java.lang.Thread.run(Thread.java:745)
  21. [10:32:43] [pool-9-thread-3/WARN]: java.lang.NullPointerException
  22. [10:32:43] [pool-9-thread-3/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  23. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  24. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  25. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  26. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  27. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  28. [10:32:43] [pool-9-thread-3/WARN]:    at java.lang.Thread.run(Thread.java:745)
  29. [10:32:43] [pool-9-thread-5/WARN]: java.lang.NullPointerException
  30. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  31. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  32. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  33. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  34. [10:32:43] [pool-9-thread-5/WARN]:    at java.lang.Thread.run(Thread.java:745)
  35. [10:32:43] [pool-9-thread-2/WARN]: java.lang.NullPointerException
  36. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  37. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  38. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  39. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  40. [10:32:43] [pool-9-thread-2/WARN]:    at java.lang.Thread.run(Thread.java:745)
  41. [10:32:43] [pool-9-thread-4/WARN]: java.lang.NullPointerException
  42. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  43. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  44. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  45. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  46. [10:32:43] [pool-9-thread-4/WARN]:    at java.lang.Thread.run(Thread.java:745)
  47. [10:32:43] [pool-9-thread-2/WARN]: java.lang.NullPointerException
  48. [10:32:43] [pool-9-thread-2/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  49. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  50. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  51. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  52. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  53. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  54. [10:32:43] [pool-9-thread-2/WARN]:    at java.lang.Thread.run(Thread.java:745)
  55. [10:32:43] [pool-9-thread-4/WARN]: java.lang.NullPointerException
  56. [10:32:43] [pool-9-thread-4/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  57. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  58. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  59. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  60. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  61. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  62. [10:32:43] [pool-9-thread-4/WARN]:    at java.lang.Thread.run(Thread.java:745)
  63. [10:32:43] [pool-9-thread-5/WARN]: java.lang.NullPointerException
  64. [10:32:43] [pool-9-thread-5/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  65. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  66. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  67. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  68. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  69. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  70. [10:32:43] [pool-9-thread-5/WARN]:    at java.lang.Thread.run(Thread.java:745)
  71. [10:32:43] [pool-9-thread-6/WARN]: java.lang.NullPointerException
  72. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  73. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  74. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  75. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  76. [10:32:43] [pool-9-thread-6/WARN]:    at java.lang.Thread.run(Thread.java:745)
  77. [10:32:43] [pool-9-thread-6/WARN]: java.lang.NullPointerException
  78. [10:32:43] [pool-9-thread-6/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  79. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  80. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  81. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  82. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  83. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  84. [10:32:43] [pool-9-thread-6/WARN]:    at java.lang.Thread.run(Thread.java:745)


Sep's Klasse funktioniert, aber bei der von Jofkos, die ich für das Nicken benötige gibts Fehler.
Mit freundlichen Grüßen
Twister21
Benutzeravatar
Twister_21
 
Beiträge: 652
Registriert: Mi 11. Jun 2014, 05:51
Wohnort: Deutschland

Re: Asynchroner UUIDFetcher mit Cache

Beitragvon Jofkos » Di 6. Jan 2015, 16:15

Twister_21 hat geschrieben:Ich weiß zwar nicht warum, aber irgendwie funktioniert die Klasse bei mir nicht richtig. Die getUUID()-Methode funktioniert nicht mal im GameProfileBuilder.

Fehlermeldung(mehrere Ausführungen):
Code: Alles auswählen
  1. [10:32:43] [pool-9-thread-1/WARN]: java.lang.NullPointerException
  2. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  3. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  4. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  5. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  6. [10:32:43] [pool-9-thread-1/WARN]:    at java.lang.Thread.run(Thread.java:745)
  7. [10:32:43] [pool-9-thread-1/WARN]: java.lang.NullPointerException
  8. [10:32:43] [pool-9-thread-1/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  9. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  10. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  11. [10:32:43] [pool-9-thread-1/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  12. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  13. [10:32:43] [pool-9-thread-1/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  14. [10:32:43] [pool-9-thread-1/WARN]:    at java.lang.Thread.run(Thread.java:745)
  15. [10:32:43] [pool-9-thread-3/WARN]: java.lang.NullPointerException
  16. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  17. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  18. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  19. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  20. [10:32:43] [pool-9-thread-3/WARN]:    at java.lang.Thread.run(Thread.java:745)
  21. [10:32:43] [pool-9-thread-3/WARN]: java.lang.NullPointerException
  22. [10:32:43] [pool-9-thread-3/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  23. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  24. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  25. [10:32:43] [pool-9-thread-3/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  26. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  27. [10:32:43] [pool-9-thread-3/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  28. [10:32:43] [pool-9-thread-3/WARN]:    at java.lang.Thread.run(Thread.java:745)
  29. [10:32:43] [pool-9-thread-5/WARN]: java.lang.NullPointerException
  30. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  31. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  32. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  33. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  34. [10:32:43] [pool-9-thread-5/WARN]:    at java.lang.Thread.run(Thread.java:745)
  35. [10:32:43] [pool-9-thread-2/WARN]: java.lang.NullPointerException
  36. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  37. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  38. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  39. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  40. [10:32:43] [pool-9-thread-2/WARN]:    at java.lang.Thread.run(Thread.java:745)
  41. [10:32:43] [pool-9-thread-4/WARN]: java.lang.NullPointerException
  42. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  43. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  44. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  45. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  46. [10:32:43] [pool-9-thread-4/WARN]:    at java.lang.Thread.run(Thread.java:745)
  47. [10:32:43] [pool-9-thread-2/WARN]: java.lang.NullPointerException
  48. [10:32:43] [pool-9-thread-2/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  49. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  50. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  51. [10:32:43] [pool-9-thread-2/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  52. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  53. [10:32:43] [pool-9-thread-2/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  54. [10:32:43] [pool-9-thread-2/WARN]:    at java.lang.Thread.run(Thread.java:745)
  55. [10:32:43] [pool-9-thread-4/WARN]: java.lang.NullPointerException
  56. [10:32:43] [pool-9-thread-4/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  57. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  58. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  59. [10:32:43] [pool-9-thread-4/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  60. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  61. [10:32:43] [pool-9-thread-4/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  62. [10:32:43] [pool-9-thread-4/WARN]:    at java.lang.Thread.run(Thread.java:745)
  63. [10:32:43] [pool-9-thread-5/WARN]: java.lang.NullPointerException
  64. [10:32:43] [pool-9-thread-5/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  65. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  66. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  67. [10:32:43] [pool-9-thread-5/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  68. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  69. [10:32:43] [pool-9-thread-5/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  70. [10:32:43] [pool-9-thread-5/WARN]:    at java.lang.Thread.run(Thread.java:745)
  71. [10:32:43] [pool-9-thread-6/WARN]: java.lang.NullPointerException
  72. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.UUIDFetcher.getUUID(UUIDFetcher.java:58)
  73. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  74. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  75. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  76. [10:32:43] [pool-9-thread-6/WARN]:    at java.lang.Thread.run(Thread.java:745)
  77. [10:32:43] [pool-9-thread-6/WARN]: java.lang.NullPointerException
  78. [10:32:43] [pool-9-thread-6/WARN]:    at com.mojang.util.UUIDTypeAdapter.fromUUID(UUIDTypeAdapter.java:22)
  79. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:77)
  80. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.GameProfileBuilder.fetch(GameProfileBuilder.java:55)
  81. [10:32:43] [pool-9-thread-6/WARN]:    at de.twister_21.globalnametag.TagSkin$1.run(TagSkin.java:38)
  82. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  83. [10:32:43] [pool-9-thread-6/WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  84. [10:32:43] [pool-9-thread-6/WARN]:    at java.lang.Thread.run(Thread.java:745)


Sep's Klasse funktioniert, aber bei der von Jofkos, die ich für das Nicken benötige gibts Fehler.
Was ist denn bei dir Zeile 58? (UUIDFetcher.java:58)
Gestern als ich es getestet habe, hat es bei mir Funktioniert.
Welche Serversoftware-Version benutzt du?

//EDIT:
habs gerade nochmal getestet
Bei mir gehts...
Jofkos

...........

..Bild
Benutzeravatar
Jofkos
 
Beiträge: 1537
Registriert: So 16. Jun 2013, 22:45

Re: [UtilKlasse] UUIDFetcher - Asynchron & mit Cache - Name/

Beitragvon Twister_21 » So 11. Jan 2015, 17:13

Gibt es den UUIDTypeAdapter auch in BungeeCord? Habe da keinen Import für gefunden.
Mit freundlichen Grüßen
Twister21
Benutzeravatar
Twister_21
 
Beiträge: 652
Registriert: Mi 11. Jun 2014, 05:51
Wohnort: Deutschland

Nächste

Zurück zu Anleitungen

Wer ist online?

Mitglieder in diesem Forum: Bing [Bot] und 1 Gast

cron