diff options
author | zaaarf <zaaarf@proton.me> | 2023-02-28 22:09:07 +0100 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-02-28 22:09:07 +0100 |
commit | e82f1cc5e6a7aa60d3c69e67d8d0678d448ab886 (patch) | |
tree | 34d0479e5880783fbb3309746d713f5e1fc31c22 /src/main/java | |
parent | e3af53002f59167ae1923211be7982ac47ecf85d (diff) |
chore: delegated default group and name to AbstractModule
Diffstat (limited to 'src/main/java')
17 files changed, 11 insertions, 141 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/AbstractModule.java b/src/main/java/ftbsc/bscv/modules/AbstractModule.java index a7f4b04..2239beb 100644 --- a/src/main/java/ftbsc/bscv/modules/AbstractModule.java +++ b/src/main/java/ftbsc/bscv/modules/AbstractModule.java @@ -26,6 +26,17 @@ public abstract class AbstractModule implements IModule<AbstractModule.Group> { 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 public ForgeConfigSpec.Builder getConfigBuilder() { return BoSCoVicino.modManager.getCfgBuilder(); } diff --git a/src/main/java/ftbsc/bscv/modules/defense/Aura.java b/src/main/java/ftbsc/bscv/modules/defense/Aura.java index 9bb3f25..d5838ae 100644 --- a/src/main/java/ftbsc/bscv/modules/defense/Aura.java +++ b/src/main/java/ftbsc/bscv/modules/defense/Aura.java @@ -1,11 +1,8 @@ package ftbsc.bscv.modules.defense; -import com.mojang.brigadier.CommandDispatcher; - import ftbsc.bscv.ICommons; import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.tools.Setting; -import net.minecraft.command.CommandSource; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraftforge.common.ForgeConfigSpec; @@ -16,16 +13,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; public class Aura extends QuickModule implements ICommons { @Override - public String getName() { - return "Aura"; - } - - @Override - public Group getGroup() { - return Group.DEFENSE; - } - - @Override protected int getDefaultKey() { return UNBOUND; } diff --git a/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java b/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java index d754ee9..53a8f89 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java +++ b/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java @@ -11,12 +11,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import static ftbsc.bscv.tools.Text.TextBuilder; public class ActiveModules extends HudModule implements ICommons { - - @Override - public String getName() { - return "ActiveModules"; - } - @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent event) { if (event.getType() == ElementType.TEXT) { diff --git a/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java b/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java index bf6923d..cac6170 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java +++ b/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java @@ -14,12 +14,6 @@ import ftbsc.bscv.ICommons; import ftbsc.bscv.modules.HudModule; public class Coordinates extends HudModule implements ICommons { - - @Override - public String getName() { - return "Coordinates"; - } - @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent event) { if (event.getType() == ElementType.TEXT && MC.player != null) { diff --git a/src/main/java/ftbsc/bscv/modules/hud/EntityList.java b/src/main/java/ftbsc/bscv/modules/hud/EntityList.java index 954e8b7..58e9c11 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/EntityList.java +++ b/src/main/java/ftbsc/bscv/modules/hud/EntityList.java @@ -24,11 +24,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; public class EntityList extends HudModule implements ICommons { - @Override - public String getName() { - return "EntityList"; - } - public final ForgeConfigSpec.ConfigValue<String> search; public EntityList() { diff --git a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java index 240ce83..533bed4 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java +++ b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java @@ -23,11 +23,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; 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 double instant_speed = 0.0; private double average_speed = 0.0; diff --git a/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java b/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java index 8a36bfe..106531f 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java +++ b/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java @@ -15,10 +15,6 @@ import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; public class PlayerList extends HudModule implements ICommons { - @Override - public String getName() { - return "PlayerList"; - } @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent event) { diff --git a/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java b/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java index 413f335..f2fdb5d 100644 --- a/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java +++ b/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java @@ -16,16 +16,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; 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> rise; public final ForgeConfigSpec.ConfigValue<Boolean> gravity; diff --git a/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java b/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java index 9193934..47c00a7 100644 --- a/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java +++ b/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java @@ -16,15 +16,6 @@ import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.eventbus.api.SubscribeEvent; public class VanillaFlight extends QuickModule implements ICommons { - @Override - public String getName() { - return "VanillaFlight"; - } - - @Override - public Group getGroup() { - return Group.MOTION; - } @Override protected int getDefaultKey() { diff --git a/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java b/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java index 7f69197..5bf4411 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java +++ b/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java @@ -11,15 +11,6 @@ import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; 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> hover; diff --git a/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java b/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java index 0ad492e..6581546 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java +++ b/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java @@ -15,16 +15,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; 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 AutoDisconnect() { diff --git a/src/main/java/ftbsc/bscv/modules/self/AutoFish.java b/src/main/java/ftbsc/bscv/modules/self/AutoFish.java index e275c4c..a312cee 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AutoFish.java +++ b/src/main/java/ftbsc/bscv/modules/self/AutoFish.java @@ -1,13 +1,10 @@ package ftbsc.bscv.modules.self; -import com.mojang.brigadier.CommandDispatcher; - import ftbsc.bscv.ICommons; import ftbsc.bscv.events.PacketEvent; import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.tools.Setting; import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandSource; import net.minecraft.network.play.server.SPlaySoundEffectPacket; import net.minecraft.util.Hand; import net.minecraft.util.SoundEvents; @@ -16,16 +13,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; 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<Integer> delay; // public final ForgeConfigSpec.ConfigValue<Long> reaction; diff --git a/src/main/java/ftbsc/bscv/modules/self/AutoTool.java b/src/main/java/ftbsc/bscv/modules/self/AutoTool.java index 2201343..482ee8b 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AutoTool.java +++ b/src/main/java/ftbsc/bscv/modules/self/AutoTool.java @@ -16,16 +16,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; 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 AutoTool() { diff --git a/src/main/java/ftbsc/bscv/modules/self/FastInteract.java b/src/main/java/ftbsc/bscv/modules/self/FastInteract.java index e947b5e..297e3c0 100644 --- a/src/main/java/ftbsc/bscv/modules/self/FastInteract.java +++ b/src/main/java/ftbsc/bscv/modules/self/FastInteract.java @@ -16,16 +16,6 @@ import ftbsc.bscv.ICommons; public class FastInteract extends QuickModule implements ICommons { @Override - public String getName() { - return "FastInteract"; - } - - @Override - public Group getGroup() { - return Group.SELF; - } - - @Override protected int getDefaultKey() { return UNBOUND; } diff --git a/src/main/java/ftbsc/bscv/modules/self/Freecam.java b/src/main/java/ftbsc/bscv/modules/self/Freecam.java index a80e5b3..bbc8382 100644 --- a/src/main/java/ftbsc/bscv/modules/self/Freecam.java +++ b/src/main/java/ftbsc/bscv/modules/self/Freecam.java @@ -30,16 +30,6 @@ public class Freecam extends QuickModule implements ICommons { private MockPlayer mock_player; @Override - public String getName() { - return "Freecam"; - } - - @Override - public Group getGroup() { - return Group.SELF; - } - - @Override protected int getDefaultKey() { return UNBOUND; } diff --git a/src/main/java/ftbsc/bscv/modules/self/PortalGui.java b/src/main/java/ftbsc/bscv/modules/self/PortalGui.java index 326f64d..c900f97 100644 --- a/src/main/java/ftbsc/bscv/modules/self/PortalGui.java +++ b/src/main/java/ftbsc/bscv/modules/self/PortalGui.java @@ -7,16 +7,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; public class PortalGui extends AbstractModule implements ICommons { - @Override - public String getName() { - return "PortalGui"; - } - - @Override - public Group getGroup() { - return Group.SELF; - } - @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (MC.player == null) return; diff --git a/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java b/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java index 4585a68..26d0fab 100644 --- a/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java +++ b/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java @@ -10,17 +10,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import java.awt.event.KeyEvent; public class Fullbright extends QuickModule implements ICommons { - - @Override - public String getName() { - return "Fullbright"; - } - - @Override - public Group getGroup() { - return Group.VISION; - } - @Override protected int getDefaultKey() { return KeyEvent.VK_V; |