Removed message 'sign-shop-first-line' from the config and replaced it with 8 new messages inside the language files.

* 'admin-sign-shop-line1/2/3/4'
* 'player-sign-shop-line1/2/3/4'

This gives more control over the sign contents of admin and player shop signs.
The default appearance of sign shops has also changed. They are slightly more colorful now.
master
blablubbabc 2020-11-26 15:12:13 +01:00
parent b90bfe1ad0
commit cc3f82b9ab
7 changed files with 64 additions and 20 deletions

View File

@ -49,6 +49,10 @@ Messages:
* 'editor-title'
* 'for-hire-title'
* 'nameplate-prefix'. Also changed the color to a dark green.
* 'sign-shop-first-line'. This has been replaced with 8 new messages for the sign lines of different types of shops:
* 'admin-sign-shop-line1/2/3/4'
* 'player-sign-shop-line1/2/3/4'
* The appearance of sign shops has changed. They are slightly more colorful now.
* Changed the default color of 'villager-editor-title' to be less bright.
* Changed the 'too-many-shops' message to be more general.
* Minor changes to the german translation.

View File

@ -124,6 +124,16 @@ public class Messages {
public static String buttonMagmaCubeSize = c("&aChoose magma cube size");
public static List<String> buttonMagmaCubeSizeLore = c(Arrays.asList("Cycles the magma cube's size.", "Current size: &e{size}"));
public static String adminSignShopLine1 = c("&2[SHOP]");
public static String adminSignShopLine2 = c("&7{shopName}");
public static String adminSignShopLine3 = c("");
public static String adminSignShopLine4 = c("&eRight click!");
public static String playerSignShopLine1 = c("&2[SHOP]");
public static String playerSignShopLine2 = c("&7{shopName}");
public static String playerSignShopLine3 = c("&7{owner}");
public static String playerSignShopLine4 = c("&eRight click!");
public static String forHireTitle = c("For Hire");
public static String buttonHire = c("&aHire");
public static List<String> buttonHireLore = c(Arrays.asList("Buy this shop"));

View File

@ -175,7 +175,6 @@ public class Settings {
public static boolean enableSignShops = true;
public static boolean enableSignPostShops = true;
public static String signShopFirstLine = "[SHOP]";
/*
* Naming

View File

@ -1,7 +1,9 @@
package com.nisovin.shopkeepers.shopobjects.sign;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -17,8 +19,8 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import com.nisovin.shopkeepers.Messages;
import com.nisovin.shopkeepers.Settings;
import com.nisovin.shopkeepers.api.shopkeeper.ShopCreationData;
import com.nisovin.shopkeepers.api.shopkeeper.admin.AdminShopkeeper;
import com.nisovin.shopkeepers.api.shopkeeper.player.PlayerShopkeeper;
import com.nisovin.shopkeepers.api.shopobjects.sign.SignShopObject;
import com.nisovin.shopkeepers.shopkeeper.AbstractShopkeeper;
@ -28,6 +30,7 @@ import com.nisovin.shopkeepers.util.BlockFaceUtils;
import com.nisovin.shopkeepers.util.EnumUtils;
import com.nisovin.shopkeepers.util.ItemUtils;
import com.nisovin.shopkeepers.util.Log;
import com.nisovin.shopkeepers.util.TextUtils;
import com.nisovin.shopkeepers.util.Validate;
public class SKSignShopObject extends AbstractBlockShopObject implements SignShopObject {
@ -252,29 +255,39 @@ public class SKSignShopObject extends AbstractBlockShopObject implements SignSho
return;
}
// Line 0: Header
sign.setLine(0, Settings.signShopFirstLine);
// Line 1: Shop name
String name = shopkeeper.getName(); // Can be empty
name = this.prepareName(name);
String line1 = name;
sign.setLine(1, line1);
// Line 2: Owner name
String line2 = "";
// Setup sign contents:
if (shopkeeper instanceof PlayerShopkeeper) {
line2 = ((PlayerShopkeeper) shopkeeper).getOwnerName();
this.setupPlayerShopSign(sign, (PlayerShopkeeper) shopkeeper);
} else {
assert shopkeeper instanceof AdminShopkeeper;
this.setupAdminShopSign(sign, (AdminShopkeeper) shopkeeper);
}
sign.setLine(2, line2);
// Line 3: Empty
sign.setLine(3, "");
// Apply sign changes:
sign.update(false, false);
}
protected void setupPlayerShopSign(Sign sign, PlayerShopkeeper playerShop) {
Map<String, Object> arguments = new HashMap<>();
arguments.put("shopName", this.prepareName(playerShop.getName())); // Not null, can be empty
arguments.put("owner", playerShop.getOwnerName()); // Not null, can be empty
sign.setLine(0, TextUtils.replaceArguments(Messages.playerSignShopLine1, arguments));
sign.setLine(1, TextUtils.replaceArguments(Messages.playerSignShopLine2, arguments));
sign.setLine(2, TextUtils.replaceArguments(Messages.playerSignShopLine3, arguments));
sign.setLine(3, TextUtils.replaceArguments(Messages.playerSignShopLine4, arguments));
}
protected void setupAdminShopSign(Sign sign, AdminShopkeeper adminShop) {
Map<String, Object> arguments = new HashMap<>();
arguments.put("shopName", this.prepareName(adminShop.getName())); // Not null, can be empty
sign.setLine(0, TextUtils.replaceArguments(Messages.adminSignShopLine1, arguments));
sign.setLine(1, TextUtils.replaceArguments(Messages.adminSignShopLine2, arguments));
sign.setLine(2, TextUtils.replaceArguments(Messages.adminSignShopLine3, arguments));
sign.setLine(3, TextUtils.replaceArguments(Messages.adminSignShopLine4, arguments));
}
@Override
public boolean check() {
if (!shopkeeper.getChunkCoords().isChunkLoaded()) {

View File

@ -267,8 +267,6 @@ enable-citizen-shops: true
enable-sign-shops: true
# Whether to allow the creation of sign posts (instead of only wall signs).
enable-sign-post-shops: true
# The first line of a sign shop.
sign-shop-first-line: "[SHOP]"
# *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
# Naming

View File

@ -163,6 +163,16 @@ button-magma-cube-size-lore:
- "Ändert die Größe des Magmawürfels."
- "Aktuelle Größe: &e{size}"
admin-sign-shop-line1: "&2[SHOP]"
admin-sign-shop-line2: "&7{shopName}"
admin-sign-shop-line3: ""
admin-sign-shop-line4: "&eRechtsklick!"
player-sign-shop-line1: "&2[SHOP]"
player-sign-shop-line2: "&7{shopName}"
player-sign-shop-line3: "&7{owner}"
player-sign-shop-line4: "&eRechtsklick!"
for-hire-title: "Zum Anheuern"
button-hire: "&aAnheuern"
button-hire-lore:

View File

@ -164,6 +164,16 @@ button-magma-cube-size-lore:
- "Cycles the magma cube's size."
- "Current size: &e{size}"
admin-sign-shop-line1: "&2[SHOP]"
admin-sign-shop-line2: "&7{shopName}"
admin-sign-shop-line3: ""
admin-sign-shop-line4: "&eRight click!"
player-sign-shop-line1: "&2[SHOP]"
player-sign-shop-line2: "&7{shopName}"
player-sign-shop-line3: "&7{owner}"
player-sign-shop-line4: "&eRight click!"
for-hire-title: "For Hire"
button-hire: "&aHire"
button-hire-lore: