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

改名物品扩展显示原版物品名称...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-12-22 09:35:11 +08:00
parent 2397e33d35
commit 1934b5748c
3 changed files with 19 additions and 14 deletions

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.6.6.1</version> <version>1.6.7</version>
<description>快捷商店重置版本...</description> <description>快捷商店重置版本...</description>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
@ -55,7 +55,7 @@
<properties> <properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url> <jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<env.BUILD_NUMBER>DEBUG</env.BUILD_NUMBER> <env.BUILD_NUMBER>DEBUG</env.BUILD_NUMBER>
<update.description>&amp;c修复异步载入商店信息未刷新的问题...</update.description> <update.description>&amp;c改名物品扩展显示原版物品名称(熊孩子防不胜防)...</update.description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>

View File

@ -156,16 +156,24 @@ public class QuickShop extends JavaPlugin {
this.getServer().getScheduler().runTaskAsynchronously(this, new Runnable() { this.getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
@Override @Override
public void run() { public void run() {
while (!LocalUtil.isInit()) { int error = 0;
try { try {
Thread.sleep(500); while (!LocalUtil.isInit()) {
} catch (final InterruptedException e) { try {
Thread.sleep(500);
} catch (final InterruptedException e) {
}
} }
getLogger().info("本地化工具载入完成 刷新汉化信息...");
final Iterator<Shop> shops = shopManager.getShopIterator();
while (shops.hasNext()) {
shops.next().onClick();
}
} catch (final Exception e) {
error++;
} }
getLogger().info("本地化工具载入完成 刷新汉化信息..."); if (error != 0) {
final Iterator<Shop> shops = shopManager.getShopIterator(); getLogger().info("信息刷新完成 期间发生 " + error + " 个错误 已忽略(不是BUG 无需反馈)...");
while (shops.hasNext()) {
shops.next().onClick();
} }
} }
}); });

View File

@ -162,16 +162,13 @@ public class Util {
* @return The human readable item name. * @return The human readable item name.
*/ */
public static String getName(final ItemStack i) { public static String getName(final ItemStack i) {
// final String vanillaName = getDataName(i.getType(), i.getDurability()); final String vanillaName = LocalUtil.getItemFullName(i);
final String vanillaName = LocalUtil.getItemName(i);
return vanillaName; return vanillaName;
} }
// Let's make very long names shorter for our sign // Let's make very long names shorter for our sign
public static String getNameForSign(final ItemStack itemStack) { public static String getNameForSign(final ItemStack itemStack) {
// final String name = getDataName(itemStack.getType(), itemStack.getDurability());
String name = getName(itemStack); String name = getName(itemStack);
if (name.length() > 16) { if (name.length() > 16) {
name = name.substring(0, 16); name = name.substring(0, 16);
} }