Merge remote-tracking branch 'origin/1.15' into 1.15

This commit is contained in:
MattBDev 2020-03-20 21:19:37 -04:00
commit 45ac55185f
4 changed files with 33 additions and 23 deletions

View File

@ -3,20 +3,26 @@ name: Java CI
on:
push:
branches:
- 1.15
- '1.15'
pull_request:
branches:
- 1.15
- '1.15'
jobs:
test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Checkout
uses: actions/checkout@v2.0.0
- name: Setup Java JDK
uses: actions/setup-java@v1.3.0
with:
java-version: 1.8
- name: Download BuildTools
run: wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
- name: Run BuildTools
run: java -jar BuildTools.jar --rev latest
- name: Test with Gradle
run: ./gradlew clean build -x test

View File

@ -654,6 +654,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
int firstSpace = buffer.indexOf(' ');
if (firstSpace < 0) return;
String label = buffer.substring(0, firstSpace);
// Strip leading slash, if present.
label = label.startsWith("/") ? label.substring(1) : label;
final Optional<org.enginehub.piston.Command> command
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
if (!command.isPresent()) return;

View File

@ -815,7 +815,10 @@ public final class PlatformCommandManager {
@Subscribe
public void handleCommandSuggestion(CommandSuggestionEvent event) {
try {
String arguments = event.getArguments();
String rawArgs = event.getArguments();
// Increase the resulting positions by 1 if we remove a leading `/`
final int posOffset = rawArgs.startsWith("/") ? 1 : 0;
String arguments = rawArgs.startsWith("/") ? rawArgs.substring(1) : rawArgs;
List<Substring> split = parseArgs(arguments).collect(Collectors.toList());
List<String> argStrings = split.stream()
.map(Substring::getSubstring)
@ -837,11 +840,10 @@ public final class PlatformCommandManager {
Substring original = suggestion.getReplacedArgument() == split.size()
? Substring.from(arguments, noSlashLength, noSlashLength)
: split.get(suggestion.getReplacedArgument());
// increase original points by 1, for removed `/` in `parseArgs`
return Substring.wrap(
suggestion.getSuggestion(),
original.getStart() + 1,
original.getEnd() + 1
original.getStart() + posOffset,
original.getEnd() + posOffset
);
}).collect(Collectors.toList()));
} catch (ConditionFailedException e) {

View File

@ -105,13 +105,13 @@ public class PrimitiveBindings extends Bindings {
final double radiusX, radiusY, radiusZ;
switch (radii.length) {
case 1:
radiusX = radiusY = radiusZ = Math.max(1, PrimitiveBindings.parseNumericInput(radii[0]));
radiusX = radiusY = radiusZ = PrimitiveBindings.parseNumericInput(radii[0]);
break;
case 3:
radiusX = Math.max(1, PrimitiveBindings.parseNumericInput(radii[0]));
radiusY = Math.max(1, PrimitiveBindings.parseNumericInput(radii[1]));
radiusZ = Math.max(1, PrimitiveBindings.parseNumericInput(radii[2]));
radiusX = PrimitiveBindings.parseNumericInput(radii[0]);
radiusY = PrimitiveBindings.parseNumericInput(radii[1]);
radiusZ = PrimitiveBindings.parseNumericInput(radii[2]);
break;
default:
@ -135,12 +135,12 @@ public class PrimitiveBindings extends Bindings {
final double radiusX, radiusZ;
switch (radii.length) {
case 1:
radiusX = radiusZ = Math.max(1, PrimitiveBindings.parseNumericInput(radii[0]));
radiusX = radiusZ = PrimitiveBindings.parseNumericInput(radii[0]);
break;
case 2:
radiusX = Math.max(1, PrimitiveBindings.parseNumericInput(radii[0]));
radiusZ = Math.max(1, PrimitiveBindings.parseNumericInput(radii[1]));
radiusX = PrimitiveBindings.parseNumericInput(radii[0]);
radiusZ = PrimitiveBindings.parseNumericInput(radii[1]);
break;
default:
@ -163,13 +163,13 @@ public class PrimitiveBindings extends Bindings {
final double radiusX, radiusY, radiusZ;
switch (radii.length) {
case 1:
radiusX = radiusY = radiusZ = Math.max(1, PrimitiveBindings.parseNumericInput(radii[0]));
radiusX = radiusY = radiusZ = PrimitiveBindings.parseNumericInput(radii[0]);
break;
case 3:
radiusX = Math.max(1, PrimitiveBindings.parseNumericInput(radii[0]));
radiusY = Math.max(1, PrimitiveBindings.parseNumericInput(radii[1]));
radiusZ = Math.max(1, PrimitiveBindings.parseNumericInput(radii[2]));
radiusX = PrimitiveBindings.parseNumericInput(radii[0]);
radiusY = PrimitiveBindings.parseNumericInput(radii[1]);
radiusZ = PrimitiveBindings.parseNumericInput(radii[2]);
break;
default:
@ -192,12 +192,12 @@ public class PrimitiveBindings extends Bindings {
final double radiusX, radiusZ;
switch (radii.length) {
case 1:
radiusX = radiusZ = Math.max(1, parseNumericInput(radii[0]));
radiusX = radiusZ = parseNumericInput(radii[0]);
break;
case 2:
radiusX = Math.max(1, parseNumericInput(radii[0]));
radiusZ = Math.max(1, parseNumericInput(radii[1]));
radiusX = parseNumericInput(radii[0]);
radiusZ = parseNumericInput(radii[1]);
break;
default: