From 1ddfd1e3cc7f4e3b2a841cce7c54bf3e3de1cef4 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 19 Jul 2017 13:26:00 +0200 Subject: [PATCH] Added some 'extends ChromaGamerBase' --- .../buttondevteam/lib/player/AbstractUserClass.java | 2 +- .../buttondevteam/lib/player/ChromaGamerBase.java | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/buttondevteam/lib/player/AbstractUserClass.java b/src/main/java/buttondevteam/lib/player/AbstractUserClass.java index f6554e1..fdbc45d 100644 --- a/src/main/java/buttondevteam/lib/player/AbstractUserClass.java +++ b/src/main/java/buttondevteam/lib/player/AbstractUserClass.java @@ -24,5 +24,5 @@ public @interface AbstractUserClass { /** * Indicates the class to create when connecting accounts. */ - Class prototype(); + Class prototype(); } diff --git a/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java b/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java index beff3a4..0424c41 100644 --- a/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java +++ b/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java @@ -16,7 +16,7 @@ import buttondevteam.lib.TBMCCoreAPI; public abstract class ChromaGamerBase implements AutoCloseable { public static final String TBMC_PLAYERS_DIR = "TBMC/players/"; - private static final HashBiMap, String> playerTypes = HashBiMap.create(); + private static final HashBiMap, String> playerTypes = HashBiMap.create(); /** * Used for connecting with every type of user ({@link #connectWith(ChromaGamerBase)}) @@ -55,7 +55,7 @@ public abstract class ChromaGamerBase implements AutoCloseable { * The folder to get the class from (like "minecraft") * @return The type for the given folder name or null if not found */ - public static Class getTypeForFolder(String foldername) { + public static Class getTypeForFolder(String foldername) { return playerTypes.inverse().get(foldername); } @@ -131,16 +131,15 @@ public abstract class ChromaGamerBase implements AutoCloseable { Consumer sync = sourcedata -> { final String sourcefolder = sourcedata == plugindata ? ownFolder : userFolder; final String id = sourcedata.getString(sourcefolder + "_id"); - for (Entry, String> entry : playerTypes.entrySet()) { // Set our ID in all files we can find, both from our connections and the new ones + for (Entry, String> entry : playerTypes.entrySet()) { // Set our ID in all files we can find, both from our connections and the new ones if (entry.getKey() == getClass() || entry.getKey() == user.getClass()) continue; final String otherid = sourcedata.getString(entry.getValue() + "_id"); if (otherid == null) continue; - try (@SuppressWarnings("unchecked") - ChromaGamerBase cg = getUser(otherid, (Class) entry.getKey())) { + try (ChromaGamerBase cg = getUser(otherid, entry.getKey())) { cg.plugindata.set(sourcefolder + "_id", id); // Set new IDs - for (Entry, String> item : playerTypes.entrySet()) + for (Entry, String> item : playerTypes.entrySet()) if (sourcedata.contains(item.getValue() + "_id")) cg.plugindata.set(item.getValue() + "_id", sourcedata.getString(item.getValue() + "_id")); // Set all existing IDs } catch (Exception e) {