forked from RepoMirrors/seppuku
lots more fixes for values, fixed enum loading and saving, arraylist metadata now looks different, added new metadata to velocity
This commit is contained in:
parent
bd1e1d5ca5
commit
c51b36f1b4
|
@ -22,7 +22,7 @@ public final class ValueConfig extends Configurable {
|
|||
@Override
|
||||
public void load() {
|
||||
try {
|
||||
for(Module mod : Seppuku.INSTANCE.getModuleManager().getModuleList()) {
|
||||
for (Module mod : Seppuku.INSTANCE.getModuleManager().getModuleList()) {
|
||||
final File file = new File(this.getPath() + mod.getDisplayName() + ".cfg");
|
||||
|
||||
if (!file.exists()) {
|
||||
|
@ -64,8 +64,8 @@ public final class ValueConfig extends Configurable {
|
|||
}
|
||||
|
||||
if (v.getValue() instanceof Enum) {
|
||||
if (StringUtil.isInt(split[1])) {
|
||||
v.setValue(Integer.parseInt(split[1]));
|
||||
if (split.length > 1) {
|
||||
v.setEnumValue(split[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,10 +87,10 @@ public final class ValueConfig extends Configurable {
|
|||
@Override
|
||||
public void save() {
|
||||
try {
|
||||
for(Module mod : Seppuku.INSTANCE.getModuleManager().getModuleList()) {
|
||||
for (Module mod : Seppuku.INSTANCE.getModuleManager().getModuleList()) {
|
||||
final File file = new File(this.getPath() + mod.getDisplayName() + ".cfg");
|
||||
|
||||
if(!file.exists()) {
|
||||
if (!file.exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ public final class ArrayListComponent extends DraggableHudComponent {
|
|||
}
|
||||
|
||||
final Comparator<Module> comparator = (first, second) -> {
|
||||
final String firstName = first.getDisplayName() + (first.getMetaData() != null ? " " + ChatFormatting.GRAY + first.getMetaData() : "");
|
||||
final String secondName = second.getDisplayName() + (second.getMetaData() != null ? " " + ChatFormatting.GRAY + second.getMetaData() : "");
|
||||
final String firstName = first.getDisplayName() + (first.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + first.getMetaData() + ChatFormatting.GRAY + "]" : "");
|
||||
final String secondName = second.getDisplayName() + (second.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + second.getMetaData() + ChatFormatting.GRAY + "]" : "");
|
||||
final float dif = Minecraft.getMinecraft().fontRenderer.getStringWidth(secondName) - Minecraft.getMinecraft().fontRenderer.getStringWidth(firstName);
|
||||
return dif != 0 ? (int) dif : secondName.compareTo(firstName);
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ public final class ArrayListComponent extends DraggableHudComponent {
|
|||
|
||||
for (Module mod : mods) {
|
||||
if (mod != null && mod.getType() != Module.ModuleType.HIDDEN && mod.isEnabled() && !mod.isHidden()) {
|
||||
final String name = mod.getDisplayName() + (mod.getMetaData() != null ? " " + ChatFormatting.GRAY + mod.getMetaData() : "");
|
||||
final String name = mod.getDisplayName() + (mod.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + mod.getMetaData() + ChatFormatting.GRAY + "]" : "");
|
||||
|
||||
final float width = Minecraft.getMinecraft().fontRenderer.getStringWidth(name);
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ public final class CommandManager {
|
|||
}
|
||||
|
||||
if (v.getValue() instanceof Enum) {
|
||||
if (!this.clamp(input, 3, 3)) {
|
||||
if (!this.clamp(input, 3, 3) || split[2].matches("-?\\d+(\\.\\d+)?")) { // is a number?
|
||||
this.printUsage();
|
||||
return;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public final class CommandManager {
|
|||
final int op = v.getEnum(split[2]);
|
||||
|
||||
if (op != -1) {
|
||||
v.setValue(op);
|
||||
v.setEnumValue(split[2]);
|
||||
Seppuku.INSTANCE.logChat(module.getDisplayName() + " \247c" + v.getName() + "\247f set to " + ((Enum) v.getValue()).name());
|
||||
Seppuku.INSTANCE.getConfigManager().saveAll();
|
||||
} else if (StringUtil.isInt(split[2])) {
|
||||
|
@ -243,7 +243,7 @@ public final class CommandManager {
|
|||
Seppuku.INSTANCE.getConfigManager().saveAll();
|
||||
}
|
||||
} else {
|
||||
Seppuku.INSTANCE.errorChat("Invalid input " + "\"" + split[2] + "\" expected a number");
|
||||
Seppuku.INSTANCE.errorChat("Invalid input " + "\"" + split[2] + "\" expected a string");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.module.combat;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
|
@ -23,6 +24,11 @@ public final class VelocityModule extends Module {
|
|||
super("Velocity", new String[]{"Vel", "AntiVelocity", "Knockback", "AntiKnockback"}, "Modify the velocity you take", "NONE", -1, ModuleType.COMBAT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaData() {
|
||||
return String.format("H:%s%%" + ChatFormatting.GRAY + "|" + ChatFormatting.RESET + "V:%s%%", this.horizontal_vel.getValue(), this.vertical_vel.getValue());
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void receivePacket(EventReceivePacket event) {
|
||||
if (event.getStage() == EventStageable.EventStage.PRE) {
|
||||
|
|
Loading…
Reference in New Issue