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