mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Various changes to shop signs, see details.
Details: - Now showing price as formatted by the economy plugin (be sure to keep it short). Closes #115 - The shop sign [QuickShop] line was changed with the owner name. Closes #53 - The shop sign item line can now be customized
This commit is contained in:
1 parent
2fae21e4e7
commit
078c6104d5
4 files changed
+30
-10
No files matched your search
@@ -3,12 +3,11 @@ package org.maxgamer.quickshop.Shop;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -462,15 +461,15 @@ public class ContainerShop implements Shop {
|
||||
if (Util.isLoaded(this.getLocation()) == false)
|
||||
return;
|
||||
String[] lines = new String[4];
|
||||
lines[0] = ChatColor.RED + "[QuickShop]";
|
||||
lines[0] = MsgUtil.getMessage("signs.header", this.ownerName());
|
||||
if (this.isBuying()) {
|
||||
lines[1] = MsgUtil.getMessage("signs.buying", "" + this.getRemainingSpace());
|
||||
}
|
||||
if (this.isSelling()) {
|
||||
lines[1] = MsgUtil.getMessage("signs.selling", "" + this.getRemainingStock());
|
||||
}
|
||||
lines[2] = Util.getNameForSign(this.item);
|
||||
lines[3] = MsgUtil.getMessage("signs.price", "" + this.getPrice());
|
||||
lines[2] = MsgUtil.getMessage("signs.item", Util.getNameForSign(this.item));
|
||||
lines[3] = MsgUtil.getMessage("signs.price", Util.format(this.getPrice()));
|
||||
this.setSignText(lines);
|
||||
}
|
||||
|
||||
@@ -682,11 +681,28 @@ public class ContainerShop implements Shop {
|
||||
public void onClick() {
|
||||
this.setSignText();
|
||||
}
|
||||
|
||||
public String ownerName() {
|
||||
if (this.isUnlimited()) {
|
||||
return MsgUtil.getMessage("admin-shop");
|
||||
}
|
||||
|
||||
if (this.getOwner() == null) {
|
||||
return MsgUtil.getMessage("unknown-owner");
|
||||
}
|
||||
|
||||
final String name = Bukkit.getOfflinePlayer(this.getOwner()).getName();
|
||||
if (name == null) {
|
||||
return MsgUtil.getMessage("unknown-owner");
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Shop " + (loc.getWorld() == null ? "unloaded world" : loc.getWorld().getName()) + "(" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
|
||||
sb.append(" Owner: " + getOwner().toString());
|
||||
sb.append(" Owner: " + this.ownerName() + " - " + getOwner().toString());
|
||||
if (isUnlimited())
|
||||
sb.append(" Unlimited: true");
|
||||
sb.append(" Price: " + getPrice());
|
||||
|
||||
@@ -75,4 +75,6 @@ public abstract interface Shop {
|
||||
public abstract void onLoad();
|
||||
|
||||
public abstract void onClick();
|
||||
|
||||
public abstract String ownerName();
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class MsgUtil {
|
||||
p.sendMessage("");
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.shop-information"));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.owner", Bukkit.getOfflinePlayer(shop.getOwner()).getName()==null ? (shop.isUnlimited() ? "AdminShop" : "Unknown") : Bukkit.getOfflinePlayer(shop.getOwner()).getName()));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.owner", shop.ownerName()));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item", shop.getDataName()));
|
||||
if (NMS.isPotion(items.getType())) {
|
||||
String effects = CustomPotionsName.getEffects(items);
|
||||
|
||||
Reference in new issue
Block a user