mirror of
https://github.com/BentoBoxWorld/Limits.git
synced 2024-11-26 12:45:56 +01:00
Adds support for EpicSpawners
This commit is contained in:
parent
ffeb4a7386
commit
448229892c
373
pom.xml
373
pom.xml
@ -1,190 +1,199 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<groupId>world.bentobox</groupId>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<artifactId>limits</artifactId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<version>0.2.0-SNAPSHOT</version>
|
<groupId>world.bentobox</groupId>
|
||||||
<name>addon-limits</name>
|
<artifactId>limits</artifactId>
|
||||||
<description>An add-on for BentoBox that limits blocks and entities on islands.</description>
|
<version>0.2.1-SNAPSHOT</version>
|
||||||
<url>https://github.com/BentoBoxWorld/addon-level</url>
|
<name>addon-limits</name>
|
||||||
<inceptionYear>2018</inceptionYear>
|
<description>An add-on for BentoBox that limits blocks and entities on islands.</description>
|
||||||
|
<url>https://github.com/BentoBoxWorld/addon-level</url>
|
||||||
|
<inceptionYear>2018</inceptionYear>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:https://github.com/BentoBoxWorld/addon-limits.git</connection>
|
<connection>scm:git:https://github.com/BentoBoxWorld/addon-limits.git</connection>
|
||||||
<developerConnection>scm:git:git@github.com:BentoBoxWorld/addon-limits.git</developerConnection>
|
<developerConnection>scm:git:git@github.com:BentoBoxWorld/addon-limits.git</developerConnection>
|
||||||
<url>https://github.com/BentoBoxWorld/addon-limits</url>
|
<url>https://github.com/BentoBoxWorld/addon-limits</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
<system>GitHub</system>
|
<system>GitHub</system>
|
||||||
<url>https://github.com/BentoBoxWorld/addon-limits/issues</url>
|
<url>https://github.com/BentoBoxWorld/addon-limits/issues</url>
|
||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<powermock.version>1.7.4</powermock.version>
|
<powermock.version>1.7.4</powermock.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>codemc</id>
|
<id>codemc</id>
|
||||||
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
|
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
</repositories>
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mockito</groupId>
|
|
||||||
<artifactId>mockito-all</artifactId>
|
|
||||||
<version>1.10.19</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.powermock</groupId>
|
|
||||||
<artifactId>powermock-module-junit4</artifactId>
|
|
||||||
<version>${powermock.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.powermock</groupId>
|
|
||||||
<artifactId>powermock-api-mockito</artifactId>
|
|
||||||
<version>${powermock.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>world.bentobox</groupId>
|
|
||||||
<artifactId>bentobox</artifactId>
|
|
||||||
<version>1.4.0-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
<dependencies>
|
||||||
<defaultGoal>clean package</defaultGoal>
|
<dependency>
|
||||||
<resources>
|
<groupId>org.spigotmc</groupId>
|
||||||
<resource>
|
<artifactId>spigot-api</artifactId>
|
||||||
<directory>src/main/resources</directory>
|
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||||
<filtering>true</filtering>
|
<scope>provided</scope>
|
||||||
</resource>
|
</dependency>
|
||||||
<resource>
|
<dependency>
|
||||||
<directory>src/main/resources/locales</directory>
|
<groupId>org.mockito</groupId>
|
||||||
<targetPath>./locales</targetPath>
|
<artifactId>mockito-all</artifactId>
|
||||||
<filtering>false</filtering>
|
<version>1.10.19</version>
|
||||||
</resource>
|
<scope>test</scope>
|
||||||
</resources>
|
</dependency>
|
||||||
<plugins>
|
<dependency>
|
||||||
<plugin>
|
<groupId>org.powermock</groupId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<artifactId>powermock-module-junit4</artifactId>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<version>${powermock.version}</version>
|
||||||
<version>3.1.0</version>
|
<scope>test</scope>
|
||||||
</plugin>
|
</dependency>
|
||||||
<plugin>
|
<dependency>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.powermock</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>powermock-api-mockito</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>${powermock.version}</version>
|
||||||
</plugin>
|
<scope>test</scope>
|
||||||
<plugin>
|
</dependency>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<dependency>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<groupId>world.bentobox</groupId>
|
||||||
<version>3.7.0</version>
|
<artifactId>bentobox</artifactId>
|
||||||
<configuration>
|
<version>1.4.0-SNAPSHOT</version>
|
||||||
<source>${java.version}</source>
|
<scope>provided</scope>
|
||||||
<target>${java.version}</target>
|
</dependency>
|
||||||
</configuration>
|
<dependency>
|
||||||
</plugin>
|
<groupId>com.songoda</groupId>
|
||||||
<plugin>
|
<artifactId>EpicSpawners-API</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<version>5.2</version>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<scope>provided</scope>
|
||||||
<version>2.22.0</version>
|
</dependency>
|
||||||
</plugin>
|
</dependencies>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<build>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<defaultGoal>clean package</defaultGoal>
|
||||||
<version>3.1.0</version>
|
<resources>
|
||||||
</plugin>
|
<resource>
|
||||||
<plugin>
|
<directory>src/main/resources</directory>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<filtering>true</filtering>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
</resource>
|
||||||
<version>3.0.1</version>
|
<resource>
|
||||||
<configuration>
|
<directory>src/main/resources/locales</directory>
|
||||||
<show>public</show>
|
<targetPath>./locales</targetPath>
|
||||||
<failOnError>false</failOnError>
|
<filtering>false</filtering>
|
||||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
</resource>
|
||||||
</configuration>
|
</resources>
|
||||||
<executions>
|
<plugins>
|
||||||
<execution>
|
<plugin>
|
||||||
<id>attach-javadocs</id>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<goals>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<goal>jar</goal>
|
<version>3.1.0</version>
|
||||||
</goals>
|
</plugin>
|
||||||
</execution>
|
<plugin>
|
||||||
</executions>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
</plugin>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<plugin>
|
<version>3.1.0</version>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</plugin>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<plugin>
|
||||||
<version>3.0.1</version>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<executions>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<execution>
|
<version>3.7.0</version>
|
||||||
<id>attach-sources</id>
|
<configuration>
|
||||||
<goals>
|
<source>${java.version}</source>
|
||||||
<goal>jar-no-fork</goal>
|
<target>${java.version}</target>
|
||||||
</goals>
|
</configuration>
|
||||||
</execution>
|
</plugin>
|
||||||
</executions>
|
<plugin>
|
||||||
</plugin>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<plugin>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<version>2.22.0</version>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
</plugin>
|
||||||
<version>3.1.1</version>
|
<plugin>
|
||||||
<configuration>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<minimizeJar>false</minimizeJar>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
</configuration>
|
<version>3.1.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.5.2</version>
|
<version>3.0.1</version>
|
||||||
</plugin>
|
<configuration>
|
||||||
<plugin>
|
<show>public</show>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<failOnError>false</failOnError>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||||
<version>2.8.2</version>
|
</configuration>
|
||||||
</plugin>
|
<executions>
|
||||||
<plugin>
|
<execution>
|
||||||
<groupId>org.jacoco</groupId>
|
<id>attach-javadocs</id>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<goals>
|
||||||
<version>0.8.1</version>
|
<goal>jar</goal>
|
||||||
<configuration>
|
</goals>
|
||||||
<append>true</append>
|
</execution>
|
||||||
</configuration>
|
</executions>
|
||||||
<executions>
|
</plugin>
|
||||||
<execution>
|
<plugin>
|
||||||
<id>pre-unit-test</id>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<goals>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<goal>prepare-agent</goal>
|
<version>3.0.1</version>
|
||||||
</goals>
|
<executions>
|
||||||
</execution>
|
<execution>
|
||||||
<execution>
|
<id>attach-sources</id>
|
||||||
<id>post-unit-test</id>
|
<goals>
|
||||||
<goals>
|
<goal>jar-no-fork</goal>
|
||||||
<goal>report</goal>
|
</goals>
|
||||||
</goals>
|
</execution>
|
||||||
</execution>
|
</executions>
|
||||||
</executions>
|
</plugin>
|
||||||
</plugin>
|
<plugin>
|
||||||
</plugins>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
</build>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<minimizeJar>false</minimizeJar>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
|
<version>2.5.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<version>2.8.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<version>0.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<append>true</append>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>pre-unit-test</id>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>post-unit-test</id>
|
||||||
|
<goals>
|
||||||
|
<goal>report</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -12,6 +12,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -39,6 +40,8 @@ import world.bentobox.bentobox.api.user.User;
|
|||||||
import world.bentobox.bentobox.database.Database;
|
import world.bentobox.bentobox.database.Database;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
|
|
||||||
|
import com.songoda.epicspawners.api.events.SpawnerBreakEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
*
|
*
|
||||||
@ -142,22 +145,32 @@ public class BlockLimitsListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlock(BlockBreakEvent e) {
|
public void onBlock(BlockBreakEvent e) {
|
||||||
notify(e, User.getInstance(e.getPlayer()), process(e.getBlock(), false), e.getBlock().getType());
|
handleBreak(e, e.getPlayer(), e.getBlock());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onBlockBreak(SpawnerBreakEvent e) {
|
||||||
|
Block b = e.getSpawner().getLocation().getBlock();
|
||||||
|
handleBreak(e, e.getPlayer(), b);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBreak(Cancellable e, Player player, Block b) {
|
||||||
|
notify(e, User.getInstance(player), process(b, false), b.getType());
|
||||||
// Player breaks a block and there was a redstone dust/repeater/... above
|
// Player breaks a block and there was a redstone dust/repeater/... above
|
||||||
if (e.getBlock().getRelative(BlockFace.UP).getType() == Material.REDSTONE_WIRE || e.getBlock().getRelative(BlockFace.UP).getType() == Material.REPEATER || e.getBlock().getRelative(BlockFace.UP).getType() == Material.COMPARATOR || e.getBlock().getRelative(BlockFace.UP).getType() == Material.REDSTONE_TORCH) {
|
if (b.getRelative(BlockFace.UP).getType() == Material.REDSTONE_WIRE || b.getRelative(BlockFace.UP).getType() == Material.REPEATER || b.getRelative(BlockFace.UP).getType() == Material.COMPARATOR || b.getRelative(BlockFace.UP).getType() == Material.REDSTONE_TORCH) {
|
||||||
process(e.getBlock().getRelative(BlockFace.UP), false);
|
process(b.getRelative(BlockFace.UP), false);
|
||||||
}
|
}
|
||||||
if (e.getBlock().getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WALL_TORCH) {
|
if (b.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WALL_TORCH) {
|
||||||
process(e.getBlock().getRelative(BlockFace.EAST), false);
|
process(b.getRelative(BlockFace.EAST), false);
|
||||||
}
|
}
|
||||||
if (e.getBlock().getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WALL_TORCH) {
|
if (b.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WALL_TORCH) {
|
||||||
process(e.getBlock().getRelative(BlockFace.WEST), false);
|
process(b.getRelative(BlockFace.WEST), false);
|
||||||
}
|
}
|
||||||
if (e.getBlock().getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WALL_TORCH) {
|
if (b.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WALL_TORCH) {
|
||||||
process(e.getBlock().getRelative(BlockFace.SOUTH), false);
|
process(b.getRelative(BlockFace.SOUTH), false);
|
||||||
}
|
}
|
||||||
if (e.getBlock().getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WALL_TORCH) {
|
if (b.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WALL_TORCH) {
|
||||||
process(e.getBlock().getRelative(BlockFace.NORTH), false);
|
process(b.getRelative(BlockFace.NORTH), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user