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

异步发送商店信息 防止getOfflinePlayer卡服

This commit is contained in:
502647092 2016-03-23 23:00:56 +08:00
parent 43c6c7a0ef
commit 44ec03bd30
3 changed files with 56 additions and 49 deletions

34
pom.xml
View File

@ -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.5</version> <version>1.8.6</version>
<description>快捷商店重置版本...</description> <description>快捷商店重置版本...</description>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
@ -52,18 +52,30 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<ciManagement>
<system>Jenkins</system>
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
</ciManagement>
<properties> <properties>
<jenkins.url>http://hs.yumc.pw:8080</jenkins.url>
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT> <env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
<update.description>&amp;a全新版本 &amp;c虚拟悬浮物(橙子提供 对 就是那个汉化COI的逗比)&amp;e7老板修复逗比BUG...</update.description> <update.description>&amp;a全新版本 &amp;c虚拟悬浮物(橙子提供 对 就是那个汉化COI的逗比)&amp;e7老板修复逗比BUG...</update.description>
<update.changes> <update.changes>
&amp;b1.8.5 - &amp;e我是打酱油的 我上个兄弟抽风 不能下载更新...; &amp;b1.8.6 - &amp;c修复getOfflinePlayer导致的服务器卡顿(连不上MOJANG...);
&amp;b1.8.4 - &amp;c清理多余的监听事件,修复部分版本不兼容问题 支持1.9...; &amp;b1.8.4 - &amp;7清理多余的监听事件,修复部分版本不兼容问题 支持1.9...;
&amp;b1.8.3 - &amp;c修复漏斗传输NPE错误...; &amp;b1.8.3 - &amp;7修复漏斗传输NPE错误...;
&amp;b1.8.2 - &amp;c修复箱子的标题为Null是产生的报错...;
</update.changes> </update.changes>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>yumc-repo</id>
<url>http://repo.yumc.pw/content/groups/public/</url>
</repository>
</repositories>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>jtb</id> <id>jtb</id>
@ -71,16 +83,6 @@
<url>http://repo.yumc.pw/content/repositories/yumcenter/</url> <url>http://repo.yumc.pw/content/repositories/yumcenter/</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
<repositories>
<repository>
<id>yumc-repo</id>
<url>${jenkins.url}/plugin/repository/everything/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>

View File

@ -172,14 +172,17 @@ public class MsgUtil {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void sendShopInfo(final Player p, final Shop shop, final int stock) { public static void sendShopInfo(final Player p, final Shop shop, final int stock) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
// Potentially faster with an array? // Potentially faster with an array?
final ItemStack item = shop.getItem(); final ItemStack item = shop.getItem();
p.sendMessage(""); p.sendMessage("");
p.sendMessage(""); p.sendMessage("");
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+"); p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.shop-information")); p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.shop-information"));
p.sendMessage(ChatColor.DARK_PURPLE + "| " p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.owner",
+ MsgUtil.p("menu.owner", Bukkit.getOfflinePlayer(shop.getOwner()).getName() == null ? (shop.isUnlimited() ? "系统商店" : "未知") : Bukkit.getOfflinePlayer(shop.getOwner()).getName())); Bukkit.getOfflinePlayer(shop.getOwner()).getName() == null ? (shop.isUnlimited() ? "系统商店" : "未知") : Bukkit.getOfflinePlayer(shop.getOwner()).getName()));
final String msg = ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.item", shop.getDataName()); final String msg = ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.item", shop.getDataName());
sendItemMessage(p, shop.getItem(), msg); sendItemMessage(p, shop.getItem(), msg);
if (Util.isTool(item.getType())) { if (Util.isTool(item.getType())) {
@ -205,4 +208,6 @@ public class MsgUtil {
p.sendMessage(MsgUtil.p("how-many-sell", items)); p.sendMessage(MsgUtil.p("how-many-sell", items));
} }
} }
});
}
} }

View File

@ -10,7 +10,7 @@ authors:
softdepend: softdepend:
- Vault - Vault
- WowSuchCleaner - WowSuchCleaner
website: ${jenkins.url}/job/${project.artifactId}/ website: ${ciManagement.url}
commands: commands:
qs: qs:
description: QuickShop 命令 description: QuickShop 命令