port fixes
This commit is contained in:
commit
9e8c3333c0
6 changed files with 38 additions and 15 deletions
|
@ -15,11 +15,11 @@ public interface CommandClearChat {
|
|||
static void register (CommandDispatcher dispatcher) {
|
||||
final LiteralCommandNode node = dispatcher.register(
|
||||
literal("clearchat")
|
||||
.requires(source -> source.hasPermissionLevel(2))
|
||||
.requires(CommandClearChat::requirement)
|
||||
.executes(CommandClearChat::clearChatCommand)
|
||||
);
|
||||
|
||||
dispatcher.register(literal("cc").redirect(node));
|
||||
dispatcher.register(literal("cc").requires(CommandClearChat::requirement).executes(CommandClearChat::clearChatCommand).redirect(node));
|
||||
}
|
||||
|
||||
static int clearChatCommand (CommandContext<ServerCommandSource> context) {
|
||||
|
@ -33,4 +33,8 @@ public interface CommandClearChat {
|
|||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
static boolean requirement (ServerCommandSource source) {
|
||||
return source.hasPermissionLevel(2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ public interface CommandDestroyEntities {
|
|||
static void register (CommandDispatcher dispatcher) {
|
||||
final LiteralCommandNode node = dispatcher.register(
|
||||
literal("destroyentities")
|
||||
.requires(source -> source.hasPermissionLevel(2))
|
||||
//.executes(CommandDestroyEntities::destroyEntitiesCommand)
|
||||
.requires(CommandDestroyEntities::requirement)
|
||||
// .executes(CommandDestroyEntities::destroyEntitiesCommand)
|
||||
);
|
||||
|
||||
dispatcher.register(literal("de").redirect(node));
|
||||
dispatcher.register(literal("de").requires(CommandDestroyEntities::requirement).redirect(node));
|
||||
}
|
||||
|
||||
static int destroyEntitiesCommand (CommandContext<ServerCommandSource> context) {
|
||||
|
@ -55,4 +55,8 @@ public interface CommandDestroyEntities {
|
|||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
static boolean requirement (ServerCommandSource source) {
|
||||
return source.hasPermissionLevel(2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ public interface CommandJumpscare {
|
|||
static void register (CommandDispatcher dispatcher) {
|
||||
final LiteralCommandNode node = dispatcher.register(
|
||||
literal("jumpscare")
|
||||
.requires(source -> source.hasPermissionLevel(2))
|
||||
.requires(CommandJumpscare::requirement)
|
||||
.then(
|
||||
argument("targets", players())
|
||||
.executes(CommandJumpscare::jumpscareCommand)
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.register(literal("scare").redirect(node));
|
||||
dispatcher.register(literal("scare").requires(CommandJumpscare::requirement).redirect(node));
|
||||
}
|
||||
|
||||
static int jumpscareCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||
|
@ -65,4 +65,8 @@ public interface CommandJumpscare {
|
|||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
static boolean requirement (ServerCommandSource source) {
|
||||
return source.hasPermissionLevel(2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public abstract class CommandPing {
|
|||
public static void register (CommandDispatcher dispatcher) {
|
||||
final LiteralCommandNode node = dispatcher.register(
|
||||
literal("ping")
|
||||
.requires(source -> source.hasPermissionLevel(2))
|
||||
.requires(CommandPing::requirement)
|
||||
.executes(CommandPing::pingCommand)
|
||||
.then(
|
||||
argument("target", player())
|
||||
|
@ -26,8 +26,8 @@ public abstract class CommandPing {
|
|||
)
|
||||
);
|
||||
|
||||
dispatcher.register(literal("delay").redirect(node));
|
||||
dispatcher.register(literal("ms").redirect(node));
|
||||
dispatcher.register(literal("delay").requires(CommandPing::requirement).executes(CommandPing::pingCommand).redirect(node));
|
||||
dispatcher.register(literal("ms").requires(CommandPing::requirement).executes(CommandPing::pingCommand).redirect(node));
|
||||
}
|
||||
|
||||
public static int pingCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||
|
@ -89,4 +89,8 @@ public abstract class CommandPing {
|
|||
|
||||
return highlighting;
|
||||
}
|
||||
|
||||
static boolean requirement (ServerCommandSource source) {
|
||||
return source.hasPermissionLevel(2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface CommandPumpkin {
|
|||
.requires(source -> source.hasPermissionLevel(2))
|
||||
.then(
|
||||
argument("targets", players())
|
||||
// .executes(CommandPumpkin::pumpkinCommand)
|
||||
.executes(CommandPumpkin::pumpkinCommand)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -34,11 +34,11 @@ public interface CommandPumpkin {
|
|||
static int pumpkinCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||
final ServerCommandSource source = context.getSource();
|
||||
final Collection<ServerPlayerEntity> players = getPlayers(context, "targets");
|
||||
final Item pumpkin = Registry.ITEM.get(new Identifier("minecraft", "pumpkin"));
|
||||
final Item carvedPumpkin = Registry.ITEM.get(new Identifier("minecraft", "carved_pumpkin"));
|
||||
|
||||
for (ServerPlayerEntity player : players) {
|
||||
final PlayerInventory inventory = player.inventory;
|
||||
inventory.setStack(3, new ItemStack(pumpkin));
|
||||
inventory.setStack(39, new ItemStack(carvedPumpkin));
|
||||
}
|
||||
|
||||
if (players.size() == 1) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package land.chipmunk.kaboomfabric.extras.commands;
|
|||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
@ -14,11 +15,13 @@ import java.net.InetAddress;
|
|||
|
||||
public abstract class CommandServerInfo {
|
||||
public static void register (CommandDispatcher dispatcher) {
|
||||
dispatcher.register(
|
||||
final LiteralCommandNode node = dispatcher.register(
|
||||
literal("serverinfo")
|
||||
.requires(source -> source.hasPermissionLevel(2))
|
||||
.requires(CommandServerInfo::requirement)
|
||||
.executes(CommandServerInfo::serverInfoCommand)
|
||||
);
|
||||
|
||||
dispatcher.register(literal("specs").requires(CommandServerInfo::requirement).executes(CommandServerInfo::serverInfoCommand).redirect(node));
|
||||
}
|
||||
|
||||
private static void sendInfoMessage (ServerCommandSource source, String description, String value) {
|
||||
|
@ -92,4 +95,8 @@ public abstract class CommandServerInfo {
|
|||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
static boolean requirement (ServerCommandSource source) {
|
||||
return source.hasPermissionLevel(2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue