#help-development
1 messages ยท Page 1335 of 1
I do wonder how hard it would be to make a CoreProtect alternative that only supports latest
I mean... supporting 2-3 older verions is totally reasonable
but everybody who tries to do "1.8 - latest" is just nuts
the issue with supporting more versions is that API shenanigans aside, the caveats you have to watch out also change so you end up doing a lot of debugging
Actually, I might be able to use a library i made semi-recently to do a PS alternative of sorts.
I'll have to check ๐ค
Why exactly is PS garbage though?
our own fork of PlotSquared has 31 changed files and over thousand lines of codes changed, but keeping it up to date is no problem because plotsquared itself never changes anyway, all they ever do is update dependencies
plotsquared is effectively dead. Well not dead, but they won't ever change a thing anymore
I mean, being in maintenance status isn't bad
I mean, it doesn't really need changes tbf
if anything it makes it easier to fork
you don't have to keep up with upstream changes for your features
As long as it works, there's no real reason to make an alternative
it has a ton of valid open issues on github that never get answered
same as HuskSync
plot servers are not that popular anymore so I guess there's also little incentive to keep improving the design anyway
the HuskSync author relies on people like me to fix their shit
but at least he merges PRs from time to time
what was HuskSync about, sharing inventories across a network?
yeah inventories, attributes, PDC, etc
I see, I guess that's a must for multi-instance SMPs
Yea, there's this too. Creative in general is dying i think
exactly
Hi, I need help creating a boss. I want to create custom rewards, such as executing a command when the boss dies. Ideally, when the boss dies, it should give a reward to all players who damaged it. If that's not possible, I'd like it to give that same reward to players within a 100-block radius. For example, when the boss is killed, all players should receive 100,000. Is that possible?
it is possible, just not sure what a "boss" entails
I already had plans for recreating other plugins, but eh. we'll see what i actually get around to doing lol
tag the entitiy once you spawn with PDC, and then on every EntityDamageEvent etc, you can identify your custom entity with that PDC tag
if it is just a buffed vanilla mob, then it should be easy
if it is more of a custom thing, you'd be looking in the direction of MythicMobs/ModelEngine as much as I hate it
I'm using mythicmobs premium
are you asking about mythicmob stuff, or are you coding a plugin yourself?
If you're not coding, head over to mythicmob's discord please
I'm not that good at programming; I've only managed to make this boss like this, but when you kill him, he doesn't give any reward:
HyperBoss:
Type: WITHER_SKELETON
Display: '&6Skeleton King'
Health: 500
Damage: 10
Options:
AlwaysShowName: true
PreventOtherDrops: true
Skills:
- onDeath:
- delay 1
- consolecommand{c="eco give %player% 500000"} ~onDamagers true
- message{msg="&aยกHas recibido &e500.000$ &apor participar en la muerte del Skeleton King!"} ~onDamagers true
you should head over to Mythic's discord
Okay, sorry for my recklessness.
no problem, just wanted to clarify. This channel here is for coding own plugins
we don't really have much knowledge on the specifics of mythicmobs, so we can't really help you with it. That's all
Can you send it to me privately? I don't know what the link is.
it should be in their site
Okay, thank you very much
No problem, thank you anyway
Thanks
np
Speaking of replacing stuff. I've wanted to do my own world editing plugin still, just haven't gotten around to it lmfao
ye, but less poorly coded & more suited towards how everything I'm doing is coded lol
I think people are vastly content with Axiom, you should give it a go
Moulberry did an amazing job with it
I only heard about Axiom like a few days ago
ugh gradle. no thanks since I'd be forking it lol
anyway, I doubt that optic fusion could make a better worldedit
I mean, you don't have to build it to use it lol
Aye, private changes
the breaks with optifine badge is hilarious
if you'd be only 10% able of the worldedit devs, you wouldn't care about whether they use maven or gradle or ant or cmake
I think most mods that do anything with rendering do, fuck optifine
optifine is total shit and deserves to die
optifine is a bad, closed source version of sodium, isnt it?
does it do anything better than sodium + iris?
If so, what exactly?
Many resourcepack features
custom items, custom entities
Yea, don't care ngl. I have my preferences on what i like working with
As for custom & forked stuff, I fork paper & code most things from scratch which means rewriting plugins were possible to use new/changed functionality
I think custom items have been vastly covered by vanilla at this point
doesn't that force the server owners to require every player to have that installed too?
custom armor models even
But those can mostly be emulated with other mods that just support the optifine format
only redeeming point is custom entity models but that's about it
it would, yes
so it's shit
it wasn't much of an issue when optifine was the de-facto optimization mod
Yea, you can do a whole lot with datapacks & resource packs
that is at least my opinion. everyone else is free to disagree
I've been meaning to look into those since they seem interesting, but i'd really only be able to mess with datapacks lol
datapacks are cool, aside from functions which kill server performance due to people poorly using target selectors
I mean... I'm working for a server that got bedrock + java crossplay and even we manage to get custom entities and textures done, for both platforms. So why would optifine exist lmao
I agree that datapacks are shit
I'd really only use them for things that are better fit as datapacks like custom loottables so i don't think I'd really struggle with fucking over the server performance lol
yeah, I only ever used it for worldgen
I mean, i do have a weightedrandom which more or less replaces loottables but ehhhhhh
Minecraft's already got the datapack right there so I'd rather use that
I can't really blame datapack makers though, they just try to do the most out of a limited DSL
I'll give a quick example of datapack insanity in a few minutes:
Guess i do have the benefit of being able to make it better though ๐ค
Question is if i hate myself enough to rip out the entire data-pack system and replace it with my own data-driven library or merge the two lol
datapack to disable elytras in end:
A function that runs every tick and scans every entity in the world.
proper solution: a tiny plugin that manipulates world gen directly
if mojang would have been smart, they would have added lua support instead of their shitty "datapack functions"
I'd have preferred tcl ๐
why not REXX
skript!
perl
assembly
java
if only md5 wouldnt hate kotlin
it has so many nice things
like data classes, or extension functions
or reifed inline functions
null safety
less boilerplate
default function parameters
shall I go on?
oh and operator overloading
in kotlin you can e.g. do dur1 + dur2 where they are both regular java Duration objects
oh and kotlin differentiates by default between mutable and immutable collections
Sometimes I like the boilerplate of Java
how so?
But it does really need default parameter values lol
you can still write custom getters and setters for properties in kotlin too, if you want to
The boilerplate lets me know exactly what's happening just by looking at it. There's no hidden code ๐
Yea, i don't mind it either as my IDE generates 99% of it lol
It's why I don't fuck with Lombok
you can also override equals and hashcode in kotlin so kotlin really doesnt take anything away from you
but yeah lombok is weird, at best
I used to like lombok but nowadays I also think it's a weird bullshit hack that tries to make java behave like kotlin
but you also know that in kotlin - except that you don't have to look at anything
it's not like a regular getter without anything except "return X" would be any magic
once I forced myself to use kotlin for a week, I have literally NEVER looked back a single time to regular java
and I really hated kotlin at first, so one cannot say that I was preoccupied or sth lol
kotlin is like a piano keyboard where you got ABCDEFG and you press the key, and it makes the sound.
java is like a piano keyboard where you got ABCDEFG but you first have to wire the A key to they three A strings that actually make the sound and watch out that it only happens synced, etc, and then repeat that for B-G
I mean, I've been programming in Java since 2019 w/o any major issues but ๐คทโโ๏ธ
I've also been drinking since 2008, doesn't mean it's good
Good enough for me to not think about switching lol
you people just hate change
Nope, I just don't see the point in spending time learning something new if i don't have too
2 days which can be spent doing something productive, instead of learning a new lang
2 days which will spare you 14 weeks in the future long term
unless you die next week
Meh. Again, i auto gen a lot of the code so it's not really a concern
alt+enter or whatever FTW
640kb will be enough for everyone
Irrelevant to me
you do you. I'd never go back from kt to java
if i have a digital book on kotlin, then I'll just do enough projects to finish the book.
Same with rust.
And i hate both lol
fun fact:
I recently compiled a rust project:
cargo build -> 500mb
cargo build --release -> 25mb
oh and both took about 20 minutes
eh. i found the time to finish annoying, but i just did other things in the meantime in other languages so it didn't really matter in the end lol
300-ish projects between C++, Java, Python, C, C#, JS, PHP, and a few other misc things is more than enough to keep me busy ๐
I won't speak ill of someone's religion
code works for the most part, but when i activate the inputs in this order:
input 1
input 2
(XAND sign activates as it should)
input 2 (a 2nd input sign for channel 2)
then deactivate input 2, the XAND sign gets stuck on
sounds like an eventpriority problem to me
wdym
both your listeners are running on the same priority
That can cause inconsistencies between who gets triggered first
just a lucky guess go figure
I've had cursed issues arise where restarting the server would fix them
restarting again would resurface
but im only powering off 1 thing so only 1 event is firing
debug it
is there a way to disable item merge without changing the itemstack's data? if a player picks them up i want them to stack but I dont want the item entity to merge
There's an event for that
Gives you both the source and target items, from there just get the itemstack and compare
i see, thanks
Could anyone help me set up my intellij?
Hmm what do you struggle with?
Download intellij for windows and to set the jdk you could let intellij download a jdk
Im kinda struggling with it parsing my code
it doesnt have the added notations from spigot/paper
like the onEnable void or the getPlayer events
Add spigot api as a dependency in your maven's pom
Oh okay tysm
?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/
Yes but I do not make plugins therefor I haven't made posts therefor I cannot type in forums
Contact someone offering their services
Oh true
if i have signs that do stuff when powered by redstone, and i activate them at the same time, it breaks them:
i have 2 input signs x1, x2, that go into an and gate sign, and the and gate sign doesnt activate since x1 and x2 happen at the same time, but it works when its not at the same time, whats the best way to fix this?
Sounds like somethings off with how you're checking the sign on state
but we don't really have any information to help you
ill send the code 1s
input sign:
https://pastebin.com/BF4UpHKZ
xand sign:
https://pastebin.com/Tfw0vM6K
sign power listener:
https://pastebin.com/wzpXTxJG
Has the player already been teleported in PlayerJoinEvent? Or if I use player#teleport in playerjoinevent, will the player only be teleported once?
I would like to teleport the player upon entry, but I don't want to teleport them to a new loc and then overwrite that (as this would take longer for the player to actually be teleported)
Has the player already been teleported
Where would they be teleported exactly
If nothing you installed teleports them then no they won't teleport
There might have been some previous event, I don't know
?
The problem is that, for example, if I want to override another teleport plugin that's in PlayerJoinEvent, I can always set the priority to HIGHEST, for example. The issue is that it takes longer for the client because they are teleported to to different locations but yea nothing to do
Don't go overriding other peoples plugins
That is not your concern
Haven't we already had that discussion
i dont think so xd
must have been someone else then ๐คทโโ๏ธ
you aren't meant to teleport in the join event anyway
set the spawn location in the spawn location event
Is there a timeout in player#sendPluginMessage when redirecting a player to another server using this method?
timeout of what
what are you asking
The only timeout I can think of is the one at bungeecords end, like server_connect_timeout
https://pastes.dev/ti12rZdouv If this method is called but the player is not teleported to the server for some reason, I would like to remove the lock (I remove the lock in the playerjoinevent for the server through which the server should be redirected, but this event may never be called for some reason). Therefore, I would like to set the TTL in the RMap (teleportLockStore) with a safe value. Let's say I set the TTL to 15 seconds. It's possible that player#sendPluginMessage redirects the player in 16 seconds. I don't know how sendPluginMessage works and I don't know if taking that long is possible
not spigot code; not a minimum reproducible example, have you actually checked that async mess is doing what you want
This code is exactly what I want because i wrote this
I believe that this is not useful because this is the time limit a player takes to connect to the bungeecord - but the spigot to communicate with the bungeecord takes time
Maybe I misunderstand you
whats the concern? Are you worried about the time between sendPluginMessage being called on the Spigot/Paper side and the proxy actually receiving and acting on it??
#sendPluginMessage queues a packet for the proxy on the next tick, once the proxy receives it, the redirect is nearly instant. The proxy-side handling of a Connect message is simple, there's no queuing, retry logic, or anything else that could stretch that into a 16-second delay.
16-second delay would only realistically happen if the server was not ticking (in which case nothing is going to work anyways)
My concern would be that my defined ttl (for example, 15 seconds) ends and the player switches servers moments after my ttl ends
If the method had a TTL I would use it; but if it doesn't, that's fine too
Is MockBukkit recommended by developers?
I'd recommend
But, you need to understand that MockBukkit is a reimplementation of the API in a simulated envrionment. Meaning not all functions are 1:1 mapped
But MockBukkit dropped Spigot as well so its a Paper thing now
MockBukkit is useful, but only if u really need that kind of simulated testing environment since it always needs to spin up a server instance. A lot of the times, you can get away with unit testing ur individual classes + QA testing on integration and system level.

It's useless
It's just a collection of paper thin wrappers implementing the most basic possible api methods in the most basic possible way
I currently only use 'Executors.newVirtualThreadPerTaskExecutor()' to schedule tasks for the database, but I've seen that this can be bad because it can result in 1000 threads waiting for the Hikari connection pool to become free. Therefore, should I use a semaphore?
i personally dont mock
1000 virtual threads
i just extract the parts which are part of my domain and only unit test those parts, since bukkit api implementations would get tested either way
which is fine, virtual threads are cheap and are expected to be numerous
So it's okay to have 1000 virtual threads waiting for free connections?
isnt virtual thread essentially just an yieldable runnable on the main thread
using a semaphore will just make the 1000 virtual threads wait for a free semaphore ticket
something like javascripts async function
yes, having 1000 virtual threads is fine, as long as they are blocking or in other words waiting, not running
the semaphore that was mentioned earlier is to prevent all 1000 from running at the same time, by forcing all but at most n to be blocking for the semaphore instead of running
but as was said before already, hikari already does that by forcing them to wait for available db connections, so using a semaphore is redundant
I see
It's a Java feature that allows you to "divide" a OS thread into several smaller threads that alternate with each other
It is possible to create multiple virtual threads but OS threads no
I mean that virtual threads allow you to create much more
idk js, so I can't confirm it for you
But async is different from another thread
async function in js is basically a function which can yield to event queue when something blocks its return (like db call) so that other code can run at that time on the same thread
From what I've seen, this function doesn't execute in another thread, but rather in the same thread; the only thing it does is execute asynchronously
yea that's what matches to async functions in js
ig js async event loop model differs from virtual thread only in that JVM maintains thread pool and doesnt use the main thread just like js does
but personally i dislike the idea of threads in a first place. process based concurrency has less bugs, are by design more modular, allows for better scalability from external tools like kubernetes, and easier to reason about overall
afaik even if they're blocking jvm swallows those threads just fine since it then offloads the blocking virtual threads on separate threads since it maintains a thread pool
I mean sometimes you have components you want to test that depends on external services, in which case you don't really have an option other than to mock said service to isolate testing said components, its not so much about "i dont want to" if u're serious about testing, its more just that u have to do it in certain circumstances
just make a separate method in which you can pass the service results without mocking the service contract
you miss the point
public User authenticate(final Username username, final Password password, final Hash passwordHash) {
// do logic here
}
instead of
public User authenticate(final Username username, final Password password) {
this.repository.getHashByUsername(username);
///
}
leave the remaining part to the integration tests
at some point you will have to depend on code that's not urs, let's say a database class that directly talks to the database
this is why you decouple the domain from the infrastructure
infrastructure should be integration tested
not mocked
yes but perhaps you want to test whatever unit that is interacting with said database to work correctly
that's literally the definition of integration test
no not really
Integration testing is a software testing approach that verifies how well different components, modules, or services work together after being combined.
we're not testing the actual database
its one unit we're testing still
but that unit in prod would depend on the database, we want to isolate non incorrectness on said unit
not when said unit works w the prod database
its a unit test
if u have any real writing tests experience and not just theory in ur head, this is so obvious
you can just use inmemory database for this. I get what you mean, but imo its not worth to test couple lines of code in isolated manner when they only test the wiring but not the actual logic, i would just do integration test with inmemory database if i were so desperate for that
it might not be couple of lines of code tho lol
wdym by an in memory database
not all code is going to strictly rely on some relational database if that's what u think
and sometimes you actually want to avoid decoupling too much because you're working with concurrency where keeping the code logic itself in one place is a necessity for readability
its just matter of taste, you can mock it and keep the components coupled, or you can decouple and dont care about wiring or if you care do a separate tests for this
but also if u're using an in-memory database, you still haven't isolated that said unit
u're still on integration level
but you're isolating wiring, not the actual logic that needs to be tested in isolation
there's literally little to no gain from testing wiring
unless you couple your wiring with domain code
then you're forced to mock it
what i mean is that if you decouple good enough, the wiring part of that service function becomes miniscule enough to not be tested or be tested with integration tests, since all other logic is being unit tested, like parsing, hashing, validation. Only branching is what's left to be tested in that case
it's crazy how writing a fun project is like 50% actually writing code and 50% debugging, while writing professional enterprise backends seems like 5% writing code, 50% debugging and 45% writing tests
as said already, not everything is going to look like a nice tree of hieachical components of different levels where you perfectly decouple everything, you're just talking nonsensical theory
as said already, some units may use external services directly and you have no control over it, sure you can decouple it into 25 different layers but ur fucking concurrency infrastructure will be a blood and hell nightmare to keep up with
a big part of unit testing is that we want test a unit in complete isolation because we want to be able with great certainty to assert the unit is not behaving incorrectly on its own, that is not useless at all, that is in fact very useful and there is a reason a lot of companies used to want tdd practice etc
and you're under the assumption we're using a simple in mem database, what if have a complex service that talks to a four layered cache system with a vectorized database, all the sudding testing the unit that directly invoked said database can become interesting, such that you can assert that unit is not causing any bugs, mind you this code base could be millions of lines
snake oil
like sure there might not be much other logic
tell me how many conccurency bugs plugins had just because they called bukkit api from seperate thread
i am currently holding you personally responsible for my browser having 250 child processes and using like 60gb of memory
pipe bombs will be mailed shortly
redis, valkey use process based concurrency and they scale well
redis is ๐ฎ
most lacklustre messaging system ever created
redis is like a combination of halfbaked implementations of 5 other projects that do them well
oh yeah so that's the reason why the whole internet is based on redis, because it's halfbaked
the whole internet is also based on a whole lot of other pieces of garbage, it wouldn't be so shit otherwise
process based concurrency is also the reason php still exists
ok fair point
I mean for an in mem database its good
it has atomicity contracts and is reliably fast
but like
it serves as an okay cache layer
the pubsub is another story
but it's not a good enough database to be a database on its own, and it's not a good enough pubsub system to stand as a proper cache coherency system on its own
it's a spork
for caching, there are much more sophisticated cache coherency and control systems
of course there are
i'm not sure at all why redis in particular caught on
what do u mean by processed based concurrency, this term is used for when u talk about concurrency between IO processes
but software is not always written by 5000 highly-experienced devs that began writing assembly when they were 5. Sometimes you just need decent stable software solutions that just work
for personal projects
instead of having 10 business threads in one process, you spawn 10 processes with a "main" business thread
and that's why I like redis
by process based concurrency i mean forking processes, spawning new ones instead of making separate threads
yes but process must surely be the wrong term
well... process as in an os process
not process in the general sense
think multipaper vs folia
yea os process
in my biased opinion IPC with multiple processes outweighs multithreaded apps
isn't os processes very much of an impl detail in langs
somewhat yes
but it very broadly comes with much stronger memory isolation guarantees, unless you explicitly do something like shared memory
oh thats what u meant
yea thats fair
atp isn't this a #general thing? Just saying
nuh uh, we're talking dev
multithreaded apps only works for cpu bound tasks, even in that case separating those tasks by domain with proccesses is better
ok chef
mamma mia
so dovidas whats ur issue with it, or i mean why do u like process based concurrency
chunky chunk
the two aren't really mutually exclusive
i'd rather scale the single process first which is enough for 90% of real life use cases if you're not google
it splits your project by domain
and then make use of the existing concurrency support in the codebase to scale further
look at the minecraft server for example; look at all the hacky shit people do over bungeecord messaging and have shit catch on fire
turning a completely single threaded not concurrency aware codebase into a multi-process, coherent, concurrent system is far more difficult, than taking an already concurrent system and spreading out further
i think dovidas is more fond of the design principles behind os processes, than that he literally means os processes
unless you entangle your codebase with thread locks and synchronization
java synchronization is an abstraction over concurrency in general, and intentional locking is easier to bring into a threaded domain than completely single threaded lockless code
over synchronizing ur codebase to the brim of where there's so much contention is not ideal tho
e.g. a compare and set in local memory vs over the network is not principally any different
i just find threading is too brittle to be used daily in programming tasks. it should be left as a last resort thing.
ugh
if i had image perms i'd post a "skill issue" gif
very often when u write real world apps u will need some sort of async mechanic
but then again it is true that concurrency in general is probably the hardest thing in programming, right after naming things
ui rendering, computationally heavy tasks, data fetching, web api wrapping etc
ofc, but most of that comes to blocking io, not cpu bound tasks
doesn't really matter whether it's threads or multiple os processes on a single node or a decentralized system, it's always difficult and any mistake will come to bite you in the ass
which can be solved without multithreading
yea
it definitely can
i mean this is why java added virtual threads
well it still maintains thread pool soo
but i dont blame them, they couldnt do it without it due to compatibility reasons
i mean sure they have a carrier pool if that's what u meant
yea
i definitely would like some more control over which platform threads my virtual threads run on
but like emily brought up earlier, putting them behind a semaphore already gives you most of the control you'd need in practice, i.e. limiting parallelism
but someone else could still blow up the common fork join pool with 10,000 virtual threads and lock everything up
minecraft is also to some extent cpu bounded, so using multiple threads (and by extension possibly cores/physical threads) is advantageous
if u need to scale
some parts could be separated easily tho, like chat
but again that's what proxies already had achieved basically
honestly like 90% of the tick loop could be made concurrent and even lockless
but the small indie studio that is mojang probably doesn't want to throw dev hours and money at it
after all, this means they can sell people more expensive realms
yeeees
i mean they don't have THAAT many java devs as in code writers i believe
(correct me if im wrong tho)
certainly enough to refactor half of the nms i depend on every update, or so it feels like at least
im not sure
the spigot community would scream if they refactored everything to be concurrent
mm yes levelchunk.level() is now levelchunk.level
that's why they're hesitant
no nevermind we switched it back to a method again next update
porting the minecraft client to vulkan already promises to break half of the mods
why are they doing it again?
let alone doing concurrency in nms
not half the mods
just a small set of mods that invoked the graphics library explicitly no?
all shaders are out the window for sure
most of the rendering optimization mods will also explode, but only the mods that touch rendering
yea but seems like that iris mod was going to be recoded either way?
they will probably either become redundant anyway or pretty quickly update i'd assume
yea
i hope that after port we wont need those optimization mods
myeah exactly
since i think if they're investing into porting graphics pipelines i think they would invest into performance too
that's what we said when they rewrote the chunk system
but i suppose in this particular case the performance would be user-facing, not serverside
so they might actually care for a change
clearly they really don't care for any servers with more than 15 concurrent players
which just so happens to be about the size of a realm
I mean yea
but trying to make nms multithreaded would break so many eco systems and it'd be expensive in terms of time also
yeah it's never happening
i don't necessarily want for most of it to happen, either
what i do want to happen is for the read-only entity logic like pathfinding and some goals to become concurrent
it mustve been a hell to write folia
honestly i think they went in the wrong direction
they're already maintaining massive diffs, breaking most of the api, and breaking most of the expectations of the old api
at that point i think it would've been better to just make the tick loop itself more parallel
you mean start from scratch? patching nms freshly?
i mean some concurrency patches on top of paper most likely; e.g. async pathfinding, async entity tracking, and proper api support for reading world state async
most of the writing would still be single threaded almost certainly
honestly at this point with all mappings are gone, minecraft nms should become open source with CLA agreements that contributors from like paper could contribute back into nms instead of trying to play cat and mouse game
perhaps some few and select spots could use compare-and-swap semantics
features could be still decided by mojang, but the minor updates could be maintained by the community
istg in a few years it'll be bukkit all over again and we learn that paper has been pocketed by mojang
lol
yea its a nice idea but not sure how practical it'd be in reality
have some replacement?
for which part of it?
my criticism of it is that it's a cobbled together middleground of like 4 different things that it does all, but doesn't do best
pub / sub and caching structures Map Set etc
for pub-sub, I use rabbitmq
for distributed databases, anything here is generally better https://en.wikipedia.org/wiki/Raft_(algorithm)#Production_use_of_Raft
for same-node caching, i use this https://github.com/OpenHFT/Chronicle-Map/blob/ea/docs/CM_Features.adoc which uses shared memory for sub-ยตs latency for data shared across servers on one node
for cross-node caching, iirc mongobongo does it out of the box
but for that i just rolled my own solution with rabbitmq for messaging, chroniclemap for transient storage, and mariadb for persistent storage, basically reimplementing MESI
wait they are actually doing that???
yes
lol
Yea, OpenGL related stuff is the reason why
Ehhhh, it's more of a Mac thing than an OpenGL thing
if i have a config file that i create the 1st time the plugin is ran
public static void createResourceFile(String name) {
File rf = new File(RedstonePlus.getPlugin().getDataFolder(), name);
if (!rf.exists()) {
rf.getParentFile().mkdirs();
RedstonePlus.getPlugin().saveResource(name, false);
}
}```
whats the best way to go about updating changes to the config file if people already have the file created (if that makes sense) because ofc the people wont delete the config file then add the new plugin
You can just add the new entries
Loop over each entry in your internal config and the one saved on the server, add any that are missing
alr thanks, so basically js on enable, compare the config on the server with the one written in the plugin?
Yes
eventually it becomes even easier depending how large you want your plugin to be
IE, larger the plugin you end up caching your configs in memory anyways ๐
the easiest way to detect what you are wanting is to load the configs and check for those things since you already know what the updated info is
if your loading of config doesn't detect the updated changes, add them in
another way, is to just rename the config and put the new config in place and tell the user that happened
String inputName = file.getAbsolutePath().replace(plugin.getDataFolder().getAbsolutePath() + File.separator, "");
try (InputStreamReader reader = new InputStreamReader(plugin.getResource(inputName))) {
YamlConfiguration source = YamlConfiguration.loadConfiguration(reader);
for (String key : source.getKeys(true)) {
if (!configuration.contains(key)) {
configuration.addDefault(key, source.get(key));
}
}
} catch (IOException e) {
e.printStackTrace(); // or something better idk
}
It's basically this
I noticed that LivingEntity.getBodyYaw() does NOT reflect the rotation of the actual model
is there a body yaw value for the player which ACTUALLY represents how the body is rotated on the screen?
How bad is it?
Pretty sure the game does some weird clamping
float conversionFactor = 256/360f;
float reverseFactor = 1f/conversionFactor;
float clampedYaw = ((int) (yaw * conversionFactor)) * reverseFactor;
apparently it's not even the same between clients
guys, do you guys know which repo the bungeecord chat is now on?
Spigot public iirc
Can use it for Spigot too
I saw that
But my api is working with legacy as well which means old spigot is required
all good now ๐
i copied src form another project to my projoect, intellij says this ("OFF") and all classes are just raw... what does that mean?
Not using maven or it's not marked as src?
yeah found the cause thank you
Yo dawg I heard U like src
Mcp be like
Src/ minecraft.src/
src/namespace/minecraft/minecraft.src/
src/src.source.src would be funny
Dont give them ideas
src/src.src.src
Gotta keep it the same for all of them
nah src/src.src.src/minecraft/src
devcontainers are so fricking cool
src/test has been forgotten ๐ญ
set up the compose.yml file with dev db and cache containers, slap java's devcontainer package and bam, you have reproducible dev environment which you can version control
no its not forgotten, its just that nobody in spigotmc community does tests
they use players for their tests
Ever heard about Nix 
yes, but at least this wasnt managed with weird language and just json
that alone makes me not use it
Don't forget the โญs around the name
nix ๐คก
i once had a guy give up trying to collaborate on a project because he couldn't figure out how to auth to our private maven repository without making the credentials part of his nix setup and publishing them
The classic credentials problem of Nix
in the end he told me maven is dumb and java is dumb and the java ecosystem is dumb and that we should be using some vpn tunnel bullshit he would configure into his router instead
i would've just sent him the jar to use as an external library but i guess he probably couldn't do that either without publishing it
"no bro you don't get it it's a great os it makes everything easier"
so it would fucking seem
You don't have to run NixOS to use Nix
well he was running the os, i don't really know anything about it except that it's stupid and makes me mad
It's really not
I don't even use tests outside of Minecraft lol
Whatโs a nix
braindead but seems like a skill issue
its definitely possible
also nix is not made for desktops
or rather, it is made to solve deployment issues
you should read the phd thesis on nix!
(though i havent finished it)
Plenty of people use nix for desktops because its immutable
ik and it makes sense somewhere
i just mean that blaming nix for its usability in desktops is stupid
yes its slow to install packages, but its not the point to be fast as it doesnt really matter for servers
there is no way to remove tooltips completely with the api. where do i have to go to make a pull request?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#setHideTooltip(boolean)
Does this not work anymore ?
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
Probably doesn't since 1.21.5 'cause there have been some changes
it doesnt work since 1.21.6
i get that, it seems very useful for reproducible setups and gitops and what have you, but i don't see why you would ever run that on your personal computer as an os if you can't reliably even auth to a http server with it
i'd get it for e.g. a secure workstation you use for banking and other high-trust things that must be immutable
I can't imagine setting up credentials being any harder than just setting some environment variables for the user/password and afaik you can do that pretty easily with nix-shell
though I think nowadays you're supposed to use nix develop? Much of the same deal anyway
if it were for a deployment I would just bake the credentials onto the nix configuration though, no point in derivating every time if that's the only thing it is gonna be used for anyway
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Could not find artifact net.md-5:bungeecord-chat:pom:1.8-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
can someone help me please
Use the public repo instead of the snapshots one
it only gives warnings now:
[WARNING] Failed to download maven-metadata-sonatype-nexus-snapshots.xml [https://oss.sonatype.org/content/repositories/snapshots/]
[WARNING] Failed to download gson-2.3.1.pom [https://hub.spigotmc.org/nexus/repository/public/]
[WARNING] Failed to download guava-18.0.pom [https://hub.spigotmc.org/nexus/repository/public/]
[WARNING] Failed to download guava-parent-18.0.pom [https://hub.spigotmc.org/nexus/repository/public/]
[WARNING] Failed to download guava-18.0.jar [https://hub.spigotmc.org/nexus/repository/public/]
[WARNING] Failed to download gson-2.3.1.jar [https://hub.spigotmc.org/nexus/repository/public/]
that's normal, maven tries to download everything from everywhere
but the spigot repo doesn't serve e.g. gson, so it won't find it there; it'll eventually find it in some other repo, or if it doesn't, print an error about it
the configs are conflicting. is there any other way to fix it other than to rename them?
i shade both modules into 1 ar
do you need both?
then why not combine them?
not really, unless maven has a plugin to merge conflicting files that are named the same
or that, yea
cause i need to sync velocity config to all serveriam nx
so ytou dont have to update every config
then why are you combining the jars if you obviously have differences?
not sure what these configs here, have to do with production stuff
unless you got some weird setup
anyways, your only solution if you need to keep them separate is to rename one of them
fortunately maven can easily do that during shading
Hey, are there any plugin/command experienced developers that could possibly help me fix and test my Minecraft server?
?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/
Are these developers trusted or randoms?
randoms that get paid
But it could be a scam no?
better than asking complete randoms who don't get paid on a discord
Okay
I used buildtools gui to use 1.21.11 nms, i chose latest for version and ticked remapped mojang but when i try to use CraftPlayer#getHandle the server throws a NoSuchMethodError
How can i fix this
heres pom.xml
81 lines
You didnโt set up reobfuscating
^^
?nms
ded link
That link is still dead isnโt it
If you need to access NMS classes from inside your Spigot plugin, it is a very good idea to use the so called Mojang mappings. Disclaimer: This post is written for 1.20.4. If you use another version, you of course have to replace every occurance of ๏ฟฝ1.20.4๏ฟฝ with the version you actually use. What are...
thanks
thx lemme check it out
We need to move that to the wiki or something
i bet choco has a pr for reobf mapping plugins at runtime but it never got merged
i was about to say
26 will hit soon
but i guess people won't use nms and keep themselves only to latest
tbf it depends on how easy md makes it to use NMS once 26 releases lol
if it's anything like paper, i foresee quite a bit of adoption
on paper, we're at the point of debating whether to can the paper-api altogether because it's increasingly becoming just a thin abstraction wrapper (marked experimental, of course) over nms anyway
i can see where they're going with generating api facets directly from nms; in a sense it's exactly the "nms in the api" that people have been asking for for years
but at the same time, with nms so easily accessible now, what's the point of using an (usually very poorly documented and quickly thrown together) abstraction over the real thing?
if nms changes, the generated facet changes with it, and everything breaks anyway
Yea, at this rate it's easier to do just the bare minimum to support plugins and then let people run wild with the NMS code itself kekw
the issue with no abstraction is that you get no proper plugin interop
one could argue that the parts of internals being used in datapacks more or less are fine in that regard since datapack/plugin interop is pretty much the same problem and so Mojang designs those in a way that is viable for plugins as well, but even in those parts there's some issues regarding what plugin touches what
i mean, look at the paper item components api
it's an incredibly thin wrapper over nms components
yeah, it is just a thin wrapper around NMS, but that's just because there is no need for it to be anything else, at least in the way it is right now
I am not sure we could say that about other parts of the server
that's exactly what i was talking about
we still definitely need the bukkit api, as in an event bus and a structured way for plugins to hook into places
but at this point there really isn't any point to using e.g. the paper item components api over nms, or perhaps even more complicated systems like ai/pathfinders
one promise bukkit/spigot have made, for better or worse, that it offers abstraction through time, like the worldgen api which has changed under the hood like 3 times, but still exposes the same interface to plugins
i really see no point to adding these thin wrappers or "datagen" style api features
the point is exposing them to the API in order to work with API objects
you could argue that's a way to sideway the problem of not being able to just add a lifecycle hook that works directly with the internal objects instead of thin wrappers, but that idea often falls apart the moment you need to consider how plugins work in Bukkit
i call your hand and raise you a getHandle
some of the registry spaghetti aside it honestly feels like some of the nms objects are easier to reason about than the paper wrappers
I agree on that note, I don't like RecipeChoice stuff at all when looking at the fancy RecipeBuilder internal API
it's just hard to find a balance
if bukkit was designed in a way where it would just be lifecycle hooks that directly work with internal objects, it'd be a different story however we all know how that ends up (looking at you, fabric)
it is nice and powerful but half of your modlist doesn't work with the other half so you have to pick and choose what will touch what
Set<TypedKey<BlockType>> set = new HashSet<>();
for (var mat : materials) {
set.add(RegistryKey.BLOCK.typedKey(mat.key()));
}
itemStack.setData(DataComponentTypes.CAN_PLACE_ON, ItemAdventurePredicate.itemAdventurePredicate(List.of(BlockPredicate.predicate().blocks(RegistrySet.keySet(RegistryKey.BLOCK, set)).build())));
mmm yes my api interop
my blood pressure explodes just looking at this block of code
we went from a setter that takes a Set<Material> to whatever the fuck this is
It's gross, yes, but a couple things:
- Minecraft itself is kinda headed in this direction. It's the nature of data-driven behaviour
- While I disagree with this design choice, Adventure's primary design philosophy is to use static imports, so it would look more like this instead:
itemAdventurePredicate(List.of(predicate().blocks(RegistrySet.keySet(RegistryKey.BLOCK, set)).build()))
ur gross
Why is "Unobfuscated" added to the version number 1.21.11?
The issue isn't with importing obfuscation; rather, it's that the version number retrieval is incorrect because of an extra obfuscation flag. It should only show the version number, but now it's showing an obfuscation flag.
Originally, it was supposed to check for 1.21.11 and process it into something like 12111, but because of an extra flag, it couldn't be detected. Therefore, an unobfuscated flag was added.
I understand this, but I don't understand why this marker is needed when getting the version number. Wouldn't it be better to just add it to the file itself?
what are you talking about
"getting the version number" where? "this marker is needed" where?
This is the version information obtained from the command: This server is running CraftBukkit version 4590-Spigot-da5d877-2746e0b (MC: 1.21.11 Unobfuscated) (Implementing API version 1.21.11-R0.2-SNAPSHOT)
My Bukkit.getServer().getVersion() function returns the line (MC: 1.21.11 Unobfuscated). Previously, it processed versions like 1.20.1 and 1.21.11, but now that it has added more, it's causing the problem to fail to process the later versions.
I mean that's sort of the problem with parsing a string
Yes, this is exactly what caused the problem in my previous processing. I just don't understand why it's written in the version number instead of the filename.
it's written in the version because it's a classifier for the version number
versions aren't restricted to numbers
filenames mean nothing; it's the version that's supposed to encapsulate the semantic information about the build
I mean even in your original message you mention it returning (MC: โฆ)
why does intellij suggest to create a class and not just implement
do you have a project jdk set up
sometimes not updating intellij causes that too
(generally, not spigot or yaml-specific)
is it possible to serialize objects keeping their typed parameters?
would i have to make a method of List<Object> instead
i dont see a way to deserialize an object without knowing the typed parameter, just having the class<?>
strictly, yes, but it usually isn't what you want to do and will end up ugly
if you really don't have the type information at runtime, you'll have to embed it into the serial data itself, something like bukkit configs' ==: org.bukkit.Location entries
however doing that to the extent of e.g. type parameters in collections, something like ==: java.util.ArrayList<org.bukkit.Location> or god knows what horrid formulation once you start nesting type parameters, almost certainly isn't what you want or need
what's your use case?
im just making my format
considering this
should i just return a List<Object> or convert any parameterized class into <Object>
you should do what gson and other typed-at-runtime serialization systems do
which is to return T and take a TypeToken<T>
e.g. one can use Gson.fromJson(JsonElement, TypeToken<T>) to
List<Location> locs = gson.fromJson(myJson, new TypeToken<List<Location>>(){});
returning a List<Object> is probably strictly technically correct in most cases, at least as long as you don't involve arrays
but it will get nasty down the road
mostly because you don't know what the types of the object in the list are, and so won't be able to deserialize them without guesswork
Inquiry: Interfacing Spigot/Java with OS-level Age-Assurance APIs (2027 Standards)
I'm looking into the feasibility of a plugin that can interface with the upcoming OS-level Age-Assurance APIs (relevant to 2027 standards like AB 1043).
As a sysadmin with a MySQL backend (using CoreProtect and Factions), I'm trying to figure out how to ingest these real-time age signals from the client OS to partition UUID data. Since the current Minecraft protocol doesn't include a metadata field for OS-level age-assurance flags in the Handshake or Login packets, has anyone looked into using a custom Netty transition or Plugin Messaging Channel to relay this from a modified client?
Receiving these signals triggers 'Actual Knowledge' liability (with negligence fines of $7,500), so I'm trying to determine if a Java wrapper or a Spigot-compatible API can even be built to read these signals. Or is the JVM sandbox effectively blocking us from reaching the OS API entirely, making geofencing the only technical solution for independent servers?
why would you care about that in the server
Mojang would introduce that in the client as that's the thing interfacing with the user, servers don't need to care about it
as a matter of fact, Mojang has already been working on age verification on the chat: https://www.sportskeeda.com/minecraft/age-verification-minecraft-everything-need-know
Thanks. This helps out a lot.
Microsoft didn't care till countries started pushing for age verification
so eh, I can't put this one on them
Age verification is the most useless thing to be introduced
โOh no my 13 year old child can insult other 13 year old childs just like on any other internet platform in this worldโ
Not for the mega corpos funding it. Since it can help doge liability
Idk why a platform could ever be liable for such things
Thatโs also very stupid
they can be liable for not moderating the platform
^^
Yeah sure and this sucks
it doesn't really, children should be supervised by parents ideally but that's not gonna happen so the governments around the world have to step in
To clarify, the goal isn't just to see if the account is verified, but to manage the secondary data generated by the server.
Even if the client handles the initial handshake, as a server owner, I am persistently logging chat logs (moderation), player behavior (Factions/Bounties stats), and IP addresses into a MySQL backend. Once an age signal is triggered, these logs transition from 'anonymous traffic' to 'Actual Knowledge' of a protected user's data.
Iโm looking for technical solutions or listeners that can:
Tag UUIDs based on that incoming age-bracket metadata.
Automate SQL triggers to apply different retention periods or auto-anonymization to those specific UUIDs in CoreProtect and other behavioral databases.
There are 2 possible cases:
- Your parents should be liable for moderating their childrenโs usage of the internet
- when the child gets old enough to chat on their own, they should be able to moderate themselves and should be liable for what they are typing
Itโs as easy as that
none of these things are identifying data so you shouldn't have to worry about it
It wouldnโt be so bad if there was a way to verify without sending your ID to a third party
Well no, itโs straight up unnecessary to do age checks in the first place
the issue with this logic is that it assumes an ideal world
Some 10 year olds are developed enough to chat on their own, some 16 year olds are not
Canโt we get like
Our bank or government to give us a document that confirms our age
Rather than sending our Id to Microsoft
in my country it is easy, there's a country-wide ID database controlled by the government
Well the logic suggests that those are the cases that should clarify liability. If some party involved fails to moderate themselves in the chat, they should be held accountable.
Using that data would be hella illegal where I live
the data is controlled by the government so it is fine
Exactly
the companies only get a verification that we are indeed who we say we are
And using it for any other cases than currently defined by German law, would be hella illegal
Itโs very very strict
I think weโre veering away from the technical scope here. Regardless of where the responsibility lies, Iโm looking at this as a System Administrator with a data-retention requirement.
My question is strictly about automation and API hooks:
Is there a listener in the Spigot API that can catch the account-level age signal during the PlayerLoginEvent?
If so, can that signal be used to trigger an automated SQL script (like an UPDATE or DELETE on a specific UUID) in my behavioral and chat databases to meet 2027 data-minimization standards?
I'm just trying to find out if the current server-side architecture allows for this kind of automated data partitioning.
Would have made my life a lot more boring if unavoidable age checks existed for everything
Lol
Itโs not even countable how often I smuggled into partys that would be 18+
And I can freely say that because funnily you arenโt held responsible if you smuggle into it, the organiser is liable lmao
I donโt think the age verification status is sent to the server
Maybe you can query the Mojang api from the server to check, idk
If EntityUnloadEvent is called, and I set entity#setRemoveWhenFarAway=true, does that mean I don't need to use entity#remove in that event?
i'd say to test it
?tas
Iirc that is the spigot name for isPersistent so yes
hm? that method is not about storage persistence, the entity can still be unloaded and saved and reloaded even if that property is set to true
then i must misremember it
If I set setRemoveWhenFarAway=true, can the entity be loaded even after it has been unloaded before?
yes
So what does this method do?
that property just controls whether an entity can be allowed to despawn naturally outside the player's spawn radius
even if the chunk it is in remains loaded
Entity#setPersistent controls whether the entity gets saved to storage when the chunk it is in unloads
If false, does this no happen?
The entity despawns even when the false flag is set no?
if the property is set to false, it is not allowed to despawn outside the spawn radius
it does despawn if the chunk unloads, of course, but it might get saved with it (if setPersistent is true)
what is the spawn radius
i suddenly have this deja vu that this is the third time this happens
a radius around the player in which entities can spawn and exist
it's in the wiki
look it up
i'm like 90% sure i've confused persistent and removeWhenFarAway at least 2 times before and you've corrected it
it doesn't help that Entity#setPersistent is a spigot addition, and the internal name for the api's remove when far away isโฆ persistenceRequired
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html I'm here but I can't see anything about spawn radius
got quite confused when I had to port a plugin to fabric
isn't the despawn radius separate from the spawn radius
and goes by mob category
iirc at least in paper, it goes by same category as mob spawn caps, and has 2 radii; a hard and a soft radius
soft radius makes them randomly despawn over time, hard despawns them instantly
ghasts are allowed to stay around for farther
defaults to like 48 and 128 or 64 or something respectively
iirc it is also spherical where the spawn radius is square
Well, I'm lost. I don't know what values โโI should set
what're you trying to do
i think paper at least disallows you from removing the entity in EntityUnload or EntityRemoveFromWorld Events
or used to
i remember running headfirst into it in my spawner plugin where i wanted to check things on entity unload to determine whether they should despawn or not
It's the Hypixel Skyblock minions
set where?
what values?
what do you want to do? what do you want to happen?
without knowing anything about what you're trying to do or how it should work, probably just set isPersistent to false and treat the entity as a transient one
yeah
I don't want the entity to disappear if the entity is unloaded
That is, if someone loads the chunk again, then the entity will be there
then set it to true
the persistent flag?
Hey so I'm just getting back into development and my bungeecord plugin isn't compiling. Says
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find com.mojang:brigadier:1.2.9.```
Using Gradle.
what about removeWhenFarAway?
setPersistent defaults to true already so you don't really need to touch anything to begin with
are monsters actually persistent? i think they aren't unless they have name tags or something
they are persistent, yes
odd
if you shut down the server while you're next to a creeper,
oh boy is it going to be there when you join back
Don't recall ever having this issue before if anyone could help
i could've sworn they disappear when i crank the despawn range up to higher values than view distance
that is the removeFromFarAway bit
I didn't know that
which internally is called persistenceRequired
๐ฟ
What is the default value for removedWhenFarAway?
But I have no idea what that does yet ๐ญ
I don't know if I want this to be false lol
when it's true, the entity will be removed when it's far away
when it's false, it will not be removed when it's far away
if it's set to true and you walk away, it gets deleted for all eternity
that's what it does
simple
Is there a entity type that makes this false by default?
most animals for example
but does it matter? just set it to false explicitly when you spawn your entity and forget about it
But is this option true by default for monsters?
for monsters without nametags or whatever, it's true i think
most
i see
excluding some special cases like elder guardians and shit
not sure if that implements monster but i'd say it's a monster
the wither boss sure as shit is a monster that doesn't despawn when far away
most monstrous
Anyone??
If EntityRemoveFromWorldEvent is called, then EntityUnloadEvent was guaranteed to have been called as well?
no, an entity can be removed without all entities in the chunk unloading
for example, a player kills the entity
you also can't call entity::remove on the entity of a removefromworld event, in case that's what you're thinking about
that would be stupid anyway
Hello, I want to create a small server in 1.8.9 and add some plugins to it should I be using spigot, and if so, where can I find the 1.8.9 jars ?
it's already getting removed
same goes for entity unload
?bt Spigot is obtained through BuildTools
pretty sure you can do it in the entities unload event and it won't get saved, but atp just setPersistent(false)
But using entity#remove on this case, am I not permanently removing it?
it might come back later though
yea
hm true
iirc that throws an exception about section status being changed, but i'm not sure
thx a lot
I'm exiting the chunk, and for some reason, the entity within the chunk isn't being called in EntitiesUnloadEvent. do you know what can be?
is the event getting called at all for the chunk the entity is in?
could be the chunk is being kept loaded or anything, idk
or you forgor to set removewhenfaraway to false and it despawned before unloading
kk I'll look into it
Isn't this flag false by default in armor stands?
i'd assume so
The EntityRemoveFromWorld event is called, but the EntitiesUnload event is not
that means it's getting deleted for one reason or another
make sure you do actually set removefaraway to false instead of relying on the default
if that's not it, it could be some other plugin
How could a plugin interfere with that?
it could delete it
for whatever reason
i don't know
something something mob stacker deluxe 9000 will delete all faraway armorstands
maybe is slime paper causing this
you can try dumping a stack trace in the remove event
But the opposite is true, right? If EntitiesUnloadEvent is called, then I have a guarantee that EntityRemoveFromWorldEvent will be called
yes, the remove event is called whenever a mob ceases to be in the world for any reason
such as dying, unloading, despawning, or any other reason
it and the entityaddtoworld event are designed specifically with the invariant in mind that they can be used to bookkeep which entities exist in the world in a loaded state
Perhaps this is what I need then. The problem is that this event is only available in the paper
Several useful pieces of information, such as the minion's efficiency, the last time the minion was active so that when the minion is loaded, I can calculate the time difference to know how many resources to generate based on that time, and other informations
And remove it from the cache because if the server has 1000 minions placed but only 20 are loaded, I won't have everything in the cache
And if an entity that is a minion is loaded, then I put it back in the cache
that's the right place to do it, that's what the event, and its mirror counterpart in addtoworldevent, are for; entity lifecycle
especially useful for managing a cache
e.g. i used them in villager lobotomizatornator to maintain the lists of villagers to act on/update the trades of, so i wouldn't have to keep iterating over the world's entities to find the villagers
But EntityRemoveFromWorldEvent is only in the paper. How do I do that in Spigot?
i'll be honest, my real recommendation is to just drop spigot support; many if not most large plugins have already, specifically because of things like this, and spigot only has like a 10-20% market share now (on modern versions), so it isn't a problem financially
entities unload event should work for when the entities unload, but not for other removal causes
the "banging rocks together" type alternative is to loop over the cached entities each tick and check Entity::isValid
alright
https://pastes.dev/3Uhjh7T1BL another thing This is returning the block above the bedrock in the nether. How can I fix this?
https://imgur.com/huY1d4y this area
i don't think heightmaps will do anything useful in the nether
i don't remember what i did for the nether in my rtp plugin
probably just picked a position at y 80ish and scanned down/up
Why isn't there a heightmap for bedrock in the Nether?
I would say it could ignore bedrock
But thereโs basically always solid netherrack below the bedrock so that doesnโt help
myes
one way of defining it that'd be sort of useful is the "highest air block on top of a solid block but under the bedrock ceiling"
but that is kind of difficult to keep up to date efficiently
Is there any tutorial / documentation for spigot plugin developement in older versions of mc ? like 1.8.9
my best advice is to give up
Isn't that literally the height map of the leaves?
ty
no, it's a little different: the leaves heightmap considers leaves as air
treating "bedrock as air" wouldn't help in the nether
It would have to both consider netherrack and not consider netherrack
Depending on if there was air above it
why not
because there's just netherrack directly under it
and if you skip the netherrack too there's not much left of the nether
Does player.openInventory() ever cause a moment where player.getOpenInventory() is null?
If a player already has an inventory open and I call:
player.openInventory(newInventory);
is there ever a moment during the transition โ between the old inventory closing and the new one opening โ where player.getOpenInventory() returns null? Or is the switch guaranteed to be atomic so itโs never null?
Don't think so
worrying about atomicity in bukkit is a bit redundant since just about everything you do happens on the main thread
i see
it's not atomic in the sense that there's a compareAndSet loop somewhere that perfectly transitions the state from one inventory to another
but it's atomic in the sense that to you, the caller on the main thread, once openInventory returns, the inventory is open, and getOpenInventory will reflect that
notwithstanding any nonsense like a InventoryOpenEvent listener changing the open inventory
^
Thanks
i'm trying to make it so that fishing rods in 1.8 will still cause kb/hit event, but no armor durability damage, is there any easy way to do this without shceduling events in the future (this will probably introduce exploits)
I'm looking at the possibility of grabbing the damage that causes durability on armor to decrement and if its 0 or caused by rod, cancel the decrement event, but idk how you would grab this. or ig you could make a java agent to manually rewrite the class, but i don't want to do that
are there any better methods or nah
actually ig i could just ask the spigot developer to make it an option
what's the point of enums when we have sealed interfaces with pattern matching in modern java?
like i can attach custom values to specific enums like objects now
What spigot developer
is it possible to pretend blocks have skylight access? or do i need to manipulate light blocks in an insane volume to even approach simulating that?
the light block?
? why do you want to pretend they have sky access
mostly to know if its possible tbh
It's probably possible
worth the effort probably not
also depends on what you're really trying to achieve
package com.servedon.user.username;
import org.jspecify.annotations.NullMarked;
import java.util.regex.Pattern;
@NullMarked
public sealed interface UsernameValidationError permits UsernameValidationError.TooShort, UsernameValidationError.TooLong, UsernameValidationError.IllegalCharacter {
final class TooShort implements UsernameValidationError {
private final int minimum;
private TooShort(final int minimum) {
this.minimum = minimum;
}
public int minimum() {
return this.minimum;
}
}
final class TooLong implements UsernameValidationError {
private final int maximum;
private TooLong(final int maximum) {
this.maximum = maximum;
}
public int maximum() {
return this.maximum;
}
}
final class IllegalCharacter implements UsernameValidationError {
private final Pattern pattern;
private IllegalCharacter(final Pattern pattern) {
this.pattern = pattern;
}
public Pattern pattern() {
return this.pattern;
}
}
TooShort TOO_SHORT = new TooShort(3);
TooLong TOO_LONG = new TooLong(32);
IllegalCharacter ILLEGAL_CHARACTER = new IllegalCharacter(Pattern.compile("^[A-Za-z][A-Za-z0-9_]*$"));
}
i love pattern matching
Could you not use records?
I see
if you dont enforce it, you couldnt make assumption that the constants are the only way to get proper values unless you execute the validation to get the object itself
I mean it would be possible to use enums in conjunction with sealed interfaces
tho I do think there's very little reason to use enums in this day and era
unless you need ordinal generation i dont see of use tbh
sealed interfaces are sort of superior to enums in most ways
with enums you do still get ordinals however, which make for very efficient sets and maps
even then, it's not impossible to create ordinals for registry style objects at runtime, and create matching efficient set/map impls using them
so i would say enums still have their place as a convenience more than anything; representing a state that can be more than 2 things but doesn't require any per-state logic or behavior, and doesn't need to be open to e.g. addons registering their own constants
what i would campaign against is using enums as a major business code component, like in mcmmo where every skill is an enum constant, since it means you end up with either switch blocks everywhere, or a massive god-enum class; and addons won't be able to register their own skills
I mean yea, it can be sufficient for ordinals, singletons, just a set of constants with iterability, but like ofc u can acheive everything that enums offer with a sealed approach
ik there are certain memory benefits to records (assuming u were to use those), curious if enums by chance get similar treatment
I have recently developed a database lazy loading utility: https://github.com/keywhale/Loader
If anyone wants to use it with Maven, feel free to add it via Jitpack.
Any comments or recommendations would also be appreciated.
Thanks
part1, part2 etc are horrible names if you don't have any context
But also splitting the serialization and saving steps and leaving it to be implementation dependant is incredibly error prone
Ideally return a Callback<byte[]> or have an encode(T object, ByteBuf buffer) or something
That way you can avoid the whole hassle of managing mutable arrays, which can be a nightmare for bulk operations
And still have some sort of system to manage successful vs failed encodes
Thank you
I also noticed that I got org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled when I did shutdownNow() on the onDisable of my shop plugin
I will probably have to detect when it's expediting, and then add the runnable to the set instead of scheduling
@NullMarked
public sealed interface PasswordValidationResult permits PasswordValidationResult.Success, PasswordValidationResult.Failure {
record Success(Password password) implements PasswordValidationResult {}
record Failure(PasswordValidationError error) implements PasswordValidationResult {}
}
is it possible to make this somehow a generic sealed interface, when i declare type parameters on the interface it seems it cannot apply them to the records
it would be neat to make this as a Result<T, V>
and then Result<Password, PasswordValidationError> for this concrete type
records are implicitly static, meaning they won't inherit the type parameters of the class they're enclosed in
so that warning is about you declaring a type variable T in the interface, which is never referenced again, because every nested record defines a new type variable T which hides the interface's T
is it possible to workaround this
I mean ideally you'd probably just provide the constructed type Result<Password, PasswordValidationError>, but else you can have sth like
Type<T>
Subtype<T extends SpecialType> extends Type<T>
where you add additional constraint to the type parameter when using the subtype construction
i'd advise against trying to type errors with generics
data oriented programming can be nice to represent data and state, ig but yea errors is another story as they usually pop up around services, gates or processes rather than data and state
Anyone able to help me? I can't post an image but there is a scoreboard I seen on another server, and it has like the &m strikethrough but it looks clean as if its 1.7, but it's a 1.21+ server, I was just wondering how they did it
As u can see the spacers looks like that, but the last time I seen strikethrough lines look like that was 1.7
any ideas how to hook all sounds to modify/cancel them? I am using ProtocolLib to process PacketEvent but many sounds are not handled/affected by it, for example dispensers or jukeboxes
many sounds are played by the client, not the server
ok
that worked ty
Yall like my scoreboard and tab
I'd give it a 5/10
id give it less
gotta make it clean?
you need to have talent or sum shi
any feedback or smth
I donโt know it feels a bit unorganized rn and a bit much with all the colors
Was wondering if there is a known way of opening and handling dialogs on BungeeCord without relying on the API from it.
I want to add support for it, but currently have this issue here blocking any possible use for me: https://github.com/SpigotMC/BungeeCord/issues/3871
It could also be an issue within my plugin's code, so any help would be apreciated.
it might be a bungee side bug rather than your code
Right now that's my assumption too (And that was also suggested last time I asked here)
So I'm looking for a way to make this work, even if it means bypassing the API itself.
Because having this block my progress isn't really nice.
dialogs are packet uhm so you could try sending the dialog packets directly via Bungee packet
yeah u can bypass API
Smth like hooking into channelInitializer and injecting a custom packet handler should let you bypass the api entirely..
Probably. Tho, that most likely requires me to create the proper packet (and validate it's fine). Not to mention handling the packets themself for sending/receiving...
I do try to avoid this stuff, but if there's no better alternative....
u tested on Velocity?
Velocity has no dialog support last time I checked
ah
why does everyone insist on using this stupid smallcaps font on every server
huh?
b-but a server with many players uses it so I must too
so there's nothing I can do basically?
this is literally me ๐ญ
I'm building a server and that's why I'm taking inspiration from the biggest ones, but I think that was a mistake btw
you do have to ask yourself; Why are they going to play on your server instead of the bigger one
because i have more gradients and smallcaps text
I've asked myself that before, and that's why I don't copy 1:1. The thing is, there are things that, in my mind, I should copy. One of them is the font
that said i think the overall design is alright
But for example, they support older versions, but older versions doesn't format well with the custom fonts
the main problems that i see are that
- the icons and text aren't aligned; looks messy
- the rank plate really does not fit in with the rest
- the red-yellow gradient is a bit hard to read to me, but that might just be me
It seems they just installed ViaVersion and didn't even bother to check if it works correctly xd
Are you trying to modify/cancel all sounds entirely?
other than that i think it's pretty good, but it also is i think what i'd see on every other server i'd log on
blending in without being unremarkable in bad ways is a sort of quality of its own i suppose
rank & bank, especially with that gray color scheme, are a bit hard to tell apart
to align the icons, either throw 1-width spaces at it, or actually make sure the icon glyphs in the font all have the same width