Removed dependency on EpicSpawners

https://github.com/BentoBoxWorld/Limits/issues/25
This commit is contained in:
tastybento 2019-08-16 19:55:58 -07:00
parent b0888d1e9d
commit 4603e9e1a9
7 changed files with 15 additions and 88 deletions

11
pom.xml
View File

@ -98,10 +98,6 @@
</profiles>
<repositories>
<repository>
<id>my-local-repo</id>
<url>file://${basedir}/src/main/resources/jars</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
@ -149,13 +145,6 @@
<version>${bentobox.version}</version>
<scope>provided</scope>
</dependency>
<!-- For EpicSpawners -->
<dependency>
<groupId>com.songoda</groupId>
<artifactId>EpicSpawners-API</artifactId>
<version>6.0.9</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@ -3,14 +3,12 @@ package bentobox.addon.limits;
import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.World;
import bentobox.addon.limits.commands.AdminCommand;
import bentobox.addon.limits.commands.PlayerCommand;
import bentobox.addon.limits.listeners.BlockLimitsListener;
import bentobox.addon.limits.listeners.EntityLimitListener;
import bentobox.addon.limits.listeners.EpicSpawnersListener;
import bentobox.addon.limits.listeners.JoinListener;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.addons.GameModeAddon;
@ -57,12 +55,6 @@ public class Limits extends Addon {
registerListener(blockLimitListener);
registerListener(new JoinListener(this));
registerListener(new EntityLimitListener(this));
// Register epic spawners one tick after load
Bukkit.getScheduler().runTask(getPlugin(), () -> {
if (Bukkit.getServer().getPluginManager().getPlugin("EpicSpawners") != null) {
registerListener(new EpicSpawnersListener(this));
}
});
// Done
}

View File

@ -136,12 +136,12 @@ public class BlockLimitsListener implements Listener {
}
// Player-related events
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = false)
public void onBlock(BlockPlaceEvent e) {
notify(e, User.getInstance(e.getPlayer()), process(e.getBlock(), true), e.getBlock().getType());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = false)
public void onBlock(BlockBreakEvent e) {
handleBreak(e, e.getPlayer(), e.getBlock());
}
@ -166,7 +166,7 @@ public class BlockLimitsListener implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockMultiPlaceEvent e) {
notify(e, User.getInstance(e.getPlayer()), process(e.getBlock(), true), e.getBlock().getType());
}
@ -181,57 +181,57 @@ public class BlockLimitsListener implements Listener {
}
// Non-player events
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockBurnEvent e) {
process(e.getBlock(), false);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockExplodeEvent e) {
e.blockList().forEach(b -> process(b, false));
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockFadeEvent e) {
process(e.getBlock(), false);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockFormEvent e) {
process(e.getBlock(), true);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockGrowEvent e) {
process(e.getBlock(), true);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockSpreadEvent e) {
process(e.getBlock(), true);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(EntityBlockFormEvent e) {
process(e.getBlock(), true);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(LeavesDecayEvent e) {
process(e.getBlock(), false);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(EntityExplodeEvent e) {
e.blockList().forEach(b -> process(b, false));
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(EntityChangeBlockEvent e) {
process(e.getBlock(), false);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlock(BlockFromToEvent e) {
if (e.getBlock().isLiquid()) {
if (e.getToBlock().getType() == Material.REDSTONE_WIRE || e.getToBlock().getType() == Material.REPEATER || e.getToBlock().getType() == Material.COMPARATOR || e.getToBlock().getType() == Material.REDSTONE_TORCH || e.getToBlock().getType() == Material.REDSTONE_WALL_TORCH) {
@ -361,7 +361,7 @@ public class BlockLimitsListener implements Listener {
*
* @param e - island delete event
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onIslandDelete(IslandDeleteEvent e) {
islandCountMap.remove(e.getIsland().getUniqueId());
saveMap.remove(e.getIsland().getUniqueId());

View File

@ -1,33 +0,0 @@
package bentobox.addon.limits.listeners;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.songoda.epicspawners.api.events.SpawnerBreakEvent;
import bentobox.addon.limits.Limits;
/**
* @author tastybento
*
*/
public class EpicSpawnersListener implements Listener {
Limits addon;
/**
* @param addon
*/
public EpicSpawnersListener(Limits addon) {
this.addon = addon;
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(SpawnerBreakEvent e) {
Block b = e.getSpawner().getLocation().getBlock();
addon.getBlockLimitListener().handleBreak(e, e.getPlayer(), b);
}
}

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId>
<artifactId>EpicSpawners-API</artifactId>
<version>6.0.9</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.songoda</groupId>
<artifactId>EpicSpawners-API</artifactId>
<versioning>
<release>6.0.9</release>
<versions>
<version>6.0.9</version>
</versions>
<lastUpdated>20190815012640</lastUpdated>
</versioning>
</metadata>