-
-
Notifications
You must be signed in to change notification settings - Fork 19
GH-999 Add end screen command #1104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1fc98df
Add end screen feature with translations and command
P1otrulla e43c825
Update eternalcore-core/src/main/java/com/eternalcode/core/feature/fu…
P1otrulla 3dcb95d
troll -> fun
P1otrulla 3d941a5
Merge remote-tracking branch 'origin/2.0/end-screen-command' into 2.0…
P1otrulla 6fd0750
follow Martin's suggestions
P1otrulla 76112b3
Added missing config comments
P1otrulla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...lcore-core/src/main/java/com/eternalcode/core/feature/fun/endscreen/EndScreenCommand.java
This file contains hidden or 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,51 @@ | ||
package com.eternalcode.core.feature.fun.endscreen; | ||
|
||
import com.eternalcode.annotations.scan.command.DescriptionDocs; | ||
import com.eternalcode.core.compatibility.Compatibility; | ||
import com.eternalcode.core.compatibility.Version; | ||
import com.eternalcode.core.injector.annotations.Inject; | ||
import com.eternalcode.core.notice.NoticeService; | ||
import com.eternalcode.paper.PaperOverlay; | ||
import dev.rollczi.litecommands.annotations.argument.Arg; | ||
import dev.rollczi.litecommands.annotations.command.Command; | ||
import dev.rollczi.litecommands.annotations.context.Context; | ||
import dev.rollczi.litecommands.annotations.execute.Execute; | ||
import dev.rollczi.litecommands.annotations.permission.Permission; | ||
import org.bukkit.entity.Player; | ||
|
||
@Command(name = "endscreen", aliases = {"end-screen", "win-screen"}) | ||
@Permission("eternalcore.endscreen") | ||
@Compatibility(from = @Version(minor = 19, patch = 4)) // Requires Minecraft 1.19.4 or higher | ||
public class EndScreenCommand { | ||
|
||
private final NoticeService noticeService; | ||
|
||
@Inject | ||
public EndScreenCommand(NoticeService noticeService) { | ||
this.noticeService = noticeService; | ||
} | ||
|
||
@Execute | ||
@DescriptionDocs(description = "Show a end screen to yourself") | ||
void self(@Context Player sender) { | ||
PaperOverlay.END_SCREEN.show(sender); | ||
|
||
this.noticeService.create() | ||
.notice(translation -> translation.endScreen().shownToSelf()) | ||
.player(sender.getUniqueId()) | ||
.send(); | ||
} | ||
|
||
@Execute | ||
@DescriptionDocs(description = "Show a end screen to a player", arguments = "<player>") | ||
void other(@Context Player sender, @Arg Player target) { | ||
PaperOverlay.END_SCREEN.show(target); | ||
|
||
this.noticeService.create() | ||
.notice(translation -> translation.endScreen().shownToOtherPlayer()) | ||
.player(sender.getUniqueId()) | ||
.placeholder("{PLAYER}", target.getName()) | ||
.send(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...rc/main/java/com/eternalcode/core/feature/fun/endscreen/messages/ENEndScreenMessages.java
This file contains hidden or 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 com.eternalcode.core.feature.fun.endscreen.messages; | ||
|
||
import com.eternalcode.multification.notice.Notice; | ||
import eu.okaeri.configs.OkaeriConfig; | ||
import eu.okaeri.configs.annotation.Comment; | ||
import lombok.Getter; | ||
import lombok.experimental.Accessors; | ||
|
||
@Getter | ||
@Accessors(fluent = true) | ||
|
||
public class ENEndScreenMessages extends OkaeriConfig implements EndScreenMessages { | ||
|
||
public Notice shownToSelf = Notice.chat("<green>► <white>You have shown the end screen to yourself!</white>"); | ||
|
||
@Comment("# {PLAYER} - returns player's name") | ||
public Notice shownToOtherPlayer = Notice.chat("<green>► <white>You have shown the end screen to player <green>{PLAYER}!</green>"); | ||
P1otrulla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
9 changes: 9 additions & 0 deletions
9
.../src/main/java/com/eternalcode/core/feature/fun/endscreen/messages/EndScreenMessages.java
This file contains hidden or 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,9 @@ | ||
package com.eternalcode.core.feature.fun.endscreen.messages; | ||
|
||
import com.eternalcode.multification.notice.Notice; | ||
|
||
public interface EndScreenMessages { | ||
|
||
Notice shownToSelf(); | ||
Notice shownToOtherPlayer(); | ||
} |
17 changes: 17 additions & 0 deletions
17
...rc/main/java/com/eternalcode/core/feature/fun/endscreen/messages/PLEndScreenMessages.java
This file contains hidden or 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,17 @@ | ||
package com.eternalcode.core.feature.fun.endscreen.messages; | ||
|
||
import com.eternalcode.multification.notice.Notice; | ||
import eu.okaeri.configs.OkaeriConfig; | ||
import eu.okaeri.configs.annotation.Comment; | ||
import lombok.Getter; | ||
import lombok.experimental.Accessors; | ||
|
||
@Getter | ||
@Accessors(fluent = true) | ||
public class PLEndScreenMessages extends OkaeriConfig implements EndScreenMessages { | ||
|
||
public Notice shownToSelf = Notice.chat("<green>► <white>Pokazałeś ekran końca gry sobie!</white>"); | ||
|
||
@Comment("# {PLAYER} - ten placeholder zostanie zastąpiony przez nazwę gracza, któremu pokazujesz ekran końca gry.") | ||
public Notice shownToOtherPlayer = Notice.chat("<green>► <white>Pokazałeś ekran końca gry graczowi <green>{PLAYER}!</green>"); | ||
P1otrulla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.