chore: delegated default group and name to AbstractModule

This commit is contained in:
zaaarf 2023-02-28 22:09:07 +01:00
parent e3af53002f
commit e82f1cc5e6
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C
17 changed files with 11 additions and 141 deletions

View file

@ -25,6 +25,17 @@ public abstract class AbstractModule implements IModule<AbstractModule.Group> {
protected ForgeConfigSpec.ConfigValue<Boolean> enabled; protected ForgeConfigSpec.ConfigValue<Boolean> enabled;
@Override
public String getName() {
return this.getClass().getSimpleName();
}
@Override
public Group getGroup() {
String[] pkg = this.getClass().getPackage().getName().split("\\.");
return Group.valueOf(pkg[pkg.length - 1].toUpperCase());
}
@Override @Override
public ForgeConfigSpec.Builder getConfigBuilder() { public ForgeConfigSpec.Builder getConfigBuilder() {
return BoSCoVicino.modManager.getCfgBuilder(); return BoSCoVicino.modManager.getCfgBuilder();

View file

@ -1,11 +1,8 @@
package ftbsc.bscv.modules.defense; package ftbsc.bscv.modules.defense;
import com.mojang.brigadier.CommandDispatcher;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.modules.QuickModule;
import ftbsc.bscv.tools.Setting; import ftbsc.bscv.tools.Setting;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
@ -15,16 +12,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class Aura extends QuickModule implements ICommons { public class Aura extends QuickModule implements ICommons {
@Override
public String getName() {
return "Aura";
}
@Override
public Group getGroup() {
return Group.DEFENSE;
}
@Override @Override
protected int getDefaultKey() { protected int getDefaultKey() {
return UNBOUND; return UNBOUND;

View file

@ -11,12 +11,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import static ftbsc.bscv.tools.Text.TextBuilder; import static ftbsc.bscv.tools.Text.TextBuilder;
public class ActiveModules extends HudModule implements ICommons { public class ActiveModules extends HudModule implements ICommons {
@Override
public String getName() {
return "ActiveModules";
}
@SubscribeEvent @SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) { public void onRenderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == ElementType.TEXT) { if (event.getType() == ElementType.TEXT) {

View file

@ -14,12 +14,6 @@ import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.HudModule; import ftbsc.bscv.modules.HudModule;
public class Coordinates extends HudModule implements ICommons { public class Coordinates extends HudModule implements ICommons {
@Override
public String getName() {
return "Coordinates";
}
@SubscribeEvent @SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) { public void onRenderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == ElementType.TEXT && MC.player != null) { if (event.getType() == ElementType.TEXT && MC.player != null) {

View file

@ -24,11 +24,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class EntityList extends HudModule implements ICommons { public class EntityList extends HudModule implements ICommons {
@Override
public String getName() {
return "EntityList";
}
public final ForgeConfigSpec.ConfigValue<String> search; public final ForgeConfigSpec.ConfigValue<String> search;
public EntityList() { public EntityList() {

View file

@ -23,11 +23,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class InfoDisplay extends HudModule implements ICommons { public class InfoDisplay extends HudModule implements ICommons {
@Override
public String getName() {
return "InfoDisplay";
}
private Vector3d last_position = new Vector3d(0.0, 0.0, 0.0); private Vector3d last_position = new Vector3d(0.0, 0.0, 0.0);
private double instant_speed = 0.0; private double instant_speed = 0.0;
private double average_speed = 0.0; private double average_speed = 0.0;

View file

@ -15,10 +15,6 @@ import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class PlayerList extends HudModule implements ICommons { public class PlayerList extends HudModule implements ICommons {
@Override
public String getName() {
return "PlayerList";
}
@SubscribeEvent @SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) { public void onRenderOverlay(RenderGameOverlayEvent event) {

View file

@ -16,16 +16,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BoatFly extends AbstractModule implements ICommons { public class BoatFly extends AbstractModule implements ICommons {
@Override
public String getName() {
return "BoatFly";
}
@Override
public Group getGroup() {
return Group.MOTION;
}
public final ForgeConfigSpec.ConfigValue<Double> speed; public final ForgeConfigSpec.ConfigValue<Double> speed;
public final ForgeConfigSpec.ConfigValue<Double> rise; public final ForgeConfigSpec.ConfigValue<Double> rise;
public final ForgeConfigSpec.ConfigValue<Boolean> gravity; public final ForgeConfigSpec.ConfigValue<Boolean> gravity;

View file

@ -16,15 +16,6 @@ import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class VanillaFlight extends QuickModule implements ICommons { public class VanillaFlight extends QuickModule implements ICommons {
@Override
public String getName() {
return "VanillaFlight";
}
@Override
public Group getGroup() {
return Group.MOTION;
}
@Override @Override
protected int getDefaultKey() { protected int getDefaultKey() {

View file

@ -11,15 +11,6 @@ import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class AntiHunger extends AbstractModule implements ICommons { public class AntiHunger extends AbstractModule implements ICommons {
@Override
public String getName() {
return "AntiHunger";
}
@Override
public Group getGroup() {
return Group.SELF;
}
public final ForgeConfigSpec.ConfigValue<Boolean> sprint; public final ForgeConfigSpec.ConfigValue<Boolean> sprint;
public final ForgeConfigSpec.ConfigValue<Boolean> hover; public final ForgeConfigSpec.ConfigValue<Boolean> hover;

View file

@ -15,16 +15,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class AutoDisconnect extends AbstractModule implements ICommons { public class AutoDisconnect extends AbstractModule implements ICommons {
@Override
public String getName() {
return "AutoDisconnect";
}
@Override
public Group getGroup() {
return Group.SELF;
}
public final ForgeConfigSpec.ConfigValue<Double> threshold; public final ForgeConfigSpec.ConfigValue<Double> threshold;
public AutoDisconnect() { public AutoDisconnect() {

View file

@ -1,13 +1,10 @@
package ftbsc.bscv.modules.self; package ftbsc.bscv.modules.self;
import com.mojang.brigadier.CommandDispatcher;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.events.PacketEvent; import ftbsc.bscv.events.PacketEvent;
import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.modules.AbstractModule;
import ftbsc.bscv.tools.Setting; import ftbsc.bscv.tools.Setting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandSource;
import net.minecraft.network.play.server.SPlaySoundEffectPacket; import net.minecraft.network.play.server.SPlaySoundEffectPacket;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.SoundEvents; import net.minecraft.util.SoundEvents;
@ -16,16 +13,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class AutoFish extends AbstractModule implements ICommons { public class AutoFish extends AbstractModule implements ICommons {
@Override
public String getName() {
return "AutoFish";
}
@Override
public Group getGroup() {
return Group.SELF;
}
public final ForgeConfigSpec.ConfigValue<Boolean> recast; public final ForgeConfigSpec.ConfigValue<Boolean> recast;
public final ForgeConfigSpec.ConfigValue<Integer> delay; public final ForgeConfigSpec.ConfigValue<Integer> delay;
// public final ForgeConfigSpec.ConfigValue<Long> reaction; // public final ForgeConfigSpec.ConfigValue<Long> reaction;

View file

@ -16,16 +16,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class AutoTool extends AbstractModule implements ICommons { public class AutoTool extends AbstractModule implements ICommons {
@Override
public String getName() {
return "AutoTool";
}
@Override
public AbstractModule.Group getGroup() {
return AbstractModule.Group.SELF;
}
public final ForgeConfigSpec.ConfigValue<Integer> limit; public final ForgeConfigSpec.ConfigValue<Integer> limit;
public AutoTool() { public AutoTool() {

View file

@ -15,16 +15,6 @@ import ftbsc.bscv.modules.QuickModule;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
public class FastInteract extends QuickModule implements ICommons { public class FastInteract extends QuickModule implements ICommons {
@Override
public String getName() {
return "FastInteract";
}
@Override
public Group getGroup() {
return Group.SELF;
}
@Override @Override
protected int getDefaultKey() { protected int getDefaultKey() {
return UNBOUND; return UNBOUND;

View file

@ -29,16 +29,6 @@ public class Freecam extends QuickModule implements ICommons {
private GameType prev_gamemode = GameType.SURVIVAL; private GameType prev_gamemode = GameType.SURVIVAL;
private MockPlayer mock_player; private MockPlayer mock_player;
@Override
public String getName() {
return "Freecam";
}
@Override
public Group getGroup() {
return Group.SELF;
}
@Override @Override
protected int getDefaultKey() { protected int getDefaultKey() {
return UNBOUND; return UNBOUND;

View file

@ -7,16 +7,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class PortalGui extends AbstractModule implements ICommons { public class PortalGui extends AbstractModule implements ICommons {
@Override
public String getName() {
return "PortalGui";
}
@Override
public Group getGroup() {
return Group.SELF;
}
@SubscribeEvent @SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) { public void onTick(TickEvent.ClientTickEvent event) {
if (MC.player == null) return; if (MC.player == null) return;

View file

@ -10,17 +10,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
public class Fullbright extends QuickModule implements ICommons { public class Fullbright extends QuickModule implements ICommons {
@Override
public String getName() {
return "Fullbright";
}
@Override
public Group getGroup() {
return Group.VISION;
}
@Override @Override
protected int getDefaultKey() { protected int getDefaultKey() {
return KeyEvent.VK_V; return KeyEvent.VK_V;