1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-11-22 01:58:54 +00:00

refactor: 清理部分无用方法

This commit is contained in:
502647092 2016-04-03 23:58:21 +08:00
parent c2ac919c40
commit 918c329b2c

View File

@ -214,27 +214,14 @@ public class ShopManager {
return inWorld.get(shopChunk);
}
public void handleChat(final Player p, final String msg) {
final String message = ChatColor.stripColor(msg);
// Use from the main thread, because Bukkit hates life
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
public void handleChat(final Player p, final String msgs) {
final String message = ChatColor.stripColor(msgs);
final HashMap<String, Info> actions = getActions();
// They wanted to do something.
final Info info = actions.remove(p.getName());
if (info == null) {
return; // multithreaded means this can happen
}
if (info.getLocation().getWorld() != p.getLocation().getWorld()) {
p.sendMessage(MsgUtil.p("shop-creation-cancelled"));
return;
}
if (info.getLocation().distanceSquared(p.getLocation()) > 25) {
p.sendMessage(MsgUtil.p("shop-creation-cancelled"));
return;
}
/* Creation handling */
if (info.getAction() == ShopAction.CREATE) {
try {
@ -402,21 +389,15 @@ public class ShopManager {
if (plugin.getConfigManager().isShowTax()) {
String msg = MsgUtil.p("player-bought-from-your-store-tax", p.getName(), "" + amount, shop.getDataName(), Util.format((tax * total)));
if (stock == amount) {
msg += "\n" + MsgUtil.p("shop-out-of-stock",
"" + shop.getLocation().getBlockX(),
"" + shop.getLocation().getBlockY(),
"" + shop.getLocation().getBlockZ(),
shop.getDataName());
msg += "\n"
+ MsgUtil.p("shop-out-of-stock", "" + shop.getLocation().getBlockX(), "" + shop.getLocation().getBlockY(), "" + shop.getLocation().getBlockZ(), shop.getDataName());
}
MsgUtil.send(shop.getOwner(), msg);
} else {
String msg = MsgUtil.p("player-bought-from-your-store", p.getName(), "" + amount, shop.getDataName());
if (stock == amount) {
msg += "\n" + MsgUtil.p("shop-out-of-stock",
"" + shop.getLocation().getBlockX(),
"" + shop.getLocation().getBlockY(),
"" + shop.getLocation().getBlockZ(),
shop.getDataName());
msg += "\n"
+ MsgUtil.p("shop-out-of-stock", "" + shop.getLocation().getBlockX(), "" + shop.getLocation().getBlockY(), "" + shop.getLocation().getBlockZ(), shop.getDataName());
}
MsgUtil.send(shop.getOwner(), msg);
}
@ -489,8 +470,6 @@ public class ShopManager {
return; // It was cancelled, go away.
}
}
});
}
/**
* Loads the given shop into storage. This method is used for loading data