Added more feedback messages when a player cannot trade with a shop for some reason.

Added the messages 'msg-cant-trade-with-own-shop' and 'msg-cant-trade-with-shop-missing-chest' for the cases that trading with the own shop is prevented or if the target shop is missing its chest.

Also:
* The check for whether the player is able to bypass the restriction of not being able to trade with own shops was previously checking if the player is an operator. Instead we now check if the player has the bypass permission.
* When checking if the player is able to bypass the restriction of not being able to trade with shops while their owner is online, we only check for the bypass permission now after checking if the shop owner is actually online currently.
* Slightly changed the german translation of the 'msg-cant-trade-while-owner-online' message.
master
blablubbabc 2020-06-25 17:10:14 +02:00
parent f79d06d32f
commit c68be20af5
5 changed files with 21 additions and 5 deletions

View File

@ -4,6 +4,9 @@ Date format: (YYYY-MM-DD)
## v2.9.4 (TBA)
### Supported MC versions: 1.15.2, 1.14.4
* Added: Added feedback messages when a player cannot trade with a shop due to trading with own shops being disabled or if the shop's chest is missing.
* Changed: The check for whether the player is able to bypass the restriction of not being able to trade with own shops was previously checking if the player is an operator. Instead we now check if the player has the bypass permission.
* Changed: When checking if the player is able to bypass the restriction of not being able to trade with shops while their owner is online, we only check for the bypass permission now after checking if the shop owner is actually online currently.
* Added: The variant of rabbit shopkeepers can now be changed. Any existing rabbit shopkeepers will use the brown variant (the default). This also resolves an issue with the rabbit type randomly changing whenever the shopkeeper is respawned.
* Added: Added a header comment to the top of the save.yml file mentioning the risk of manually editing this file while the server is still running or without making a backup first.
* Fixed: If regular item usage is disabled we also prevent any kind of entity interaction now while holding the shop creation item in hand. Players with the 'shopkeeper.bypass' permission are exempt from this restriction.
@ -26,6 +29,8 @@ Internal changes:
Added messages:
* msg-button-rabbit-variant
* msg-button-rabbit-variant-lore
* msg-cant-trade-with-own-shop
* msg-cant-trade-with-shop-missing-chest
Changed messages (you will have to manually update those!):
* Renamed 'msg-removed-player-shops' to 'msg-removed-shops-of-player'.
@ -35,6 +40,7 @@ Changed messages (you will have to manually update those!):
* Renamed 'msg-confirm-remove-player-shops' to 'msg-confirm-remove-all-shops-of-player'.
* The 'msg-removed-player-shops' message (previously 'msg-removed-all-player-shops') no longer mentions that 'all' shops got deleted (since this is not necessarily true).
* Changed the 'msg-button-villager-level' and 'msg-button-villager-level-lore' messages to clarify that this option only changes the visual appearance of the villager's badge color. The included german translation has been updated accordingly as well.
* Slightly changed the german translation of the 'msg-cant-trade-while-owner-online' message.
## v2.9.3 (2020-04-12)
### Supported MC versions: 1.15.2, 1.14.4

View File

@ -438,7 +438,9 @@ public class Settings {
public static Text msgMissingTradePerm = Text.parse("&7You do not have the permission to trade with this shop.");
public static Text msgMissingCustomTradePerm = Text.parse("&7You do not have the permission to trade with this shop.");
public static Text msgCantTradeWithOwnShop = Text.parse("&7You cannot trade with your own shop.");
public static Text msgCantTradeWhileOwnerOnline = Text.parse("&7You cannot trade while the owner of this shop ('&e{owner}&7') is online.");
public static Text msgCantTradeWithShopMissingChest = Text.parse("&7You cannot trade with this shop, because its chest is missing.");
public static Text msgShopkeeperCreated = Text.parse("&aShopkeeper created: &6{type} &7({description})\n{setupDesc}");

View File

@ -55,15 +55,18 @@ public abstract class PlayerShopTradingHandler extends TradingHandler {
Player tradingPlayer = tradeData.tradingPlayer;
// no trading with own shop:
if (Settings.preventTradingWithOwnShop && shopkeeper.isOwner(tradingPlayer) && !tradingPlayer.isOp()) {
if (Settings.preventTradingWithOwnShop && shopkeeper.isOwner(tradingPlayer)
&& !PermissionUtils.hasPermission(tradingPlayer, ShopkeepersPlugin.BYPASS_PERMISSION)) {
TextUtils.sendMessage(tradingPlayer, Settings.msgCantTradeWithOwnShop);
this.debugPreventedTrade(tradingPlayer, "Trading with the own shop is not allowed.");
return false;
}
// no trading while shop owner is online:
if (Settings.preventTradingWhileOwnerIsOnline && !PermissionUtils.hasPermission(tradingPlayer, ShopkeepersPlugin.BYPASS_PERMISSION)) {
if (Settings.preventTradingWhileOwnerIsOnline) {
Player ownerPlayer = shopkeeper.getOwner();
if (ownerPlayer != null && !shopkeeper.isOwner(tradingPlayer)) {
if (ownerPlayer != null && !shopkeeper.isOwner(tradingPlayer)
&& !PermissionUtils.hasPermission(tradingPlayer, ShopkeepersPlugin.BYPASS_PERMISSION)) {
TextUtils.sendMessage(tradingPlayer, Settings.msgCantTradeWhileOwnerOnline, "owner", ownerPlayer.getName());
this.debugPreventedTrade(tradingPlayer, "Trading is not allowed while the shop owner is online.");
return false;
@ -73,7 +76,8 @@ public abstract class PlayerShopTradingHandler extends TradingHandler {
// check for the shop's chest:
Block chest = shopkeeper.getChest();
if (!ItemUtils.isChest(chest.getType())) {
this.debugPreventedTrade(tradingPlayer, "Couldn't find the shop's chest.");
TextUtils.sendMessage(tradingPlayer, Settings.msgCantTradeWithShopMissingChest, "owner", shopkeeper.getOwnerName());
this.debugPreventedTrade(tradingPlayer, "The shop's chest is missing.");
return false;
}

View File

@ -574,7 +574,9 @@ msg-villager-for-hire: "&aThe villager offered his services as a shopkeeper in e
msg-missing-trade-perm: "&7You do not have the permission to trade with this shop."
msg-missing-custom-trade-perm: "&7You do not have the permission to trade with this shop."
msg-cant-trade-with-own-shop: "&7You cannot trade with your own shop."
msg-cant-trade-while-owner-online: "&7You cannot trade while the owner of this shop ('&e{owner}&7') is online."
msg-cant-trade-with-shop-missing-chest: "&7You cannot trade with this shop, because its chest is missing."
msg-shopkeeper-created: "&aShopkeeper created: &6{type} &7({description})\n{setupDesc}"

View File

@ -206,7 +206,9 @@ msg-villager-for-hire: "&aDieser Dorfbewohner bietet dir im Tausch für &6{costs
msg-missing-trade-perm: "&7Du hast nicht die nötige Befugnis, um mit diesem Shop zu handeln."
msg-missing-custom-trade-perm: "&7Du hast nicht die nötige Befugnis, um mit diesem Shop zu handeln."
msg-cant-trade-while-owner-online: "&7Du kannst nicht Handeln, während der Besitzer dieses Shops ('&e{owner}&7') online ist."
msg-cant-trade-with-own-shop: "&7Du kannst nicht mit deinem eigenen Shop handeln."
msg-cant-trade-while-owner-online: "&7Du kannst nicht handeln, während der Besitzer dieses Shops ('&e{owner}&7') online ist."
msg-cant-trade-with-shop-missing-chest: "&7Du kannst nicht mit diesem Shop handeln, da seine Truhe fehlt."
msg-shopkeeper-created: "&aShop erstellt: &6{type} &7({description})\n{setupDesc}"