mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-01-05 22:57:49 +01:00
Add GriefPrevention support (Resolves #227)
Also slightly cleanup dependency logic loading to not have per-plugin code in Dependencies class
This commit is contained in:
parent
37b7669acb
commit
3d83bfdddd
17
pom.xml
17
pom.xml
@ -45,6 +45,10 @@
|
||||
<id>reserve-repo</id>
|
||||
<url>https://dl.bintray.com/theneweconomy/java/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -240,6 +244,19 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>16.12.0</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.webkonsept.bukkit.simplechestlock</groupId>
|
||||
<artifactId>simplechestlock</artifactId>
|
||||
|
@ -232,7 +232,7 @@ public class Properties {
|
||||
public static boolean REMOVE_LWC_PROTECTION_AUTOMATICALLY = true;
|
||||
|
||||
@PrecededBySpace
|
||||
@ConfigurationComment("Do you want to only let people build inside regions?")
|
||||
@ConfigurationComment("Do you want to only let people build inside WorldGuard regions?")
|
||||
public static boolean WORLDGUARD_INTEGRATION = false;
|
||||
|
||||
@ConfigurationComment("Do you want to only let people build inside region flagged by doing /region regionName flag allow-shop allow?")
|
||||
@ -241,6 +241,10 @@ public class Properties {
|
||||
@ConfigurationComment("Do you want ChestShop to respect WorldGuard's chest protection?")
|
||||
public static boolean WORLDGUARD_USE_PROTECTION = false;
|
||||
|
||||
@PrecededBySpace
|
||||
@ConfigurationComment("Do you want to only let people build inside GriefPrevention claims?")
|
||||
public static boolean GRIEFPREVENTION_INTEGRATION = false;
|
||||
|
||||
@PrecededBySpace
|
||||
@ConfigurationComment("Do you want to deny shop access to unlogged users?")
|
||||
public static boolean AUTHME_HOOK = true;
|
||||
|
@ -5,7 +5,6 @@ import com.Acrobot.ChestShop.Configuration.Properties;
|
||||
import com.Acrobot.ChestShop.Listeners.Economy.Plugins.ReserveListener;
|
||||
import com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener;
|
||||
import com.Acrobot.ChestShop.Plugins.*;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -126,7 +125,6 @@ public class Dependencies {
|
||||
|
||||
//Terrain protection plugins
|
||||
case WorldGuard:
|
||||
WorldGuardPlugin worldGuard = (WorldGuardPlugin) plugin;
|
||||
boolean inUse = Properties.WORLDGUARD_USE_PROTECTION || Properties.WORLDGUARD_INTEGRATION;
|
||||
|
||||
if (!inUse) {
|
||||
@ -134,15 +132,22 @@ public class Dependencies {
|
||||
}
|
||||
|
||||
if (Properties.WORLDGUARD_USE_PROTECTION) {
|
||||
ChestShop.registerListener(new WorldGuardProtection(worldGuard));
|
||||
ChestShop.registerListener(new WorldGuardProtection(plugin));
|
||||
}
|
||||
|
||||
if (Properties.WORLDGUARD_INTEGRATION) {
|
||||
listener = new WorldGuardBuilding(worldGuard);
|
||||
listener = new WorldGuardBuilding(plugin);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GriefPrevention:
|
||||
if (!Properties.GRIEFPREVENTION_INTEGRATION) {
|
||||
return;
|
||||
}
|
||||
listener = new GriefPrevenentionBuilding(plugin);
|
||||
break;
|
||||
|
||||
//Other plugins
|
||||
case Heroes:
|
||||
Heroes heroes = Heroes.getHeroes(plugin);
|
||||
@ -179,6 +184,7 @@ public class Dependencies {
|
||||
OddItem,
|
||||
|
||||
WorldGuard,
|
||||
GriefPrevention,
|
||||
|
||||
Heroes,
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
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
|
||||
public void canBuild(BuildPermissionEvent event) {
|
||||
event.allow(griefPrevention.dataStore.getClaimAt(event.getSign(), false, null) != null);
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
@ -20,8 +21,8 @@ public class WorldGuardBuilding implements Listener {
|
||||
private WorldGuardPlugin worldGuard;
|
||||
private WorldGuardPlatform worldGuardPlatform;
|
||||
|
||||
public WorldGuardBuilding(WorldGuardPlugin plugin) {
|
||||
this.worldGuard = plugin;
|
||||
public WorldGuardBuilding(Plugin plugin) {
|
||||
this.worldGuard = (WorldGuardPlugin) plugin;
|
||||
this.worldGuardPlatform = WorldGuard.getInstance().getPlatform();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
@ -24,8 +25,8 @@ public class WorldGuardProtection implements Listener {
|
||||
private WorldGuardPlugin worldGuard;
|
||||
private WorldGuardPlatform worldGuardPlatform;
|
||||
|
||||
public WorldGuardProtection(WorldGuardPlugin worldGuard) {
|
||||
this.worldGuard = worldGuard;
|
||||
public WorldGuardProtection(Plugin plugin) {
|
||||
this.worldGuard =(WorldGuardPlugin) plugin;
|
||||
this.worldGuardPlatform = WorldGuard.getInstance().getPlatform();
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ version: '${bukkit.plugin.version}'
|
||||
author: Acrobot
|
||||
authors: ['https://github.com/ChestShop-authors/ChestShop-3/contributors']
|
||||
description: A chest shop for economy plugins.
|
||||
softdepend: [Vault, Reserve, LWC, Lockette, Deadbolt, OddItem, WorldGuard, Heroes, SimpleChestLock, Residence, ShowItem]
|
||||
softdepend: [Vault, Reserve, LWC, Lockette, Deadbolt, OddItem, WorldGuard, GriefPrevention, Heroes, SimpleChestLock, Residence, ShowItem]
|
||||
api-version: '1.13'
|
||||
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user