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

Add Hack class

This commit is contained in:
Alexander01998 2019-06-07 16:47:41 +02:00
parent 2aedf09e0b
commit 061db0b259
4 changed files with 181 additions and 0 deletions

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2014 - 2018 | Wurst-Imperium | All rights reserved.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient;
import net.minecraft.client.MinecraftClient;
public abstract class Feature
{
protected static final MinecraftClient MC = MinecraftClient.getInstance();
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (C) 2014 - 2019 | Wurst-Imperium | All rights reserved.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.hack;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DontSaveState
{
}

View File

@ -0,0 +1,114 @@
/*
* Copyright (C) 2014 - 2019 | Wurst-Imperium | All rights reserved.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.hack;
import net.wurstclient.Feature;
import net.wurstclient.WurstClient;
public abstract class Hack extends Feature
{
protected final WurstClient wurst;
private final String name;
private final String description;
private HackCategory category;
// TODO
// private final LinkedHashMap<String, Setting> settings =
// new LinkedHashMap<>();
private boolean enabled;
private final boolean stateSaved =
!getClass().isAnnotationPresent(DontSaveState.class);
public Hack(WurstClient wurst, String name, String description)
{
this.wurst = wurst;
this.name = name;
this.description = description;
}
public final String getName()
{
return name;
}
public String getRenderName()
{
return name;
}
public final String getDescription()
{
return description;
}
public final HackCategory getCategory()
{
return category;
}
protected final void setCategory(HackCategory category)
{
this.category = category;
}
// TODO
// public final Map<String, Setting> getSettings()
// {
// return Collections.unmodifiableMap(settings);
// }
//
// protected final void addSetting(Setting setting)
// {
// String key = setting.getName().toLowerCase();
//
// if(settings.containsKey(key))
// throw new IllegalArgumentException(
// "Duplicate setting: " + name + " " + key);
//
// settings.put(key, setting);
// }
public final boolean isEnabled()
{
return enabled;
}
public final void setEnabled(boolean enabled)
{
if(this.enabled == enabled)
return;
this.enabled = enabled;
if(enabled)
onEnable();
else
onDisable();
// TODO
// if(stateSaved)
// wurst.getHax().saveEnabledHacks();
}
public final boolean isStateSaved()
{
return stateSaved;
}
protected void onEnable()
{
}
protected void onDisable()
{
}
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2014 - 2018 | Wurst-Imperium | All rights reserved.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.hack;
public enum HackCategory
{
BLOCKS("Blocks"),
MOVEMENT("Movement"),
COMBAT("Combat"),
RENDER("Render"),
CHAT("Chat"),
FUN("Fun"),
ITEMS("Items"),
OTHER("Other");
private final String name;
private HackCategory(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
}