Skip to content

Commit

Permalink
Removed dependency on EpicSpawners
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Aug 17, 2019
1 parent b0888d1 commit 4603e9e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 88 deletions.
11 changes: 0 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/bentobox/addon/limits/Limits.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
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;
Expand Down Expand Up @@ -57,12 +55,6 @@ public void onEnable() {
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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ public void save() {
}

// Player-related events
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = false)

This comment has been minimized.

Copy link
@BONNe

BONNe Aug 17, 2019

Member

Why did you change Priority to normal?

Monitor priority means that it will be run at the end, as the last event, and that do not use any modifications to events.

Ignore :D I thought this is level addon :D

This comment has been minimized.

Copy link
@tastybento

tastybento Aug 17, 2019

Author Member

I do need to change that ignore to true though.

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());
}
Expand All @@ -166,7 +166,7 @@ void handleBreak(Cancellable e, Player player, Block b) {
}
}

@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());
}
Expand All @@ -181,57 +181,57 @@ private void notify(Cancellable e, User user, int limit, Material m) {
}

// 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) {
Expand Down Expand Up @@ -361,7 +361,7 @@ public Map<Material, Integer> getMaterialLimits(World w, String id) {
*
* @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());
Expand Down

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

0 comments on commit 4603e9e

Please sign in to comment.