From 3bc44e6acfec542cc30b9cf234714947864c7511 Mon Sep 17 00:00:00 2001 From: ShonP40 <13995143+ShonP40@users.noreply.github.com> Date: Thu, 4 May 2023 20:00:49 +0300 Subject: [PATCH] Example plugin for enabling legacy combat on 1.8 --- Examples/cLegacyCombat/pom.xml | 83 +++++++++++++++++++ .../clegacycombat/cLegacyCombat.java | 33 ++++++++ .../src/main/resources/config.yml | 1 + .../src/main/resources/plugin.yml | 5 ++ 4 files changed, 122 insertions(+) create mode 100644 Examples/cLegacyCombat/pom.xml create mode 100644 Examples/cLegacyCombat/src/main/java/net/cheatbreaker/clegacycombat/cLegacyCombat.java create mode 100644 Examples/cLegacyCombat/src/main/resources/config.yml create mode 100644 Examples/cLegacyCombat/src/main/resources/plugin.yml diff --git a/Examples/cLegacyCombat/pom.xml b/Examples/cLegacyCombat/pom.xml new file mode 100644 index 0000000..362a70f --- /dev/null +++ b/Examples/cLegacyCombat/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + net.cheatbreaker + cLegacyCombat + 1.0-SNAPSHOT + jar + + cLegacyCombat + + + 1.8 + UTF-8 + + + + clean package + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + ${java.version} + ${java.version} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.0 + + + package + + shade + + + false + + + + + + + + src/main/resources + true + + + + + + + spigotmc-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + + + org.bukkit + bukkit + 1.15.2-R0.1-SNAPSHOT + provided + + + org.projectlombok + lombok + 1.18.12 + + + com.cheatbreaker + CheatBreakerAPI + 1.0-SNAPSHOT + ${project.basedir}/lib/CheatBreakerAPI.jar + system + + + diff --git a/Examples/cLegacyCombat/src/main/java/net/cheatbreaker/clegacycombat/cLegacyCombat.java b/Examples/cLegacyCombat/src/main/java/net/cheatbreaker/clegacycombat/cLegacyCombat.java new file mode 100644 index 0000000..3b5c5cf --- /dev/null +++ b/Examples/cLegacyCombat/src/main/java/net/cheatbreaker/clegacycombat/cLegacyCombat.java @@ -0,0 +1,33 @@ +package net.cheatbreaker.clegacycombat; + +import com.cheatbreaker.api.CheatBreakerAPI; +import lombok.Getter; +import org.bukkit.Bukkit; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public final class cLegacyCombat extends JavaPlugin implements Listener { + + @Getter cLegacyCombat instance; + + @Override + public void onEnable() { + instance = this; + + this.saveDefaultConfig(); + + Bukkit.getPluginManager().registerEvents(this, this); + } + + @Override + public void onDisable() { + instance = this; + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) { + CheatBreakerAPI.getInstance().setLegacyCombat(event.getPlayer(), this.getConfig().getBoolean("legacyCombat")); + } +} diff --git a/Examples/cLegacyCombat/src/main/resources/config.yml b/Examples/cLegacyCombat/src/main/resources/config.yml new file mode 100644 index 0000000..d0c163a --- /dev/null +++ b/Examples/cLegacyCombat/src/main/resources/config.yml @@ -0,0 +1 @@ +legacyCombat: true \ No newline at end of file diff --git a/Examples/cLegacyCombat/src/main/resources/plugin.yml b/Examples/cLegacyCombat/src/main/resources/plugin.yml new file mode 100644 index 0000000..e7b7007 --- /dev/null +++ b/Examples/cLegacyCombat/src/main/resources/plugin.yml @@ -0,0 +1,5 @@ +name: cLegacyCombat +version: ${project.version} +main: net.cheatbreaker.clegacycombat.cLegacyCombat +api-version: 1.13 +depend: [ CheatBreakerAPI ] \ No newline at end of file