-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev/chatpreview' into dev/dev
- Loading branch information
Showing
12 changed files
with
317 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
18 changes: 18 additions & 0 deletions
18
commandapi-core/src/main/java/dev/jorel/commandapi/arguments/IPreviewable.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,18 @@ | ||
package dev.jorel.commandapi.arguments; | ||
|
||
import java.util.Optional; | ||
|
||
import dev.jorel.commandapi.wrappers.Preview; | ||
|
||
/** | ||
* An interface representing that the argument can be previewed using | ||
* Minecraft's chat preview feature. To use this, the server must have | ||
* {@code previews-chat=true} set in its {@code server.properties} file | ||
*/ | ||
public interface IPreviewable<T extends Argument<?>> { | ||
|
||
public T withPreview(Preview preview); | ||
|
||
public Optional<Preview> getPreview(); | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
commandapi-core/src/main/java/dev/jorel/commandapi/arguments/PreviewInfo.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,20 @@ | ||
package dev.jorel.commandapi.arguments; | ||
|
||
import org.bukkit.entity.Player; | ||
|
||
public record PreviewInfo( | ||
/** @param player - the Player typing this command */ | ||
Player player, | ||
|
||
/** | ||
* @param input - the current partially typed argument. For example "/mycmd tes" | ||
* will return "tes" | ||
*/ | ||
String input, | ||
|
||
/** | ||
* @param fullInput - a string representing the full current input (including /) | ||
*/ | ||
String fullInput) { | ||
|
||
} |
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
12 changes: 12 additions & 0 deletions
12
commandapi-core/src/main/java/dev/jorel/commandapi/wrappers/Preview.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,12 @@ | ||
package dev.jorel.commandapi.wrappers; | ||
|
||
import dev.jorel.commandapi.arguments.PreviewInfo; | ||
import dev.jorel.commandapi.exceptions.WrapperCommandSyntaxException; | ||
import net.kyori.adventure.text.Component; | ||
|
||
@FunctionalInterface | ||
public interface Preview { | ||
|
||
public Component generatePreview(PreviewInfo info) throws WrapperCommandSyntaxException; | ||
|
||
} |
Oops, something went wrong.