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

Add compatibility with Itemsadder//Oraxen #176

Open
2 tasks done
Olthoo opened this issue Apr 14, 2023 · 16 comments
Open
2 tasks done

Add compatibility with Itemsadder//Oraxen #176

Olthoo opened this issue Apr 14, 2023 · 16 comments
Assignees
Labels
enhancement New feature or request in progress being worked on

Comments

@Olthoo
Copy link

Olthoo commented Apr 14, 2023

Is your feature request related to a problem?

no

Describe the solution you'd like.

I'd like to be able to limit the quantity of some custom blocks as well as vanilla one

In my case i'm using Itemsadder but some people might want oraxen compatibility

Describe alternatives you've considered.

N/A

Agreements

  • I have searched for and ensured there isn't already an open issue regarding this.
  • I have ensured the feature I'm requesting isn't already in the latest supported BentoBox build or Addons.

Other

https://itemsadder.devs.beer/developers/java-api

https://docs.oraxen.com/developers/api

@tastybento tastybento added the under investigation this is being looked into label Apr 14, 2023
@tastybento tastybento self-assigned this Apr 14, 2023
@tastybento
Copy link
Member

I just did a quick try. I haven't tested it yet because to install ItemsAdder requires a lot of setup. You can give it a go (on a test server!) if you like. Here's the jar:
Limits-1.19.1-SNAPSHOT-LOCAL.jar.zip

@Olthoo
Copy link
Author

Olthoo commented Apr 15, 2023

Wow that was fast! I'm gonna give it a try right now !

If you need help with the setup it can be done really quickly just ping me on the discord 😄

@tastybento
Copy link
Member

Okay, I'm in the middle of something right now, but I plan to test this weekend. I have not tested it at all yet (!) so I'll be very surprised if it works, but maybe! Share the error if it bugs out.

@Olthoo
Copy link
Author

Olthoo commented Apr 15, 2023

how shoud I define a limit of an ia block in the config ?

# Game Modes covered by limits
gamemodes:
- BSkyBlock

# Ignore this island's center block. For most worlds, this is bedrock, but for AOneBlock it is
# the magic block, so ignoring it from limits makes sense.
ignore-center-block: false

# Permissions
# Island owners can be given permissions that override all general settings
# Format is GAME-MODE-NAME.island.limit.MATERIAL.LIMIT
# example: bskyblock.island.limit.hopper.10 
# permission activates when player logs in.
#
# Cooldown for player recount command in seconds
cooldown: 120

# Use async checks for snowmen and iron golums. Set to false if you see problems.
async-golums: true

# General block limiting
# Use this section to limit how many blocks can be added to an island.
# 0 means the item will be blocked from placement completely.
# These limits apply to every game mode world
blocklimits:
  HOPPER: 10
  customcrops:pot: 5
# This section is for world-specific limits and overrides the general limit
# Specify each world you want to limit individually (including nether and end worlds)
# If these worlds are not covered by the game modes above, nothing will happen
worlds:
  bskyblock_world:
#    HOPPER: 11

# Default entity limits within a player's island space (protected area and to island limit).
# A limit of 5 will allow up to 5 entities in over world, 5 in nether and 5 in the end.
# Affects all types of creature spawning. Also includes entities like MINECARTS.
# Note: Only the first 49 limited blocks and entities are shown in the limits GUI.
entitylimits:
  

@tastybento
Copy link
Member

Have a look here:

# Custom block limits

@tastybento
Copy link
Member

So, uncommented:

customblocklimits:
  "iafestivities:christmas/christmas_tree/green_orb": 5

@Olthoo
Copy link
Author

Olthoo commented Apr 15, 2023

thanks, it doesn't work for now , here is the error when placing a limited block

[21:57:11] [Server thread/INFO]: Olthoo issued server command: /tp Noxa2408
[21:57:23] [Server thread/ERROR]: Could not pass event kT to BentoBox v1.22.1-SNAPSHOT-b2377
java.lang.NullPointerException: Cannot invoke "java.util.Map.containsKey(Object)" because "this.customBlockLimits" is null
	at world.bentobox.limits.objects.IslandBlockCount.isCustomBlockLimited(IslandBlockCount.java:204) ~[Limits.jar:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.checkCustomLimit(BlockLimitsListener.java:497) ~[Limits.jar:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.lambda$process$3(BlockLimitsListener.java:396) ~[Limits.jar:?]
	at java.util.Optional.map(Optional.java:260) ~[?:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.process(BlockLimitsListener.java:377) ~[Limits.jar:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.onBlock(BlockLimitsListener.java:185) ~[Limits.jar:?]
	at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1050.execute(Unknown Source) ~[?:?]
	at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:git-Purpur-1933]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:617) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at ia.m.jK.a(SourceFile:423) ~[ItemsAdder.jar:?]
	at ia.m.cD.a(SourceFile:341) ~[ItemsAdder.jar:?]
	at ia.m.cD.i(SourceFile:159) ~[ItemsAdder.jar:?]
	at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:40) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:git-Purpur-1933]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:617) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:546) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.level.ServerPlayerGameMode.useItemOn(ServerPlayerGameMode.java:530) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleUseItemOn(ServerGamePacketListenerImpl.java:2040) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.handle(ServerboundUseItemOnPacket.java:37) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.a(ServerboundUseItemOnPacket.java:9) ~[?:?]
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1368) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1345) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1338) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1316) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1204) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
[21:57:24] [Server thread/ERROR]: Could not pass event kT to BentoBox v1.22.1-SNAPSHOT-b2377
java.lang.NullPointerException: Cannot invoke "java.util.Map.containsKey(Object)" because "this.customBlockLimits" is null
	at world.bentobox.limits.objects.IslandBlockCount.isCustomBlockLimited(IslandBlockCount.java:204) ~[Limits.jar:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.checkCustomLimit(BlockLimitsListener.java:497) ~[Limits.jar:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.lambda$process$3(BlockLimitsListener.java:396) ~[Limits.jar:?]
	at java.util.Optional.map(Optional.java:260) ~[?:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.process(BlockLimitsListener.java:377) ~[Limits.jar:?]
	at world.bentobox.limits.listeners.BlockLimitsListener.onBlock(BlockLimitsListener.java:185) ~[Limits.jar:?]
	at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1050.execute(Unknown Source) ~[?:?]
	at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:git-Purpur-1933]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:617) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at ia.m.jK.a(SourceFile:423) ~[ItemsAdder.jar:?]
	at ia.m.cD.a(SourceFile:341) ~[ItemsAdder.jar:?]
	at ia.m.cD.i(SourceFile:159) ~[ItemsAdder.jar:?]
	at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:40) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:git-Purpur-1933]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:617) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:546) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.level.ServerPlayerGameMode.useItemOn(ServerPlayerGameMode.java:530) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleUseItemOn(ServerGamePacketListenerImpl.java:2040) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.handle(ServerboundUseItemOnPacket.java:37) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.a(ServerboundUseItemOnPacket.java:9) ~[?:?]
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1368) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1345) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1338) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1316) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1204) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[purpur-1.19.3.jar:git-Purpur-1933]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]```

@Olthoo
Copy link
Author

Olthoo commented Apr 15, 2023

full logs https://mclo.gs/1O23KnE

@tastybento
Copy link
Member

Limits-1.19.1-SNAPSHOT-LOCAL.jar.zip
Pretty sure that's due to backward compatibility issues with your current database files that don't track the custom blocks so they are null. This should fix that.

@Olthoo
Copy link
Author

Olthoo commented Apr 15, 2023

now I get the message in chat but i'm still not limited
I don't get any error in the console

image

@tastybento tastybento added enhancement New feature or request in progress being worked on and removed under investigation this is being looked into labels Apr 15, 2023
@tastybento
Copy link
Member

So, just to clarify, when you place the block, you get a limit alert (I can see above) but you can still place the block?

@Olthoo
Copy link
Author

Olthoo commented Apr 16, 2023

exactly

@Olthoo
Copy link
Author

Olthoo commented May 16, 2023

any news on this request ? 😄

@tastybento
Copy link
Member

Limits-1.19.1-SNAPSHOT-LOCAL.jar.zip
I have changed the priority of the event listeners to try and run first before the other plugin has a chance to react to the block placing. I suspect that they are placing the block and then I am canceling the event after that. Clearly, the limiting logic is correct because you are getting the alert.
Try the attached and see if that works. If it doesn't then the issue is that the other plugin is not respecting the cancelation. Let's see...

@Olthoo
Copy link
Author

Olthoo commented May 22, 2023

Thanks for your answer, I get the same result with this version.
The chat warning seems to only trigger once every 4-5 blocks placed when the player spam it
The limit is still not preventing the player placing blocks

@Olthoo
Copy link
Author

Olthoo commented Sep 15, 2023

Hi any news on this subject ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress being worked on
Projects
Development

No branches or pull requests

2 participants