3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 18:10:08 +01:00

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

Dieser Commit ist enthalten in:
MattBDev 2020-03-20 21:19:37 -04:00
Commit 45ac55185f
4 geänderte Dateien mit 33 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -3,20 +3,26 @@ name: Java CI
on: on:
push: push:
branches: branches:
- 1.15 - '1.15'
pull_request: pull_request:
branches: branches:
- 1.15 - '1.15'
jobs: jobs:
test: test:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v1 - name: Checkout
- name: Set up JDK 1.8 uses: actions/checkout@v2.0.0
uses: actions/setup-java@v1 - name: Setup Java JDK
uses: actions/setup-java@v1.3.0
with: with:
java-version: 1.8 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 - name: Test with Gradle
run: ./gradlew clean build -x test run: ./gradlew clean build -x test

Datei anzeigen

@ -654,6 +654,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
int firstSpace = buffer.indexOf(' '); int firstSpace = buffer.indexOf(' ');
if (firstSpace < 0) return; if (firstSpace < 0) return;
String label = buffer.substring(0, firstSpace); 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 final Optional<org.enginehub.piston.Command> command
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label); = WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
if (!command.isPresent()) return; if (!command.isPresent()) return;

Datei anzeigen

@ -815,7 +815,10 @@ public final class PlatformCommandManager {
@Subscribe @Subscribe
public void handleCommandSuggestion(CommandSuggestionEvent event) { public void handleCommandSuggestion(CommandSuggestionEvent event) {
try { 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<Substring> split = parseArgs(arguments).collect(Collectors.toList());
List<String> argStrings = split.stream() List<String> argStrings = split.stream()
.map(Substring::getSubstring) .map(Substring::getSubstring)
@ -837,11 +840,10 @@ public final class PlatformCommandManager {
Substring original = suggestion.getReplacedArgument() == split.size() Substring original = suggestion.getReplacedArgument() == split.size()
? Substring.from(arguments, noSlashLength, noSlashLength) ? Substring.from(arguments, noSlashLength, noSlashLength)
: split.get(suggestion.getReplacedArgument()); : split.get(suggestion.getReplacedArgument());
// increase original points by 1, for removed `/` in `parseArgs`
return Substring.wrap( return Substring.wrap(
suggestion.getSuggestion(), suggestion.getSuggestion(),
original.getStart() + 1, original.getStart() + posOffset,
original.getEnd() + 1 original.getEnd() + posOffset
); );
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} catch (ConditionFailedException e) { } catch (ConditionFailedException e) {

Datei anzeigen

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