-
Hello, I'm getting
local Bukkit = import "org.bukkit.Bukkit"
local ResourcePackStatus = import "org.bukkit.event.player.PlayerResourcePackStatusEvent$Status"
---
-- Listeing to PlayerResourcePackStatusEvent in order to send welcome/motd message when player joins and loads all server resource-packs.
script.hook("org.bukkit.event.player.PlayerResourcePackStatusEvent", function(event)
-- Listeing for the SUCCESSFULLY_LOADED status.
if (event:getStatus() == ResourcePackStatus.SUCCESSFULLY_LOADED) then
-- Retrieving amount of resource-packs that have been sent to the player.
local sent = event:getPlayer():getMetadata("sent_resource-packs"):get(0):asInt();
-- Retrieving amount of resource-packs that have been loaded by the player.
local loaded = event:getPlayer():getMetadata("loaded_resource-packs"):get(0):asInt()
-- Checking whether this resource-pack associated with this event is the last to be loaded by the player.
if (sent == loaded) then
Bukkit:dispatchCommand(Bukkit:getConsoleSender(), "dialogs send " .. event:getPlayer():getName() .. " welcome/motd")
end
end
end) As far as I can tell, I'm setting metadata in my plugin that I've written in Java, I'm also able to access it using the same methods. // Setting metadata so other plugins/scripts can easily tell if player has loaded all resource-packs sent by the server.
final int count = player.getMetadata("sent_resource-packs").get(0).asInt();
player.setMetadata("sent_resource-packs", new FixedMetadataValue(plugin, count + 1)); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I beleive that Freggy had the same issue while making his own gamemode which he described here. I can't confirm 100% if it is or not but looking up that error suggests to do something similar to what he did. Can you try adding |
Beta Was this translation helpful? Give feedback.
I beleive that Freggy had the same issue while making his own gamemode which he described here. I can't confirm 100% if it is or not but looking up that error suggests to do something similar to what he did.
Can you try adding
--add-opens=java.base/java.util=ALL-UNNAMED
to the JVM startup arguments?