Skip to content

Commit 5591fac

Browse files
committed
Fix commands not recognizing players properly
1 parent 59c6267 commit 5591fac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fabric/src/main/java/xyz/jpenilla/squaremap/fabric/command/FabricCommander.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public Object commanderId() {
3939
}
4040

4141
public static FabricCommander from(final CommandSourceStack stack) {
42-
if (((CommandSourceStackAccess) stack).source() instanceof ServerPlayer) {
42+
if (stack.getEntity() instanceof ServerPlayer) {
4343
return new Player(stack);
4444
}
4545
return new FabricCommander(stack);
@@ -52,7 +52,7 @@ private Player(final CommandSourceStack stack) {
5252

5353
@Override
5454
public ServerPlayer player() {
55-
return (ServerPlayer) ((CommandSourceStackAccess) this.stack()).source();
55+
return (ServerPlayer) this.stack().getEntity();
5656
}
5757

5858
@Override

neoforge/src/main/java/xyz/jpenilla/squaremap/forge/command/ForgeCommander.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public Object commanderId() {
4343
}
4444

4545
public static ForgeCommander from(final CommandSourceStack stack) {
46-
if (stack.source instanceof ServerPlayer) {
46+
if (stack.getEntity() instanceof ServerPlayer) {
4747
return new Player(stack);
4848
}
4949
return new ForgeCommander(stack);
@@ -58,7 +58,7 @@ private Player(final CommandSourceStack stack) {
5858

5959
@Override
6060
public ServerPlayer player() {
61-
return (ServerPlayer) this.stack().source;
61+
return (ServerPlayer) this.stack().getEntity();
6262
}
6363

6464
@Override

0 commit comments

Comments
 (0)