Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error analyzer improvements #192

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void onMessageReceived(MessageReceivedEvent event) {
groups[i] = groups[i] == null ? "" : groups[i]; // Replace nulls with empty strings
}

url = String.format(logUrlPatterns.get(regex), groups);
url = String.format(logUrlPatterns.get(regex), groups); // Casting this to Object breaks something, don't do it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should disable the inspector warning along with this comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting to Object[] should be sufficient right?

break;
}

Expand Down Expand Up @@ -147,7 +147,7 @@ private void handleLog(MessageReceivedEvent event, String logContent) {
break;
}

if (logContent.contains(issue)) {
if (logContent.toLowerCase().contains(issue.toLowerCase())) {
String title = BotHelpers.trim(issue, MessageEmbed.TITLE_MAX_LENGTH);

if (MessageHelper.similarFieldExists(embedBuilder.getFields(), title)) {
Expand All @@ -161,7 +161,7 @@ private void handleLog(MessageReceivedEvent event, String logContent) {
}

// Add any errors from stacktraces
if (exceptions.size() != 0) {
if (!exceptions.isEmpty()) {
// Get the github trees for fetching the file paths
String branch = "master";
Matcher branchMatcher = BRANCH_PATTERN.matcher(logContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static void loadTags() {
switch (lineParts[0]) { // intentional fallthrough
case "type", "aliases" -> tagData.put(lineParts[0], lineParts[1].trim().toLowerCase());
case "image" -> tagData.put(lineParts[0], lineParts[1].trim());
case "issues" -> issueTriggers = lineParts[1].split("\\|\\|");
case "issues" -> issueTriggers = lineParts[1].split("\\|\\|"); // Issues are delimited by ||
rtm516 marked this conversation as resolved.
Show resolved Hide resolved
default -> GeyserBot.LOGGER.warn("Invalid tag option key '" + lineParts[0] + "' for tag '" + tagName + "'!");
}
}
Expand Down
27 changes: 27 additions & 0 deletions src/main/resources/tags/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,30 @@ type: text-raw

Test
```

## Type: Issue only
The below lays out the `issue-only` tag type. This tag will not be registered as a tag that users can run, and only exists to
register responses for issues. It follows the rules that `Issue responses` below sets out.

```markdown
type: issue-only
issues: <issue1> || <issue2> || <issue 3> ...

---

Text
```

## Issue responses
Issue responses work with `text`, `text-raw` and `issue-only` types. Any issues listed are registered to have the content of the tag as the issue response.
Different issues are delimited by `||`, allowing differently worded issues to have the same response.
When a message or log file is shared, it will be scanned to check if it contains any known issues. Responses to the issues found will be sent in a single embed.
`text` and `text-raw` types with issues listed can still be called with the tag command; they do not lose their functionality.
```markdown
type: text
issues: <issue1> || <issue2> || <issue 3> ...

---

Text
```
6 changes: 6 additions & 0 deletions src/main/resources/tags/errors/protocollibinjector.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: issue-only
issues: com.comphenix.protocol.injector.netty.ProtocolInjector$3 is not a @Sharable handler, so can't be added or removed multiple times.

---

Update ProtocolLib.
9 changes: 9 additions & 0 deletions src/main/resources/tags/errors/unsupportedjavadetected.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: issue-only
issues: Unsupported Java detected (60.0)

---

Old server versions do not support Java 16, which Geyser requires. Paper 1.15.2 and higher can be forced to use Java 16 by adding `-DPaper.IgnoreJavaVersion=true`
to the JVM startup flags.
Servers on 1.8.8 can use Java 16 if `use-native-transport` is set to `false` in `server.properties`, although Geyser
does not support versions below 1.12.2
9 changes: 9 additions & 0 deletions src/main/resources/tags/errors/zipfileclosed.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: issue-only
issues: java.lang.IllegalStateException: zip file closed

---

If **Geyser** is showing this error, there are are a few likely causes:
A: You reloaded Geyser or the server, which is unsupported. Please do a full restart instead.
B: Your Geyser jar is corrupted, and you need to re-download it.
C: Geyser failed to start for a different reason. Check the start of your server logs for a different error explaining why it failed to start.
2 changes: 1 addition & 1 deletion src/main/resources/tags/info/javaversion.tag
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ issues: java.lang.UnsupportedClassVersionError

---

Geyser and Floodgate currently require Java 16 or higher. Information about how you can update to this is [here](https://paper.readthedocs.io/en/latest/java-update/index.html).
Geyser currently requires Java 16 or higher. Information about how you can update to this is [here](https://paper.readthedocs.io/en/latest/java-update/index.html).