Skip to content

Commit

Permalink
add allay dupe prevention
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Aug 14, 2024
1 parent 7e22478 commit a1357a5
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 4,330 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package me.xginko.aef.modules.dupepreventions;

import com.cryptomorin.xseries.XEntityType;
import me.xginko.aef.modules.AEFModule;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.vehicle.VehicleEnterEvent;

public class AllayDupe extends AEFModule implements Listener {

public AllayDupe() {
super("dupe-preventions.allay-dupe");
config.addComment(configPath, """
Will prevent allays from entering vehicles to prevent a duplication exploit
confirmed working in 1.19.4.""");
}

@Override
public void enable() {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}

@Override
public boolean shouldEnable() {
return config.getBoolean(configPath, false);
}

@Override
public void disable() {
HandlerList.unregisterAll(this);
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
private void onVehicleEnter(VehicleEnterEvent event) {
if (event.getEntered().getType() == XEntityType.ALLAY.get()) {
event.setCancelled(true);
}
}
}
Loading

0 comments on commit a1357a5

Please sign in to comment.