Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holograms not working on 1.16.4 #359

Open
TheAwoo opened this issue Jan 17, 2021 · 1 comment
Open

Holograms not working on 1.16.4 #359

TheAwoo opened this issue Jan 17, 2021 · 1 comment

Comments

@TheAwoo
Copy link

TheAwoo commented Jan 17, 2021

The issue

Created shops display no holograms whatsoever. Still able to buy/sell; player balance changes properly.

PaperMC version: paper-1.16.5-428

Plugin version: Build #99

Hologram format config:

lines:
  0:
    options:
      normal-shop:
        format: "%VENDOR%"
        requirements:
          - NORMAL_SHOP

      admin-shop:
        format: "&cAdmin Shop"
        requirements:
          - ADMIN_SHOP

  1:
    options:
      default:
        format: "%AMOUNT% x %ITEMNAME%"
        requirements:

  2:
    options:
      buy-and-sell:
        format: "Buy %BUY-PRICE% | %SELL-PRICE% Sell"
        requirements:
          - BUY_PRICE > 0
          - SELL_PRICE > 0

      only-buy:
        format: "Buy %BUY-PRICE%"
        requirements:
          - BUY_PRICE > 0

      only-sell:
        format: "Sell %SELL-PRICE%"
        requirements:
          - SELL_PRICE > 0

Relevant logs:

> shop reload
[14:02:29 INFO]: [ShopChest] Using locale "en_US"
[14:02:29 INFO]: [de.epiceric.shopchest.dependencies.hikari.HikariDataSource] HikariPool-1 - Shutdown initiated...
[14:02:29 INFO]: [de.epiceric.shopchest.dependencies.hikari.HikariDataSource] HikariPool-1 - Shutdown completed.
[14:02:29 INFO]: [de.epiceric.shopchest.dependencies.hikari.HikariDataSource] HikariPool-2 - Starting...
[14:02:29 INFO]: [de.epiceric.shopchest.dependencies.hikari.HikariDataSource] HikariPool-2 - Start completed.
[14:02:29 INFO]: [ShopChest] Cleaned up economy log
[14:02:29 INFO]: Successfully reloaded 1 shop/s.
[14:02:29 WARN]: Exception in thread "pool-29-thread-3" java.lang.NullPointerException
[14:02:29 WARN]:        at java.base/java.lang.String.replace(String.java:2158)
[14:02:29 WARN]:        at de.epiceric.shopchest.shop.Shop.getHologramText(Shop.java:317)
[14:02:29 WARN]:        at de.epiceric.shopchest.shop.Shop.createHologram(Shop.java:228)
[14:02:29 WARN]:        at de.epiceric.shopchest.shop.Shop.lambda$create$1(Shop.java:141)
[14:02:29 WARN]:        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[14:02:29 WARN]:        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[14:02:29 WARN]:        at java.base/java.lang.Thread.run(Thread.java:832)

on using a shop

[14:06:44 ERROR]: Could not pass event PlayerInteractEvent to ShopChest v1.13-SNAPSHOT
java.lang.NullPointerException: null
        at java.lang.String.replace(String.java:2158) ~[?:?]
        at de.epiceric.shopchest.language.LanguageUtils.getMessage(LanguageUtils.java:2666) ~[?:?]
        at de.epiceric.shopchest.listeners.ShopInteractListener.buy(ShopInteractListener.java:874) ~[?:?]
        at de.epiceric.shopchest.listeners.ShopInteractListener.handleInteractEvent(ShopInteractListener.java:285) ~[?:?]
        at de.epiceric.shopchest.listeners.ShopInteractListener.onPlayerInteract(ShopInteractListener.java:471) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor389.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-428]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.5.jar:git-Paper-428]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-428]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.5.jar:git-Paper-428]
        at org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:510) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.PlayerInteractManager.a(PlayerInteractManager.java:464) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1549) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.PacketPlayInUseItem.a(PacketPlayInUseItem.java:27) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.PacketPlayInUseItem.a(PacketPlayInUseItem.java:5) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1132) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1125) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1086) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1000) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:173) ~[patched_1.16.5.jar:git-Paper-428]
        at java.lang.Thread.run(Thread.java:832) [?:?]
@TheAwoo
Copy link
Author

TheAwoo commented Mar 14, 2021

Update

Managed to debug and reproduce the issue on my end. As it turns out, some economy plugins do not provide a meaningful implementation of Economy.format(double) and instead just return null.

That, in turn, causes the following code to throw on a null value:

switch (placeholder) {
    case BUY_PRICE:
        replace = plugin.getEconomy().format(getBuyPrice()); // sets replace to null
        break;
    case SELL_PRICE:
        replace = plugin.getEconomy().format(getSellPrice()); // also sets replace to null
        break;
    default:
        replace = String.valueOf(placeholders.get(placeholder));
}

format = format.replace(placeholder.toString(), replace); // consumes the null and throws

Despite the issue being caused by incomplete implementations of Economy in other plugins I'd still recommend handling this case more gracefully, perhaps even printing out a message to nag the authors of used econ plugin to provide a proper format implementation.

TheAwoo added a commit to TheAwoo/BetterEconomy that referenced this issue Mar 15, 2021
This change fixes interfacing with some economy-dependant plugins, for instance ShopChest. Related issue: EpicEricEE/ShopChest/issues/359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant