Skip to content

Commit

Permalink
Example plugin for enabling legacy combat on 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ShonP40 committed May 4, 2023
1 parent 0047069 commit 3bc44e6
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
83 changes: 83 additions & 0 deletions Examples/cLegacyCombat/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.cheatbreaker</groupId>
<artifactId>cLegacyCombat</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cLegacyCombat</name>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
<dependency>
<groupId>com.cheatbreaker</groupId>
<artifactId>CheatBreakerAPI</artifactId>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/lib/CheatBreakerAPI.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -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"));
}
}
1 change: 1 addition & 0 deletions Examples/cLegacyCombat/src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacyCombat: true
5 changes: 5 additions & 0 deletions Examples/cLegacyCombat/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: cLegacyCombat
version: ${project.version}
main: net.cheatbreaker.clegacycombat.cLegacyCombat
api-version: 1.13
depend: [ CheatBreakerAPI ]

0 comments on commit 3bc44e6

Please sign in to comment.