-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a32feb
commit 9920970
Showing
5 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
Binary file modified
BIN
-12 Bytes
(100%)
...uction/commander-bta.main/net/pedroricardo/commander/content/commands/SummonCommand.class
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...tion/commander-bta.main/net/pedroricardo/commander/content/commands/TeleportCommand.class
Binary file not shown.
Binary file removed
BIN
-2.67 KB
...ion/commander-bta.main/net/pedroricardo/commander/content/helpers/DoubleCoordinates.class
Binary file not shown.
65 changes: 65 additions & 0 deletions
65
src/main/java/net/pedroricardo/commander/content/arguments/ParticleArgumentType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package net.pedroricardo.commander.content.arguments; | ||
|
||
import com.mojang.brigadier.StringReader; | ||
import com.mojang.brigadier.arguments.ArgumentType; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
import com.mojang.brigadier.suggestion.Suggestions; | ||
import com.mojang.brigadier.suggestion.SuggestionsBuilder; | ||
import net.minecraft.core.sound.SoundCategory; | ||
import net.pedroricardo.commander.CommanderHelper; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class ParticleArgumentType implements ArgumentType<String> { | ||
private static final List<String> EXAMPLES = Arrays.asList("smoke", "bubble", "explode"); | ||
private static final List<String> SUGGESTIONS = Arrays.asList( | ||
"bubble", | ||
"smoke", | ||
"note", | ||
"portal", | ||
"explode", | ||
"flame", | ||
"blueflame", | ||
"soulflame", | ||
"lava", | ||
"footstep", | ||
"splash", | ||
"largesmoke", | ||
"reddust", | ||
"item", | ||
"block", | ||
"snowshovel", | ||
"heart", | ||
"slimechunk", | ||
"fireflyGreen", | ||
"fireflyBlue", | ||
"fireflyOrange", | ||
"fireflyRed", | ||
"arrowtrail", | ||
"fallingleaf", | ||
"boatbreak" | ||
); | ||
|
||
public static ArgumentType<String> particle() { | ||
return new ParticleArgumentType(); | ||
} | ||
|
||
@Override | ||
public String parse(StringReader reader) throws CommandSyntaxException { | ||
return reader.readUnquotedString(); | ||
} | ||
|
||
@Override | ||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) { | ||
String remaining = builder.getRemainingLowerCase(); | ||
for (String string : SUGGESTIONS) { | ||
Optional<String> optional = CommanderHelper.getStringToSuggest(string, remaining); | ||
optional.ifPresent(builder::suggest); | ||
} | ||
return builder.buildFuture(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters