From 3d5aa384b1e72fe31aec7a7444df47e6b7f93a26 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Thu, 8 Oct 2015 20:07:14 +0800 Subject: [PATCH] change tool tip... Signed-off-by: 502647092 --- src/main/java/org/maxgamer/QuickShop/Util/MsgUtil.java | 4 ++-- src/main/java/org/maxgamer/QuickShop/Util/Util.java | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/maxgamer/QuickShop/Util/MsgUtil.java b/src/main/java/org/maxgamer/QuickShop/Util/MsgUtil.java index 803b9e3..3b410b3 100644 --- a/src/main/java/org/maxgamer/QuickShop/Util/MsgUtil.java +++ b/src/main/java/org/maxgamer/QuickShop/Util/MsgUtil.java @@ -17,9 +17,9 @@ import cn.citycraft.PluginHelper.config.FileConfig; import mkremins.fanciful.FancyMessage; public class MsgUtil { - private static QuickShop plugin; private static FileConfig messages; private static HashMap> player_messages = new HashMap>(); + private static QuickShop plugin; /** * Deletes any messages that are older than a week in the database, to save @@ -141,7 +141,7 @@ public class MsgUtil { final double tax = plugin.getConfig().getDouble("tax"); final double total = amount * shop.getPrice(); if (tax != 0) { - if (!p.getUniqueId().equals(shop.getOwner())) { + if (!p.getName().equals(shop.getOwner())) { p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.sell-tax", "" + Util.format((tax * total)))); } else { p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.sell-tax-self")); diff --git a/src/main/java/org/maxgamer/QuickShop/Util/Util.java b/src/main/java/org/maxgamer/QuickShop/Util/Util.java index bc701ac..b7ee41a 100644 --- a/src/main/java/org/maxgamer/QuickShop/Util/Util.java +++ b/src/main/java/org/maxgamer/QuickShop/Util/Util.java @@ -1,6 +1,5 @@ package org.maxgamer.QuickShop.Util; -import java.text.DecimalFormat; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -26,11 +25,11 @@ import org.maxgamer.QuickShop.Config.ItemConfig; @SuppressWarnings("deprecation") public class Util { - private static HashSet tools = new HashSet(); private static HashSet blacklist = new HashSet(); - private static HashSet shoppables = new HashSet(); - private static HashSet transparent = new HashSet(); private static QuickShop plugin; + private static HashSet shoppables = new HashSet(); + private static HashSet tools = new HashSet(); + private static HashSet transparent = new HashSet(); public static void addTransparentBlock(final Material m) { if (transparent.add(m) == false) { @@ -228,8 +227,7 @@ public class Util { public static String getToolPercentage(final ItemStack item) { final double dura = item.getDurability(); final double max = item.getType().getMaxDurability(); - final DecimalFormat formatter = new DecimalFormat("0"); - return dura + "/" + max + "(" + formatter.format((1 - dura / max) * 100.0) + ")"; + return String.format("%.2f(%s/%s)", (1 - dura / max) * 100.0, dura, max); } public static void initialize() {