From 2506d2ac9ed26808f66904984e9f77f40b79ebe4 Mon Sep 17 00:00:00 2001 From: tastybento Date: Fri, 8 Jan 2021 22:14:03 -0800 Subject: [PATCH] Deprecated and removed WarpListEvent Cannot be fired because this part of the code needs to run async. https://github.com/BentoBoxWorld/Warps/issues/93 --- .../bentobox/warps/WarpSignsManager.java | 12 +++------- .../bentobox/warps/event/WarpListEvent.java | 22 +++---------------- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/src/main/java/world/bentobox/warps/WarpSignsManager.java b/src/main/java/world/bentobox/warps/WarpSignsManager.java index d408638..51009ba 100644 --- a/src/main/java/world/bentobox/warps/WarpSignsManager.java +++ b/src/main/java/world/bentobox/warps/WarpSignsManager.java @@ -38,7 +38,6 @@ import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.lists.Flags; import world.bentobox.bentobox.util.Util; import world.bentobox.warps.event.WarpInitiateEvent; -import world.bentobox.warps.event.WarpListEvent; import world.bentobox.warps.objects.WarpsData; /** @@ -129,7 +128,7 @@ public class WarpSignsManager { return getWarpMap(location.getWorld()).entrySet().stream().filter(en -> en.getValue().equals(location)) .findFirst().map(en -> plugin.getPlayers().getName(en.getKey())).orElse(""); } - + /** * Get the optional UUID of the warp owner by location * @param location to search @@ -165,11 +164,6 @@ public class WarpSignsManager { if (list.size() > MAX_WARPS) { list.subList(0, MAX_WARPS).clear(); } - // Fire event - WarpListEvent event = new WarpListEvent(addon, list); - Bukkit.getPluginManager().callEvent(event); - // Get the result of any changes by listeners - list = event.getWarps(); return list; } @@ -262,7 +256,7 @@ public class WarpSignsManager { if (getWarpMap(world).containsKey(uuid)) { popSign(getWarpMap(world).get(uuid)); getWarpMap(world).remove(uuid); - + } // Remove sign from warp panel cache addon.getWarpPanelManager().removeWarp(world, uuid); @@ -353,7 +347,7 @@ public class WarpSignsManager { user.getWorld().playSound(user.getLocation(), Sound.ENTITY_ARROW_HIT, 1F, 1F); } else { user.getWorld().playSound(user.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 1F, 1F); - } + } if (!warpOwner.equals(user)) { warpOwner.sendMessage("warps.player-warped", "[name]", user.getName()); } diff --git a/src/main/java/world/bentobox/warps/event/WarpListEvent.java b/src/main/java/world/bentobox/warps/event/WarpListEvent.java index 869750c..8384034 100644 --- a/src/main/java/world/bentobox/warps/event/WarpListEvent.java +++ b/src/main/java/world/bentobox/warps/event/WarpListEvent.java @@ -1,20 +1,3 @@ -/******************************************************************************* - * This file is part of ASkyBlock. - * - * ASkyBlock is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ASkyBlock is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASkyBlock. If not, see . - *******************************************************************************/ - package world.bentobox.warps.event; import java.util.List; @@ -30,10 +13,11 @@ import world.bentobox.warps.Warp; * the API updateWarpPanel method is called. * A listener to this event can reorder or rewrite the warp list by using setWarps. * This new order will then be used in the warp panel. - * + * * @author tastybento - * + * @deprecated this event is not fired any more because the task is async */ +@Deprecated public class WarpListEvent extends Event { private static final HandlerList handlers = new HandlerList(); private List warps;