-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix crash with commands that doesn't extend CommandBase (#125)
Signed-off-by: Lyfts <[email protected]>
- Loading branch information
Showing
6 changed files
with
56 additions
and
12 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
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
36 changes: 36 additions & 0 deletions
36
src/mixins/java/serverutils/mixins/early/minecraft/MixinICommand.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,36 @@ | ||
package serverutils.mixins.early.minecraft; | ||
|
||
import net.minecraft.command.ICommand; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import serverutils.ranks.ICommandWithPermission; | ||
|
||
@Mixin(ICommand.class) | ||
public interface MixinICommand extends ICommandWithPermission { | ||
|
||
@Shadow | ||
String getCommandName(); | ||
|
||
@Override | ||
default String serverutilities$getPermissionNode() { | ||
return commandPermissions.get(getCommandName()); | ||
} | ||
|
||
@Override | ||
default void serverutilities$setPermissionNode(@NotNull String node) { | ||
commandPermissions.put(getCommandName(), node); | ||
} | ||
|
||
@Override | ||
default String serverutilities$getModName() { | ||
return commandOwners.get(getCommandName()); | ||
} | ||
|
||
@Override | ||
default void serverutilities$setModName(@NotNull String modName) { | ||
commandOwners.put(getCommandName(), modName); | ||
} | ||
} |