.give command bossbar and dud tnt

This commit is contained in:
C10udburst
2022-03-18 22:38:54 +01:00
parent 9f3385a576
commit b32d679f48
2 changed files with 19 additions and 4 deletions

View File

@@ -61,8 +61,7 @@ public class GiveCommand extends Command {
}));
builder.then(literal("holo").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> {
String message = ctx.getArgument("message", String.class);
message = message.replace("&", "\247");
String message = ctx.getArgument("message", String.class).replace("&", "\247");
ItemStack stack = new ItemStack(Items.ARMOR_STAND);
NbtCompound tag = new NbtCompound();
NbtList NbtList = new NbtList();
@@ -81,6 +80,21 @@ public class GiveCommand extends Command {
return SINGLE_SUCCESS;
})));
builder.then(literal("bossbar").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> {
String message = ctx.getArgument("message", String.class).replace("&", "\247");
ItemStack stack = new ItemStack(Items.BAT_SPAWN_EGG);
NbtCompound tag = new NbtCompound();
tag.putString("CustomName", Text.Serializer.toJson(new LiteralText(message)));
tag.putBoolean("NoAI", true);
tag.putBoolean("Silent", true);
tag.putBoolean("PersistenceRequired", true);
tag.putBoolean("Invisible", true);
tag.put("id", NbtString.of("minecraft:wither"));
stack.setSubNbt("EntityTag", tag);
GiveUtils.giveItem(stack);
return SINGLE_SUCCESS;
})));
builder.then(literal("head").then(argument("owner",StringArgumentType.greedyString()).executes(ctx -> {
String playerName = ctx.getArgument("owner",String.class);
ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD);