mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-09-27 14:13:05 +02:00
d0919e78d7
This makes it possible for other plugins to force allow placing of shops and avoid potential issues in the check if multiple plugins are changing the allow settings. ALso while the allow counters were a nice idea they might not have even worked correctly because in the case of only one plugin disallowing it they would've still returned true at the end. Only if one listener allowed it and another disallowed it the end result would be disallow. This also makes the BuildPermissionEvent implement Cancellable (which is an inverted allowed) in order to easily ignore events that are already disallowed by another listener.
24 lines
725 B
Java
24 lines
725 B
Java
package com.Acrobot.ChestShop.Plugins;
|
|
|
|
import com.Acrobot.ChestShop.Events.Protection.BuildPermissionEvent;
|
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.Listener;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class GriefPrevenentionBuilding implements Listener {
|
|
private GriefPrevention griefPrevention;
|
|
|
|
public GriefPrevenentionBuilding(Plugin plugin) {
|
|
this.griefPrevention = (GriefPrevention) plugin;
|
|
}
|
|
|
|
@EventHandler(ignoreCancelled = true)
|
|
public void canBuild(BuildPermissionEvent event) {
|
|
event.allow(griefPrevention.dataStore.getClaimAt(event.getSign(), false, null) != null);
|
|
}
|
|
}
|