ChestShop Sign Dying (#479)

Signed-off-by: TreyRuffy <TreyRuffy@users.noreply.github.com>
This commit is contained in:
TreyRuffy 2021-10-12 16:30:49 -06:00 committed by GitHub
parent 4f8e7938e2
commit bb7bd3415c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 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 and in 1.14+, the owner of a chest shop can click with a dye / ink sac to dye the sign.")
public static boolean SIGN_DYING = true;
@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

@ -125,6 +125,15 @@ public class PlayerInteract implements Listener {
if (!AccessToggle.isIgnoring(player) && ChestShopSign.canAccess(player, sign) && !ChestShopSign.isAdminShop(sign)) {
if (Properties.IGNORE_ACCESS_PERMS || ChestShopSign.isOwner(player, sign)) {
if ((player.getInventory().getItemInMainHand().getType().name().endsWith("DYE")
|| player.getInventory().getItemInMainHand().getType().name().endsWith("INK_SAC"))
&& action == RIGHT_CLICK_BLOCK) {
if (Properties.SIGN_DYING) {
return;
} else {
event.setCancelled(true);
}
}
if (Properties.ALLOW_SIGN_CHEST_OPEN && !(Properties.IGNORE_CREATIVE_MODE && player.getGameMode() == GameMode.CREATIVE)) {
if (player.isSneaking() || player.isInsideVehicle()
|| (Properties.ALLOW_LEFT_CLICK_DESTROYING && action == LEFT_CLICK_BLOCK)) {