Added shop type permission error to config

This commit is contained in:
Stijn 2022-08-31 20:51:15 +02:00
parent 89acf0c10e
commit baf1a3696b
2 changed files with 6 additions and 2 deletions

View File

@ -24,11 +24,13 @@ public class MessageConfig extends AbstractConfiguration {
public static String NO_SHOP_CREATE_PERMISSION = "<red>You don't have permission to create shops.</red>";
public static String SHOP_LIMIT_REACHED = "<red>You cannot create this shop as you already have reached the limit (<limit>).</red>";
public static String BREAK_SHOP_WHILE_CONVERSING = "<red>You can not break shop signs while editing them.</red>";
public static String NO_PERMISSION_FOR_SHOP_TYPE = "<red>You do not have permission to use <shop_type> shops.";
void loadErrorMessages() {
SHOP_ALREADY_EXISTS = getString("errors.shop-already-exists", SHOP_ALREADY_EXISTS);
NO_SHOP_CREATE_PERMISSION = getString("errors.no-shop-create-permission", NO_SHOP_CREATE_PERMISSION);
SHOP_LIMIT_REACHED = getString("errors.shop-limit-reached", SHOP_LIMIT_REACHED);
BREAK_SHOP_WHILE_CONVERSING = getString("errors.break-shop-while-conversing", BREAK_SHOP_WHILE_CONVERSING);
NO_PERMISSION_FOR_SHOP_TYPE = getString("permissions-messages.shop-type", NO_PERMISSION_FOR_SHOP_TYPE);
}
}

View File

@ -1,6 +1,7 @@
package com.alttd.playershops.listener;
import com.alttd.playershops.PlayerShops;
import com.alttd.playershops.config.MessageConfig;
import com.alttd.playershops.gui.ShopManagementGui;
import com.alttd.playershops.handler.ShopHandler;
import com.alttd.playershops.hook.WorldGuardHook;
@ -60,8 +61,9 @@ public class TransactionListener extends EventListener {
return;
}
if (!player.hasPermission("playershops.shop.use." + playerShop.getType().toString())) {
player.sendMiniMessage("<red>You do not have permission to use " + playerShop.getType().toString() + " shops.", null); // TODO config
String shopType = playerShop.getType().toString();
if (!player.hasPermission("playershops.shop.use." + shopType)) {
player.sendMiniMessage(MessageConfig.NO_PERMISSION_FOR_SHOP_TYPE, Placeholder.unparsed("shop_type", shopType));
return;
}