aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/Options.java37
8 files changed, 30 insertions, 38 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java
index 1a7cd803..fac3a8d1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java
@@ -164,9 +164,8 @@ public class BetterContainers {
if(hasNullPane() && container instanceof ContainerChest) {
int backgroundStyle = NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuBackgroundStyle.value.intValue();
backgroundStyle = Math.max(1, Math.min(10, backgroundStyle));
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
- new ResourceLocation("notenoughupdates:dynamic_54/style"+ backgroundStyle+"/dynamic_config.json")).getInputStream(), StandardCharsets.UTF_8));
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
+ new ResourceLocation("notenoughupdates:dynamic_54/style"+ backgroundStyle+"/dynamic_config.json")).getInputStream(), StandardCharsets.UTF_8))) {
JsonObject json = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, JsonObject.class);
String textColourS = json.get("text-colour").getAsString();
textColour = (int)Long.parseLong(textColourS, 16);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index 9c90532a..8073227c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -148,9 +148,7 @@ public class NEUManager {
* Parses a file in to a JsonObject.
*/
public JsonObject getJsonFromFile(File file) {
- try {
- InputStream in = new FileInputStream(file);
- BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
JsonObject json = gson.fromJson(reader, JsonObject.class);
return json;
} catch(Exception e) { return null; }
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index f90f4367..3ca2ab04 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -690,9 +690,8 @@ public class NotEnoughUpdates {
SimpleCommand neumapCommand = new SimpleCommand("neumap", new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
if(colourMap == null) {
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
- new ResourceLocation("notenoughupdates:maps/F1Full.json")).getInputStream(), StandardCharsets.UTF_8));
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
+ new ResourceLocation("notenoughupdates:maps/F1Full.json")).getInputStream(), StandardCharsets.UTF_8))) {
JsonObject json = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, JsonObject.class);
colourMap = new Color[128][128];
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
index 13e61a06..d56a3f8c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
@@ -81,6 +81,8 @@ public class NEUCape {
shaderName = "mcworld_cape";
} else if(capeName.equalsIgnoreCase("lava")) {
shaderName = "lava_cape";
+ } else if(capeName.equalsIgnoreCase("lightning")) {
+ shaderName = "lightning_cape";
} else {
shaderName = "cape";
}
@@ -306,6 +308,8 @@ public class NEUCape {
shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
} else if(shaderName.equalsIgnoreCase("lava_cape")) {
shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
+ } else if(shaderName.equalsIgnoreCase("lightning_cape")) {
+ shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
index e68cde61..fa49c0c2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -376,9 +376,8 @@ public class DungeonMap {
return borderRadiusCache.get(style);
}
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
- new ResourceLocation("notenoughupdates:dungeon_map/borders/"+sizeId+"/"+style+".json")).getInputStream(), StandardCharsets.UTF_8));
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
+ new ResourceLocation("notenoughupdates:dungeon_map/borders/"+sizeId+"/"+style+".json")).getInputStream(), StandardCharsets.UTF_8))) {
JsonObject json = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, JsonObject.class);
float radiusSq = json.get("radiusSq").getAsFloat();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
index 2c99c8c0..f6538346 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
@@ -144,9 +144,6 @@ public class DungeonWin {
long currentTime = System.currentTimeMillis();
String unformatted = Utils.cleanColour(e.message.getUnformattedText());
if(e.message.getFormattedText().startsWith(EnumChatFormatting.RESET+" ")) {
- if(unformatted.contains("\u25AC")) {
- System.out.println("CONTAINS BREAK!");
- }
if(currentTime - lastDungeonFinish > 10000) {
Matcher matcher = TEAM_SCORE_REGEX.matcher(unformatted);
if(matcher.find()) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
index 377977ac..09f00beb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
@@ -135,10 +135,7 @@ public class SBGamemodes {
return;
}
- try {
- InputStream in = new FileInputStream(gamemodeFile);
- BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
-
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(gamemodeFile), StandardCharsets.UTF_8))) {
String line = reader.readLine();
String decoded = decrypt(line);
currentGamemode = gson.fromJson(decoded, GamemodeWrapper.class).currentGamemode;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java
index 1b6cebe3..0aedc306 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java
@@ -733,28 +733,27 @@ public class Options {
}
public static Options loadFromFile(Gson gson, File file) throws IOException {
- InputStream in = new FileInputStream(file);
- BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
-
- Options oLoad = gson.fromJson(reader, Options.class);
- Options oDefault = new Options();
- if (oLoad == null) return oDefault;
-
- for (Field f : Options.class.getDeclaredFields()) {
- try {
- if (((Option<?>) f.get(oDefault)).value instanceof List) {
- //If the default size of the list is greater than the loaded size, use the default value.
- //if(((List<?>)((Option)f.get(oDefault)).value).size() > ((List<?>)((Option)f.get(oLoad)).value).size()) {
- // continue;
- //}
- }
- if(((Option<?>) f.get(oDefault)).value.getClass().isAssignableFrom(((Option<?>) f.get(oLoad)).value.getClass())) {
- ((Option) f.get(oDefault)).value = ((Option) f.get(oLoad)).value;
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
+ Options oLoad = gson.fromJson(reader, Options.class);
+ Options oDefault = new Options();
+ if (oLoad == null) return oDefault;
+
+ for (Field f : Options.class.getDeclaredFields()) {
+ try {
+ if (((Option<?>) f.get(oDefault)).value instanceof List) {
+ //If the default size of the list is greater than the loaded size, use the default value.
+ //if(((List<?>)((Option)f.get(oDefault)).value).size() > ((List<?>)((Option)f.get(oLoad)).value).size()) {
+ // continue;
+ //}
+ }
+ if(((Option<?>) f.get(oDefault)).value.getClass().isAssignableFrom(((Option<?>) f.get(oLoad)).value.getClass())) {
+ ((Option) f.get(oDefault)).value = ((Option) f.get(oLoad)).value;
+ }
+ } catch (Exception e) {
}
- } catch (Exception e) {
}
+ return oDefault;
}
- return oDefault;
}