Use the provided Logger instead of System.out and System.err, inform the user how many disguises failed to load. Inform the user how many settings are missing from their config
This commit is contained in:
parent
53b0491f57
commit
f3d8a18e11
@ -1,11 +1,8 @@
|
|||||||
package me.libraryaddict.disguise;
|
package me.libraryaddict.disguise;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
import me.libraryaddict.disguise.utilities.*;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
|
||||||
import me.libraryaddict.disguise.utilities.PacketsManager;
|
|
||||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -209,7 +206,7 @@ public class DisguiseConfig {
|
|||||||
setModifySeeFriendlyInvisibles(config.getBoolean("Scoreboard.SeeFriendlyInvisibles"));
|
setModifySeeFriendlyInvisibles(config.getBoolean("Scoreboard.SeeFriendlyInvisibles"));
|
||||||
|
|
||||||
if (!LibsPremium.isPremium() && (isSavePlayerDisguises() || isSaveEntityDisguises())) {
|
if (!LibsPremium.isPremium() && (isSavePlayerDisguises() || isSaveEntityDisguises())) {
|
||||||
System.out.println("[LibsDisguises] You must purchase the plugin to use saved disguises!");
|
DisguiseUtilities.getLogger().warning("You must purchase the plugin to use saved disguises!");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -222,10 +219,29 @@ public class DisguiseConfig {
|
|||||||
disablePushing = DisguisePushing.valueOf(option);
|
disablePushing = DisguisePushing.valueOf(option);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
System.out.println("[LibsDisguises] Cannot parse '" + config.getString("SelfDisguisesScoreboard") +
|
DisguiseUtilities.getLogger().info("Cannot parse '" + config.getString("SelfDisguisesScoreboard") +
|
||||||
"' to a valid option for SelfDisguisesTeam");
|
"' to a valid option for SelfDisguisesTeam");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadCustomDisguises();
|
||||||
|
|
||||||
|
int missingConfigs = 0;
|
||||||
|
|
||||||
|
for (String key : config.getDefaultSection().getKeys(true)) {
|
||||||
|
if (config.contains(key, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
missingConfigs++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (missingConfigs > 0) {
|
||||||
|
DisguiseUtilities.getLogger().warning(
|
||||||
|
"Your config is missing " + missingConfigs + " options! Please consider regenerating your config!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void loadCustomDisguises() {
|
||||||
customDisguises.clear();
|
customDisguises.clear();
|
||||||
|
|
||||||
File disguisesFile = new File("plugins/LibsDisguises/disguises.yml");
|
File disguisesFile = new File("plugins/LibsDisguises/disguises.yml");
|
||||||
@ -241,12 +257,14 @@ public class DisguiseConfig {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int failedCustomDisguises = 0;
|
||||||
|
|
||||||
for (String key : section.getKeys(false)) {
|
for (String key : section.getKeys(false)) {
|
||||||
String toParse = section.getString(key);
|
String toParse = section.getString(key);
|
||||||
|
|
||||||
if (getCustomDisguise(toParse) != null) {
|
if (getCustomDisguise(toParse) != null) {
|
||||||
System.err.println(
|
DisguiseUtilities.getLogger()
|
||||||
"[LibsDisguises] Cannot create the custom disguise '" + key + "' as there is a name conflict!");
|
.severe("Cannot create the custom disguise '" + key + "' as there is a name conflict!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,21 +275,27 @@ public class DisguiseConfig {
|
|||||||
|
|
||||||
customDisguises.put(key, disguise);
|
customDisguises.put(key, disguise);
|
||||||
|
|
||||||
System.out.println("[LibsDisguises] Loaded custom disguise " + key);
|
DisguiseUtilities.getLogger().info("Loaded custom disguise " + key);
|
||||||
}
|
}
|
||||||
catch (DisguiseParseException e) {
|
catch (DisguiseParseException e) {
|
||||||
System.err.println("[LibsDisguises] Error while loading custom disguise '" + key + "'" +
|
DisguiseUtilities.getLogger().severe("Error while loading custom disguise '" + key + "'" +
|
||||||
(e.getMessage() == null ? "" : ": " + e.getMessage()));
|
(e.getMessage() == null ? "" : ": " + e.getMessage()));
|
||||||
|
|
||||||
if (e.getMessage() == null)
|
if (e.getMessage() == null)
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
|
failedCustomDisguises++;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[LibsDisguises] Loaded " + customDisguises.size() + " custom disguise" +
|
if (failedCustomDisguises > 0) {
|
||||||
|
DisguiseUtilities.getLogger().severe("Failed to load " + failedCustomDisguises + " custom disguises");
|
||||||
|
}
|
||||||
|
|
||||||
|
DisguiseUtilities.getLogger().info("Loaded " + customDisguises.size() + " custom disguise" +
|
||||||
(customDisguises.size() == 1 ? "" : "s"));
|
(customDisguises.size() == 1 ? "" : "s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ public class DisguiseListener implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
System.out.print(String
|
DisguiseUtilities.getLogger().warning(String
|
||||||
.format("[LibsDisguises] Failed to check for update: %s", ex.getMessage()));
|
.format("Failed to check for update: %s", ex.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0, (20 * 60 * 60 * 6)); // Check every 6 hours
|
}, 0, (20 * 60 * 60 * 6)); // Check every 6 hours
|
||||||
|
@ -44,17 +44,14 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
|
|
||||||
if (ReflectionManager.getMinecraftVersion().startsWith("1.13")) {
|
if (ReflectionManager.getMinecraftVersion().startsWith("1.13")) {
|
||||||
if (!LibsPremium.isPremium()) {
|
if (!LibsPremium.isPremium()) {
|
||||||
System.out.println("[LibsDisguises] You must purchase the plugin to use 1.13!");
|
getLogger().severe("You must purchase the plugin to use 1.13!");
|
||||||
System.out.println(
|
getLogger().severe("This will be released free two weeks after all bugs have been fixed!");
|
||||||
"[LibsDisguises] This will be released free two weeks after all bugs have been fixed!");
|
getLogger().severe("If you've already purchased the plugin, place the purchased jar inside the " +
|
||||||
System.out.println(
|
|
||||||
"[LibsDisguises] If you've already purchased the plugin, place the purchased jar inside the " +
|
|
||||||
"Lib's Disguises plugin folder");
|
"Lib's Disguises plugin folder");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println(
|
getLogger().severe("You're using the wrong version of Lib's Disguises for your server! This is " +
|
||||||
"[LibsDisguises] You're using the wrong version of Lib's Disguises for your server! This is " +
|
|
||||||
"intended for 1.13!");
|
"intended for 1.13!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -368,7 +365,7 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (watcherClass == null) {
|
if (watcherClass == null) {
|
||||||
System.err.println("Error loading " + disguiseType.name() + ", FlagWatcher not assigned");
|
getLogger().severe("Error loading " + disguiseType.name() + ", FlagWatcher not assigned");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,11 +507,9 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
MetaIndex flagType = MetaIndex.getFlag(watcherClass, watch.getIndex());
|
MetaIndex flagType = MetaIndex.getFlag(watcherClass, watch.getIndex());
|
||||||
|
|
||||||
if (flagType == null) {
|
if (flagType == null) {
|
||||||
System.err.println("[LibsDisguises] MetaIndex not found for " + disguiseType + "! Index: " +
|
getLogger().severe("MetaIndex not found for " + disguiseType + "! Index: " + watch.getIndex());
|
||||||
watch.getIndex());
|
getLogger().severe("Value: " + watch.getRawValue() + " (" + watch.getRawValue().getClass() +
|
||||||
System.err.println("[LibsDisguises] Value: " + watch.getRawValue() + " (" +
|
") (" + nmsEntity.getClass() + ") & " + watcherClass.getSimpleName());
|
||||||
watch.getRawValue().getClass() + ") (" + nmsEntity.getClass() + ") & " +
|
|
||||||
watcherClass.getSimpleName());
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,19 +520,19 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
|
|
||||||
if (ourValue != nmsValue &&
|
if (ourValue != nmsValue &&
|
||||||
((ourValue == null || nmsValue == null) || ourValue.getClass() != nmsValue.getClass())) {
|
((ourValue == null || nmsValue == null) || ourValue.getClass() != nmsValue.getClass())) {
|
||||||
System.err.println("[LibsDisguises] MetaIndex mismatch for " + disguiseType + "! Index: " +
|
getLogger().severe("[MetaIndex mismatch for " + disguiseType + "! Index: " + watch.getIndex());
|
||||||
watch.getIndex());
|
getLogger().severe("MetaIndex: " + flagType.getDefault() + " (" +
|
||||||
System.err.println("[LibsDisguises] MetaIndex: " + flagType.getDefault() + " (" +
|
|
||||||
flagType.getDefault().getClass() + ") (" + nmsEntity.getClass() + ") & " +
|
flagType.getDefault().getClass() + ") (" + nmsEntity.getClass() + ") & " +
|
||||||
watcherClass.getSimpleName());
|
watcherClass.getSimpleName());
|
||||||
System.err.println("[LibsDisguises] Minecraft: " + watch.getRawValue() + " (" +
|
getLogger().severe("Minecraft: " + watch.getRawValue() + " (" + watch.getRawValue().getClass() +
|
||||||
watch.getRawValue().getClass() + ")");
|
")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MetaIndex index : indexes) {
|
for (MetaIndex index : indexes) {
|
||||||
System.out.println("[LibsDisguises] " + disguiseType + " has MetaIndex remaining! " +
|
getLogger().warning(
|
||||||
index.getFlagWatcher().getSimpleName() + " at index " + index.getIndex());
|
disguiseType + " has MetaIndex remaining! " + index.getFlagWatcher().getSimpleName() +
|
||||||
|
" at index " + index.getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
DisguiseSound sound = DisguiseSound.getType(disguiseType.name());
|
DisguiseSound sound = DisguiseSound.getType(disguiseType.name());
|
||||||
@ -566,13 +561,12 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
disguiseValues.setEntitySize(ReflectionManager.getSize(bukkitEntity));
|
disguiseValues.setEntitySize(ReflectionManager.getSize(bukkitEntity));
|
||||||
}
|
}
|
||||||
catch (SecurityException | IllegalArgumentException | IllegalAccessException | FieldAccessException ex) {
|
catch (SecurityException | IllegalArgumentException | IllegalAccessException | FieldAccessException ex) {
|
||||||
System.out.print("[LibsDisguises] Uh oh! Trouble while making values for the disguise " +
|
getLogger().severe("Uh oh! Trouble while making values for the disguise " + disguiseType.name() + "!");
|
||||||
disguiseType.name() + "!");
|
getLogger().severe("Before reporting this error, " +
|
||||||
System.out.print("[LibsDisguises] Before reporting this error, " +
|
|
||||||
"please make sure you are using the latest version of LibsDisguises and ProtocolLib.");
|
"please make sure you are using the latest version of LibsDisguises and ProtocolLib.");
|
||||||
System.out.print("[LibsDisguises] Development builds are available at (ProtocolLib) " +
|
getLogger().severe("Development builds are available at (ProtocolLib) " +
|
||||||
"http://ci.dmulloy2.net/job/ProtocolLib/ and (LibsDisguises) http://server.o2gaming" +
|
"http://ci.dmulloy2.net/job/ProtocolLib/ and (LibsDisguises) https://ci.md-5" +
|
||||||
".com:8080/job/LibsDisguises%201.9+/");
|
".net/job/LibsDisguises/");
|
||||||
|
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
|||||||
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtType;
|
import com.comphenix.protocol.wrappers.nbt.NbtType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.*;
|
import me.libraryaddict.disguise.disguisetypes.watchers.*;
|
||||||
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
@ -389,10 +390,10 @@ public class MetaIndex<Y> {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
System.err.println(
|
DisguiseUtilities.getLogger().severe(entry.getKey().getSimpleName() +
|
||||||
entry.getKey().getSimpleName() + " has multiple FlagType's registered for the index " +
|
" has multiple FlagType's registered for the index " + i + " (" +
|
||||||
i + " (" + type.getFlagWatcher().getSimpleName() + ", " +
|
type.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher().getSimpleName() +
|
||||||
found.getFlagWatcher().getSimpleName() + ")");
|
")");
|
||||||
continue loop;
|
continue loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,11 +403,13 @@ public class MetaIndex<Y> {
|
|||||||
if (found != null)
|
if (found != null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
System.err.println(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i);
|
DisguiseUtilities.getLogger()
|
||||||
|
.severe(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static void printMetadata() {
|
public static void printMetadata() {
|
||||||
ArrayList<String> toPrint = new ArrayList<>();
|
ArrayList<String> toPrint = new ArrayList<>();
|
||||||
|
|
||||||
@ -501,8 +504,8 @@ public class MetaIndex<Y> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.err.println(
|
DisguiseUtilities.getLogger()
|
||||||
"[LibsDisguises] MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " +
|
.severe("MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " +
|
||||||
metaIndex.getIndex() + " has already registered this! (" + metaIndex.getDefault() +
|
metaIndex.getIndex() + " has already registered this! (" + metaIndex.getDefault() +
|
||||||
"," + index.getDefault() + ")");
|
"," + index.getDefault() + ")");
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ public enum DisguiseSound {
|
|||||||
Object soundEffect = ReflectionManager.getCraftSound(sound);
|
Object soundEffect = ReflectionManager.getCraftSound(sound);
|
||||||
|
|
||||||
if (disguiseSounds.containsKey(soundEffect)) {
|
if (disguiseSounds.containsKey(soundEffect)) {
|
||||||
System.out.println("Already doing " + sound);
|
DisguiseUtilities.getLogger().severe("Already doing " + sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
disguiseSounds.put(soundEffect, type);
|
disguiseSounds.put(soundEffect, type);
|
||||||
|
@ -50,6 +50,7 @@ import java.io.FileReader;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class DisguiseUtilities {
|
public class DisguiseUtilities {
|
||||||
@ -111,7 +112,7 @@ public class DisguiseUtilities {
|
|||||||
if (!DisguiseConfig.isSaveEntityDisguises() && !DisguiseConfig.isSavePlayerDisguises())
|
if (!DisguiseConfig.isSaveEntityDisguises() && !DisguiseConfig.isSavePlayerDisguises())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
System.out.println("[LibsDisguises] Now saving disguises..");
|
getLogger().info("Now saving disguises..");
|
||||||
|
|
||||||
for (HashSet<TargetedDisguise> list : disguisesInUse.values()) {
|
for (HashSet<TargetedDisguise> list : disguisesInUse.values()) {
|
||||||
for (TargetedDisguise disg : list) {
|
for (TargetedDisguise disg : list) {
|
||||||
@ -127,7 +128,7 @@ public class DisguiseUtilities {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[LibsDisguises] Saved disguises.");
|
getLogger().info("Saved disguises.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasGameProfile(String playername) {
|
public static boolean hasGameProfile(String playername) {
|
||||||
@ -239,7 +240,7 @@ public class DisguiseUtilities {
|
|||||||
return gson.fromJson(cached, Disguise[].class);
|
return gson.fromJson(cached, Disguise[].class);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
System.out.println("Malformed disguise for " + entityUUID);
|
getLogger().severe("Malformed disguise for " + entityUUID);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,8 +796,8 @@ public class DisguiseUtilities {
|
|||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
runnables.remove(playerName);
|
runnables.remove(playerName);
|
||||||
|
|
||||||
System.out.print("[LibsDisguises] Error when fetching " + playerName +
|
getLogger().severe("Error when fetching " + playerName + "'s uuid from mojang: " +
|
||||||
"'s uuid from mojang: " + e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1513,6 +1514,10 @@ public class DisguiseUtilities {
|
|||||||
return libsDisguises;
|
return libsDisguises;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Logger getLogger() {
|
||||||
|
return getPlugin().getLogger();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to send a packet to the self disguise, translate his entity ID to the fake id.
|
* Method to send a packet to the self disguise, translate his entity ID to the fake id.
|
||||||
*/
|
*/
|
||||||
|
@ -175,7 +175,7 @@ public enum LibsMsg {
|
|||||||
|
|
||||||
public String get(Object... strings) {
|
public String get(Object... strings) {
|
||||||
if (StringUtils.countMatches(getRaw(), "%s") != strings.length) {
|
if (StringUtils.countMatches(getRaw(), "%s") != strings.length) {
|
||||||
System.out.println("[LibsDisguises] Mismatch in messages, incorrect parameters supplied for " + name() +
|
DisguiseUtilities.getLogger().severe("Mismatch in messages, incorrect parameters supplied for " + name() +
|
||||||
". Please inform plugin author.");
|
". Please inform plugin author.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,11 +58,12 @@ public class LibsPremium {
|
|||||||
thisPluginIsPaidFor = (Boolean) m.invoke(null);
|
thisPluginIsPaidFor = (Boolean) m.invoke(null);
|
||||||
|
|
||||||
if (isPremium()) {
|
if (isPremium()) {
|
||||||
System.out.println("[LibsDisguises] Found a premium Lib's Disguises jar, premium enabled!");
|
DisguiseUtilities.getLogger().info("Found a premium Lib's Disguises jar, premium enabled!");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[LibsDisguises] You have a non-premium Lib's Disguises jar in the folder!");
|
DisguiseUtilities.getLogger()
|
||||||
|
.warning("You have a non-premium Lib's Disguises jar (" + file.getName() + ") in the folder!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
@ -36,7 +36,7 @@ public enum TranslateType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
|
if (!LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
|
||||||
System.out.println("[LibsDisguises] You must purchase the plugin to use translations!");
|
DisguiseUtilities.getLogger().severe("You must purchase the plugin to use translations!");
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslateFiller.fillConfigs();
|
TranslateFiller.fillConfigs();
|
||||||
@ -74,11 +74,11 @@ public enum TranslateType {
|
|||||||
translated.clear();
|
translated.clear();
|
||||||
|
|
||||||
if (LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
|
if (LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
|
||||||
System.out.println("[LibsDisguises] Loading translations: " + name());
|
DisguiseUtilities.getLogger().info("Loading translations: " + name());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getFile().exists()) {
|
if (!getFile().exists()) {
|
||||||
System.out.println("[LibsDisguises] Translations for " + name() + " missing! Skipping...");
|
DisguiseUtilities.getLogger().info("Translations for " + name() + " missing! Skipping...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,22 +93,23 @@ public enum TranslateType {
|
|||||||
String value = config.getString(key);
|
String value = config.getString(key);
|
||||||
|
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
System.err.println("Translation for " + name() + " has a null value for the key '" + key + "'");
|
DisguiseUtilities.getLogger()
|
||||||
|
.severe("Translation for " + name() + " has a null value for the key '" + key + "'");
|
||||||
} else {
|
} else {
|
||||||
String newKey = ChatColor.translateAlternateColorCodes('&', key);
|
String newKey = ChatColor.translateAlternateColorCodes('&', key);
|
||||||
|
|
||||||
if (translated.containsKey(newKey)) {
|
if (translated.containsKey(newKey)) {
|
||||||
if (dupes++ < 5) {
|
if (dupes++ < 5) {
|
||||||
System.out.println(
|
DisguiseUtilities.getLogger()
|
||||||
"[LibsDisguises] Alert! Duplicate translation entry for " + key + " in " + name() +
|
.severe("Alert! Duplicate translation entry for " + key + " in " + name() +
|
||||||
" translations!");
|
" translations!");
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
System.out.println(
|
DisguiseUtilities.getLogger()
|
||||||
"[LibsDisguises] Too many duplicated keys! It's likely that this file was mildly " +
|
.severe("Too many duplicated keys! It's likely that this file was mildly " +
|
||||||
"corrupted by a previous bug!");
|
"corrupted by a previous bug!");
|
||||||
System.out.println(
|
DisguiseUtilities.getLogger()
|
||||||
"[LibsDisguises] Delete the file, or you can remove every line after the first " +
|
.severe("Delete the file, or you can remove every line after the first " +
|
||||||
"duplicate message!");
|
"duplicate message!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -123,7 +124,7 @@ public enum TranslateType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
|
if (LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
|
||||||
System.out.println("[LibsDisguises] Loaded " + translated.size() + " translations for " + name());
|
DisguiseUtilities.getLogger().info("Loaded " + translated.size() + " translations for " + name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,19 +37,22 @@ public class UpdateChecker {
|
|||||||
*/
|
*/
|
||||||
private String getSpigotVersion() {
|
private String getSpigotVersion() {
|
||||||
try {
|
try {
|
||||||
HttpURLConnection con = (HttpURLConnection) new URL("https://www.spigotmc.org/api/general.php").openConnection();
|
HttpURLConnection con = (HttpURLConnection) new URL("https://www.spigotmc.org/api/general.php")
|
||||||
|
.openConnection();
|
||||||
con.setDoOutput(true);
|
con.setDoOutput(true);
|
||||||
con.setRequestMethod("POST");
|
con.setRequestMethod("POST");
|
||||||
con.getOutputStream().write(
|
con.getOutputStream()
|
||||||
("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=32453").getBytes("UTF-8"));
|
.write(("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=32453")
|
||||||
|
.getBytes("UTF-8"));
|
||||||
String version = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
String version = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
||||||
if (version.length() <= 10) {
|
if (version.length() <= 10) {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
System.out.print("[LibsDisguises] Failed to check for a update on spigot.");
|
DisguiseUtilities.getLogger().warning("Failed to check for a update on spigot.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user