Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
alex2276564 committed Feb 13, 2025
1 parent 7b9d5a2 commit 319b2e5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@
* **Compatible with AntiRedstoneClock-Remastered:** Enhances protection against redstone-based exploits and lag.
* **Auto-Update Check:** On server start, the plugin checks for updates. If a new version is available, a notification is displayed in the console.

## ⚠️ Important Note About Redstone Exploits
## ⚠️ Important Notes About Redstone Exploits

Using `use-faster-eigencraft-redstone: true` in legacy versions or `redstone-implementation: ALTERNATE_CURRENT` in newer versions of Paper **will not protect your server from all redstone-based exploits**. These settings may optimize performance but do not prevent all exploit scenarios.

To ensure maximum protection against redstone-related exploits and lag, it is recommended to use **LeverLock** alongside [AntiRedstoneClock-Remastered](https://modrinth.com/plugin/antiredstoneclock-remastered), as both plugins provide comprehensive safeguards beyond what Paper's settings offer.

Make sure to configure your server with the appropriate plugins for full protection!

If you are using the [AnarchyExploitFixes](https://github.com/xGinko/AnarchyExploitFixes) plugin, which also includes redstone and lever checks, you may not need to install LeverLock and AntiRedstoneClockRemastered. However, consider the following:

- LeverLock and AntiRedstoneClockRemastered were specifically developed to counter particular exploits
- AnarchyExploitFixes contains many different fixes, and its redstone checks might be less tested
- It's recommended to test both options on your server to determine the most effective solution

The choice between specialized plugins (LeverLock + AntiRedstoneClockRemastered) and a comprehensive solution (AnarchyExploitFixes) depends on your server's specific needs and testing results.

## 📥 Installation

1. **Download:** Download the latest version of LeverLock from the [Releases](https://github.com/alex2276564/LeverLock/releases) page.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/uz/alex2276564/leverlock/LeverLock.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private void setupRunner() {
}

private void registerListeners() {
getServer().getPluginManager().registerEvents(new PlayerLeverClickListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerLeverClickListener(runner), this);
}

private void registerCommands() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
import uz.alex2276564.leverlock.LeverLock;
import uz.alex2276564.leverlock.events.PlayerInteractWithLeverEvent;
import uz.alex2276564.leverlock.task.Runner;
import uz.alex2276564.leverlock.utils.ConfigManager;

import java.time.Duration;
Expand All @@ -19,13 +18,12 @@
import java.util.concurrent.ConcurrentHashMap;

public class PlayerLeverClickListener implements Listener {
private final JavaPlugin plugin;
private final Runner runner;
private static final Material TARGET_BLOCK = Material.LEVER;

private final Map<Player, Instant> cooldownMap = new ConcurrentHashMap<>();

public PlayerLeverClickListener(LeverLock plugin) {
this.plugin = plugin;
public PlayerLeverClickListener(Runner runner) {
this.runner = runner;
startCleanupTask();
}

Expand Down Expand Up @@ -58,7 +56,9 @@ public void on(PlayerInteractWithLeverEvent event) {
}

private void startCleanupTask() {
Bukkit.getScheduler().runTaskTimer(plugin, this::cleanupCooldowns, ConfigManager.getCleanupInterval(), ConfigManager.getCleanupInterval());
runner.runPeriodical(
this::cleanupCooldowns, ConfigManager.getCleanupInterval(), ConfigManager.getCleanupInterval()
);
}

private void cleanupCooldowns() {
Expand Down

0 comments on commit 319b2e5

Please sign in to comment.