Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dough-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,14 @@
<version>1.7</version>
<scope>provided</scope>
</dependency>

<!-- NoBuildPlus -->
<dependency>
<groupId>com.github.Ez4p1xEL</groupId>
<artifactId>NoBuildPlus</artifactId>
<version>1.5.16</version>
<scope>provided</scope>
</dependency>

<!-- ShopChest -->
<dependency>
Expand Down
14 changes: 14 additions & 0 deletions dough-protection/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,20 @@
</exclusions>
</dependency>

<!-- NoBuildPlus -->
<dependency>
<groupId>com.github.Ez4p1xEL</groupId>
<artifactId>NoBuildPlus</artifactId>
<version>1.5.16</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>bukkit</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>

<!-- FunnyGuilds -->
<dependency>
<groupId>net.dzikoysk.funnyguilds</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import io.github.bakedlibs.dough.protection.modules.*;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
Expand All @@ -18,24 +19,6 @@
import io.github.bakedlibs.dough.common.DoughLogger;
import io.github.bakedlibs.dough.protection.loggers.CoreProtectLogger;
import io.github.bakedlibs.dough.protection.loggers.LogBlockLogger;
import io.github.bakedlibs.dough.protection.modules.BentoBoxProtectionModule;
import io.github.bakedlibs.dough.protection.modules.BlockLockerProtectionModule;
import io.github.bakedlibs.dough.protection.modules.BoltProtectionModule;
import io.github.bakedlibs.dough.protection.modules.ChestProtectProtectionModule;
import io.github.bakedlibs.dough.protection.modules.FactionsUUIDProtectionModule;
import io.github.bakedlibs.dough.protection.modules.FunnyGuildsProtectionModule;
import io.github.bakedlibs.dough.protection.modules.GriefPreventionProtectionModule;
import io.github.bakedlibs.dough.protection.modules.HuskTownsProtectionModule;
import io.github.bakedlibs.dough.protection.modules.HuskClaimsProtectionModule;
import io.github.bakedlibs.dough.protection.modules.LWCProtectionModule;
import io.github.bakedlibs.dough.protection.modules.LandsProtectionModule;
import io.github.bakedlibs.dough.protection.modules.LocketteProtectionModule;
import io.github.bakedlibs.dough.protection.modules.PlotSquaredProtectionModule;
import io.github.bakedlibs.dough.protection.modules.PreciousStonesProtectionModule;
import io.github.bakedlibs.dough.protection.modules.RedProtectProtectionModule;
import io.github.bakedlibs.dough.protection.modules.ShopChestProtectionModule;
import io.github.bakedlibs.dough.protection.modules.TownyProtectionModule;
import io.github.bakedlibs.dough.protection.modules.WorldGuardProtectionModule;

/**
* This Class provides a nifty API for plugins to query popular protection plugins.
Expand Down Expand Up @@ -97,6 +80,7 @@ private void loadModuleImplementations(Plugin plugin) {
registerModule(pm, "ShopChest", shopChest -> new ShopChestProtectionModule(shopChest));
registerModule(pm, "HuskClaims", huskClaims -> new HuskClaimsProtectionModule(huskClaims));
registerModule(pm, "Bolt", bolt -> new BoltProtectionModule(bolt));
registerModule(pm, "NoBuildPlus", noBuildPlus -> new NoBuildPlusProtectionModule());

/*
* The following Plugins work by utilising one of the above listed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.github.bakedlibs.dough.protection.modules;

import io.github.bakedlibs.dough.protection.Interaction;
import io.github.bakedlibs.dough.protection.ProtectionModule;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import p1xel.nobuildplus.Flags;
import p1xel.nobuildplus.NoBuildPlus;
import p1xel.nobuildplus.Storage.Worlds;

public class NoBuildPlusProtectionModule implements ProtectionModule {

private NoBuildPlus plugin;
@Override
public void load() {
plugin = NoBuildPlus.getInstance();
}

@Override
public NoBuildPlus getPlugin() {
return plugin;
}

@Override
public boolean hasPermission(OfflinePlayer p, Location l, Interaction action) {
if (!p.isOnline()) {
return false;
}

Player player = (Player) p;
String world = l.getWorld().getName();
if (player.hasPermission(Worlds.getPermission(world))) {
return true;
}

switch (action) {
case BREAK_BLOCK:
return !plugin.getAPI().canExecute(world, Flags.destroy);
case PLACE_BLOCK:
return !plugin.getAPI().canExecute(world, Flags.build);
case ATTACK_PLAYER:
return !plugin.getAPI().canExecute(world, Flags.pvp);
case ATTACK_ENTITY:
return !plugin.getAPI().canExecute(world, Flags.mob_damage);
case INTERACT_ENTITY:
case INTERACT_BLOCK:
return !plugin.getAPI().canExecute(world, Flags.use);
}

return true;
}
}