Skip to content

Commit

Permalink
ExprStringCase - include expression in toString (#6777)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneBeee authored Jun 15, 2024
1 parent aa7955c commit 2627c95
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/main/java/ch/njol/skript/expressions/ExprStringCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,28 @@ public Class<? extends String> getReturnType() {
}

@Override
public String toString(@Nullable Event e, boolean debug) {
public String toString(@Nullable Event event, boolean debug) {
String mode = "";
switch (type) {
case 0: // Basic Case Change
return (casemode == 1) ? "uppercase" : "lowercase";
mode = (casemode == 1) ? "uppercase" : "lowercase";
break;
case 1: // Proper Case
return ((casemode == 3) ? "strict" : "lenient") + " proper case";
mode = ((casemode == 3) ? "strict" : "lenient") + " proper case";
break;
case 2: // Camel Case
return ((casemode == 3) ? "strict" : "lenient") + " camel case";
mode = ((casemode == 3) ? "strict" : "lenient") + " camel case";
break;
case 3: // Pascal Case
return ((casemode == 3) ? "strict" : "lenient") + " pascal case";
mode = ((casemode == 3) ? "strict" : "lenient") + " pascal case";
break;
case 4: // Snake Case
return ((casemode == 0) ? "" : ((casemode == 1)) ? "upper " : "lower ") + "snake case";
mode = ((casemode == 0) ? "" : ((casemode == 1)) ? "upper " : "lower ") + "snake case";
break;
case 5: // Kebab Case
return ((casemode == 0) ? "" : ((casemode == 1)) ? "upper " : "lower ") + "kebab case";
mode = ((casemode == 0) ? "" : ((casemode == 1)) ? "upper " : "lower ") + "kebab case";
}
return ""; // Shouldn't reach here anyways
return mode + " " + expr.toString(event, debug);
}

@SuppressWarnings("null")
Expand Down

0 comments on commit 2627c95

Please sign in to comment.