mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-25 12:06:16 +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
|
* @param shop the shop
|
||||||
* @return whether this player is the vendor
|
* @return whether this player is the vendor
|
||||||
|
* @since 1.13
|
||||||
*/
|
*/
|
||||||
default boolean ownsShop(Shop shop) {
|
default boolean isVendor(Shop shop) {
|
||||||
return shop != null && !shop.isAdminShop()
|
return shop != null && shop.getVendor()
|
||||||
&& shop.getVendor().get().getUniqueId().equals(getBukkitPlayer().getUniqueId());
|
.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) {
|
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
|
return; // vendors cannot use their own shops
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class ShopInteractListener implements Listener {
|
|||||||
return;
|
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
|
player.sendMessage("§cYou don't have permission to edit this shop."); // TODO: i18n
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -78,7 +78,7 @@ public class ShopInteractListener implements Listener {
|
|||||||
return;
|
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
|
player.sendMessage("§cYou don't have permission to remove this shop."); // TODO: i18n
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user