#help-development
1 messages · Page 1183 of 1
i mean the drop
like everything but the part where i want it to not drop raw iron works
Looking for developers for an OG prison server from scratch
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Thanks!
Because Block#getDrops isn’t actually tied to the items that are dropped
I believe there is BlockBreakEvent#setDropItems
does player.getInventory().addItem() error out if the inventory is full
or does it drop it
@return A HashMap containing items that didn't fit.
lynx out here sending empty messages
Can anyone comment on why this code is somehow wrong? I even wrapped it in "valueOf" in hopes it would stop shitting itself
This enum works, and is written, literally the same.
help
you dont pass loc iirc, it takes it from localPlayer
try without it
so what should i pass?
when i first started messing with wg
location was
red
because i didnt import it
but i saw two options
import from bukkit
or world gaurd
and i choose bukkit
so i think that might be doing something
not sure
ohhh
declaration: package: com.sk89q.worldguard.protection.regions, class: RegionQuery
Arre you actually passing com.sk89q.worldedit.util.Location as your location?
Yeah I just told you that.
the location ur using is of Bukkit, you need to convert it to Location from Worldguard using this func
is there an event that fires when a minecraft server autosaves (or just saves is fine too)
WorldSaveEvent
Try PDC if you want nbt that persists, but nbt does persist, yes
Awesome
?pdc
PS, I'm currently using a very ancient version
I thought NBT-API eliminated that?
Idk what nbt api is
Whenever I used legacy versions, I've been using nms to do nbt stuff
Yeah that thing just uses nms in the background so you don't have to
Would you recommend using NBT-API over yaml?
Depends on what you are doing, both can be a great choice
For example, adding data to items -> nbt
I'm storing data, to be specific, a number
For what is it?
?paste
Yeah you can definitely use NBT right there
I should probably get my code reviewed
If you don't need it to get parsed out again, you can just set it in your item desc/lore or title, but if you do, consider storing it in nbt
Alrighty
Doesn't matter for me to support, bad code is also code, and I can read Java Code, so we good ;)
Also don't really have the time to analyse the exact code rn, I am literally omw walking to school rn
Thank you!
EntityTargetLivingEntityEvent
is it possible to prevent eye contact with mobs with this event? just like spectator mode
or u can only cancel eye contact with protocollib
inside of there just put event.setCancelled(true);
what it does is just ignore the player but still look at players if not in spectator mode
im looking for a solution to make myself completely invisible like spectator mode (prevent eye contact)
EntityTargetEvent
add that one in addition
and for both make it check for player, like if (event.getTarget() instanceof Player) { //cancel }
ye tried it acts like creative mode, but still can't prevent eye contact
It's not about the entity despawning it's about keeping ticking the entity even if nobody's around and keeping the chunk loaded.
The workaround works fine at the moment
Btw does anyone here knows is there's an event when a villager panics?
Or is reflection is the only way for now?
most likely part of the brain which isn't in the api
I'm wondering if you can change the entitys direction to the same it has as the event is called before it actually happens. Or set it one tick later but that might look weird idk
One of the servers I work on currently uses GadgetsMenu, and players are able to phase through the map while flying upwards while riding the Blaze pet. Is there a way to prevent this, such as by implementing a phase check?
check if their head is in a block and they're riding the blaze pet, then teleport them a block down again
https://paste.md-5.net/uqoyefawof.java, this is the code, any thoughts?
Store the last position, get a vector from that last pos to the new pos, then check if that ray hit a block. That should be how you can detect if they hit a block above them
Actually you could just use an up vector of (0, 1, 0) from the last position
Is the code wrong?
You're still just doing the same thing but with unnecessary steps, you'd need to raycast with a vector of getFrom pointing towards getTo. Make sure not to normalize it since the length is important here. That should get the block hit, if there is one. Then, if a block was hit, get the hit location. You'd want to teleport back down the distance from getTo - the hit loc, then like another .1 or so to make sure you don't get clipped into the block
This way accounts for any movement speed, so if you're moving really fast it will still detect the collision and teleport accordingly
Wait I didn't realize that was cancelable so yeah no teleport just cancel i guess
I'll give this a shot
alright gl man I'm boutta go do some chess puzzles and pass out
ye it was goofy, i think i tried smth like that before. The entity tries to rotate its head like a robot
Doesn't seem to function 🤔
Hey team, when trying to add Bukkit 1.20.5-R0.1-SNAPSHOT to my maven project, it says it cannot find the artifact. Downloading the maven-metadata.xml it says that the latest is 1.15.2.R0.1-SNAPSHOT when 1.20.5-R0.1-SNAPSHOT actually exists. Who can we reach out to get the maven-metadata.xml file updated?
Use 1.20.6
1.20.5 should not be used, 1.20.6 is only a lil hotfix
Doesn't look like Bukkit has a 1.20.6? https://hub.spigotmc.org/nexus/service/rest/repository/browse/snapshots/org/bukkit/bukkit/
^^ use Spigot
I'm a pre 1.13.2 dev, just coming back from the abyss haha
Back in those days we were told to use bukkit-api during development
Spigot did exist there
Yeah no doubt, spigot definitely exist. It came into the picture maybe 1.7 ish
1.8 iirc
Coolio but the latest and greatest is to ditch using BukkitAPI and instead use Spigot ?
Nah there was a 1.7.10 build of spigot
I believe there are a couple 1.7.10 jars of Spigot
Idk about before that
Yup
1.7.2 might exist as well
shouldn't be using those
awesome thanks
My plugin.yml still has a api-version: 1.13 is that property still relavent to spigot?
Yes
pretty much just keep it the same version as whatever I declare in my pom.xml right?
^^ so Spigot can run it's compatibility mode
Hmm, so if I am not using any of the newer api method, this value could technically be lower than what I set for spigot in my pom.xml?
yes
Sweet thanks
Do note the lowest value you can put is 1.13
versions older than that will just ignore it
and not all versions support minimum version being specified
Thanks, yeah I recall this property was introduced around that time
(strong recommendation to put this at the minimum version you are going to support, the software may apply things to your plugin if you set it to low, that cause it to break)
yeah that's why I said this
Yeah, I think for ease of maintainability I'll just keep it the same as whatever version I vend with pom.xml
yea 
I think spigot is fine with anything beyond 1.13, I know paper does some optional stuff for higher versions
I would always advise you do that, ye
actually spigot also does that now with the enum -> interface
Wanting to use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#setEnchantmentGlintOverride(java.lang.Boolean) which I believe was introduced in 1.20.5
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
So 1.13 -> 1.20.5, I'm probs gonna have quite a few things break in my plugin (I recall hearing about a bunch of Material/ItemStack changes throughout the years)
Just like components 
before that you'd use an empty enchantment tag or things like that, it was kind of hacky
I'd recommend going straight for 1.21.3 if you're going to upgrade
the harder version to upgrade is in fact 1.20.5 anyway so you'll have to suffer through that
rip the 1 user that is still on 1.14.4 and the 2 users on 1.17.1
do plugins refuse to load if the api version is higher than the server's?
nope
Around 50% of my userbase floats around 1.20~ so I might continue supporting that for a while
one tip
don't get yourself into localizednames
they got removed in 1.21. just use the pdc at the beginning :)
never heard of that so I guess I'm lucky?
yeah they were pretty much always missused
Yes
really?
I did see a bunch of threads talk about PDC which was supposed to replace NBT I believe?
yes
It doesn't replace NBT
It uses NBT I believe
o
Unless it’s a server version that doesn’t even support api-version
interesting
oh, i remember testing my 1.21 plugin on a 1.20.6 server (didn't notice until i ran into method not found)
I guess it make sense, If my plugin declares 1.21.3 and you try to run it on a 1.20 server the risk is I could be using methods that don't exist in 1.20
So what is the server gonna do it that case if it tries to run the actual code, poops :p
kinda hate it tbh
what if my plugin supports both versions properly by doing reflective checks
then it'll enable legacy conversion for no reason
Honestly I feel like the api-version can be easily forgotten to be bumped
whats the latest take on NMS, is it still taboo, or has the landscape gotten better now?
It's much easier to work with now
^^
yarn >>>>
^^ if you want to take a look
Hmm I wonder
Thanks, I think it will be a good read anyways to bring me up to speed
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
Can I call papers native adventure methods using objects that are from the adventure version I have shaded
No
what
Interestingly enough, I had some old NMS code that survived version bumps
Especially because tou should be relocating adventure
defs died in 1.20.5 +
If you wanna support spigot crud, you are limited to the Bukkit platform sadly
Or just drop spigot support 😉
With fallback to the legacy serializer
someone should update this command
Man the landscape sure has changed
it is just https://mappings.dev/ now
Well maybe it should be a better platform smh my head
I feel like I have to drink out of the waterhose again with all this new info
Maybe spigot could just support it

Chocoooo
Well that's still not even adventure 😦
honestly I like what Spigot did with components in that PR
it doesn't have to be adventure
?cc edit mappings Compare different mappings with this website: https://mappings.dev/
Yes I also like chocos pr
Smh does the command not work in this channel
nah
?mappings
Compare different mappings with this website: https://mappings.dev/
Coming out of retirement was all because I had users from the paper side report everything died.
Then I saw this:
As of 1.20.5, the versioned relocation of the CraftBukkit package was removed and CraftBukkit packages are now located in org.bukkit.craftbukkit and not in org.bukkit.craftbukkit.<version>.
and everything made sense, time for a big overhaul and remove that hacky code
it'd be nice if it were adventure since it's pretty much the component platform nowadays, but as long as it is complete and the API is reasonable enough then I don't mind it not being adventure
Didn't understand their whole announcement but apparently it was for the "better"
But if spigot can include Mojang mappings without breaking everyone, surely they coulda too
It breaks internal usage
What
Spigot doesn't include Mojang mappings
the server is not mojang mapped either
Well maybe if the api was magical and could do everything!
fix it lynx
O, then what the link that was sent earlier that had the plugins?
that did the mapping or something
It allows you to develop with Mojang mappings but it reobfuscates the code when you build
what you do is run build tools to generate a remapped vesion with mojmap, and then specialsource makes use of that in your plugin as dependency instead
Spigot doesn't
ohh yeah, isn't that what paper also does now though? or do they actually compile server with mappings too?
they do both
So I guess as a plugin dev it doesn't make too much of a difference?
not really, just tooling difference
in the end this is all for use of internals anyway so if you stick to API then it really doesn't matter
it used to be impossible in older versions, but the API is much more complete nowadays than it was before
paper also provides paperweight-userdev which has all nms stuff available
as long as you don't depend on the newer features being there that is, item components and the like are still things spigot is playing catchup with mojang
I've seen that paper merged their item component API recently, wonder what people think of it
We have methods for most of the component stuff
Needs some more work on dx
I think the new food stuff is missing tho
oh boy, what is item component? sounds like another new topic I need to consume
last time I saw the thread about it in the api discussion channel there wasn't much talk and I hated how it used builders for everything
How do I make an apple non-edible
New system for custom data on items
https://mappings.dev/ dam, I can't believe the domain name was snagged just for minecraft xD
tell the player that if they eat it, owen comes to their house
lynx just actually'd you smh
But Mojang also took it as an excuse to add a bunch of new functionality to items
Tooltip hiding, custom tooltip backgrounds, etc
So kinda like a PDC but for Items?
PDC is arbitrary data
Items already have PDC
item components are for modifying the item's behavior
wait till you hear about display entities and custom fonts and shaders
🤯
i.e., make a tool edible or make any item a tool
Wait until you hear about data driven bloc- oh wait not yet
Dam, this sounds like CSS in Java :p
Wait till you hear about signed chat and chat reporting
Oh yeah that thing people freaked out about and then immediately forgot
that one I'm not excited about, I love that there's more security towards chat but it broke all my fancy conversation stuff that I used to have with villagers smh
Probably because it just doesn’t work on most servers
Since they customize chat in some way
wait till you realise that you can do this now
how do I open a book on a player in 1.8.8
periodic announcements be like
nvm go tit
I will not go tit
my fault
When do we get minecraft Adblock
Client mod that blocks all those messages telling you to go to a servers store page :p
hmm we should make those announcements be per-player and customised ads, good idea
surely you could chcuk google ads in a minecraft plugin
like imagine player had to watch an ad to join a server
easy W
That’s just minehut
yea
Although the commercial usage guidelines do have things to say about that
How would I be able to find if an Item has a certain enchantment meta.getEnchants().forEach(enchantment -> enchantment.<something>?);
split it to a string list and run contains
But If I need to remove the enchant I'll rprobs have to loop through 😅
map
wait I'm silly
meta.removeEnchant aight problem solved, no looping need to be done :p
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
Hey, does someone have a snippet for getting the tps of a server by hazard? Would be very much appreciated.
Best i could find was this https://bukkit.org/threads/get-server-tps.143410/
Hi, could someone tell me in 1.8 Bukkit how I could cancel the consumption of a strength potion, for example?
Probably PlayerItemConsumeEvent
I tested it didn't work, maybe I'm doing it wrong
fun question
now that biomes are keys
or rather registry values
are the values still uppercase
confused
trying to add compatibility for custom biomes
now taht that is technically possible via the api
yeah I know
Plugins should have been pulling Biome constants from the biome registry to begin with
If they were doing Enum.valueOf() then they were doing it wrong :p
most were
I mean, Registry is still a fairly recent API
just trying to grab the most popular world gen plugins and basically make a method where if I am, say, looking at a desert biome form vanilla, it would also then go pick all the terralith, terraformgenerator and terra biomes that would fit that
so that stuff like biome-specific structures will spawn in appropriate biomes even if people are not using vanilla biomes
10/10
I haven't really messed with registry at all honestly
don't think we can see biome tags afaik but if we could that would be pretty cool
It was added in 1.13, 6 years ago
It's not recent lol
that was only 6 years ago?!
tbf my codebase is older
COVID distorted the perception of time for a lot of people
That was a 3 year period lol
I never had any to begin with lmfao
depending on your country
5m? 5h? no diff
Minecraft 1.13 is 6 years, 4 months old.
it really is 6 dam
it's recent from a plugin development perspective, and there wasn't much of a heads up for people to know "hey, these are not hardcoded enums anymore but registries, use this instead of that" so the expectation was still to just use enums until rather recently when using registries did become useful to support datapack stuff and what not
registries themselves have been long part of the internals of the game so if anything, it's surprising the API users are just catching up right now
there was just no benefit to using a registry since the API didn't change until recently with the movement from enums to interfaces, and people didn't care enough about datapacks or mods
yeah I mean up until now the most complex thing I did with biomes getting enum from string
It’s best to have a configurable list of biomes for your structures
Then one can easily add custom biomes to it
The benefit was allowing your users to make use of registry ids in your configs
I've been using registry keys in VeinMiner since 1.13, it's been so nice
they are
You can also provide a default config with some of the popular custom biomes
I'm just adding default compat
Like idk terralith
I mean
that's basically what this is
except as a generator instead of a single file
weee
it'd be interesting to see the API have fallback biomes
I mean even just exposing types would be a good enough replacement here
if plugins could self-report deserts or something like that it would already be 99% good
not perfect in my case for some of this stuff but it would be pretty good
biome categories exist in the game so it is just matter of someone exposing that tbh
jeez at least make that shit a constant
this is the lazy way of doing it
hey, if it works
I literally just asked people to submit them in a format then just had ai clean it up and slap regex on it
no effort and it just gets dumped into a map
but my beautiful source code!!! 😦
discord why do you replace my sad face with an emote smh
how can I get BukkitValues from Entity?
that's the PDC
so, item.getPersistentDataContainer().get(NamespacedKey.fromString("itemsadder:placeable_entity_item"), PersistentDataType.STRING)
NamespacedKey.fromString("itemsadder:xyz")
your thinking of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/NamespacedKey.html#fromString(java.lang.String,org.bukkit.plugin.Plugin) which takes a plugin
declaration: package: org.bukkit, class: NamespacedKey
yeah, I mixed them up lol
I fixed it there
though I assume ItemsAdder has API to access this information
api sucks
It's not working properly. For some reason it's seeing furniture in a bigger radius.
There's not even a proper event for the furniture placing.
or there's an event where you can cancel it, but you don't know where the furniture is. Or you can only recognise the location of the furniture
there is no getLocation() method
Ew why does it return the namespaced id as a string
there is FurniturePlaceSuccessEvent, but you can't cancel it
oh so there's two events
found it weird that it only provides a namespace in the place event
Yeah that seems silly
are you going to make ur own itemsadder
Means you can’t cancel furniture placement inside a certain region
with blackjack and hookers
Easily at least
needs to use packed
there's a FurnitureEvent super class that FurniturePlaceEvent doesn't extend, that's hilarious
so I should listen interact event, store location, and then listen FurniturePlaceEvent
The heck is packed
packed promo?!?
Also you could potentially delete the furniture in the success event and then give the item back
Mayhaps
if it places after the event why does it not let you cancel that smh
Jank
so yeah, player interact event it is kek
their skript API just tells you to use that reflection addon for Skript lol, how is that an API
I thought that itemsadder is the best plugin for this kind of stuff, but there are so many crutches in it. not even normal support
the best plugin for this stuff is Oraxen probably
wait why is the spigot resource unavailable for purchase
There is a drama around that lmao.
spill the tea
The original developer returns and decide to take control of the plugin, kicking the developer who's been maintaining it 3 years minimum.
Also demand 5-6 figures from the maintainer.
oraxen or ia
Oraxen
oh dam
who is oraxen's original dev and who is the maintainer
Original developer is th0rgal and maintainer is Boy
i didnt even know thorgal left it
who is Bro, Boy0000?
Sorry yeah, it's Boy0000
Isn’t ItemsAdder also unavailable to purchase atm
You can look at the reviews for Oraxen, it has so many 0 stars review lmao
yeah
Block game drama truely is the best
Maybe we do need a new plugin with blackjack and hookers
I mean that was just dumb from the maintainer's part
it'd be more understandable if it had been a few months after they left, but they went on for years without actually trying to "legalize" their ownership of Oraxen
of course it's just shitty from the creator's part, but it's what it is
That's true lmao
one learns from mistakes so I'm sure they'll never let this kind of thing happen again to them, if anything
I am curious how this th0rgal guy even has the gall to do this, knowing the severe backslash they'd receive for attempting an aggressive takeover
I guess even with that on the plate, they'd still gain a few bucks before it implodes on their face so they might just be aiming for that
Read their side of the things too
what did they say about it, I am not on Oraxen's server to know
chatgpt!!!
https://www.youtube.com/watch?v=UyP7FQHM1AM hopefully this video explains it
Become a Channel Member and unlock epic perks ► https://www.youtube.com/channel/UCjUrZyueysuEQ1a5qntzI9Q/join
Discord ► https://discord.com/invite/67nrpHrCX2
Twitch ► https://twitch.tv/KasaiLIVE
Instagram ► https://instagram.com/KasaiSora
Bluesky ► https://bsky.app/profile/kasai.gg
TikTok ► https://www.tiktok.com/@kasaisora
Looking for more K...
the fact that a minecraft plugin community drama gets 6.5k views is crazy
of course there's a video about it
course theres a video about oraxen
What is that background
Looks like vomit
Idk if that’s a resource pack or custom blocks added by Oraxen
But it’s terrible
you look like vomit
Uuuf
did spigot seriously just give the dude back the resource because they asked for it lol
you cant say that to coll1234567
that's hilarious
I hate that stupid YouTuber zoom thing
It was transfered without authorization from the author, so yes
I’m reporting this to hypixel HR
@simonhypixel
And spigot HR
how can it get transferred without authorization from the author at all
By having access to his account
why did they have access to his account
Is this why 2fa is required now
They were pushing updates. So it was a shared account without Spigot's knowledge :p
ah
I'd just let them have it for being dumb
Permissions ✨
This is exactly why we want people to let us know about shared accounts, by the way
2 people fighting over a resource? Sike neither of you get it now
My offer to share your account with me still stands choco
should probably have organizations like github to avoid this kind of problem
Fuck the account. Let's share a house, lynx


Tell that to xenforo
damn he on a lease and a mortgage
I'm sure there's a plugin out there for it
for xf 1 maybe not
Just make an entirely custom system
Should have made it an automatic gh act-
The side effect being youll end up insane like minidigger
need that Alaskan King bed to fix everyone and the huskies
Imean what
are you trying to say something about mini digger
that video really puts spigot in a bad light for siding with th0rgal lol
Mini isn't too far gone yet
yet
We can save him 
Web dev smh
*yeti
it doesn't outright say anything bad about spigot, but it does seem to imply the decision was kind of dumb
I'd agree if I knew the context here but there seems to be no info on th0rgal's side
@eternal night why did you send me through this rabbit hole smh
Source: deez nuts lmao
so this is just a shitty situation
but Boy does seem to be acting in bad faith if all of that is true
it's easy to prove, just show transactions
if Boy did send them the 20% that they had decided upon still, then th0rgal is the one lying
if they didn't, then we'd have to see chat of that being agreed upon to begin with
seems like everything is rather recent still so I'll stay tuned for more tea
Oraxen
Oraxen, the custom items plugin
Employees gonna love you
Facts XD
in 6 years from spigotmc it has made just over 6 figures
which isn't all that much
it isn't just spigot, but polymart and wherever else they're in + sponsorships
I am going based off spigotmc
don't care about polymart and probably has less downloads from there
sponsorships don't necessarily make you money
rather it allows you to do something
613 to be exact kek, so yeah small portion
but if they're asking for 6 figures then sponsorships must have some kind of monetary compensation otherwise it wouldn't make sense to charge the whole sum of the plugin's earnings
or so I'd like to assume, but who is to say
A know a lot of server hosts just give you a free server as a sponsorship
Absolute stonks
do i have to handle time zones or will just server do it
what do timezones have to do with scheduled tasks
i said at the same time every day so like 4pm or something
$111,484.23 from spigotmc alone over 6 years and not factoring in taxes. $18,580/yr ($1,548/month) which in US terms is way below poverty level lmao.
You can use the machine's time zone maybe
What if my server is located on a globe travelling cruise ship
it depends, sponsorships have strings attached and is more like being paid to do something but they are paying upfront without you do anything. A person can't be entitled to a sponsorship unless there was funds left over from said sponsorship
what does it mena
as I said originally, sponsorships are not for making money per say as that would be illegal
And do a bit of math to compensate for the servers timezone
but there is like zoneddatetime
ZonedDateTime
int hour = 20;
int minute = 3;
ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Poland"));
ZonedDateTime nextRun = now.withHour(hour).withMinute(minute).withSecond(0).withNano(0);
if (nextRun.isBefore(now)) {
nextRun = nextRun.plusDays(1);
}
long initialDelay = Duration.between(now, nextRun).toMillis();
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(
() -> code,
initialDelay,
TimeUnit.DAYS.toMillis(1),
TimeUnit.MILLISECONDS
);
System.out.println("Task scheduled to run at: " + nextRun);
i did this
counting the rest of purchases from other sites, it is honestly decent for a plugin imo
6190 downloads for 19.99 each, over the span of 60 months and 10 days
When the plugin takes 80% of your time, 2k isnt worth it
of course, without taking taxes into account
Wouldn’t it be 60.33 ish
Just goes to show the big money is in owning servers ig
10 days is not 0.1 of a month
why are you dividing by 60?
it is 60 months since first release
easiest is to save in utc+0 and convert to system time for display purposes
right, I suppose it has done alright in terms of what is typical of plugins.
but it still isn't a lot of money though
it isn't but I'd be curious to know how many hours a week they spent on the plugin so we'd ultimately know whether it was worth it or not monetary-wise
and whether or not they are providing support
how to do that, use ZonedDateTime?
or not
;c
and you construct it with some utc value and then you can the time it would be for other timezones
you shouldn't create a thread pool per task
save the thread pool in a constant and use that
but im gonna use it only in onEnable
Yeah but what if you want to schedule multiple tasks
but i dont want, what do you mean
it's fine then I guess
so the rest is ok
yeah, https://stackoverflow.com/questions/20387881/how-to-run-certain-task-every-day-at-a-particular-time-using-scheduledexecutorse if you care about having to restart it every 2 years
I had assumed leap year shenanigans but it seems to be related to how the scheduled executor service internally stores time (a long), making it overflow if your service runs for 2 years
then again, I doubt your plugin will run for 2 years straight
time 
Smh they should have used a BigInt
They mean that you may wanna schedule other tasks or services to execute based on a schedule, then its ofc convenient to reuse the same executor service, in fact its a very common practice to keep around a single thread pool for scheduling tasks with like 1-3 threads for the entire application, then ofc executing the task itself may occur in another thread pool etc
Hey, does someone have an idea if theres a way so asynchronously update a bossbar? My goal is to create a TPSBar which wont be affected by lags on the main thread.
you can just do it async
make a new thread
why would something ran once a day overflow in 700 days
Tbh I asked myself the same question
I'm currently trying to do it with a scheduler.runTaskTimerAsynchronously, but that doesn't seem to work. How would you do it?
define doesnt work
Sorry if im slow but what do you mean by that?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Sorry I'm a bit tired xd
I've created some lag by spawning a bunch of tnts with explosion power 100 and the server started to lag, but the TPSBar didn't update asynchronously or at least my client didn't receive that update
if you count 700 days in miliseconds the number gets quite big
Make a new thread
why in gods name would it count in ms
if you know beforehand it needs to trigger once a day
just reset it when it gets triggered
but I guess thats all standard java shenanigans
- are you seeing the bossbar?
- have you checked if ur tps implementation sets it correctly, or gets the correct value?
Server might need a tick to compute the tps
- Yes i'm seeing the bossbar and its updating
- I believe that should be the case, since a bit of lag results in an update, delayed, but an update
since it needs the time the tick took
You won't see the tps change until the tick is finished
If you want a more acurate thing track the time in ms yourself
Yeah I mean even with internal cpu clocks you count up to a certain unit and reset it on triggers lol not sure why you do it any different with Java
I'm using this implementation that should be okay, right?
https://bukkit.org/threads/get-server-tps.143410/
Bukkit.getTPS be like
That’s not a spigot method
damn
is there a way I can get this data in bukkit plugin? (enchantments)
i was bout to say that
the fuck did bro do
Anvil + Block + Book + RMB = poof enchanted block
thats why im asking
if there is a way to get this data
there is no reason for it to be saved to begin with, blocks can't use enchantments in any way
not with the API
fck
here I thought the items were stored container/client side
I guess since it is a tile entity it allows it to save the data but hella weird
I don’t think tile entities save arbitrary data
doesnt every player have their own anvil screen?
Entities don’t at least
wat??
Why does the anvil screen matter?
or am I going crazy
what are you talking about
oh wait
They put an enchantment on a chest and then placed it
oh I guess it saves the component to keep the enchantment when broken, that makes sense
let me check my 1.21.3 source real fast
it probably works the same way for the name
if you rename a chest or shulker in an anvil the name will be kept when placing and opening it
butttt, it doesnt save
doesnt add enchants to broken block
then why the heck does it keep the component lol
are you sure that vanilla is adding this data?
Oh does it only last until the block is unloaded
The heck
i dont know but i want that data lol
how did that data even get there
sooo no way to get this data?
The "components" tag is there to easily support the item name & other stuff
it just saves everything from the item stack iirc
How did I never hear about that change
is that for every block or just tiles
tiles
?
Not with the api afaik
That leaves me with one option.. PersistentDataContainers
you can get it with internals, if you wanna go that route
Wait whaaat
nope :(
read this
((CraftChest) yourChestBlockState).collectComponents()
im gonna pass on all of these CraftThings
if you could get the block state in item form you could have used BlockStateMeta but I don't think you can
wait I think I found a way
Wow that’s sad
Just read the whole thing now I’m gonna cry
i thought you knew
No
var chest = new ItemStack(Material.CHEST);
var meta = chest.getItemMeta();
((BlockDataMeta) meta).setBlockData(yourChestBlock.getBlockData());
var enchantments = meta.getEnchantments();
I haven’t touched packets in like 4 months kek
since when is BlockDataMeta a thing, I haven't seen it before
I wanna know where in the internals are PerlinOctaveGenerator objects being used
examples on how to use it?
Yeah
https://www.youtube.com/watch?v=CSa5O6knuwI
I was watching this guy and tbf it’s quite simple I just don’t understand how to incorporate in my own impl
Fuckkkk man I shoulda just used chunk generators anyway
Looking like I’m gonna have to rewrite to account for this considering I don’t wanna spruce up the current wfc impl to handle this
Erm upsetting
wait, what were you using if not chunk generators
bro is manually placing the blocks, obv
Yup…
Manually in a way
I just use my own generation algo then force block type at specific locations - https://github.com/NormalManV2/NormalDiscGolf/blob/master/src/main/java/normalmanv2/normalDiscGolf/impl/course/CourseGrid.java

why would you do that lol
Cuz uh
Uh
insert good excuse here
I suppose it’s solid practice for actual game impl
can i make the Player object have a string, that i can change anytime i want and it doesnt change for the same player?
like for example every player has an integer that counts the times they took damage
?pdc
thank you
Hey, does someone know how to shade GraalVM into a gradle project? I've been searching but couldn't find anything (perhaps I have negative searching skills) Could someone help me please?
Thanks
I believe I tried that and Got the NotClassFoundError
is this plugin related?
Yeah, want to relocate it into my plugin
what are you trying to do with it
use the polyglot features of graal?
because you can't just shade a whole jdk, you'd have to run graal in your server for it to work
Use it to evaluate strings as conditions (I Know is possible to make my own system)
Yeah, want to use polyglot
Oh really?
Cam't shadowJar only shade what's important?
man why does shadowJar not shade the entire JDK smh
most parts of the JDK are important lol
you'd have to initialize the components by yourself, and I doubt there's any documentation around that or if it is even possible without doing some reflection hackery
it is part of the runtime
@acoustic pendant it looks like what I said was old news
apparently they've decoupled the polyglot api from the jdk so now you can in fact use it outside of non-graal JDKs
jeez
you just don't get any JIT compilation, which is fine since graal community edition doesn't anyway
Hey, does someone know how I can disable blocks being destroyed from a tnt I've just summoned?
This is my snippet I'm using atm
TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(player.getLocation(), EntityType.TNT);
tnt.setFuseTicks(0);
tnt.setYield(10);
use the World#spawnEntity method with a consumer param to edit the entity before it is spawned
Performance 💀
clear the block list in the BlockExplodeEvent: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockExplodeEvent.html#blockList()
#spawn*
someone should deprecate all the other methods smh
Ahhh okay that makes more sense thank yall very much :)
the TNTPrimed entity doesn't have a way to set the explosion power
.
sadge, you'll have to use rad's method probably
even though it is part of the entity data
Thank you very muchh, will try that out probably
it was added rather recently so I guess it makes sense it wasn't added yet
Is it possible that yield is the same as explosion power?
I'll try that
Why did they remove it in java 15 through?
I don't know for sure, it might be
remove what
GraalVM support
I am not following, GraalVM is still being maintained if that's what you're asking
the standard JDK never supported the polyglot API by itself, that has always been Graal's domain
Hey, does someone have an Idea if theres some event which I could use to:
a. detect placement of item frame
b. detect the itemstack of the itemframe
c. modify the item frame entity and make it invisible
when the itemframe is placed a entityspawnevent is called
then you just check for instanceof ItemFrame
Thats what I've tried but somehow the event isnt firing
have you registered the event
Yes, just read through the docs and the event isn't supposed to fire
But I couldnt find any alternative for item frames
entityspawnevent
Ahhh i'm braindead nvm
Thank you very much, will try that out :)
no problem
Is there some way to find out the metadata from the item frame which has been placed? Because casting the entity to an itemFrame and getting the itemstack doesnt seem to work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
itemFrame.getItem() returns null
That’s for the item in the frame
Which will of course be null if it’s just been placed
Ahhh maybe I should've read the docs
Is there any way to get the item which resulted in the entity being spawned?
I'm getting this error from using Kord in my plugin: ClassNotFoundException: kotlinx.io.unsafe.UnsafeBufferOperations. I have all the libraries loading, including kotlinx-io-core-jvm which the error is from. Any clues what could be the problem?
there is probably an event to know when a player puts something into an item frame
Ahh okay
Do you have an idea how I can set the entity_data component for an itemstack?
which entity_data component?
okay and what do you want to set there?
Normally the entity_data will be empty or at least not have the Invisible tag. I want to create a custom recipe which gives you an invisible item frame you'd normally receive with this command /give @s item_frame[entity_data={id:"minecraft:item_frame",Invisible:1b}]
im not sure, i would have probably just listened to the event and made it invisible once the player tried to place it
Thats what i wanted to do at first but wasnt able to get it to work
im not sure i havent used the new api for itemstacks yet, with the components
the docs probably have that written down somewhere
It's a bit limited atm
Hmm but there must be some way to set the tag right
It should be possible with NMS atleast
Iirc it's on World
Yes with NMS or Unsafe
declaration: package: org.bukkit, interface: UnsafeValues
isn't that the block_entity_data component
item frames aren't blocks
Before java 15 I could use the method i was trying to use (eval)
knowing there is a meta impl that essentially serves this purpose but there's no API equivalent annoys me even more lol
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEntityTag.java I guess EntityTag isn't quite the same as entity_data component
hi, a question: i have an armorstand with an itemstack as a helmet (for a custom entity) and when i try to update the helmet, it does serverside, but not clientside. how can i force the client to update the armorstand?
e.g. i have a paper with a custom model data, once set to the armorstand i can do anything about it, but it wont change again. changing the custom model data or removing/changing the helmet entirely, nothing works - it stays the same model as initial
to update the model we currently have to destroy the old armorstand and spawn a new one with the new model as helmet, which is not ideal
Had to downgrade to 0.14.0, due to dependency conflicts with kotlinx-io-core-jvm
works when i teleport it as well and way cleaner, but is there a better way?
removing the helmet not updating is weird
it should send the equipment change packet
@hybrid spoke what happens if you do Player#sendEquipmentChange instead
of course, you'd have to do it for all players, but it is just for testing purposes
to me this sounds like a client rendering issue rather than an issue with the server given the helmet is being changed
are you using the vanilla client?
yeah and no, labymod. i figured, since teleporting the entity automatically updates it clientside. weirdest shit is, that its the same for itemdisplays, which do not have any equipment
I haven't heard about labymod in ages
pretty big thing in germany
why labymod over something like simply optimized or fabolously optimized modpacks
- i look cool
well, do try Player#sendEquipmentChange
if that doesn't do it either, try it in the vanilla client and if it happens to be a labymod issue just report it to them I guess
i cannot try sendEquipmentChange on an itemdisplay
and i already threw away the armorstand
I mean, try it on the armor stand
couldve been a fix, but now its too late ig
try hiding and showing the entity again
that sends the destroy and reappear packet so there's no way it doesn't re-render
i tried that earlier, same issue
with the item display too?
si
well fuck labymod
lmao
I use lunar, is it any better performance wise
idrk, i dont care about performance, i just want to look cool and already spent enough money at my cosmetics
lmao
so im kinda forced to use it lol
but still weird, i will try it with vanilla
nvm, i have to download it from the store which is quite annoying
fuck vanilla
I like simply optimized better for 1.21.3
yeah your client is fucked
check your labymod settings if there's anything with the word cache or rendering on it to see if you could maybe adapt it
Are you using Laby? I wouldn’t use Laby to test plugins…
Laby fucks up too many things
I'd like to assume their userbase are also using it
but yeah, generally, you shouldn't use it for plugin dev
It’s also possible you have something server side fuckin with packets
honestly not out of consideration, hence why I wanted to test vanilla first
In fact fabulously optimized fucked up once for command shit
I'd like to believe laby isn't so fucked up that it wouldn't detect an entity being destroyed and re-spawned
"why am I not moving? Oh"
@hybrid spoke what plugins do you have
is any of them or yours doing anything funny with packets
none except for mine
if you aren't doing anything with packets then that only really leaves you using a cursed spigot fork that isn't sending the appropriate packets or labymod fucking things up
probably both
i just tried on both paper and spigot
for spigot the teleport workaround works, for paper even that doesnt work
and we were using paper before
but the issue remains the same on spigot
and that leads me that the rest is either a really weird spigot problem or labymod
if it happens to be labymod it'll really fun to tell your players to just not use it lol
well, assuming labymod support doesn't care about it
im just too lazy to test it with vanilla rn, i will just live with it lol
enough effort have been put into it for private shit
yo guys
wtf is happening
System.out.println("button material - " + inventoryButton.getItemStack().getType()); // not null
System.out.println("button name - " + inventoryButton.getItemStack().getItemMeta().getDisplayName()); // not null
this.inventory.setItem(slot, inventoryButton.getItemStack()); // valid slot
System.out.println("inv slot - " + this.inventory.getItem(slot)); // prints null
this code is just suppose to add an item to an inventory
and its not doing that??
it seems to work outside of the class that i am working in
but it doesn't work when im inside the class that manages the inventory stuff
it opens the inventory just fine btw
so i figured it out, kinda? i have to wait like 1 tick before i can set an item in the inventory or else it will set that slot to null. anyone know why?
/data get entity @s SelectedItem
this is the output of that command
how can i access the custom enchants via code?
if you're making a "faction" kind of plugin, is it a good idea to create a permission node for every single faction that all faction members have? Or is it better to just make an API that links to a database that stores members of a faction?
I want to create some permission-based stuff with factions, but don't know which is better.
what is the entity and what is that customEnchantList
if you are using nbt directly, don't. Use PDC
?pdc
well, you can't get it without NMS
and i cant use pdc
because
then the existing items wont work
that players already have ^
That’s probably what the other plugin uses too
Why people still use it when PDC exists is beyond me
ChAngE NBtTTT diRectly!!!