ChestShop Sign Dying

Fixes #466 and #472

Signed-off-by: TreyRuffy <TreyRuffy@users.noreply.github.com>
This commit is contained in:
TreyRuffy 2021-10-06 23:10:03 -06:00 committed by TreyRuffy
parent 4f8e7938e2
commit 6654c3c8a8
No known key found for this signature in database
GPG Key ID: 84583834E0459212
3 changed files with 12 additions and 0 deletions

View File

@ -469,6 +469,7 @@ public class ChestShop extends JavaPlugin {
map.put("shift-sells-in-stacks", getChartArray(Properties.SHIFT_SELLS_IN_STACKS));
map.put("shift-sells-everything", getChartArray(Properties.SHIFT_SELLS_EVERYTHING));
map.put("allow-sign-chest-open", getChartArray(!Properties.ALLOW_SIGN_CHEST_OPEN));
map.put("sign-dying", getChartArray(!Properties.SIGN_DYING));
map.put("remove-empty-shops", getChartArray(!Properties.REMOVE_EMPTY_SHOPS));
map.put("remove-empty-chests", getChartArray(!Properties.REMOVE_EMPTY_CHESTS));
map.put("uses-server-economy-account", getChartArray(!Properties.SERVER_ECONOMY_ACCOUNT.isEmpty()));

View File

@ -153,6 +153,9 @@ public class Properties {
@ConfigurationComment("Can shop's chest be opened by owner with right-clicking a shop's sign?")
public static boolean ALLOW_SIGN_CHEST_OPEN = false;
@ConfigurationComment("If true, the owner of a chest shop can click with a dye / ink sac to dye the sign.")
public static boolean SIGN_DYING = false;
@ConfigurationComment("If true, when you left-click your own shop sign you won't open chest's inventory, but instead you will start destroying the sign.")
public static boolean ALLOW_LEFT_CLICK_DESTROYING = true;

View File

@ -134,6 +134,14 @@ public class PlayerInteract implements Listener {
showChestGUI(player, block, sign);
return;
}
if (player.getInventory().getItemInMainHand().getType().name().endsWith("DYE")
|| player.getInventory().getItemInMainHand().getType().name().endsWith("INK_SAC")) {
if (Properties.SIGN_DYING) {
return;
} else {
event.setCancelled(true);
}
}
// don't allow owners or people with access to buy/sell at this shop
Messages.TRADE_DENIED_ACCESS_PERMS.sendWithPrefix(player);
return;