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

Bug and crash fixing #48

Merged
merged 1 commit into from
Nov 28, 2023
Merged

Bug and crash fixing #48

merged 1 commit into from
Nov 28, 2023

Conversation

senseiwells
Copy link
Contributor

  • Fixes a bug that caused the game to crash when a player uses the gradient with no parameters.
java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
	at java.base/java.util.Objects.checkIndex(Objects.java:359)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	at eu.pb4.placeholders.api.node.parent.GradientNode$GradientProvider.lambda$colorsHard$1(GradientNode.java:145)
	at eu.pb4.placeholders.impl.GeneralUtils.recursiveGradient(GeneralUtils.java:97)
	at eu.pb4.placeholders.impl.GeneralUtils.toGradient(GeneralUtils.java:65)
	at eu.pb4.placeholders.api.node.parent.GradientNode.applyFormatting(GradientNode.java:69)
	at eu.pb4.placeholders.api.node.parent.ParentNode.toText(ParentNode.java:73)
	at eu.pb4.placeholders.api.node.TextNode.toText(TextNode.java:24)
	at eu.pb4.placeholders.api.parsers.StaticPreParser.parse(StaticPreParser.java:23)
	at eu.pb4.placeholders.api.parsers.StaticPreParser.parseNodes(StaticPreParser.java:18)
	at eu.pb4.placeholders.impl.textparser.MergedParser.parseNodes(MergedParser.java:17)
	at eu.pb4.placeholders.api.parsers.NodeParser.parseNode(NodeParser.java:17)
	at eu.pb4.placeholders.api.parsers.NodeParser.parseNode(NodeParser.java:21)
  • Fixed "%player:hunger%" from not working and erroring.
    • Hunger was previously trying to be formatted as a float when it's an integer causing:
    java.util.IllegalFormatConversionException: f != java.lang.Integer
      at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:4442) ~[?:?]
      at java.util.Formatter$FormatSpecifier.printFloat(Formatter.java:2976) ~[?:?]
      at java.util.Formatter$FormatSpecifier.print(Formatter.java:2924) ~[?:?]
      at java.util.Formatter.format(Formatter.java:2689) ~[?:?]
      at java.util.Formatter.format(Formatter.java:2625) ~[?:?]
      at java.lang.String.format(String.java:4141) ~[?:?]
      at eu.pb4.placeholders.impl.placeholder.builtin.PlayerPlaceholders.lambda$register$22(PlayerPlaceholders.java:373) ~[placeholder-api-2.2.0+1.20.2.jar:?]
      at eu.pb4.placeholders.impl.placeholder.PlaceholderNode.toText(PlaceholderNode.java:21) ~[placeholder-api-2.2.0+1.20.2.jar:?]
      at eu.pb4.placeholders.api.node.parent.ParentNode.toText(ParentNode.java:52) ~[placeholder-api-2.2.0+1.20.2.jar:?]
      at eu.pb4.placeholders.api.node.TextNode.toText(TextNode.java:16) ~[placeholder-api-2.2.0+1.20.2.jar:?]
    

- Fixes a bug that caused the game to crash when a player uses the gradient with no parameters.
- Fixed "%player:hunger%" from not working and erroring.
@Patbox Patbox merged commit b548d9a into Patbox:1.20.2 Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants