mirror of
https://github.com/GTNewHorizons/BetterCrashes.git
synced 2026-11-26 06:43:03 +00:00
Replace GTNH-specific code with configuration parameters
This commit is contained in:
1 parent
88cd08a1d3
commit
c16aff7fbd
4 files changed
+31
-45
No files matched your search
@@ -1,21 +1,22 @@
|
||||
package vfyjxf.bettercrashes;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class BetterCrashesConfig {
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
public static final String GENERAL = "General";
|
||||
|
||||
public static boolean isGTNH = Loader.isModLoaded("dreamcraft");
|
||||
public static int crashLogLimitClient = 30;
|
||||
public static int crashLogLimitServer = 30;
|
||||
public static String crashLogPasteService;
|
||||
public static String issueTrackerURL;
|
||||
public static List<String> unsupportedMods;
|
||||
|
||||
public static void init(File file) {
|
||||
config = new Configuration(file);
|
||||
@@ -44,6 +45,13 @@ public class BetterCrashesConfig {
|
||||
GENERAL,
|
||||
"mclo.gs",
|
||||
"Service to use for uploading crashlogs. Currently, only mclo.gs is currently supported.");
|
||||
issueTrackerURL = config.getString("issueTrackerURL", GENERAL, "", "Link to a bug tracker.");
|
||||
unsupportedMods = Arrays.asList(
|
||||
config.getStringList(
|
||||
"unsupportedMods",
|
||||
GENERAL,
|
||||
new String[] { "Optifine" },
|
||||
"List of modids of mods that are not supported by the modpack. BetterCrashes will encourage the player to mention those specifically in their bug report."));
|
||||
|
||||
if (config.hasChanged()) {
|
||||
config.save();
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
package vfyjxf.bettercrashes.utils;
|
||||
|
||||
import static vfyjxf.bettercrashes.BetterCrashesConfig.isGTNH;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -26,7 +22,6 @@ import net.minecraft.crash.CrashReport;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -55,9 +50,7 @@ public abstract class GuiProblemScreen extends GuiScreen {
|
||||
protected final CrashReport report;
|
||||
private volatile URL pasteLink = null;
|
||||
private String modListString;
|
||||
protected static final List<String> UNSUPPORTED_MOD_IDS = Arrays.asList();
|
||||
protected List<String> detectedUnsupportedModNames;
|
||||
private static final String GTNH_ISSUE_TRACKER = "https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues?q=label%3A%22Type%3A+Crash%22";
|
||||
|
||||
public GuiProblemScreen(CrashReport report) {
|
||||
this.report = report;
|
||||
@@ -83,7 +76,7 @@ public abstract class GuiProblemScreen extends GuiScreen {
|
||||
110,
|
||||
20,
|
||||
I18n.format("bettercrashes.gui.common.uploadReportAndCopyLink")));
|
||||
if (BetterCrashesConfig.isGTNH) {
|
||||
if (StringUtils.isNotEmpty(BetterCrashesConfig.issueTrackerURL)) {
|
||||
buttonList.add(
|
||||
new GuiButton(
|
||||
3,
|
||||
@@ -91,7 +84,7 @@ public abstract class GuiProblemScreen extends GuiScreen {
|
||||
height / 4 + 120 + 12 + 25,
|
||||
140,
|
||||
20,
|
||||
I18n.format("bettercrashes.gui.common.gtnhIssueTracker")));
|
||||
I18n.format("bettercrashes.gui.common.issueTracker")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +132,7 @@ public abstract class GuiProblemScreen extends GuiScreen {
|
||||
}
|
||||
}
|
||||
if (button.id == 3) {
|
||||
CrashUtils.openBrowser(GTNH_ISSUE_TRACKER);
|
||||
CrashUtils.openBrowser(BetterCrashesConfig.issueTrackerURL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +175,7 @@ public abstract class GuiProblemScreen extends GuiScreen {
|
||||
|
||||
drawCenteredString(
|
||||
fontRendererObj,
|
||||
report.getFile() != null ? "\u00A7n" + report.getFile().getName()
|
||||
report.getFile() != null ? "§n" + report.getFile().getName()
|
||||
: I18n.format("bettercrashes.gui.common.reportSaveFailed"),
|
||||
width / 2,
|
||||
y += 11,
|
||||
@@ -193,23 +186,17 @@ public abstract class GuiProblemScreen extends GuiScreen {
|
||||
}
|
||||
|
||||
y += 12;
|
||||
y += drawLongString(
|
||||
fontRendererObj,
|
||||
I18n.format("bettercrashes.gui.common.paragraph3" + (isGTNH ? "_gtnh" : "")),
|
||||
x,
|
||||
y,
|
||||
340,
|
||||
textColor);
|
||||
y += drawLongString(fontRendererObj, I18n.format("bettercrashes.gui.common.paragraph3"), x, y, 340, textColor);
|
||||
|
||||
if (hasUnsupportedMods) {
|
||||
drawString(fontRendererObj, I18n.format("bettercrashes.gui.common.paragraph4_gtnh"), x, y += 10, textColor);
|
||||
drawString(fontRendererObj, I18n.format("bettercrashes.gui.common.paragraph4"), x, y += 10, textColor);
|
||||
drawCenteredString(
|
||||
fontRendererObj,
|
||||
StringUtils.join(detectedUnsupportedModNames, ", "),
|
||||
width / 2,
|
||||
y += 11,
|
||||
0xE0E000);
|
||||
drawString(fontRendererObj, I18n.format("bettercrashes.gui.common.paragraph5_gtnh"), x, y += 12, textColor);
|
||||
drawString(fontRendererObj, I18n.format("bettercrashes.gui.common.paragraph5"), x, y += 12, textColor);
|
||||
}
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
@@ -244,19 +231,15 @@ public abstract class GuiProblemScreen extends GuiScreen {
|
||||
}
|
||||
|
||||
protected List<String> getUnsupportedMods() {
|
||||
if (!BetterCrashesConfig.isGTNH) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> list = new ArrayList<>();
|
||||
List<String> unsupportedMods = BetterCrashesConfig.unsupportedMods;
|
||||
List<String> installedUnsupportedMods = new ArrayList<>();
|
||||
for (ModContainer mod : Loader.instance().getModList()) {
|
||||
if (UNSUPPORTED_MOD_IDS.contains(mod.getModId())) {
|
||||
list.add(mod.getName());
|
||||
if (unsupportedMods.contains(mod.getModId())) {
|
||||
installedUnsupportedMods.add(mod.getName());
|
||||
}
|
||||
}
|
||||
if (FMLClientHandler.instance().hasOptifine()) {
|
||||
list.add("Optifine");
|
||||
}
|
||||
return list;
|
||||
|
||||
return installedUnsupportedMods;
|
||||
}
|
||||
|
||||
private int getClientCrashCount() {
|
||||
|
||||
@@ -4,17 +4,16 @@ bettercrashes.gui.common.openCrashReport=Open Crash Report
|
||||
bettercrashes.gui.common.failed=[Failed]
|
||||
bettercrashes.gui.common.uploading=Uploading...
|
||||
bettercrashes.gui.common.success=Success
|
||||
bettercrashes.gui.common.gtnhIssueTracker=Open GTNH issue tracker
|
||||
bettercrashes.gui.common.issueTracker=Open bug tracker
|
||||
|
||||
bettercrashes.gui.common.paragraph1=The following mod(s) have been identified as potential causes:
|
||||
bettercrashes.gui.common.identificationErrored=[Error identifying]
|
||||
bettercrashes.gui.common.identificationErrored=[Error identifying mod]
|
||||
bettercrashes.gui.common.unknownCause=Unknown
|
||||
bettercrashes.gui.common.paragraph2=report has been generated, and click the button below to open:
|
||||
bettercrashes.gui.common.paragraph2=report has been generated, click the button below to open:
|
||||
bettercrashes.gui.common.reportSaveFailed=[Error saving report, see log]
|
||||
bettercrashes.gui.common.paragraph3=You're encouraged to send this report's link to the mod's author to help them fix the issue. Clicking the "Upload and Copy link" button can upload report and copy its link to clipboard. Since BetterCrashes is installed, you can keep playing despite the crash.
|
||||
bettercrashes.gui.common.paragraph3_gtnh=You're encouraged to send this report's link to the GTNH issue tracker to help us fix the issue, AFTER searching the tracker for similar issue already reported. Clicking the "Upload and Copy link" button can upload report and copy its link to clipboard. Since BetterCrashes is installed, you can keep playing despite the crash.
|
||||
bettercrashes.gui.common.paragraph4_gtnh=GTNH does not support the following mod(s):
|
||||
bettercrashes.gui.common.paragraph5_gtnh=When sending report, add mention to these as well.
|
||||
bettercrashes.gui.common.paragraph3=You're encouraged to send this report's link to the modpack or mod's author to help them fix the issue. Make sure to search the tracker for similar issues already reported. Clicking the "Upload and Copy link" button can upload report and copy its link to clipboard. Since BetterCrashes is installed, you can keep playing despite the crash.
|
||||
bettercrashes.gui.common.paragraph4=This modpack does not officially support the following mod(s):
|
||||
bettercrashes.gui.common.paragraph5=When sending report, add mention of these as well.
|
||||
bettercrashes.gui.common.paragraph6=Number of crash logs exceeded limit and log was not generated.
|
||||
bettercrashes.gui.common.paragraph7=Limit can be changed via config.
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ bettercrashes.gui.common.openCrashReport=打开崩溃报告
|
||||
bettercrashes.gui.common.failed=[失败]
|
||||
bettercrashes.gui.common.uploading=上传中...
|
||||
bettercrashes.gui.common.success=成功
|
||||
bettercrashes.gui.common.gtnhIssueTracker=打开GTNH的issue跟踪器
|
||||
|
||||
bettercrashes.gui.common.paragraph1=下列模组被认为可能是导致崩溃的原因:
|
||||
bettercrashes.gui.common.identificationErrored=[鉴别错误]
|
||||
@@ -12,9 +11,6 @@ bettercrashes.gui.common.unknownCause=未知
|
||||
bettercrashes.gui.common.paragraph2=一份报告已经生成,点击下方的按钮可以打开它:
|
||||
bettercrashes.gui.common.reportSaveFailed=[保存报告出错,请查看日志]
|
||||
bettercrashes.gui.common.paragraph3=我们建议您将此报告的链接发送给模组的作者以帮助他们修复问题,点击"上传并复制链接"即可上传报告并将其链接复制到剪贴板。由于安装了BetterCrashes,尽管发生了崩溃,你仍然可以继续进行游戏。
|
||||
bettercrashes.gui.common.paragraph3_gtnh=我们非常欢迎你在搜索过仓库issue,未发现类似issue后,将此报告链接发送给我们,这可以帮助我们修复这些问题。点击"上传并复制链接"即可上传报告并将其链接复制到剪贴板。由于安装了BetterCrashes,尽管发生了崩溃,你仍然可以继续进行游戏。
|
||||
bettercrashes.gui.common.paragraph4_gtnh=GTNH不支持以下模组:
|
||||
bettercrashes.gui.common.paragraph5_gtnh=请在发送崩溃报告时,同时提及这些.
|
||||
bettercrashes.gui.common.paragraph6=崩溃日志超出了数量限制,未生成日志。
|
||||
bettercrashes.gui.common.paragraph7=数量限制可以通过配置更改.
|
||||
|
||||
@@ -22,4 +18,4 @@ bettercrashes.gui.crash.title=Minecraft崩溃啦!
|
||||
bettercrashes.gui.crash.summary=Minecraft遇到了一个问题并崩溃了。
|
||||
|
||||
bettercrashes.gui.init_error.title=Minecraft未能启动!
|
||||
bettercrashes.gui.init_error.summary=启动过程中的一个错误阻止了Minecraft的启动
|
||||
bettercrashes.gui.init_error.summary=启动过程中的一个错误阻止了Minecraft的启动
|
||||
Reference in new issue
Block a user