Move setSignText actions to ContainerShop class

Former-commit-id: 7717a7a4cd55c945969dc84d7954857ab2a0def3 [formerly 5474905252b3e4a67dd533cdc69843918ae8869b]
Former-commit-id: 9f12f0f479e0bdbecbe2ede083dee3d36e74f02b
This commit is contained in:
Ghost_chu committed 2019-05-31 19:59:58 +08:00
1 parent 813354d4f5
commit f02ef09dd7
3 files changed
+14 -9

No files matched your search

@@ -39,7 +39,7 @@ public class QS implements CommandExecutor {
Shop shop = plugin.getShopManager().getShop(b.getLocation());
if (shop != null) {
shop.setUnlimited(!shop.isUnlimited());
shop.setSignText();
//shop.setSignText();
shop.update();
sender.sendMessage(MsgUtil.getMessage("command.toggle-unlimited",
(shop.isUnlimited() ? "unlimited" : "limited")));
@@ -61,7 +61,7 @@ public class QS implements CommandExecutor {
Integer.valueOf(args[3]), Integer.valueOf(args[4])));
if (shop != null) {
shop.setUnlimited(!shop.isUnlimited());
shop.setSignText();
//shop.setSignText();
shop.update();
MsgUtil.sendControlPanelInfo(sender, shop);
sender.sendMessage(MsgUtil.getMessage("command.toggle-unlimited",
@@ -206,7 +206,7 @@ public class QS implements CommandExecutor {
@SuppressWarnings("deprecation")
OfflinePlayer p = this.plugin.getServer().getOfflinePlayer(args[1]);
shop.setOwner(p.getUniqueId());
shop.setSignText();
//shop.setSignText();
shop.update();
sender.sendMessage(MsgUtil.getMessage("command.new-owner",
this.plugin.getServer().getOfflinePlayer(shop.getOwner()).getName()));
@@ -437,7 +437,7 @@ public class QS implements CommandExecutor {
Integer.valueOf(args[3]), Integer.valueOf(args[4])));
if (shop != null && shop.getModerator().isModerator(((Player) sender).getUniqueId())) {
shop.setShopType(ShopType.BUYING);
shop.setSignText();
//shop.setSignText();
shop.update();
MsgUtil.sendControlPanelInfo(sender, shop);
sender.sendMessage(MsgUtil
@@ -457,7 +457,7 @@ public class QS implements CommandExecutor {
Shop shop = plugin.getShopManager().getShop(b.getLocation());
if (shop != null && shop.getModerator().isModerator(((Player) sender).getUniqueId())) {
shop.setShopType(ShopType.BUYING);
shop.setSignText();
//shop.setSignText();
shop.update();
sender.sendMessage(MsgUtil
.getMessage("command.now-buying", MsgUtil.getItemi18n(shop.getItem().getType().name())));
@@ -477,7 +477,7 @@ public class QS implements CommandExecutor {
Integer.valueOf(args[2]), Integer.valueOf(args[3]), Integer.valueOf(args[4])));
if (shop != null && shop.getModerator().isModerator(((Player) sender).getUniqueId())) {
shop.setShopType(ShopType.SELLING);
shop.setSignText();
//shop.setSignText();
shop.update();
MsgUtil.sendControlPanelInfo(sender, shop);
sender.sendMessage(MsgUtil
@@ -498,7 +498,7 @@ public class QS implements CommandExecutor {
Shop shop = plugin.getShopManager().getShop(b.getLocation());
if (shop != null && shop.getModerator().isModerator(((Player) sender).getUniqueId())) {
shop.setShopType(ShopType.SELLING);
shop.setSignText();
//shop.setSignText();
shop.update();
sender.sendMessage(MsgUtil
.getMessage("command.now-selling", MsgUtil.getItemi18n(shop.getItem().getType().name())));
@@ -579,7 +579,7 @@ public class QS implements CommandExecutor {
}
// Update the shop
shop.setPrice(price);
shop.setSignText();
//shop.setSignText();
shop.update();
sender.sendMessage(MsgUtil.getMessage("price-is-now", plugin.getEcon().format(shop.getPrice())));
// Chest shops can be double shops.
@@ -327,6 +327,7 @@ public class ContainerShop implements Shop {
inv.removeItem(item);
remains = remains - stackSize;
}
this.setSignText();
}
/**
@@ -347,6 +348,7 @@ public class ContainerShop implements Shop {
inv.addItem(item);
remains = remains - stackSize;
}
this.setSignText();
}
/**
@@ -467,6 +469,7 @@ public class ContainerShop implements Shop {
*/
public void setOwner(UUID owner) {
this.moderator.setOwner(owner);
this.setSignText();
update();
}
@@ -481,6 +484,7 @@ public class ContainerShop implements Shop {
public void setUnlimited(boolean unlimited) {
this.unlimited = unlimited;
this.setSignText();
update();
}
@@ -754,6 +758,7 @@ public class ContainerShop implements Shop {
// check price restriction
Entry<Double, Double> priceRestriction = Util.getPriceRestriction(this.getMaterial());
if (priceRestriction != null) {
if (price < priceRestriction.getKey()) {
price = priceRestriction.getKey();
@@ -68,7 +68,7 @@ public class ShopLoader {
}
plugin.getQueuedShopManager()
.add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.LOAD, QueueAction.SETSIGNTEXT }));
.add(new QueueShopObject(shop, QueueAction.LOAD, QueueAction.SETSIGNTEXT));
} else {
loadAfterChunkLoaded++;
}