mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-22 01:58:54 +00:00
fix: 修复1.9不能异步操作方块的问题
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
e3223aa25f
commit
bbea4b57f8
5
pom.xml
5
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.maxgamer</groupId>
|
<groupId>org.maxgamer</groupId>
|
||||||
<artifactId>QuickShop</artifactId>
|
<artifactId>QuickShop</artifactId>
|
||||||
<version>1.8.9</version>
|
<version>1.9.0</version>
|
||||||
<description>快捷商店重置版本...</description>
|
<description>快捷商店重置版本...</description>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
@ -60,11 +60,10 @@
|
|||||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
||||||
<update.description>&a全新版本 &c虚拟悬浮物(橙子提供 对 就是那个汉化COI的逗比)&e7老板修复逗比BUG...</update.description>
|
<update.description>&a全新版本 &c虚拟悬浮物(橙子提供 对 就是那个汉化COI的逗比)&e7老板修复逗比BUG...</update.description>
|
||||||
<update.changes>
|
<update.changes>
|
||||||
|
&b1.9.0 - &c修复1.9开始以后不允许异步更新木牌的问题...;
|
||||||
&b1.8.9 - &c修复虚拟物品产生的异常...;
|
&b1.8.9 - &c修复虚拟物品产生的异常...;
|
||||||
&b1.8.8 - &c修复异步处理购买事件导致的状态错误...;
|
&b1.8.8 - &c修复异步处理购买事件导致的状态错误...;
|
||||||
- &c修复配置文件部分字段不存在导致的报错...;
|
- &c修复配置文件部分字段不存在导致的报错...;
|
||||||
&b1.8.7 - &e异步处理getOfflinePlayer 只能保证不卡服 连不上MOJANG-API还是一样...;
|
|
||||||
- &c修复部分情况下可以跳过AuthMe和Residence的事件拦截...;
|
|
||||||
</update.changes>
|
</update.changes>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -22,6 +22,8 @@ import org.maxgamer.QuickShop.QuickShop;
|
|||||||
import org.maxgamer.QuickShop.Util.MsgUtil;
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
import org.maxgamer.QuickShop.Util.Util;
|
import org.maxgamer.QuickShop.Util.Util;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.kit.PluginKit;
|
||||||
|
|
||||||
public class ContainerShop implements Shop {
|
public class ContainerShop implements Shop {
|
||||||
private DisplayItem displayItem;
|
private DisplayItem displayItem;
|
||||||
private final ItemStack item;
|
private final ItemStack item;
|
||||||
@ -602,19 +604,26 @@ public class ContainerShop implements Shop {
|
|||||||
if (Util.isLoaded(this.getLocation()) == false) {
|
if (Util.isLoaded(this.getLocation()) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final ContainerShop shop = this;
|
||||||
|
// 1.9不能异步修改木牌
|
||||||
|
PluginKit.runTask(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
final String[] lines = new String[4];
|
final String[] lines = new String[4];
|
||||||
lines[0] = ChatColor.RED + "[QuickShop]";
|
lines[0] = ChatColor.RED + "[QuickShop]";
|
||||||
if (this.isBuying()) {
|
if (shop.isBuying()) {
|
||||||
final int remsp = this.getRemainingSpace();
|
final int remsp = shop.getRemainingSpace();
|
||||||
lines[1] = MsgUtil.p("signs.buying", "" + (remsp == 10000 ? "无限" : remsp));
|
lines[1] = MsgUtil.p("signs.buying", "" + (remsp == 10000 ? "无限" : remsp));
|
||||||
}
|
}
|
||||||
if (this.isSelling()) {
|
if (shop.isSelling()) {
|
||||||
final int remst = this.getRemainingStock();
|
final int remst = shop.getRemainingStock();
|
||||||
lines[1] = MsgUtil.p("signs.selling", "" + (remst == 10000 ? "无限" : remst));
|
lines[1] = MsgUtil.p("signs.selling", "" + (remst == 10000 ? "无限" : remst));
|
||||||
}
|
}
|
||||||
lines[2] = Util.getNameForSign(this.item);
|
lines[2] = Util.getNameForSign(shop.item);
|
||||||
lines[3] = MsgUtil.p("signs.price", "" + this.getPrice());
|
lines[3] = MsgUtil.p("signs.price", "" + shop.getPrice());
|
||||||
this.setSignText(lines);
|
shop.setSignText(lines);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -628,13 +637,20 @@ public class ContainerShop implements Shop {
|
|||||||
if (Util.isLoaded(this.getLocation()) == false) {
|
if (Util.isLoaded(this.getLocation()) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (final Sign sign : this.getSigns()) {
|
final List<Sign> signs = this.getSigns();
|
||||||
|
// 1.9不能异步修改木牌
|
||||||
|
PluginKit.runTask(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (final Sign sign : signs) {
|
||||||
for (int i = 0; i < lines.length; i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
sign.setLine(i, lines[i]);
|
sign.setLine(i, lines[i]);
|
||||||
}
|
}
|
||||||
sign.update();
|
sign.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUnlimited(final boolean unlimited) {
|
public void setUnlimited(final boolean unlimited) {
|
||||||
|
@ -24,8 +24,6 @@ import org.maxgamer.QuickShop.Database.Database;
|
|||||||
import org.maxgamer.QuickShop.Util.MsgUtil;
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
import org.maxgamer.QuickShop.Util.Util;
|
import org.maxgamer.QuickShop.Util.Util;
|
||||||
|
|
||||||
import cn.citycraft.PluginHelper.kit.PluginKit;
|
|
||||||
|
|
||||||
public class ShopManager {
|
public class ShopManager {
|
||||||
private final HashMap<String, Info> actions = new HashMap<String, Info>();
|
private final HashMap<String, Info> actions = new HashMap<String, Info>();
|
||||||
|
|
||||||
@ -290,9 +288,6 @@ public class ShopManager {
|
|||||||
warings.add(p.getName());
|
warings.add(p.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PluginKit.scheduleTask(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// Figures out which way we should put the sign on and
|
// Figures out which way we should put the sign on and
|
||||||
// sets its text.
|
// sets its text.
|
||||||
if (info.getSignBlock() != null && info.getSignBlock().getType() == Material.AIR && plugin.getConfig().getBoolean("shop.auto-sign")) {
|
if (info.getSignBlock() != null && info.getSignBlock().getType() == Material.AIR && plugin.getConfig().getBoolean("shop.auto-sign")) {
|
||||||
@ -316,8 +311,6 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
/* They didn't enter a number. */
|
/* They didn't enter a number. */
|
||||||
catch (final NumberFormatException ex) {
|
catch (final NumberFormatException ex) {
|
||||||
p.sendMessage(MsgUtil.p("shop-creation-cancelled"));
|
p.sendMessage(MsgUtil.p("shop-creation-cancelled"));
|
||||||
@ -325,7 +318,9 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Purchase Handling */
|
/* Purchase Handling */
|
||||||
else if (info.getAction() == ShopAction.BUY) {
|
else if (info.getAction() == ShopAction.BUY)
|
||||||
|
|
||||||
|
{
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
try {
|
try {
|
||||||
amount = Integer.parseInt(message);
|
amount = Integer.parseInt(message);
|
||||||
@ -473,9 +468,12 @@ public class ShopManager {
|
|||||||
shop.setSignText(); // Update the signs count
|
shop.setSignText(); // Update the signs count
|
||||||
}
|
}
|
||||||
/* If it was already cancelled (from destroyed) */
|
/* If it was already cancelled (from destroyed) */
|
||||||
else {
|
else
|
||||||
|
|
||||||
|
{
|
||||||
return; // It was cancelled, go away.
|
return; // It was cancelled, go away.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user