Fix java.lang.IllegalStateException: ServiceRegisterEvent cannot be triggered asynchronously from another thread.

Former-commit-id: 1c7caddd0d612d504231b968dbd16d7750d4c0e6 [formerly a2190fc74606637d334443a77ea1a2eece4b5253]
Former-commit-id: eb2cb0cb757621cf3377728ccb949d94ab4345ce
This commit is contained in:
Ghost_chu committed 2019-06-02 11:58:49 +08:00
1 parent 4d4e6a04a2
commit 3b33bbff66
2 files changed
+13 -8

No files matched your search

@@ -296,12 +296,7 @@ public class QuickShop extends JavaPlugin {
MsgUtil.clean();
getLogger().info("QuickShop loaded!");
UpdateWatcher.init();
new BukkitRunnable() {
@Override
public void run() {
submitMeritcs();
}
}.runTaskAsynchronously(this);
submitMeritcs();
}
private void submitMeritcs() {
@@ -484,8 +484,18 @@ public class Util {
return false; // One of them is null (Can't be both, see above)
if (stack1.getType() != stack2.getType())
return false; // Not the same material
if (((Damageable) stack1.getItemMeta()).getDamage() != ((Damageable) stack2.getItemMeta()).getDamage())
return false; // Not the same durability
boolean damageA = stack1.getItemMeta() instanceof Damageable;
boolean damageB = stack2.getItemMeta() instanceof Damageable;
if (damageA != damageB) {
return false;
} else {
if (damageA = true) { //Already checked they same, so damageA=damageB=true
if (((Damageable) stack1.getItemMeta()).getDamage() != ((Damageable) stack2.getItemMeta()).getDamage()) {
return false;
}
}
}
if (!stack1.getEnchantments().equals(stack2.getEnchantments()))
return false; // They have the same enchants
if (stack1.getItemMeta().hasDisplayName() || stack2.getItemMeta().hasDisplayName()) {