0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Add shortcut to WURST.getEventManager()

This commit is contained in:
Alexander01998 2019-10-01 12:35:20 +02:00
parent 707d08e131
commit 76b8b4e1eb
34 changed files with 131 additions and 141 deletions

View File

@ -14,6 +14,7 @@ import java.util.Map;
import java.util.Set;
import net.minecraft.client.MinecraftClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.mixinterface.IMinecraftClient;
import net.wurstclient.settings.Setting;
@ -21,6 +22,7 @@ import net.wurstclient.settings.Setting;
public abstract class Feature
{
protected static final WurstClient WURST = WurstClient.INSTANCE;
protected static final EventManager EVENTS = WURST.getEventManager();
protected static final MinecraftClient MC = WurstClient.MC;
protected static final IMinecraftClient IMC = WurstClient.IMC;

View File

@ -57,13 +57,13 @@ public final class AnnoyCmd extends Command implements ChatInputListener
if(player != null && target.equals(player.getName().asString()))
ChatUtils.warning("Annoying yourself is a bad idea!");
WURST.getEventManager().add(ChatInputListener.class, this);
EVENTS.add(ChatInputListener.class, this);
enabled = true;
}
private void disable() throws CmdException
{
WURST.getEventManager().remove(ChatInputListener.class, this);
EVENTS.remove(ChatInputListener.class, this);
if(target != null)
{

View File

@ -42,7 +42,7 @@ public final class DropCmd extends Command implements UpdateListener
slowModeTimer = 5;
slowModeSlotCounter = 9;
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
private void dropAllItems()
@ -65,7 +65,7 @@ public final class DropCmd extends Command implements UpdateListener
slowModeTimer = 5;
if(slowModeSlotCounter >= 45)
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
private void skipEmptySlots()

View File

@ -48,13 +48,13 @@ public final class TacoCmd extends Command
if(enabled)
{
WURST.getEventManager().add(GUIRenderListener.class, this);
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(GUIRenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
}else
{
WURST.getEventManager().remove(GUIRenderListener.class, this);
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(GUIRenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
}

View File

@ -26,14 +26,13 @@ public final class AntiCactusHack extends Hack
@Override
protected void onEnable()
{
WURST.getEventManager().add(CactusCollisionShapeListener.class, this);
EVENTS.add(CactusCollisionShapeListener.class, this);
}
@Override
protected void onDisable()
{
WURST.getEventManager().remove(CactusCollisionShapeListener.class,
this);
EVENTS.remove(CactusCollisionShapeListener.class, this);
}
@Override

View File

@ -33,13 +33,13 @@ public final class AntiSpamHack extends Hack implements ChatInputListener
@Override
public void onEnable()
{
WURST.getEventManager().add(ChatInputListener.class, this);
EVENTS.add(ChatInputListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(ChatInputListener.class, this);
EVENTS.remove(ChatInputListener.class, this);
}
@Override

View File

@ -49,13 +49,13 @@ public final class AutoDropHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -77,8 +77,8 @@ public final class AutoFarmHack extends Hack
{
plants.clear();
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(RenderListener.class, this);
displayList = GL11.glGenLists(1);
box = GL11.glGenLists(1);
@ -101,8 +101,8 @@ public final class AutoFarmHack extends Hack
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(RenderListener.class, this);
if(currentBlock != null)
{

View File

@ -95,17 +95,17 @@ public final class AutoFishHack extends Hack
GL11.glEnd();
GL11.glEndList();
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(PacketInputListener.class, this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(PacketInputListener.class, this);
EVENTS.add(RenderListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(PacketInputListener.class, this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(PacketInputListener.class, this);
EVENTS.remove(RenderListener.class, this);
GL11.glDeleteLists(box, 1);
GL11.glDeleteLists(cross, 1);

View File

@ -24,13 +24,13 @@ public final class AutoRespawnHack extends Hack implements DeathListener
@Override
public void onEnable()
{
WURST.getEventManager().add(DeathListener.class, this);
EVENTS.add(DeathListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(DeathListener.class, this);
EVENTS.remove(DeathListener.class, this);
}
@Override

View File

@ -25,13 +25,13 @@ public final class AutoSprintHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -25,13 +25,13 @@ public final class AutoSwimHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -25,13 +25,13 @@ public final class AutoWalkHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
IKeyBinding forwardKey = (IKeyBinding)MC.options.keyForward;
forwardKey.setPressed(forwardKey.isActallyPressed());

View File

@ -38,13 +38,13 @@ public final class BunnyHopHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -27,14 +27,14 @@ public final class DolphinHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
WURST.getHax().fishHack.setEnabled(false);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -43,16 +43,15 @@ public final class FastBreakHack extends Hack
@Override
protected void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(BlockBreakingProgressListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(BlockBreakingProgressListener.class, this);
}
@Override
protected void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(BlockBreakingProgressListener.class,
this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(BlockBreakingProgressListener.class, this);
}
@Override

View File

@ -26,13 +26,13 @@ public final class FastLadderHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -25,13 +25,13 @@ public final class FastPlaceHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -27,14 +27,14 @@ public final class FishHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
WURST.getHax().dolphinHack.setEnabled(false);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -39,15 +39,15 @@ public final class FlightHack extends Hack
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(IsPlayerInWaterListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(IsPlayerInWaterListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(IsPlayerInWaterListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(IsPlayerInWaterListener.class, this);
}
@Override

View File

@ -56,15 +56,14 @@ public final class FreecamHack extends Hack
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(PacketOutputListener.class, this);
WURST.getEventManager().add(IsPlayerInWaterListener.class, this);
WURST.getEventManager().add(PlayerMoveListener.class, this);
WURST.getEventManager().add(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().add(IsNormalCubeListener.class, this);
WURST.getEventManager().add(SetOpaqueCubeListener.class, this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(PacketOutputListener.class, this);
EVENTS.add(IsPlayerInWaterListener.class, this);
EVENTS.add(PlayerMoveListener.class, this);
EVENTS.add(CameraTransformViewBobbingListener.class, this);
EVENTS.add(IsNormalCubeListener.class, this);
EVENTS.add(SetOpaqueCubeListener.class, this);
EVENTS.add(RenderListener.class, this);
fakePlayer = new FakePlayerEntity();
@ -87,15 +86,14 @@ public final class FreecamHack extends Hack
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(PacketOutputListener.class, this);
WURST.getEventManager().remove(IsPlayerInWaterListener.class, this);
WURST.getEventManager().remove(PlayerMoveListener.class, this);
WURST.getEventManager().remove(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().remove(IsNormalCubeListener.class, this);
WURST.getEventManager().remove(SetOpaqueCubeListener.class, this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(PacketOutputListener.class, this);
EVENTS.remove(IsPlayerInWaterListener.class, this);
EVENTS.remove(PlayerMoveListener.class, this);
EVENTS.remove(CameraTransformViewBobbingListener.class, this);
EVENTS.remove(IsNormalCubeListener.class, this);
EVENTS.remove(SetOpaqueCubeListener.class, this);
EVENTS.remove(RenderListener.class, this);
fakePlayer.resetPlayerPosition();
fakePlayer.despawn();

View File

@ -44,7 +44,7 @@ public final class FullbrightHack extends Hack implements UpdateListener
addSetting(method);
addSetting(fade);
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override

View File

@ -62,10 +62,9 @@ public final class ItemEspHack extends Hack implements UpdateListener,
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(CameraTransformViewBobbingListener.class, this);
EVENTS.add(RenderListener.class, this);
itemBox = GL11.glGenLists(1);
GL11.glNewList(itemBox, GL11.GL_COMPILE);
@ -81,10 +80,9 @@ public final class ItemEspHack extends Hack implements UpdateListener,
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(CameraTransformViewBobbingListener.class, this);
EVENTS.remove(RenderListener.class, this);
GL11.glDeleteLists(itemBox, 1);
}

View File

@ -50,7 +50,7 @@ public final class ItemGeneratorHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
if(!MC.player.abilities.creativeMode)
{
@ -62,7 +62,7 @@ public final class ItemGeneratorHack extends Hack implements UpdateListener
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -119,15 +119,15 @@ public final class KillauraHack extends Hack
@Override
protected void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(RenderListener.class, this);
}
@Override
protected void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(RenderListener.class, this);
target = null;
}

View File

@ -61,10 +61,9 @@ public final class MobEspHack extends Hack implements UpdateListener,
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(CameraTransformViewBobbingListener.class, this);
EVENTS.add(RenderListener.class, this);
mobBox = GL11.glGenLists(1);
GL11.glNewList(mobBox, GL11.GL_COMPILE);
@ -76,10 +75,9 @@ public final class MobEspHack extends Hack implements UpdateListener,
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(CameraTransformViewBobbingListener.class, this);
EVENTS.remove(RenderListener.class, this);
GL11.glDeleteLists(mobBox, 1);
mobBox = 0;

View File

@ -74,17 +74,17 @@ public final class MobSpawnEspHack extends Hack
{
pool = MinPriorityThreadFactory.newFixedThreadPool();
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(PacketInputListener.class, this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(PacketInputListener.class, this);
EVENTS.add(RenderListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(PacketInputListener.class, this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(PacketInputListener.class, this);
EVENTS.remove(RenderListener.class, this);
for(ChunkScanner scanner : new ArrayList<>(scanners.values()))
{

View File

@ -26,13 +26,13 @@ public final class NoFallHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -85,17 +85,17 @@ public final class NukerHack extends Hack
@Override
protected void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(LeftClickListener.class, this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(LeftClickListener.class, this);
EVENTS.add(RenderListener.class, this);
}
@Override
protected void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(LeftClickListener.class, this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(LeftClickListener.class, this);
EVENTS.remove(RenderListener.class, this);
if(currentBlock != null)
{

View File

@ -69,10 +69,9 @@ public final class PlayerEspHack extends Hack implements UpdateListener,
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(CameraTransformViewBobbingListener.class, this);
EVENTS.add(RenderListener.class, this);
playerBox = GL11.glGenLists(1);
GL11.glNewList(playerBox, GL11.GL_COMPILE);
@ -84,10 +83,9 @@ public final class PlayerEspHack extends Hack implements UpdateListener,
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(CameraTransformViewBobbingListener.class,
this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(CameraTransformViewBobbingListener.class, this);
EVENTS.remove(RenderListener.class, this);
GL11.glDeleteLists(playerBox, 1);
playerBox = 0;

View File

@ -110,17 +110,17 @@ public final class SearchHack extends Hack
displayList = GL11.glGenLists(1);
displayListUpToDate = false;
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(PacketInputListener.class, this);
WURST.getEventManager().add(RenderListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(PacketInputListener.class, this);
EVENTS.add(RenderListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(PacketInputListener.class, this);
WURST.getEventManager().remove(RenderListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(PacketInputListener.class, this);
EVENTS.remove(RenderListener.class, this);
stopPool2Tasks();
pool1.shutdownNow();

View File

@ -44,15 +44,15 @@ public final class SneakHack extends Hack
@Override
public void onEnable()
{
WURST.getEventManager().add(PreMotionListener.class, this);
WURST.getEventManager().add(PostMotionListener.class, this);
EVENTS.add(PreMotionListener.class, this);
EVENTS.add(PostMotionListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(PreMotionListener.class, this);
WURST.getEventManager().remove(PostMotionListener.class, this);
EVENTS.remove(PreMotionListener.class, this);
EVENTS.remove(PostMotionListener.class, this);
switch(mode.getSelected())
{

View File

@ -24,13 +24,13 @@ public final class SpiderHack extends Hack implements UpdateListener
@Override
public void onEnable()
{
WURST.getEventManager().add(UpdateListener.class, this);
EVENTS.add(UpdateListener.class, this);
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
EVENTS.remove(UpdateListener.class, this);
}
@Override

View File

@ -70,26 +70,24 @@ public final class XRayHack extends Hack implements UpdateListener,
{
oreNames = new ArrayList<>(ores.getBlockNames());
WURST.getEventManager().add(UpdateListener.class, this);
WURST.getEventManager().add(SetOpaqueCubeListener.class, this);
WURST.getEventManager().add(GetAmbientOcclusionLightLevelListener.class,
this);
WURST.getEventManager().add(ShouldDrawSideListener.class, this);
WURST.getEventManager().add(TesselateBlockListener.class, this);
WURST.getEventManager().add(RenderBlockEntityListener.class, this);
EVENTS.add(UpdateListener.class, this);
EVENTS.add(SetOpaqueCubeListener.class, this);
EVENTS.add(GetAmbientOcclusionLightLevelListener.class, this);
EVENTS.add(ShouldDrawSideListener.class, this);
EVENTS.add(TesselateBlockListener.class, this);
EVENTS.add(RenderBlockEntityListener.class, this);
MC.worldRenderer.reload();
}
@Override
public void onDisable()
{
WURST.getEventManager().remove(UpdateListener.class, this);
WURST.getEventManager().remove(SetOpaqueCubeListener.class, this);
WURST.getEventManager()
.remove(GetAmbientOcclusionLightLevelListener.class, this);
WURST.getEventManager().remove(ShouldDrawSideListener.class, this);
WURST.getEventManager().remove(TesselateBlockListener.class, this);
WURST.getEventManager().remove(RenderBlockEntityListener.class, this);
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(SetOpaqueCubeListener.class, this);
EVENTS.remove(GetAmbientOcclusionLightLevelListener.class, this);
EVENTS.remove(ShouldDrawSideListener.class, this);
EVENTS.remove(TesselateBlockListener.class, this);
EVENTS.remove(RenderBlockEntityListener.class, this);
MC.worldRenderer.reload();
if(!WURST.getHax().fullbrightHack.isEnabled())