Skip to content

Commit

Permalink
One last time
Browse files Browse the repository at this point in the history
  • Loading branch information
Tecnio committed Jan 7, 2025
1 parent 3699c02 commit f7f88f1
Show file tree
Hide file tree
Showing 51 changed files with 459 additions and 445 deletions.
35 changes: 8 additions & 27 deletions .github/README.MD
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
# AntiHaxerman
> An open-sourced anti-cheat solution for servers and for people to learn from.
## Join MAC (Minecraft Anti-Cheat Community)
https://discord.gg/SAuj458nzM
# antihaxerman
> An open-sourced anti-cheat solution for people to learn from.
## Join the [Minecraft AntiCheat Community](https://discord.gg/SAuj458nzM)
## About

Keep in mind I coded this all whilst drunk as hell so you never know what you might find. - Tecnio

This is a project mostly designed for people to be able to learn and take code from to use on their projects.

## Warning

This project is intentionally nerfed in order to teach people not to mess up on whilst providing them the ground works of
a nice and robust anti-cheat base that they can work off of.

This by itself will work stably for the most part, but do not expect it to detect everything and by no means is it flawless.
This is a project mostly designed for people to be able to learn and take code from to use on their projects and is
nerfed by design. It is not representative of what are the best practices.

## Getting Started

Expand All @@ -24,10 +16,10 @@ This by itself will work stably for the most part, but do not expect it to detec

### Installation
1. Clone the repository\
`git clone https://github.com/Tecnio/AntiHaxerman.git`
`git clone https://github.com/Tecnio/antihaxerman.git`

2. CD into the folder\
`cd AntiHaxerman`
`cd antihaxerman`

3. Compile with Gradle
- Windows: `./gradlew.bat build`
Expand All @@ -44,15 +36,4 @@ Supported server/Spigot forks are listed below, the rest are not guaranteed to w
- Paper
- TacoSpigot

Make sure to be running a 1.8.8 server.

## Contributing

If you find any issues or want to contribute to this open-source project, please feel free to do so. Any bug fixes or additions are more than welcome. Your help and ideas are greatly appreciated!

## Developers
- https://github.com/Tecnio (Tecnio)
- https://github.com/TheRealShitDev (aSwitch)
- https://github.com/gbomexify (Mexify)
- https://github.com/incognitolol (RNOIncognito)
- https://github.com/Cyanade (Cyanade)
Make sure to be running a 1.8.8 server.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Created by .ignore support plugin (hsz.mobi)
### Java template
# Compiled class file
*.class
Expand Down
12 changes: 5 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
plugins {
java
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.gradleup.shadow") version "8.3.5"
id("io.freefair.lombok") version "8.11"
}

group = "me.tecnio"
version = "4.0.2"
version = "4.0.3"

java {
toolchain {
Expand All @@ -26,19 +27,16 @@ repositories {

dependencies {
compileOnly("org.github.spigot:1.8.8:1.8.8")
compileOnly("org.projectlombok:lombok:1.18.32")

annotationProcessor("org.projectlombok:lombok:1.18.32")

implementation("com.github.artemisac.artemis-packet-api:api:2.0.0-beta-3")
implementation("com.github.artemisac.artemis-packet-api:spigot:2.0.0-beta-3")
implementation("org.atteo.classindex:classindex:3.13")
implementation("co.aikar:acf-paper:0.5.1-SNAPSHOT")
implementation("org.bstats:bstats-bukkit:3.0.2")
implementation("org.bstats:bstats-bukkit:3.1.0")
}

tasks.shadowJar {
archiveFileName = "AntiHaxerman.jar"

minimize()

relocate("org.atteo.classindex", "me.tecnio.ahm.libs.classindex")
Expand Down
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 4 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.logging.Logger;

@Getter
public enum AHM {
public enum AntiHaxerman {

INSTANCE;

Expand Down Expand Up @@ -67,7 +67,6 @@ public void end() {
terminateManagers();
}


private void registerMetrics() {
System.setProperty("bstats.relocatecheck", "false");
new Metrics(this.plugin, 11350);
Expand All @@ -82,8 +81,10 @@ private void registerManagers() {
}

private void registerConfiguration() {
get(ConfigManager.class).generate();
get(ConfigManager.class).load();
final ConfigManager config = get(ConfigManager.class);

config.generate();
config.load();
}

private void registerListeners() {
Expand Down Expand Up @@ -115,7 +116,7 @@ private void terminateManagers() {
this.configManager = null;
}

public static AHM get() {
public static AntiHaxerman get() {
return INSTANCE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import org.bukkit.plugin.java.JavaPlugin;

public final class AHMPlugin extends JavaPlugin {
public final class AntiHaxermanPlugin extends JavaPlugin {

@Override
public void onEnable() {
AHM.INSTANCE.start(this);
AntiHaxerman.INSTANCE.start(this);
}

@Override
public void onDisable() {
AHM.INSTANCE.end();
AntiHaxerman.INSTANCE.end();
}
}
8 changes: 2 additions & 6 deletions src/main/java/me/tecnio/ahm/alert/AlertManager.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.tecnio.ahm.alert;

import lombok.Getter;
import me.tecnio.ahm.AHM;
import me.tecnio.ahm.AntiHaxerman;
import me.tecnio.ahm.alert.alert.AlertHandler;
import me.tecnio.ahm.alert.alert.AlertHandlerFactory;
import me.tecnio.ahm.alert.punish.PunishmentHandler;
Expand All @@ -24,7 +24,7 @@ public class AlertManager {

private final AlertHandler alertHandler = new AlertHandlerFactory().build();
private final PunishmentHandler punishmentHandler = new PunishmentHandlerFactory()
.setTesting(AHM.TEST_MODE)
.setTesting(AntiHaxerman.TEST_MODE)
.build();

public boolean toggleAlerts(final PlayerData data) {
Expand All @@ -40,8 +40,4 @@ public void handleAlert(final Check check, final String debug) {
public void handlePunishment(final Check check) {
this.punishmentHandler.punish(check);
}

public enum ToggleAlertType {
ADD, REMOVE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public PunishmentHandlerFactory setTesting(final boolean testing) {

@Override
public PunishmentHandler build() {
return this.testing ? new TestingPunishmentHandler() : new ProductionPunishmentHandler();
return this.testing
? new TestingPunishmentHandler()
: new ProductionPunishmentHandler();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.tecnio.ahm.alert.punish.impl;

import me.tecnio.ahm.AHM;
import me.tecnio.ahm.AntiHaxerman;
import me.tecnio.ahm.alert.punish.PunishmentHandler;
import me.tecnio.ahm.check.Check;
import org.bukkit.Bukkit;
Expand All @@ -17,7 +17,7 @@ public void punish(final Check check) {
}

private void execute(final String command) {
Bukkit.getScheduler().runTask(AHM.get().getPlugin(),
Bukkit.getScheduler().runTask(AntiHaxerman.get().getPlugin(),
() -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command));
}
}
23 changes: 9 additions & 14 deletions src/main/java/me/tecnio/ahm/check/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import lombok.Getter;
import lombok.Setter;
import me.tecnio.ahm.AHM;
import me.tecnio.ahm.AntiHaxerman;
import me.tecnio.ahm.alert.AlertManager;
import me.tecnio.ahm.check.api.Buffer;
import me.tecnio.ahm.check.api.annotations.CheckManifest;
Expand All @@ -11,14 +11,12 @@
import me.tecnio.ahm.data.PlayerData;
import me.tecnio.ahm.exempt.ExemptType;
import me.tecnio.ahm.util.string.ChatUtil;
import org.atteo.classindex.IndexSubclasses;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

import java.util.List;

@Getter
@IndexSubclasses
public abstract class Check {

protected final PlayerData data;
Expand Down Expand Up @@ -57,11 +55,11 @@ public Check(final PlayerData data) {
this.buffer = new Buffer(this.info.maxBuffer());
} else {
this.info = null;
throw new IllegalStateException("The CheckManifest annotation has not been added on " + this.getClass().getName());
throw new IllegalStateException("CheckManifest has not been added to " + this.getClass().getName());
}

final String name = this.name + "." + this.type;
final ConfigManager config = AHM.get(ConfigManager.class);
final ConfigManager config = AntiHaxerman.get(ConfigManager.class);

this.enabled = config.getEnabledMap().get(name);
this.punishing = config.getPunishMap().get(name);
Expand All @@ -74,12 +72,12 @@ protected final void fail() {
}

protected final void fail(final String debug) {
++this.violations;
final AlertManager alertManager = AntiHaxerman.get(AlertManager.class);

AHM.get(AlertManager.class).handleAlert(this, debug);
alertManager.handleAlert(this, debug);

if (this.violations >= this.maxVl) {
AHM.get(AlertManager.class).handlePunishment(this);
if (++this.violations >= this.maxVl) {
alertManager.handlePunishment(this);
}
}

Expand All @@ -92,10 +90,7 @@ protected final boolean isExempt(final ExemptType... exemptTypes) {
}

protected final void debug(final Object object, final Object... objects) {
data.getPlayer().sendMessage(ChatUtil.translate(String.format("&6AntiHaxerman Debug &8> " + ChatColor.WHITE + object.toString(), objects)));
}

protected boolean canClick() {
return !data.getActionTracker().isPlacing();
data.getPlayer().sendMessage(ChatUtil.translate(
String.format("&6AntiHaxerman Debug &8> " + ChatColor.WHITE + object.toString(), objects)));
}
}
Loading

0 comments on commit f7f88f1

Please sign in to comment.