Skip to content

Commit a017602

Browse files
committed
singleplayer error message for /vote
1 parent a7bffbd commit a017602

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ authors=ModFest
1717
contributors=Prospector, Sisby folk, acikek
1818
license=MIT
1919
# Mod Version
20-
baseVersion=0.5.3
20+
baseVersion=0.5.4
2121
# Branch Metadata
2222
branch=1.21
2323
tagBranch=1.21

src/main/java/net/modfest/ballotbox/BallotBoxCommands.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ private static int vote(ServerPlayerEntity player, Consumer<Text> feedback) {
7575
feedback.accept(Text.literal("[BallotBox] ").formatted(Formatting.GREEN).append(Text.literal("Vote cannot be invoked by a non-player").formatted(Formatting.RED)));
7676
return 0;
7777
}
78+
if (player.getServer().isSingleplayer()) {
79+
feedback.accept(Text.literal("[BallotBox] ").formatted(Formatting.GREEN).append(Text.literal("Voting isn't available in singleplayer!").formatted(Formatting.RED)));
80+
return 0;
81+
}
7882
if (!ServerPlayNetworking.canSend(player, OpenVoteScreen.ID)) {
7983
feedback.accept(Text.literal("[BallotBox] ").formatted(Formatting.GREEN).append(Text.literal("Voting requires BallotBox on the client!").formatted(Formatting.RED)));
8084
return 0;

0 commit comments

Comments
 (0)