Fully remove scarpet commands when apps are unloaded (#1452)
Using new Loader 0.14+ features
This commit is contained in:
1 parent
e9f1509a1d
commit
f63c6acb05
7 files changed
+69
-3
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import com.mojang.brigadier.tree.ArgumentCommandNode;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
|
||||
import carpet.fakes.CommandNodeInterface;
|
||||
|
||||
@Mixin(CommandNode.class)
|
||||
public class CommandNode_scarpetCommandsMixin<S> implements CommandNodeInterface {
|
||||
@Shadow @Final
|
||||
private Map<String, CommandNode<S>> children;
|
||||
@Shadow @Final
|
||||
private Map<String, LiteralCommandNode<S>> literals;
|
||||
@Shadow @Final
|
||||
private Map<String, ArgumentCommandNode<S, ?>> arguments;
|
||||
|
||||
@Override
|
||||
public void carpet$removeChild(String name) {
|
||||
this.children.remove(name);
|
||||
this.literals.remove(name);
|
||||
this.arguments.remove(name);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user