mirror of https://github.com/kami-blue/client
close #689
This commit is contained in:
parent
15291b44ba
commit
7a7820cebd
|
@ -0,0 +1,37 @@
|
|||
package me.zeroeightsix.kami.command.commands;
|
||||
|
||||
import me.zeroeightsix.kami.command.Command;
|
||||
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
|
||||
import me.zeroeightsix.kami.module.modules.combat.AutoEZ;
|
||||
|
||||
import static me.zeroeightsix.kami.KamiMod.MODULE_MANAGER;
|
||||
|
||||
public class AutoEZCommand extends Command {
|
||||
public AutoEZCommand() {
|
||||
super("autoez", new ChunkBuilder().append("message").build());
|
||||
setDescription("Allows you to customize AutoEZ's custom setting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(String[] args) {
|
||||
AutoEZ az = MODULE_MANAGER.getModuleT(AutoEZ.class);
|
||||
if (az == null) {
|
||||
Command.sendErrorMessage("&cThe AutoEZ module is not available for some reason. Make sure the name you're calling is correct and that you have the module installed!!");
|
||||
return;
|
||||
}
|
||||
if (!az.isEnabled()) {
|
||||
Command.sendWarningMessage("&6Warning: The AutoEZ module is not enabled!");
|
||||
Command.sendWarningMessage("The command will still work, but will not visibly do anything.");
|
||||
}
|
||||
if (!az.mode.getValue().equals(AutoEZ.Mode.CUSTOM)) {
|
||||
Command.sendWarningMessage("&6Warning: You don't have custom mode enabled in AutoEZ!");
|
||||
Command.sendWarningMessage("The command will still work, but will not visibly do anything.");
|
||||
}
|
||||
for (String s : args) {
|
||||
if (s == null)
|
||||
continue;
|
||||
az.customText.setValue(s);
|
||||
Command.sendChatMessage("Set the Custom Mode to <" + s + ">");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import me.zeroeightsix.kami.setting.Setting;
|
|||
import me.zeroeightsix.kami.setting.Settings;
|
||||
import net.minecraft.network.play.client.CPacketChatMessage;
|
||||
|
||||
import static me.zeroeightsix.kami.KamiMod.*;
|
||||
import static me.zeroeightsix.kami.KamiMod.separator;
|
||||
|
||||
/**
|
||||
* Created by 086 on 8/04/2018.
|
||||
|
|
|
@ -2,6 +2,7 @@ package me.zeroeightsix.kami.module.modules.combat;
|
|||
|
||||
import me.zero.alpine.listener.EventHandler;
|
||||
import me.zero.alpine.listener.Listener;
|
||||
import me.zeroeightsix.kami.command.Command;
|
||||
import me.zeroeightsix.kami.event.events.GuiScreenEvent;
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
|
@ -14,39 +15,46 @@ import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
|||
* @author polymer
|
||||
* @author cookiedragon234
|
||||
* Updated by polymer 10 March 2020
|
||||
* Updated by S-B99 on 10/04/20
|
||||
* Updated by S-B99 on 12/04/20
|
||||
*/
|
||||
@Module.Info(name = "AutoEZ", category = Module.Category.COMBAT, description = "Sends an insult in chat after killing someone")
|
||||
public class AutoEZ extends Module {
|
||||
private Setting<Mode> mode = register(Settings.e("Mode", Mode.ONTOP));
|
||||
public Setting<Mode> mode = register(Settings.e("Mode", Mode.ONTOP));
|
||||
public Setting<String> customText = register(Settings.stringBuilder("Custom Text").withValue("unchanged").withConsumer((old, value) -> {}).build());
|
||||
|
||||
EntityPlayer focus;
|
||||
int hasBeenCombat;
|
||||
|
||||
public enum Mode {
|
||||
GG("gg, "),
|
||||
ONTOP("KAMI BLUE on top! ez "),
|
||||
EZD("You just got ez'd "),
|
||||
EZ_HYPIXEL("E Z Win "),
|
||||
NAENAE("You just got naenae'd by kami blue plus, ");
|
||||
GG("gg, $NAME"),
|
||||
ONTOP("KAMI BLUE on top! ez $NAME"),
|
||||
EZD("You just got ez'd $NAME"),
|
||||
EZ_HYPIXEL("E Z Win $NAME"),
|
||||
NAENAE("You just got naenae'd by kami blue plus, $NAME"),
|
||||
CUSTOM();
|
||||
|
||||
private String text;
|
||||
|
||||
Mode(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
Mode() { } // yes
|
||||
}
|
||||
|
||||
private String getText(Mode m) {
|
||||
return m.text;
|
||||
private String getText(Mode m, String playerName) {
|
||||
if (m.equals(Mode.CUSTOM)) {
|
||||
return customText.getValue().replace("$NAME", playerName);
|
||||
}
|
||||
return m.text.replace("$NAME", playerName);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public Listener<AttackEntityEvent> livingDeathEventListener = new Listener<>(event -> {
|
||||
if (event.getTarget() instanceof EntityPlayer) {
|
||||
focus = (EntityPlayer) event.getTarget();
|
||||
if (event.getEntityPlayer().getUniqueID() == mc.player.getUniqueID()) {
|
||||
if (focus.getHealth() <= 0.0 || focus.isDead || !mc.world.playerEntities.contains(focus)) {
|
||||
mc.player.sendChatMessage(getText(mode.getValue()) + event.getTarget().getName());
|
||||
mc.player.sendChatMessage(getText(mode.getValue(), event.getTarget().getName()));
|
||||
return;
|
||||
}
|
||||
hasBeenCombat = 1000;
|
||||
|
@ -61,15 +69,23 @@ public class AutoEZ extends Module {
|
|||
hasBeenCombat = 0;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
private static long startTime = 0;
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (mc.player == null) return;
|
||||
if (hasBeenCombat > 0 && (focus.getHealth() <= 0.0f || focus.isDead || !mc.world.playerEntities.contains(focus))) {
|
||||
mc.player.sendChatMessage(getText(mode.getValue())+focus.getName());
|
||||
mc.player.sendChatMessage(getText(mode.getValue(), focus.getName()));
|
||||
hasBeenCombat = 0;
|
||||
}
|
||||
--hasBeenCombat;
|
||||
if (startTime == 0) startTime = System.currentTimeMillis();
|
||||
if (startTime + 5000 <= System.currentTimeMillis()) { // 5 seconds in milliseconds
|
||||
if (mode.getValue().equals(Mode.CUSTOM) && customText.getValue().equalsIgnoreCase("unchanged") && mc.player != null) {
|
||||
Command.sendWarningMessage(getChatName() + " Warning: In order to use the custom " + getName() + ", please run the &7" + Command.getCommandPrefix() + "autoez&r command to change it, with '&7$NAME&f' being the username of the killed player");
|
||||
}
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue