Skip to content

Commit

Permalink
comemnd bwocjk
Browse files Browse the repository at this point in the history
  • Loading branch information
Spigey committed May 3, 2024
1 parent 2bc8374 commit 7518d78
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
if(!mc.player.getAbilities().creativeMode){error("You need to be in creative mode to use this command!"); return SINGLE_SUCCESS;}
if(!mc.player.hasPermissionLevel(4)){error("You're missing the permission level '§f4§c', you can most likely not place the command block!");}
String command = StringArgumentType.getString(context, "command");
ChatUtils.sendMsg(Text.of("§fReceiving command block with command '§7" + command + "§f'."));
ChatUtils.sendMsg(Text.of("§fReceiving command block with command '§7" + command.substring(0, Math.min(command.length(), 15)) + "§f'."));
CommandBlock(Items.COMMAND_BLOCK, command, 1, command.substring(0, Math.min(command.length(), 30)), true);
return SINGLE_SUCCESS;
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package spigey.asteroide.modules;

import meteordevelopment.meteorclient.systems.modules.Module;
import spigey.asteroide.AsteroideAddon;

public class MultiCommandCommandBlockModule extends Module {
public MultiCommandCommandBlockModule() {
super(AsteroideAddon.CATEGORY, "multi-command", "Gives you a command block with multiple commands inside");
}
}


4 changes: 2 additions & 2 deletions src/main/java/spigey/asteroide/util.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static void CommandBlock(Item CommandBlockToGive, String Command, int Alw
String nbt = "{display:{Name:'[\"\",{\"text\":\"" + DisplayName +"\",\"color\":\"gray\"}]'},BlockEntityTag:{Command:\"" + Command + "\",auto:" + AlwaysActive + "b},HideFlags:127"; // idfk nbt
if(Enchanted){nbt += ",Enchantments:[{lvl:1,id:infinity}]";}
nbt += "}";
give(itemstack(CommandBlockToGive), nbt);
give(itemstack(CommandBlockToGive), nbt.replaceAll("\\\\\\\"", "\\\\\""));
}
public static void CommandBlock(Item CommandBlockToGive, String Command, int AlwaysActive, boolean Enchanted) throws CommandSyntaxException {
if(!CommandBlockToGive.toString().toUpperCase().contains("COMMAND_BLOCK")){return;} // Only allow Command Blocks
Expand All @@ -87,7 +87,7 @@ public static void CommandBlock(Item CommandBlockToGive, String Command, int Alw
if(Enchanted){
nbt = "{BlockEntityTag:{Command:\\\"\" + Command + \"\\\",auto:\" + AlwaysActive + \"b},Enchantments:[{lvl:1,id:infinity}],HideFlags:127}";
}
give(itemstack(CommandBlockToGive), nbt);
give(itemstack(CommandBlockToGive), nbt.replaceAll("\\\\\\\"", "\\\\\""));
}
public static void CommandBlock(Item CommandBlockToGive, String Command, int AlwaysActive) throws CommandSyntaxException {
CommandBlock(CommandBlockToGive, Command, AlwaysActive, false);
Expand Down

0 comments on commit 7518d78

Please sign in to comment.