Fix formating

- Removed all remaining tabs (not sure how to got through the last
cleanup).
- Updated some comments.
This commit is contained in:
Pim van der Loos 2019-04-18 17:11:18 +02:00
parent da224bfc1a
commit 4b5de17bb6
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8
8 changed files with 110 additions and 113 deletions

View File

@ -17,7 +17,6 @@ public class GetArmorValueOld implements GetArmorValue
int pos = nbtString.indexOf(",Slot:\"chest\",AttributeName:\"generic.armor\""); int pos = nbtString.indexOf(",Slot:\"chest\",AttributeName:\"generic.armor\"");
if (pos > 0) if (pos > 0)
{ {
// If so, get the value of the generic.armor attribute.
pos--; pos--;
String stringAtPos = nbtString.substring(pos, pos + 1); String stringAtPos = nbtString.substring(pos, pos + 1);
return Integer.parseInt(stringAtPos); return Integer.parseInt(stringAtPos);

View File

@ -74,8 +74,7 @@ public class NBTEditor
return; return;
} }
// Old versions use the old format. It is assumed here that all versions from 1.13.2 on will use the // Old versions use the old format. It is assumed here that all versions from 1.13.2 on will use the new format.
// new format. Might want to put this in a nice interface instead of an ugly boolean.
// Spigot's 1.13.1 uses the old format, but 1.13.2 uses the new format. They share the same version number though. // Spigot's 1.13.1 uses the old format, but 1.13.2 uses the new format. They share the same version number though.
if (version.equals("v1_9_R1" ) || version.equals("v1_9_R2" ) || version.equals("v1_10_R1") || if (version.equals("v1_9_R1" ) || version.equals("v1_9_R2" ) || version.equals("v1_10_R1") ||
version.equals("v1_11_R1") || version.equals("v1_12_R1") || version.equals("v1_13_R1") || version.equals("v1_11_R1") || version.equals("v1_12_R1") || version.equals("v1_13_R1") ||
@ -219,7 +218,6 @@ public class NBTEditor
} }
} }
private Class<?> getNMSClass(String name) throws ClassNotFoundException private Class<?> getNMSClass(String name) throws ClassNotFoundException
{ {
return Class.forName(NMSbase + name); return Class.forName(NMSbase + name);

View File

@ -4,7 +4,7 @@ import org.bukkit.Material;
public enum ArmorTier public enum ArmorTier
{ {
// Tier: tier armor-value, tier armor-toughness, repair // Tier: armor-value, armor-toughness, repair
NONE (0 , 0 , null ), NONE (0 , 0 , null ),
LEATHER (3 , 0 , Material.LEATHER ), LEATHER (3 , 0 , Material.LEATHER ),
GOLD (5 , 0 , Material.GOLD_INGOT), GOLD (5 , 0 , Material.GOLD_INGOT),

View File

@ -13,7 +13,7 @@ import nl.pim16aap2.armoredElytra.ArmoredElytra;
public class Messages public class Messages
{ {
private Map<String, String> messageMap = new HashMap<String, String>(); private Map<String, String> messageMap = new HashMap<>();
private ArmoredElytra plugin; private ArmoredElytra plugin;
private String locale; private String locale;
private File textFile; private File textFile;
@ -21,7 +21,7 @@ public class Messages
public Messages(ArmoredElytra plugin) public Messages(ArmoredElytra plugin)
{ {
this.plugin = plugin; this.plugin = plugin;
this.locale = plugin.getLocale(); locale = plugin.getLocale();
textFile = new File(plugin.getDataFolder(), locale + ".txt"); textFile = new File(plugin.getDataFolder(), locale + ".txt");
readFile(); readFile();
} }
@ -32,7 +32,7 @@ public class Messages
// Load the default en_US from the resources. // Load the default en_US from the resources.
plugin.saveResource("en_US.txt", true); plugin.saveResource("en_US.txt", true);
try (BufferedReader br = new BufferedReader(new FileReader(this.textFile))) try (BufferedReader br = new BufferedReader(new FileReader(textFile)))
{ {
String sCurrentLine; String sCurrentLine;
@ -49,17 +49,17 @@ public class Messages
for (int idx = 1; idx < newLineSplitter.length; ++idx) for (int idx = 1; idx < newLineSplitter.length; ++idx)
values += "\n" + newLineSplitter[idx]; values += "\n" + newLineSplitter[idx];
this.messageMap.put(key, values); messageMap.put(key, values);
} }
br.close(); br.close();
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
plugin.myLogger(Level.SEVERE, "Locale file " + this.locale + ".txt does not exist!"); plugin.myLogger(Level.SEVERE, "Locale file " + locale + ".txt does not exist!");
} }
catch (IOException e) catch (IOException e)
{ {
plugin.myLogger(Level.SEVERE, "Could not read locale file! (" + this.locale + ".txt)"); plugin.myLogger(Level.SEVERE, "Could not read locale file! (" + locale + ".txt)");
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -68,7 +68,7 @@ public class Messages
public String getString(String key) public String getString(String key)
{ {
String value = null; String value = null;
value = this.messageMap.get(key); value = messageMap.get(key);
if (value == null) if (value == null)
{ {
value = "ArmoredElytra: Translation not found! Contact server admin!"; value = "ArmoredElytra: Translation not found! Contact server admin!";

View File

@ -133,7 +133,7 @@ public class Update
JSONObject latest = (JSONObject) array.get(array.size() - 1); JSONObject latest = (JSONObject) array.get(array.size() - 1);
// Get the version's title // Get the version's title
this.versionName = (String) latest.get(API_NAME_VALUE); versionName = (String) latest.get(API_NAME_VALUE);
} }
} }
catch (IOException e) catch (IOException e)
@ -141,7 +141,7 @@ public class Update
// There was an error reading the query. // There was an error reading the query.
// Does not print stacktrace, so people won't see any errors from this plugin // Does not print stacktrace, so people won't see any errors from this plugin
// when Bukkit Dev's servers are down, // when Bukkit Dev's servers are down,
// So people won't think the plugin is broken, while the actualy problem is // So people won't think the plugin is broken, while the actual problem is
// much, much smaller. latestVersion will be null, though, which will prompt a // much, much smaller. latestVersion will be null, though, which will prompt a
// warning in the log instead. // warning in the log instead.