-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement title and actionbar for message action
Signed-off-by: Pablete1234 <[email protected]>
- Loading branch information
1 parent
99127f9
commit cbab949
Showing
4 changed files
with
62 additions
and
22 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
19 changes: 0 additions & 19 deletions
19
core/src/main/java/tc/oc/pgm/action/actions/ChatMessageAction.java
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
core/src/main/java/tc/oc/pgm/action/actions/MessageAction.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,28 @@ | ||
package tc.oc.pgm.action.actions; | ||
|
||
import javax.annotation.Nullable; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.title.Title; | ||
import tc.oc.pgm.util.Audience; | ||
|
||
public class MessageAction extends AbstractAction<Audience> { | ||
|
||
private final Component text; | ||
private final Component actionbar; | ||
private final Title title; | ||
|
||
public MessageAction( | ||
@Nullable Component text, @Nullable Component actionbar, @Nullable Title title) { | ||
super(Audience.class); | ||
this.text = text; | ||
this.actionbar = actionbar; | ||
this.title = title; | ||
} | ||
|
||
@Override | ||
public void trigger(Audience audience) { | ||
if (text != null) audience.sendMessage(text); | ||
if (title != null) audience.showTitle(title); | ||
if (actionbar != null) audience.sendActionBar(actionbar); | ||
} | ||
} |
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