mirror of
https://github.com/BentoBoxWorld/Warps.git
synced 2024-11-15 23:25:27 +01:00
Better handling for when a warp sign is removed
This commit is contained in:
parent
fd895262c5
commit
2d74426b11
@ -37,6 +37,7 @@ public class WarpPanelManager {
|
||||
.name(addon.getPlugin().getPlayers().getName(warpOwner))
|
||||
.description(getSign(world, warpOwner))
|
||||
.clickHandler((panel, clicker, click, slot) -> { {
|
||||
clicker.closeInventory();
|
||||
addon.getWarpSignsManager().warpPlayer(world, clicker, warpOwner);
|
||||
return true;
|
||||
}
|
||||
|
@ -346,8 +346,8 @@ public class WarpSignsManager {
|
||||
final Location warpSpot = getWarp(world, owner);
|
||||
// Check if the warp spot is safe
|
||||
if (warpSpot == null) {
|
||||
user.sendMessage("warps.error.NotReadyYet");
|
||||
addon.getLogger().warning("Null warp found, owned by " + addon.getPlugin().getPlayers().getName(owner));
|
||||
user.sendMessage("warps.error.does-not-exist");
|
||||
addon.getWarpSignsManager().removeWarp(world, owner);
|
||||
return;
|
||||
}
|
||||
// Find out if island is locked
|
||||
|
@ -18,11 +18,11 @@ import world.bentobox.bentobox.api.user.User;
|
||||
*/
|
||||
public class WarpCommand extends CompositeCommand {
|
||||
|
||||
private Warp plugin;
|
||||
private Warp addon;
|
||||
|
||||
public WarpCommand(Warp plugin, CompositeCommand bsbIslandCmd) {
|
||||
super(bsbIslandCmd, "warp");
|
||||
this.plugin = plugin;
|
||||
this.addon = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -36,10 +36,10 @@ public class WarpCommand extends CompositeCommand {
|
||||
@Override
|
||||
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
|
||||
List<String> options = new ArrayList<>();
|
||||
final Set<UUID> warpList = plugin.getWarpSignsManager().listWarps(getWorld());
|
||||
final Set<UUID> warpList = addon.getWarpSignsManager().listWarps(getWorld());
|
||||
|
||||
for (UUID warp : warpList) {
|
||||
options.add(plugin.getPlugin().getPlayers().getName(warp));
|
||||
options.add(addon.getPlugin().getPlayers().getName(warp));
|
||||
}
|
||||
|
||||
return Optional.of(options);
|
||||
@ -49,7 +49,7 @@ public class WarpCommand extends CompositeCommand {
|
||||
public boolean execute(User user, String label, List<String> args) {
|
||||
if (args.size() == 1) {
|
||||
// Warp somewhere command
|
||||
Set<UUID> warpList = plugin.getWarpSignsManager().listWarps(getWorld());
|
||||
Set<UUID> warpList = addon.getWarpSignsManager().listWarps(getWorld());
|
||||
if (warpList.isEmpty()) {
|
||||
user.sendMessage("warps.error.no-warps-yet");
|
||||
user.sendMessage("warps.warpTip");
|
||||
@ -63,7 +63,7 @@ public class WarpCommand extends CompositeCommand {
|
||||
return false;
|
||||
} else {
|
||||
// Warp exists!
|
||||
plugin.getWarpSignsManager().warpPlayer(getWorld(), user, foundWarp);
|
||||
addon.getWarpSignsManager().warpPlayer(getWorld(), user, foundWarp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user