Skip to content

Commit

Permalink
fix build and possible NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 22, 2024
1 parent 7333a27 commit 242e536
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void disable() {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
private void onTeleport(EntityTeleportEvent event) {
if (event.getTo() == null) return;
if (event.getFrom().getWorld().getUID().equals(event.getTo().getWorld().getUID())) return;

if (recentWorldChangers.contains(event.getEntity().getUniqueId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.block.BlockState;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.world.StructureGrowEvent;

Expand Down Expand Up @@ -42,6 +43,11 @@ public boolean shouldEnable() {
return AnarchyExploitFixes.getConfiguration().getBoolean("preventions.permanent-block-breaking.by-growing-structures.enable", true);
}

@Override
public void disable() {
HandlerList.unregisterAll(this);
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
final World world = event.getWorld();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public boolean shouldEnable() {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
private void onTeleport(EntityTeleportEvent event) {
if (event.getTo() == null) return;
if (event.getFrom().getWorld().getUID().equals(event.getTo().getWorld().getUID())) return;

if (recentWorldChangers.contains(event.getEntity().getUniqueId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "me.moomoo.anarchyexploitfixes"
version = "2.6.2"
version = "2.6.3"
description = "Prevent many exploits that affect anarchy servers."
var url: String? = "github.com/moom0o/AnarchyExploitFixes"

Expand Down

0 comments on commit 242e536

Please sign in to comment.