Skip to content

Commit

Permalink
example: add anticheat listener example
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNature committed Aug 23, 2023
1 parent a74d509 commit e976872
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.lunarclient.apollo.example.commands.TransferCommand;
import com.lunarclient.apollo.example.commands.VignetteCommand;
import com.lunarclient.apollo.example.commands.WaypointCommand;
import com.lunarclient.apollo.example.listeners.AntiCheatListenerExample;
import com.lunarclient.apollo.example.modules.BeamExample;
import com.lunarclient.apollo.example.modules.BorderExample;
import com.lunarclient.apollo.example.modules.ColoredFireExample;
Expand Down Expand Up @@ -93,6 +94,7 @@ public void onEnable() {

this.registerModuleExamples();
this.registerCommands();
this.registerListeners();
}

@Override
Expand Down Expand Up @@ -141,4 +143,8 @@ private void registerCommands() {
this.getCommand("vignette").setExecutor(new VignetteCommand());
this.getCommand("waypoint").setExecutor(new WaypointCommand());
}

private void registerListeners() {
new AntiCheatListenerExample();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.lunarclient.apollo.event.EventBus;
import com.lunarclient.apollo.event.Listen;
import com.lunarclient.apollo.event.anticheat.ApolloPlayerAttackEvent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;

public class AntiCheatListenerExample implements ApolloListener {

Expand All @@ -35,7 +37,8 @@ public AntiCheatListenerExample() {
}

@Listen
public void onApolloPlayerAttack(ApolloPlayerAttackEvent event) {

private void onApolloPlayerAttack(ApolloPlayerAttackEvent event) {
double dist = event.getDistance();
Bukkit.broadcastMessage(dist > 3.00000000000000001 ? ChatColor.RED.toString() + dist : dist + "");
}
}

0 comments on commit e976872

Please sign in to comment.