mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
Slight clean up of MCOptionsUtils (#1586)
* Clean up MCOptionUtils.java * Use of explicit type conversion to string.
This commit is contained in:
parent
bca639b809
commit
14d9d2b177
@ -690,8 +690,8 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
|
|
||||||
//Load Minecraft options:
|
//Load Minecraft options:
|
||||||
MCOptionUtils.load();
|
MCOptionUtils.load();
|
||||||
MCOptionUtils.set("overrideWidth", ""+CallbackBridge.windowWidth);
|
MCOptionUtils.set("overrideWidth", String.valueOf(CallbackBridge.windowWidth));
|
||||||
MCOptionUtils.set("overrideHeight", ""+CallbackBridge.windowHeight);
|
MCOptionUtils.set("overrideHeight", String.valueOf(CallbackBridge.windowHeight));
|
||||||
MCOptionUtils.save();
|
MCOptionUtils.save();
|
||||||
getMcScale();
|
getMcScale();
|
||||||
// Should we do that?
|
// Should we do that?
|
||||||
|
@ -7,14 +7,10 @@ import net.kdt.pojavlaunch.*;
|
|||||||
|
|
||||||
public class MCOptionUtils
|
public class MCOptionUtils
|
||||||
{
|
{
|
||||||
private static List<String> mLineList;
|
private static final List<String> mLineList = new ArrayList<>();
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
if (mLineList == null) {
|
|
||||||
mLineList = new ArrayList<String>();
|
|
||||||
} else {
|
|
||||||
mLineList.clear();
|
mLineList.clear();
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(Tools.DIR_GAME_NEW + "/options.txt"));
|
BufferedReader reader = new BufferedReader(new FileReader(Tools.DIR_GAME_NEW + "/options.txt"));
|
||||||
@ -41,27 +37,19 @@ public class MCOptionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String get(String key){
|
public static String get(String key){
|
||||||
if (mLineList == null){
|
if(mLineList.isEmpty()) load();
|
||||||
load();
|
|
||||||
} if (mLineList.size() == 0) return null; // why it empty?
|
for(String line : mLineList){
|
||||||
for (int i = 0; i < mLineList.size(); i++) {
|
if(line.startsWith(key + ":"))
|
||||||
String line = mLineList.get(i);
|
return line.substring(line.indexOf(':') + 1);
|
||||||
if (line.startsWith(key + ":")) {
|
|
||||||
String value = mLineList.get(i);
|
|
||||||
return value.substring(value.indexOf(":")+1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void save() {
|
public static void save() {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (int i = 0; i < mLineList.size(); i++) {
|
for(String line : mLineList)
|
||||||
result.append(mLineList.get(i));
|
result.append(line).append('\n');
|
||||||
if (i + 1 < mLineList.size()) {
|
|
||||||
result.append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Tools.write(Tools.DIR_GAME_NEW + "/options.txt", result.toString());
|
Tools.write(Tools.DIR_GAME_NEW + "/options.txt", result.toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user