Fix build

This commit is contained in:
Ghost_chu committed 2021-09-26 22:09:09 +08:00
1 parent a5b8bc2508
commit 01c3fd84fa
6 files changed
+18 -7

No files matched your search

@@ -272,7 +272,7 @@ public class QuickShop extends JavaPlugin {
private WorldEditAdapter worldEditAdapter;
private BukkitAudiences adventure;
@Getter
private final TextManager textManager = new TextManager(this);
private TextManager textManager ;
/**
* Use for mock bukkit
@@ -384,6 +384,7 @@ public class QuickShop extends JavaPlugin {
}
}
}
Bukkit.getPluginManager().registerEvents(this.compatibilityTool,this);
compatibilityTool.searchAndRegisterPlugins();
if (this.display) {
//VirtualItem support
@@ -564,10 +565,12 @@ public class QuickShop extends JavaPlugin {
*/
@Override
public final void onLoad() {
instance = this;
Util.setPlugin(this);
this.onLoadCalled = true;
getLogger().info("QuickShop " + getFork() + " - Early boot step - Booting up...");
//BEWARE THESE ONLY RUN ONCE
instance = this;
this.textManager = new TextManager(this);
this.buildInfo = new BuildInfo(getResource("BUILDINFO"));
runtimeCheck(EnvCheckEntry.Stage.ON_LOAD);
getLogger().info("Reading the configuration...");
@@ -21,6 +21,7 @@ package org.maxgamer.quickshop.command.subcommand;
import io.papermc.lib.PaperLib;
import lombok.AllArgsConstructor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
@@ -131,7 +132,14 @@ public class SubCommand_Find implements CommandHandler<Player> {
Shop shop = shopDoubleEntry.getKey();
Location location = shop.getLocation();
// "nearby-shop-entry": "&a- Info:{0} &aPrice:&b{1} &ax:&b{2} &ay:&b{3} &az:&b{4} &adistance: &b{5} &ablock(s)"
stringBuilder.append(plugin.text().of(sender, "nearby-shop-entry", shop.getSignText()[1], shop.getSignText()[3], String.valueOf(location.getBlockX()), String.valueOf(location.getBlockY()), String.valueOf(location.getBlockZ()), String.valueOf(shopDoubleEntry.getValue().intValue())).forLocale()).append("\n");
stringBuilder.append(plugin.text().of(sender, "nearby-shop-entry",
LegacyComponentSerializer.legacySection().serialize(shop.getSignText()[1]),
LegacyComponentSerializer.legacySection().serialize(shop.getSignText()[3]),
String.valueOf(location.getBlockX()),
String.valueOf(location.getBlockY()),
String.valueOf(location.getBlockZ()),
String.valueOf(shopDoubleEntry.getValue().intValue())
).forLocale()).append("\n");
MsgUtil.sendDirectMessage(sender, stringBuilder.toString());
}
}
@@ -24,6 +24,7 @@ import de.themoep.minedown.adventure.MineDownParser;
import io.papermc.lib.PaperLib;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.SneakyThrows;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.nbt.api.BinaryTagHolder;
@@ -90,6 +91,7 @@ public class Util {
private static int bypassedCustomStackSize = -1;
private static Yaml yaml = null;
private static boolean devMode = false;
@Setter
private static QuickShop plugin;
private static Object serverInstance;
private static Field tpsField;
@@ -1410,7 +1412,6 @@ public class Util {
e.printStackTrace();
}
return HoverEvent.showText(Component.text("Failed to generate item preview. Consider switch to Paper."));
}
}
@@ -19,7 +19,6 @@
package org.maxgamer.quickshop.util.compatibility;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -47,7 +46,6 @@ public class CompatibilityManager extends QuickShopInstanceHolder implements Lis
public CompatibilityManager(QuickShop plugin) {
super(plugin);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
public static Map<String, Class<? extends CompatibilityModule>> getCompatibilityModuleNameMap() {
@@ -43,6 +43,7 @@ public class TextManager {
}
public void load() {
plugin.getLogger().info("Checking for translation updates...");
locale2ContentMapping.clear();
postProcessors.clear();
// Load mapping
@@ -89,7 +89,7 @@ public class CrowdinOTA implements Distribution {
throw new IllegalStateException("Failed to get project manifest");
if (!manifest.getFiles().contains(fileCrowdinPath))
throw new IllegalArgumentException("The file " + fileCrowdinPath + " not exists on Crowdin");
if (!manifest.getCustomLanguages().contains(crowdinLocale))
if (manifest.getCustomLanguages() != null && !manifest.getCustomLanguages().contains(crowdinLocale))
throw new IllegalArgumentException("The locale " + crowdinLocale + " not exists on Crowdin");
String postProcessingPath = fileCrowdinPath.replace("%locale%", crowdinLocale);
String pathHash = DigestUtils.sha1Hex(postProcessingPath);