Skip to content

Commit

Permalink
Fixed incorrect lookups of warps by their locations
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Oct 8, 2022
1 parent f129ab3 commit c24b2ce
Showing 1 changed file with 3 additions and 5 deletions.
Expand Up @@ -2750,8 +2750,7 @@ public void renameWarp(IslandWarp islandWarp, String newName) {
@Override
public IslandWarp getWarp(Location location) {
Preconditions.checkNotNull(location, "location parameter cannot be null.");
Location blockLocation = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
return warpsByLocation.get(blockLocation);
return warpsByLocation.get(new LocationKey(location));
}

@Override
Expand Down Expand Up @@ -2787,8 +2786,7 @@ public void warpPlayer(SuperiorPlayer superiorPlayer, String warp) {
public void deleteWarp(@Nullable SuperiorPlayer superiorPlayer, Location location) {
Preconditions.checkNotNull(location, "location parameter cannot be null.");

Location blockLocation = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
IslandWarp islandWarp = warpsByLocation.remove(blockLocation);
IslandWarp islandWarp = warpsByLocation.remove(new LocationKey(location));
if (islandWarp != null) {
deleteWarp(islandWarp.getName());
if (superiorPlayer != null)
Expand All @@ -2806,7 +2804,7 @@ public void deleteWarp(String name) {
WarpCategory warpCategory = islandWarp == null ? null : islandWarp.getCategory();

if (islandWarp != null) {
warpsByLocation.remove(islandWarp.getLocation());
warpsByLocation.remove(new LocationKey(islandWarp.getLocation()));
warpCategory.getWarps().remove(islandWarp);

IslandsDatabaseBridge.removeWarp(this, islandWarp);
Expand Down

0 comments on commit c24b2ce

Please sign in to comment.