Skip to content

Commit

Permalink
Fix lang issue with region not being replaced, fix landlord/owner not…
Browse files Browse the repository at this point in the history
… being changed
  • Loading branch information
md5sha256 committed Nov 13, 2023
1 parent 67dad42 commit 6f4524f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import jakarta.inject.Singleton;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
import me.wiefferink.areashop.tools.Utils;
Expand Down Expand Up @@ -95,10 +96,11 @@ private void handlePlayer(Player player, String[] args) {
this.messageBridge.message(player, "transfer-noPlayer", targetPlayerName);
return;
}
if (player.getUniqueId().equals(region.getLandlord())) {
if (region.isLandlord(targetPlayer.getUniqueId())) {
// Transfer ownership if same as landlord
region.setOwner(targetPlayer.getUniqueId());
this.messageBridge.message(player, "transfer-transferred-owner", targetPlayerName);
region.setLandlord(targetPlayer.getUniqueId(), targetPlayerName);
this.messageBridge.message(player, "transfer-transferred-owner", targetPlayerName, region);
if (targetPlayer.isOnline()) {
this.messageBridge.message(targetPlayer.getPlayer(), "transfer-transferred-owner", targetPlayerName);
}
Expand Down Expand Up @@ -134,11 +136,11 @@ public List<String> getTabCompleteList(int toComplete, String[] start, CommandSe
return this.fileManager.getRegionNames();
}
UUID uuid = player.getUniqueId();
return this.fileManager.getRegions()
return new ArrayList<>(this.fileManager.getRegions()
.stream()
.filter(region -> region.isOwner(uuid) || region.isLandlord(uuid))
.map(GeneralRegion::getName)
.toList();
.toList());
}
return Collections.emptyList();
}
Expand Down

0 comments on commit 6f4524f

Please sign in to comment.