added profile command
This commit is contained in:
1 parent
e6a49467c4
commit
85a34fdefa
4 files changed
+44
-14
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package carpet.commands;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.settings.SettingsManager;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
|
||||
import static carpet.commands.TickCommand.healthEntities;
|
||||
import static carpet.commands.TickCommand.healthReport;
|
||||
import static com.mojang.brigadier.arguments.IntegerArgumentType.getInteger;
|
||||
import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
|
||||
import static net.minecraft.server.command.CommandManager.argument;
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
|
||||
public class ProfileCommand
|
||||
{
|
||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
|
||||
{
|
||||
LiteralArgumentBuilder<ServerCommandSource> literalargumentbuilder = literal("profile").
|
||||
requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandProfile)).
|
||||
executes( (c) -> healthReport(c.getSource(), 100)).
|
||||
then(literal("health").
|
||||
executes( (c) -> healthReport(c.getSource(), 100)).
|
||||
then(argument("ticks", integer(20,24000)).
|
||||
executes( (c) -> healthReport(c.getSource(), getInteger(c, "ticks"))))).
|
||||
then(literal("entities").
|
||||
executes((c) -> healthEntities(c.getSource(), 100)).
|
||||
then(argument("ticks", integer(20,24000)).
|
||||
executes((c) -> healthEntities(c.getSource(), getInteger(c, "ticks")))));
|
||||
dispatcher.register(literalargumentbuilder);
|
||||
}
|
||||
}
|
||||
@@ -129,13 +129,13 @@ public class TickCommand
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int healthReport(ServerCommandSource source, int ticks)
|
||||
public static int healthReport(ServerCommandSource source, int ticks)
|
||||
{
|
||||
CarpetProfiler.prepare_tick_report(source, ticks);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int healthEntities(ServerCommandSource source, int ticks)
|
||||
public static int healthEntities(ServerCommandSource source, int ticks)
|
||||
{
|
||||
CarpetProfiler.prepare_entity_report(source, ticks);
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user