mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-25 03:55:22 +01:00
Rename ShopPlayer#ownsShop to ShopPlayer#isVendor
This commit is contained in:
parent
cec3e1ccdf
commit
52d3833961
@ -117,9 +117,11 @@ public interface ShopPlayer {
|
||||
*
|
||||
* @param shop the shop
|
||||
* @return whether this player is the vendor
|
||||
* @since 1.13
|
||||
*/
|
||||
default boolean ownsShop(Shop shop) {
|
||||
return shop != null && !shop.isAdminShop()
|
||||
&& shop.getVendor().get().getUniqueId().equals(getBukkitPlayer().getUniqueId());
|
||||
default boolean isVendor(Shop shop) {
|
||||
return shop != null && shop.getVendor()
|
||||
.map(vendor -> vendor.getUniqueId().equals(getBukkitPlayer().getUniqueId()))
|
||||
.orElse(false);
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ public class ChestInteractListener implements Listener {
|
||||
}
|
||||
|
||||
private void handleShopUse(Shop shop, ShopPlayer player, Type type, Cancellable e) {
|
||||
if (player.ownsShop(shop)) {
|
||||
if (player.isVendor(shop)) {
|
||||
return; // vendors cannot use their own shops
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class ShopInteractListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.ownsShop(shop) && !player.hasPermission("shopchest.edit.other")) {
|
||||
if (!player.isVendor(shop) && !player.hasPermission("shopchest.edit.other")) {
|
||||
player.sendMessage("§cYou don't have permission to edit this shop."); // TODO: i18n
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -78,7 +78,7 @@ public class ShopInteractListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.ownsShop(shop) && !player.hasPermission("shopchest.remove.other")) {
|
||||
if (!player.isVendor(shop) && !player.hasPermission("shopchest.remove.other")) {
|
||||
player.sendMessage("§cYou don't have permission to remove this shop."); // TODO: i18n
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user