use of org.bleachhack.command.exception.CmdSyntaxException in project BleachHack by BleachDrinker420.
the class CmdRpc method onCommand.
@Override
public void onCommand(String alias, String[] args) throws Exception {
if (args.length == 0) {
throw new CmdSyntaxException();
}
DiscordRPC rpc = ModuleManager.getModule(DiscordRPC.class);
String text = StringUtils.join(args, ' ', 1, args.length);
if (args[0].equalsIgnoreCase("top")) {
rpc.setTopText(text);
BleachLogger.info("Set top RPC text to \"" + text + "\"");
BleachFileHelper.saveMiscSetting("discordRPCTopText", new JsonPrimitive(text));
} else if (args[0].equalsIgnoreCase("bottom")) {
rpc.setBottomText(text);
BleachLogger.info("Set bottom RPC text to \"" + text + "\"");
BleachFileHelper.saveMiscSetting("discordRPCBottomText", new JsonPrimitive(text));
} else if (args[0].equalsIgnoreCase("current")) {
BleachLogger.info("Current RPC status:\n" + rpc.getTopText() + "\n" + rpc.getBottomText());
} else {
throw new CmdSyntaxException();
}
}
use of org.bleachhack.command.exception.CmdSyntaxException in project BleachHack by BleachDrinker420.
the class CmdCustomSign method onCommand.
@Override
public void onCommand(String alias, String[] args) {
if (args.length == 0) {
throw new CmdSyntaxException();
}
NoRender noRender = ModuleManager.getModule(NoRender.class);
if (args[0].equalsIgnoreCase("list")) {
String s = "Sign Text:";
for (Text text : noRender.signText) {
s += "\n\u00a77" + text.getString();
}
BleachLogger.info(s);
return;
}
String arg = args[0].toLowerCase(Locale.ENGLISH);
boolean all = arg.equals("all");
Text text = new LiteralText(String.join(" ", Arrays.asList(args).subList(1, args.length)));
boolean[] linesToChange = new boolean[] { arg.equals("line1") || all, arg.equals("line2") || all, arg.equals("line3") || all, arg.equals("line4") || all };
JsonArray json = new JsonArray();
for (int i = 0; i < 4; i++) {
if (linesToChange[i]) {
noRender.signText[i] = text;
json.add(noRender.signText[i].getString());
}
}
BleachFileHelper.saveMiscSetting("customSignText", json);
BleachLogger.info("Changed sign text!");
}
use of org.bleachhack.command.exception.CmdSyntaxException in project BleachHack by BleachDrinker420.
the class CmdEnchant method onCommand.
@Override
public void onCommand(String alias, String[] args) throws Exception {
if (!mc.interactionManager.getCurrentGameMode().isCreative()) {
BleachLogger.error("Not In Creative Mode!");
return;
}
if (args.length == 0) {
throw new CmdSyntaxException();
}
if (args[0].equalsIgnoreCase("list")) {
MutableText text = new LiteralText("");
int i = 0;
for (String[] s : enchantments.keySet()) {
int color = i % 2 == 0 ? BleachLogger.INFO_COLOR : Formatting.AQUA.getColorValue();
text.append(new LiteralText("\u00a77[\u00a7r" + String.join("\u00a77/\u00a7r", s) + "\u00a77] ").setStyle(Style.EMPTY.withColor(color)));
i++;
}
BleachLogger.info(text);
return;
}
int level = args.length == 1 ? 1 : Integer.parseInt(args[1]);
ItemStack item = mc.player.getInventory().getMainHandStack();
if (args[0].equalsIgnoreCase("all")) {
for (Enchantment e : Registry.ENCHANTMENT) {
enchant(item, e, level);
}
return;
}
int i = NumberUtils.toInt(args[0], -1);
if (i != -1) {
enchant(item, Enchantment.byRawId(i), level);
} else {
enchant(item, enchantments.entrySet().stream().filter(e -> ArrayUtils.contains(e.getKey(), args[0])).map(Entry::getValue).findFirst().orElse(null), level);
}
}
use of org.bleachhack.command.exception.CmdSyntaxException in project BleachHack by BleachDrinker420.
the class CmdFriends method onCommand.
@Override
public void onCommand(String alias, String[] args) throws Exception {
if (args.length == 0 || args.length > 2) {
throw new CmdSyntaxException();
}
if (args[0].equalsIgnoreCase("add")) {
if (args.length < 2) {
throw new CmdSyntaxException("No username selected");
}
BleachHack.friendMang.add(args[1]);
BleachLogger.info("Added \"" + args[1] + "\" to the friend list");
} else if (args[0].equalsIgnoreCase("remove")) {
if (args.length < 2) {
throw new CmdSyntaxException("No username selected");
}
BleachHack.friendMang.remove(args[1].toLowerCase(Locale.ENGLISH));
BleachLogger.info("Removed \"" + args[1] + "\" from the friend list");
} else if (args[0].equalsIgnoreCase("list")) {
if (BleachHack.friendMang.getFriends().isEmpty()) {
BleachLogger.info("You don't have any friends :(");
} else {
int len = BleachHack.friendMang.getFriends().stream().min((f1, f2) -> f2.length() - f1.length()).get().length() + 3;
MutableText text = new LiteralText("Friends:");
for (String f : BleachHack.friendMang.getFriends()) {
String spaces = StringUtils.repeat(' ', len - f.length());
text.append(new LiteralText("\n> " + f + spaces).styled(style -> style.withColor(BleachLogger.INFO_COLOR))).append(new LiteralText("\u00a7c[Del]").styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("Remove " + f + " from your friendlist"))).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, getPrefix() + "friends remove " + f)))).append(" ").append(new LiteralText("\u00a73[NameMC]").styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("Open NameMC page of " + f))).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://namemc.com/profile/" + f))));
}
BleachLogger.info(text);
}
} else if (args[0].equalsIgnoreCase("clear")) {
BleachHack.friendMang.getFriends().clear();
BleachLogger.info("Cleared Friend list");
} else {
throw new CmdSyntaxException();
}
BleachFileHelper.SCHEDULE_SAVE_FRIENDS.set(true);
}
use of org.bleachhack.command.exception.CmdSyntaxException in project BleachHack by BleachDrinker420.
the class CmdInvPeek method onCommand.
@Override
public void onCommand(String alias, String[] args) throws Exception {
if (args.length == 0) {
throw new CmdSyntaxException();
}
for (AbstractClientPlayerEntity e : mc.world.getPlayers()) {
if (e.getDisplayName().getString().equalsIgnoreCase(args[0])) {
BleachQueue.add(() -> {
BleachLogger.info("Opened inventory for " + e.getDisplayName().getString());
mc.setScreen(new InventoryScreen(e) {
public boolean mouseClicked(double mouseX, double mouseY, int button) {
return false;
}
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE);
this.drawTexture(matrices, x, y, 0, 0, this.backgroundWidth, this.backgroundHeight);
drawEntity(x + 51, y + 75, 30, (float) (x + 51) - mouseX, (float) (y + 75 - 50) - mouseY, this.client.player);
}
});
});
return;
}
}
BleachLogger.error("Player " + args[0] + " not found!");
}
Aggregations