Skip to content

Commit 01c3fd8

Browse files
committed
Fix build
1 parent a5b8bc2 commit 01c3fd8

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public class QuickShop extends JavaPlugin {
272272
private WorldEditAdapter worldEditAdapter;
273273
private BukkitAudiences adventure;
274274
@Getter
275-
private final TextManager textManager = new TextManager(this);
275+
private TextManager textManager ;
276276

277277
/**
278278
* Use for mock bukkit
@@ -384,6 +384,7 @@ private void load3rdParty() {
384384
}
385385
}
386386
}
387+
Bukkit.getPluginManager().registerEvents(this.compatibilityTool,this);
387388
compatibilityTool.searchAndRegisterPlugins();
388389
if (this.display) {
389390
//VirtualItem support
@@ -564,10 +565,12 @@ public void reloadConfig() {
564565
*/
565566
@Override
566567
public final void onLoad() {
568+
instance = this;
569+
Util.setPlugin(this);
567570
this.onLoadCalled = true;
568571
getLogger().info("QuickShop " + getFork() + " - Early boot step - Booting up...");
569572
//BEWARE THESE ONLY RUN ONCE
570-
instance = this;
573+
this.textManager = new TextManager(this);
571574
this.buildInfo = new BuildInfo(getResource("BUILDINFO"));
572575
runtimeCheck(EnvCheckEntry.Stage.ON_LOAD);
573576
getLogger().info("Reading the configuration...");

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Find.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import io.papermc.lib.PaperLib;
2323
import lombok.AllArgsConstructor;
24+
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
2425
import org.bukkit.Location;
2526
import org.bukkit.entity.Player;
2627
import org.bukkit.event.player.PlayerTeleportEvent;
@@ -131,7 +132,14 @@ public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @Not
131132
Shop shop = shopDoubleEntry.getKey();
132133
Location location = shop.getLocation();
133134
// "nearby-shop-entry": "&a- Info:{0} &aPrice:&b{1} &ax:&b{2} &ay:&b{3} &az:&b{4} &adistance: &b{5} &ablock(s)"
134-
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");
135+
stringBuilder.append(plugin.text().of(sender, "nearby-shop-entry",
136+
LegacyComponentSerializer.legacySection().serialize(shop.getSignText()[1]),
137+
LegacyComponentSerializer.legacySection().serialize(shop.getSignText()[3]),
138+
String.valueOf(location.getBlockX()),
139+
String.valueOf(location.getBlockY()),
140+
String.valueOf(location.getBlockZ()),
141+
String.valueOf(shopDoubleEntry.getValue().intValue())
142+
).forLocale()).append("\n");
135143
MsgUtil.sendDirectMessage(sender, stringBuilder.toString());
136144
}
137145
}

src/main/java/org/maxgamer/quickshop/util/Util.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import io.papermc.lib.PaperLib;
2525
import lombok.Getter;
2626
import lombok.NonNull;
27+
import lombok.Setter;
2728
import lombok.SneakyThrows;
2829
import net.kyori.adventure.key.Key;
2930
import net.kyori.adventure.nbt.api.BinaryTagHolder;
@@ -90,6 +91,7 @@ public class Util {
9091
private static int bypassedCustomStackSize = -1;
9192
private static Yaml yaml = null;
9293
private static boolean devMode = false;
94+
@Setter
9395
private static QuickShop plugin;
9496
private static Object serverInstance;
9597
private static Field tpsField;
@@ -1410,7 +1412,6 @@ public static HoverEvent<?> generateItemHoverEvent(ItemStack stack){
14101412
e.printStackTrace();
14111413
}
14121414
return HoverEvent.showText(Component.text("Failed to generate item preview. Consider switch to Paper."));
1413-
14141415
}
14151416

14161417
}

src/main/java/org/maxgamer/quickshop/util/compatibility/CompatibilityManager.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.maxgamer.quickshop.util.compatibility;
2121

22-
import org.bukkit.Bukkit;
2322
import org.bukkit.entity.Player;
2423
import org.bukkit.event.EventHandler;
2524
import org.bukkit.event.EventPriority;
@@ -47,7 +46,6 @@ public class CompatibilityManager extends QuickShopInstanceHolder implements Lis
4746

4847
public CompatibilityManager(QuickShop plugin) {
4948
super(plugin);
50-
Bukkit.getPluginManager().registerEvents(this, plugin);
5149
}
5250

5351
public static Map<String, Class<? extends CompatibilityModule>> getCompatibilityModuleNameMap() {

src/main/java/org/maxgamer/quickshop/util/language/text/TextManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public TextManager(QuickShop plugin) {
4343
}
4444

4545
public void load() {
46+
plugin.getLogger().info("Checking for translation updates...");
4647
locale2ContentMapping.clear();
4748
postProcessors.clear();
4849
// Load mapping

src/main/java/org/maxgamer/quickshop/util/language/text/distributions/crowdin/CrowdinOTA.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public String getFile(String fileCrowdinPath, String crowdinLocale, boolean forc
8989
throw new IllegalStateException("Failed to get project manifest");
9090
if (!manifest.getFiles().contains(fileCrowdinPath))
9191
throw new IllegalArgumentException("The file " + fileCrowdinPath + " not exists on Crowdin");
92-
if (!manifest.getCustomLanguages().contains(crowdinLocale))
92+
if (manifest.getCustomLanguages() != null && !manifest.getCustomLanguages().contains(crowdinLocale))
9393
throw new IllegalArgumentException("The locale " + crowdinLocale + " not exists on Crowdin");
9494
String postProcessingPath = fileCrowdinPath.replace("%locale%", crowdinLocale);
9595
String pathHash = DigestUtils.sha1Hex(postProcessingPath);

0 commit comments

Comments
 (0)