#help-development
1 messages ยท Page 1340 of 1
you'll need to provide more information than that
Is acting like there are no Lombok annotations and you trying to compile without these
there is no "try" there, and the Executor interface requires a happens-before relationship
Actions in a thread prior to submitting a Runnable object to an Executor happen-before its execution begins
you are using such executor in the future callback
if you really wanna be sure just make it volatile but it really doesn't matter
the java memory model guarantees a happens-before relationship between any operation performed before a thread is started, and any operations in that thread; and between any operation performed in that thread, and any operation performed on any other thread after the thread terminates
executors are a higher-level thing and so the JMM doesn't make any guarantees on them, but like emily said, the executor contract itself requires them to mimic this behavior
what if the memory model guaranteed java
What if the memory was just the Java we made along the way?
god, all i have are horrible memories
GC(ZGC Major Cycles, during)
11
total
5630ms
avg time
1m1s
avg freq
Is it normal for ZGC to take this long?
i think i have some memory leak
My TPS was going to 5 because of the default GC
so i changed to zgc
major cycles generally mean that to-space was exhausted and the gc was forced to do a full stop-the-world gc that copies and defrags everything
1m is pretty high for that still especially on this small of a heap, but i could see that happening if the machine is overloaded to begin with
This only happens with box servers; it doesn't happen with the SMP server.
i don't know what a box server is
like 50-islands-server
do you have a spark report of it happening
neither of these reports have the numbers you mentioned
box2 server rn: https://spark.lucko.me/hAqyimEuLq
box1 server rn: https://spark.lucko.me/WXp6Ma1gfj
they still don't have the numbers you mentioned
GC(ZGC Major Cycles, during)
7
total
8740ms
avg time
2m34s
avg freq
The tps from box2 with /spark tps had 5 just moments ago but it doesn't show up in the profiler
8 seconds for a major collection is normal
what's causing the low tps then?
i don't know, have you looked at the graph
what graph?
spark is a sampler
it breaks down where mspt sinks into
it really isn't very good for diagnosing gc problems
idk if is gc causing low tps
or if is like minecraft tick server
but smp server with the same amount of the players runs well
so i think is gc
bc smp server have more chunk loading than box servers
apples and oranges
two identically set up servers can perform completely differently depending on what players are doing
compare the actual mspt samples
scroll down and expand the tree
then look at what is taking time
then compare the two servers
But it's quite a coincidence that 2 box servers have 5 tps and the SMP server doesn't
and suppostly the box servers requires less resources
possibly; but if you suspect a memory leak or something gc related, you need something better than spark, especially for diagnosing zgc
zgc is weird and the numbers are difficult to make sense of since it's supposed to be completely concurrent and does weird shit like suspending high memory pressure threads
that said, especially that last bit could cause things to "magically" run slower for no apparent reason (which is why zgc is often recommended against)
i recommend you switch back to g1gc and resolve your memory issue
once it's resolved, you can switch back to zgc
the first step you'll want to do is run the spark memory allocation sampler
compare smp and the box servers
But why do you think is harder to fix memory leaks with ZGC?
.
it's less transparent
it's more magical
it's more complex
I wouldn't know how to analyze either of them, lol
switch back to g1gc and run /spark heapmonitor
then keep an eye on old gen vs young gen gc's
Yes, I know, but I already generated the file and didn't know how to view it
it's an ingame command that just prints the gc events in chat
analyzing an actual gc log, while the best approach, is beyond the scope of what i'm going to handhold anyone through here
if you see a lot of slow old gen gc's back to back, you're either allocating too fast or don't have enough free heap
increase the heap and if you just see the old gen size grow proportionately to that, it's probably a leak
if it helps, it's probably allocation pressure
for the former, take a heap dump; for the latter, take a memory sample with spark
either way, the first thing to do is to take a memory sample with spark on both servers to get a baseline of both
you can send it here and i can look at it
I'll leave one box server with ZGC and another with the old GC
spark heapsummary or heapdump?
heapmonitor doesn't exists
spark gcmonitor
idk how can i analyze this
https://imgur.com/a/qYxZknY Did this stop the main thread for 36ms?
https://spark.lucko.me/wxbbJ3GOzI idk what should i do xd
I wanted to create more servers but there isn't enough RAM lol
what to do when the configuration is kind of complex (entities, itemstacks, a lot of stuff) and its a list of some kind of item. but you dont want to provide any default values so its just empty [] or {}. but you have to explain the user how to use it, show an example of a configuration.
i dont think it will work just easily with comments, becausae when saving, its hard to preserve them, and if you just dump them again each time saving - the user wont be able to remove the comments once they dont want it
Assuming you are talking about yml files, comments have been a solved issue for a long time.
They won't be erased/limited to the header anymore.
As for explaining to the user, this kind of depends on how your config works.
Are the values absolutely required? Is there a template file provided they can reference?
What do you have currently?
you're going to spend a full two hours of your life trying to write the most appropriate comments or documentation possible as to how the configuration should be written for no-one to read it because everyone has a severe case of tunnel vision
they are preserved. but when you serialize it back to yaml. then they''re kinda not..?
but anyways there has to be an example
i cant just put
something: {}
they dont know what to put there
which is why you are going to spend two hours of your life writing something people are going to pretend does not exist
Are they editing serialized data directly?
and if i just put comments, then deserialize the yaml file, so i can access the settings in code. then its not preserved i guess, also if they remove the comment they will get it back
i dont have to spend 2 hours. i just provide an example which is as simple as creating an instance of the setting
and converting to yaml as a comment
ive done that already but the comments are either lost. or the user will be stuck with them. i guess ill go with the second one
i think rubber duck method has just worked for some reason
just add the comments each time, why would the user want to remove comments
yeah exactly
its the only way to make it work normally
you could always just put a link at the top to point to proper documentation
to avoid large comments
Simple projects can still be complex
and then just say, if you wanna know how to configure it, take a look at the example file
no time for that
I'm wondering if there's a better way to go about configuring whatever it is they are doing
what do you mean?
if its in-game stuff like item stacks I usually have a way to set those things in-game
im making an abstract YamlConfiguration class
yeah
i dont think its matters for the topic i mentioned though
oh
it does
but not everything is that easy to do in-game
Well, like Steaf said, in game configuration will beat out file based configuration (for the average user at least), but when it comes to files, keeping them simple still goes a long way.
yep. but
It sounds like you are making them edit serialized data directly, but that's my assumption.
I don't know without an example file
i actually cant think of a clean way to do things like these
- region:
world: world
region-name: region1
mobs:
- drops:
- type: DIAMOND
amount: 1
meta: {}
- type: GOLD_INGOT
amount: 1
meta: {}
- type: IRON_INGOT
amount: 1
meta: {}
type: ZOMBIE
and its not most complex
but still its easier to do with file
yeah so its a custom itemstack serializer I guess
ye
/plugin mobs ZOMBIE drops set
and then take items from the players hotbar or whatever
but yeah it still depends on your goal
then you add chances, damage, health. i dont think it would be as easy for the user and me to put it in-game than just going for the file, it becomes a tree
true, file will be easier to create as a dev
allright
Yea, I guess if this is targeted more so at devs/administrators, then there is the assumption that they should know enough to work with this format.
that too, but I was also more just talking about the ease of coding it
isnt there a standardized serializer for this like
yep, i just dump a Settings object or some MobData object into adpater and yeah thats it
since you said you have limited time
we solved chat formatting inconsistencies with adventure api and minimessage
maybe but iirc its not perfect
so why isnt there a standard format for serialization of items
dunnoo
because items are annoyingly complicated
Cause it's hard
yeah the nbt or smth
serializing to bytes is still the best way to store items xD
and most readable
also for the dfu and stuff
๐
Plus any changes to data structure
well a human reading bytes is like the least readable
actually byte serialization that java has introduces some rce vulnerabilities if those configs get out of the server
since java's serialization of classes is kinda weird and doenst protect from custom data being injected, so you could theoretically load a class instance which wasnt even supposed to be loaded in a first place
i like to read bytes
they have a deep meaning
there is it's called nbt and snbt
how is snbt any different than yml
it's perfectly fine
nbt is data because it's data, yes
I kinda wrote one
well I wrote an api that looks a bit like nms' and can decode items and components from nbt, yaml and json

how?
strictyaml -> json -> json nbt ops -> nbt
Ah yes more conversion layers
my_helmet:
components:
minecraft:trim:
pattern: "spire"
material: "emerald"
minecraft:dyed_color: 0x636C6D
minecraft:max_damage: 550
yes, all threads
did you take a memory sample yet?
p much
buuut to make it nice for users let em have aliases and stuff
also where's the fun in not having custom components
:)
thats pretty cool
not yet
see this: https://imgur.com/a/IqTcbzg
CPU usage went up to 80% when TPS went up to 15, probably to clear memory
this is from spawn server, meaning it doesn't seem to be a memory leak from the box servers; or perhaps the CPU usage of the box processes caused the TPS to drop on the spawn server
the gc going crazy on a server because of a leak/too much pressure will cause cpu usage to skyrocket
so that could still be the cause
but yes, the box being overloaded does reduce tps
I'm getting UserNotFoundException on player join.
How is that possible?
i just remove on playerquit
I thought I had guaranteed visibility on playerjoin
how do I enable debug?
cuz
playerjoinevent
does not need to be the first event
what's more
it isn't
Sorry if wrong channel, looking for Minecraft devs for VNX SMP (AH, Economy, GUI,Commands) if you are interested DM me
?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/
I think you misunderstood. The playerjoinevent is not reading the map#put made in playerasyncprelogin.
let's see your asyncprelogin
I'll show you mine if you show me yours
what's the name of that swelling up blushing emoji again

mm yes
i dont send the event listeners for some reason im dumb
I just have userService#remove on PlayerQuitEvent
when in doubt, print sysouts
you're sure the uuid/name isn't being changed after the listener inserts them into the map?
The name doesn't change anything on this error
Is it possible for the UUID to change between asyncplayerpreloginevent and playerjoinevent?
Isn't he always the same?
the uuid in the prelogin event can be changed
by someone changing it, for whatever reason you'd change it, e.g. mixed online/offline mode or username changes
๐คก
My 99 plugins are so poorly made then
Which event allows me to change the UUID?
I can't do event#setuniqueId in asyncplayerpreloginevent
print sysouts
you can change the profile iirc, that includes the name and id
So what should I do to avoid this then?
Are you on Spigot?
They're not
yes
Paper has a HandshakeEvent which might be messing with you
truth nuke ๐
on really im running paper yes
Dont say spigot then cuh
and then paper yells at u with authornagexception for sysout
fuck paper
maybe i'll need get/create data from db on playerjoin then
and prohibit interactions with the plugin until the database fetch is successful
I think on paper you can do:
@EventHandler
public void onHandshake(PlayerHandshakeEvent event) {
event.setUniqueId(idk);
event.setPropertiesJson(event.getOriginalPropertiesJson())
}
is the handshake id respected? isn't that just the crap the client sends
which is ignored because the client is authed anyways
not sure if paper decided to ignore the protocol and have their event work entirely different
yeah there's setPlayerProfile in the AsyncPlayerPreLoginEvent
true... Spork would never nag u for using sysout
FUCKING TRUE
almost all the javadocs in bukkit api are this also lol
would be nice to know if the uuid is actually used anywhere, but regardless
the async prelogin event has a profile setter
yeah i mean this is one of those cases where you'd use monitor priority
thought i was gonna be able to solve a design problem im facing by realizing i used a Map that where the Key is the information i need for how im using the Value
little did i know... past me hid the map behind implementation and only expose a Collection of Values as API
and i kind of dont want to change that
but if i dont, then im holding onto a reference to an object for waayyyy longer than i actually need to
does a plugin that depends on another plugin not only wait for it to be loaded, but also enabled?
It should yes
Worth to test tho
I think that plugin loads yours load that plugin enables, yours enables
i hope so
I'm pretty sure it'd be reported as a bug if otherwise
You could make 2 plugins with names annabelle and xenia
And then depend on each
Actually just xenia
And send a log message on load and enable
But not entirely sure if the plugins are sorted by names
cyclic dependencies :(
No
I meant individually
And also it's not cyclic
Annabelle will run first
Then xenia
And that yours
They're is no annabelle depend on yours
So that there's a cyclic dependency
if they depended on each other that would be cyclic
hmm
If your is named b to y
And the dependencies are named sorted
Then this'd be an easy way to test
pretty sure dependencies are loaded in the order they are defined
whether it be in the load thing in config or the manifest file
Ah no
There's no config or manifest, dependencies (plugins) are dynamic
So a file wouldn't work for this
You can look in simple plugin manager
If someone has access
are you talking about the order of the plugin list?
if so, order of the plugins loading is not guaranteed, however if nothing is defining a dependency to load in the plugins being loaded, then it typically defaults to being alphabetical since that is the general standard of how directories are listed
IE, its mostly OS dependent how the directory is listed and the JVM doesn't really alter that unless told to
does this also carry through to enable order?
ie. if A depends on B, would B#onEnable call before A#onEnable?
?stash
Depends what kind of dependency we talking but in general no. If you don't have it defined you are depending on another plugin, your plugin will be loaded and then ran hence why it has always been a thing to structure your plugin to handle waiting on dependencies to be loaded or to not run anything that depends on something within the first few minutes lol
because there is no guarantee that right after yours is loaded that your dependenices loaded before hand, or will load immediately after
plugin with a hard-depend on another plugin
if its defined in the config, then the server will not attempt to run your plugin until what you defined has been loaded as far as I am aware
that is the only thing that alters the loading order from plugins
otherwise its whatever order the JVM obtained from the directory lol
good enough for me
you can perform a test if you want, but just know it would be platform dependent as well because as I said, the directory lististing is depending on how the OS responds to the request and how it chooses to order everything. From windows the default comes from FindFirstFile function
which is the function that controls directory listing in windows
ye ik that dir listing isnt guaranteed to be sorted
i just didnt know if plugins wait for their dependencies to be enabled before they enable
nope, not unless the server is told to do so
or if there was a chance a dependency could be loaded, but not enabled, before the dependant enables
otherwise it will attempt to load yours and enable, and then it will fail if you required something and then move on, which if you are not careful you can cause a cascading effect if you have enough plugins depending on each other
IE, one plugin failed to enable, because something was not enabled yet because your onEnable code required it, and then this causes another plugin to not enable because this one didn't etc
update i ended up with something similar to this (but 100x more autistic) bc i realized theres a chance rounding errors with valid doubles but invalid "units" (stuff like .001 and .009 had odd rounding, and even 0.01 acted strange)
so now im going string <-> long instead of string <-> double <-> long
(i thought i was safe doing * or / 100.00, i was not)
lol
oh god it shit the bed
What
how the fuck
surely it cant be my '\0'...
god damn it it is
theres rly no way to have replace(char, char) just nuke a char from existence? damn
whole Strings it is i guess
can you split on the char and then join it again? xD
fuck ur so right
u can only split by whole strings ๐ญ
ill just have to write my own .replace method...
it appears in my hubris i didnt think "" was some fuckshit in java
(it is zero-length whereas '\0' still counts towards the overall string)
this is the equivalent of making an empty string
yeaaahh
actually wait it wasnt me misunderstanding "" was '\0' that i was using the wrong way
ofc "" makes sense bc then im actually telling java "replace this with NOTHING", whereas '\0' IS still something
and for some reason i thought that would be equivalent to using an empty string
?jd-s
i wonder how fucky i could make this
im imagining some dumb shit specifically for null char like
String replace(String str, char oldChar, char newChar) {
char[] out = new char[str.length()]; // worst-case where len(out) = len(in)
int len = 0;
for (char ch : str.toCharArray()) {
if (ch != oldChar) {
out[len++] = ch;
} else if (newChar != '\0') {
out[len++] = newChar;
}
}
return new String(out, 0, len);
}```
like 3 array copies tho kinda pepega (out alloc, toCharArray, and new)
call me john java the way i java'd that john
if java had mutable strings that could be single alloc but noOoOo
you can however use binary for this
pretty sure string builder has remove by index
oh wait StringBuilder will also just make its initial capacity the string length (+ 16 for encoding i guess?)
oh but deleteCharAt does some weird arraycopy stuff to shift everything
i might have best-case here somehow lol
it looks fine
just that instead of doing manual replace
you can do removeFromString(String string, char character)
you don't need to do it for \0
so i did consider that
and is probably what i would end up using
since duplicate replace method makes no sense
you only need to if (ch != character)
ye
and then increment and add current char to your array
yeah :p
again, java, id kill to be able to work on the backing array for strings... just this once
it also handles utf 16
its funny bc i think String#replace(char, char) itself doesnt care about encoding
oh nvm it does
it does yeah
The player's UUID after the player join event won't change until the player quit event be called, right? I know the question is stupid, but I don't doubt anything anymore.
thats usually fine
since it uses system.arraycopy
which is quite fast
(obv in terms of pure theoretical time complexity its less good, but in practice it tends to work out just fine)
it also does not realloc if it doesn't need to
deleteCharAt does not, for example
it doesn't create a new array or anything
Player UUID is never changing
any of y'all know any tools where I can toss code with spigot mappings and it auto converts
Are you printing sysouts yet
agh
true
i didnt notice the arraycopy was to the same array
(idk where i thought an extra array was coming from)
maybe this Isnt something i should worry about also
its not like these strings are gonna have input values that are like 1 Billion characters long
i should Not waste my time trying to find an optimal way to replace one character in string whos length will probably never be over 10
Clearly needs JNI and hand optimized assembly
TRUE!
im actually creating a native binding as we speak
following stdlib callchains is... something
we got the StringBuilder(String) { AbstractStringBuilder(String) { this.value = new byte[String#length() + 16], AbstractStringBuilder#append(String) { String#getBytes(this.value, PARAMS) (redirects to [StringLatin1|StringUTF16]#getBytes) { for (;;) { dst[i] = src[i] } } } }
manual copy in append but arraycopy in deleteCharAt
(most likely due to how a string encoder gets a byte at index)
it all makes sense but my lord
i think i only have one option @lilac dagger @young knoll ... i Need to fork OpenJDK and submit a PR
we need String#remove(char)
(it will just call String#replace(valueOf(char[] {char}), "")

and String#split(char, int) (it just calls String#split(valueOf(char[]{char}), int)) + overloads
crazy revelation
String#charAt is copyless
String remove(String str, char ch) {
int max = str.length();
char[] chars = new char[max];
int len = 0;
for(int i = 0; < max; i++) {
char c = str.charAt(i);
if (ch != c) {
out[len++] = c;
}
}
return new String(chars, 0, len);
}```
this is Great news @lilac dagger
(there is no circumstance where i should actually use this method)
charIterator might inline better
better idea
String.class.getDeclaredField("value").set(str, null);
Nuke the string
curse u java 9+ modules, i cannot access java.base
worse comes to worst, unsafe might do the trick :>
not sure if strong encapsulation protects against it
I CLOSED INTELLIJ AND I GOT 30 GB OF DISK SPACE BACK??? AND 20 GB OF RAM????
JETBRAINS
WHAT?
You never just make 30 GB of lock files?
๐ญ
Needs more ram in this economy?
im stealing that thx
Not sure it's gonna be useful to you tho
gradle
this is also gradle running out of heap, not ij
gradle likes to eat all available compute memory and disk space
because that's what build tools are supposed to do, right
i really wonder how you get to do that lol
I keep using a 8gb machine for Android work and it works fine
most I've pulled from IJ was 50gb
I always keep it on the default limit from toolbox and then Xmx2G for gradle
how much ram do u have
64gb on my desktop rn
i think on my PC toolbox's default id 2gb, and on work PC it's slightly less than 1gb because it has mercy on me
laptop has 16gb soldered ๐ข
so I just leave it at that and it just works lol
I've been also messing around with running my own little copilot thing which pulls 11gb vram
ddr4?
yeah I built this a while ago
ahh thats why
I'd go for 96gb ddr5 if I were building this today
the ram prices are still high ๐ฅ
I mean thats pretty fair
then they became like 30 bucks
๐
just build your own ram
I was debating running 256gb ram for shits n giggles it was like 150 bucks
hi fellow hackernews reader
huh??
then its a crazy coincidence cause check the #1 post on the front page today
its exactly that video
okay
I am yet to build my own 1 bit nand
Imagine building 16 gigs of it ๐
just use swap ๐
degrading ssd?
that's why i use a hdd for swap
But once you build 1 gb of ram i guess the mechanism is just to add one more block
Probably even 16kb blocks is enough to repeat
what does it mean?
Sadly my laptop doesn't come with a hdd
SSDs wear out when writing to them
Ssds have limited write before they're burned
Same mechanism as batteries i think
oh fr? i thought thats just a hdd thing
run smartctl for more info !!
uhh yeah whatever you say
HDDs don't really have that issue (at least not as much, they last a lot longer). Looks like you got them confused
Well there's videos where you see it in action with batteries
yeah probably
I've been using my boot ssd for 13 years ๐
It's probably a slc
Or wait
What's the term when a trap only holds 1 bit?
Oh yeah
Slc
Modern ones most likely are mlc
They wear faster but are cheaper
And also nobody bothers to put this technology on the store page when you buy an ssd
53% health ๐ญ
that's fine you still got more than half of its lifetime yet to use lol
But i don't know what's this endurance about
It's just what it's rated for
Yeah it's not like the drive will explode when I reach it
Still though I really should swap
if only the ssd prices weren't so bad ๐ญ
I'd still try to keep backup data
I only really have Windows on there
Oh it's fine
It's 128gb doesn't fit much else
Ye
Same for me
If you have an hdd also you could move the swap space there
I did it for both windows and linux
i recommend against it, hdd is too slow for swap to be very useful, it will take a long time for paged applications to "wake up"
it is better than crashing from out of os memory, but only marginally
something that works (and which we used back in the day) is to plug in a flash drive in a usb 3 port
Is that fast enough?
much faster than a hdd
Nice
a flash stick is essentially a small cheap ssd with fairly limited bandwidth
But i can't do it on a laptop
does your laptop not have usb ports?
It has but it's annoying to have ports with things on them for long
Plus i move it around i don't wanna damage the port
I have to usb 3
Both are blue
Wait
I also have a microsd slot
Can't i put one there?
check the specs and compare to the hdd
Theoretical max speed for micro sd is 300
If using the best one
I assume it's probably around 200
MB/s
A western digital one is saying speed of 173
a big issue with hdd's and optical disks, both being things with moving parts, is seek times
they perform relatively well for contiguous reads/writes, but random access involves a lot of physical movement and seeking
which is bad for random access memory, i.e. ram, in particular
not totally sure how it works in conjunction with paging; bringing the page back into physical ram is a contiguous read i'd assume
Takes time
Yeah
But also a nice thing about hdd is the write and read is quite similar no?
ideally, but doesnt have to be
Flipping a magnetic bit is fast i assume
Windows does and linux does allocate space
So i assume it's all in one place
Unless you allocate space on multiple drives (i assume it's possible)
i think what cakeeater meant to say is that it might be split behind several pages right?
Too many assumptions
ofc depending on page size ^^
I don't know what a page is
memory pages
Is that a ram memory block?
roughly yes
kinda
Oh i see
i think the primary way it makes sense is that a pages allow contiguous virtual memory to not be contiguous physically
looking at some forums, it looks like people advise against sd cards in particular because they don't disperse/manage writes as well as proper ssd drives, and so wear out much faster from the constant writes when used as swap
Good to know
nobody seems to have anything to say about the performance, everyone is being a reddit nanny and going "nooo you can't do that you will wear out the card"
but from the numbers i did see it probably does perform better
As in ram you mean by physically?
i fucking hate people that start nannying instead of answering the asked question
well you're aware of how physical and virtual adresses work right?
So you can have partial reads from swap instead of the whole page?
No, teach me
u have the virtual address space, that is the addresses we write code against, then those addresses are translated to physical addresses
I know what adresses are and rough details about ram
this is for address protection, but also to allow for example paging
So abstracting
sd cards arent designed for constant writes.. well.. depends which ones
yea
In a sense
but RAM strictly speaking is physical memory
I see
they wear out faster than ssds
Yeah makes sense
But how big is the nand on a stick?
I guess i have to open up one to see
But yeah if you think about it a microsd doesn't have a lot of real estate
And they also boast huge memory sizes
Thanks for teaching me about virtual memory
usually usb has a smaller controller chip .. maybe 1 or 2 nand flash packages
haha yea, and so the idea is that u have these pages, so basically ur app (which might live between 0x00000000 and 0x0000FFFF) looks to be contiguous, but physically, it might not be at all
But ram is fast
yep
basically each application gets its own virtual memory space that starts from zero, and then that gets mapped, in increments of pages, to physical memory
e.g. the way how java guards against null pointer references is by having the null pointer point at memory address zero, which is in page zero, which is set to be inaccessible; so trying to access it raises an error which java handles and converts into a NPE
^ and when u for example swap processes in and out, there's a chance once a process is reloaded, it will not be contiguous physically post-swap, but ofc virtually it will be.
Pretty cool
this was originally just for managing the virtual memory mappings, but eventually someone realized that you could shove infrequently-used pages to disk into a file
^
and then windows called it the pagefile.sys
๐
but since hdd's which were essentially the only thing that existed at the time were slow, it became common practice to use external flash drives to store the pages on
paging is used to solve if u run out of memory (where it will trigger a bunch of page faults, basically swapping pages in and out frequently), but also to minimize unused memory whilst allowing for locality
which is why if you plug a flash stick into windows xp, it asks if you want to "use this drive to speed up the computer"
what's the point of having one if you can't use it !!
i will use the sd card until it melts
oh my god memory unlocked
Pretty cool stuff
Still, even if it's jusr one it's bigger than a micro sd card
why not just use an ssd
Well all this started because of a ~50% durability left on a ssd with windows
And endurance at its limit
So we talk about alternatives and ended up learning about virtual memory
that must be a really old ssd
And how physical memory is not guaranteed to be continuous
10 years or so i believe olivo said
13
yea 50% is good for 13 years..
although, i have m.2 ssds from samsung from 2019 and they're all still on 95% and above
kinda depends what u use it for i guess
i dont think theres anything that would work permanently and not have a durability issue
everything wears as time passes
Yeah
If you use swap space on it
And get freqently over your designed ram capacity
Is one way to lower it i think?
Yeah
I don't know how the trap on a ssd work
But pretty sure it degrades in time
having the ssd full near its storage capacity also accelerates how fast it wears
Batteries do
Interesting
i find it kind of funny how the solid state thing wears out faster than the thing with the moving parts
Well, if smarter people than me solves batteries pretty sure we'd see this in ssds too
If it can get this small that is
I'd love to have a phone for 50 years and still have a charge
Not talking about free energy
Just to keep it in a shelf and be usable in 50 years
But sounds impossible
yeah its more about chemistry than size.. batteries just degrade over time no matter what.. even if you dont use them, they slowly lose capacity
batteries kinda destroy themselves over time
Yeah sadly
this sounds so sad
starting and stopping a debug minecraft client environment multiple times in a row over a long session
yeah I mean been there done that, but haven't had issues like that lol
and honestly neither have i
but newer intellij has been shitting the bed on me a lot (even if this is gradles fault)
it might be a bug the specific gradle version im on, bc this was a non-issue before i decided to update my wrapper
bc this project is nearly 8 years old
(i went from gradle 6.7 to 6.9.4)
(its java 8)
(its minecraft 1.8.8)
?jd-s
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
why is it "illegal" to add items to drop
Itโll throw an exception
Chunk system has shut down, cannot process chunk requests in world
'5fb6d722-8f05-43f0-be8c-1dba06d8fbcc' at (0,0) status: minecraft:full
What does this mean? I got this on playerquitevent
what the fuck why ๐ญ
Idk
Maybe the items arenโt in the world yet
And spigot didnโt really have support for that back in the day
i mean you can just call world.spawnItem or whatever
iirc that list is actually backed by Item entities, but only the ItemStacks are made available, it's a lazily transformed list so you can't really add to it
ah
yeah if it was just itemstacks it made like no sense to me as to why it was only partially mutable
this is doable but you need a special battery where shaking it will give you a charge
they exist if you can find them
Sort of like a bike's 'alternator'?
But i think all batteries get oxidized with time
You still need to store that energy that you get while shaking
But it'd definitely work
well its chemical reaction
you need a chemical that will react to a substrate, chemical can sit at the bottom of battery
shake it, and due to the shaking and interaction with substrate you now have a charge
we've had self-winding watches for a long time
I like the convenience of smartwatches but mechanical watches are just sexy
is it even convenient
only time I find it useful is for tracking your sleep or health stats when you work out
analog watches are completely useless to me, I can more or less tell the time by looking at the sun
they are definitely a good accessory, specially for men
I don't see women wearing them all that often, even though there are some really delicate ones that could really elevate the elegancy of your outfit
the things I find convenient are sleep tracking, alarm clock (bonus for it being based on your sleep state before alarm time) (i find them vibrating on my wrist much more effective than a regular alarm clock), and being able to receive notifications directly on the watch without having to look at my phone and assess if I want to bother with it (bonus points for being able to filter per application or contact)
i don't really use it for anything else besides timer/stopwatch when I don't have my phone around
oh and of course find my phone if you are very silly
I got a apple watch se 2 sitting on a drawer
I used to use it for sleep tracking but I managed to fix it without looking at the numbers so I am not too interested in it anymore
though I haven't tried anything fancier so maybe I am biased
I like them for the mechanism
The one with the heart that spins
Forgot how it was called
That makes sure it doesn't lose precision as much due to gravity
oh i have a fitbit versa, this is far from fancy
i use a 5 dollar digital casio watch that i originally got for farm work because my actual mechanical watch would be too expensive to be regularly caked in shit and grime and banged into things
however i stuck to it because it has an egg timer in it
๐
Will the chat event be removed?
Read the javadoc
i cant find any info about that
if it doesn't say then no
why would it be removed
how will players speak
fuck them kids..
for legal reasons, i do NOT mean "fuck" as in "to have sex with". i am NOT advocating to commit illegal activity with minors
it's deprecated because it's superseded by the async chat event and eventually the 5 other adventure chat events of various synchronicities that paper adds twice per annum
it works but it's not ideal as it causes an unnecessary task to be scheduled on the main thread
And also halts the server thread if you're doing something stupid in your listener
Basically, use AsyncPlayerChatEvent (and recognize you're in an async context!), or if you're using downstream software, use one of the dozen chat events they have for some reason
im gonna make an AsyncPlayerChatEvent listener that just calls Thread.sleep to make the player think they're lagging
i want to lag the player not the server :(
oh alr
I mean there are still reasons to use the sync chat event, but those are the exception and you should default to the async one
the event still exists for those valid reasons
i just use the async event and call a runtask for the next tick if it's the case
yeah but that's cringe if you need the sync result to mutate the event
ah no
it's just a one way out to things like unsafe collection for example
hmm
if i think about it, i should maybe use the playerchat event
i mean sync event
I ask this because my task needs to be done in the main thread anyways
does it need to mutate the event?
wdym
you're writing an event listener
no
why are we talking about events
I have a method that I need to call in the chat event, and if I called it using asyncchatevent, I would have to schedule a task to be executed in the main thread; but then I should use chatevent
My fear was that the event would be removed since it's deprecated
does the task you're firing from your chat event listener need to be able to modify the state or results of that event?
No but my method is not thread-safe
then use the async chat event and schedule a task
why not use the chat event sync?
because the server will block for it to complete so that you can modify the event
which is unnecessary
i dont understand
chat is async
regardless of what event you listen to
so if you do listen to the sync chat event, the server has to schedule that to run on the main thread and wait for you to be done with it before it can e,g, send the chat message to players
it does this because event listeners are expected to be able to modify the event
however your task does not need to modify the event
so this is redundant and unnecessary
what is blocked?
idk the main thread
no
your task runs on the main thread
the chat logic can complete freely and regardless of what you do on the main thread
I really don't understand the difference between listening to a sync event or listening to an async chat event and scheduling a task there
one couples the lifecycle of your task to the chat event and the other does not
the chat event cannot complete until your task is done if you just run it inside the sync listener
And until the chat event is complete, can the messages not be processed by the "async" threads?
the sync or the async chat event
okay so let me put it like this
you have a fridge at home
you go to your fridge to see if it has cheese in it
you find cheese in your fridge, and now intend to eat it
do you
a) take the cheese and eat it
b) go to the supermarket with the cheese, eat the cheese there, and then come back home
a)
since your task doesn't need to do any work on the event, it is completely pointless to have the event wait for it, and to incur the scheduling overheads involved in having the naturally-asynchronous chat logic synchronize to the main thread
so what you want to do is to listen to the event in its natural thread, and then schedule your task onto the main thread, letting the chat event proceed without pointlessly shuffling the whole thing to MT and back
Are the threads responsible for processing the messages blocked until my sync chat event is complete?
it doesn't matter
the specific thread carrying the specific event is
that is the nature of events
In that case, isn't it always the main thread?
whether or not that impacts other chat events is not defined in the api; it could or it could not, iirc there is a pool or something
chat runs on its own threads
the difference is that you're not synchronizing the ENTIRE event to main
only your task
only the part that needs to be on main
Okay, that makes sense now
but
If I use asyncplayerchatevent, it forces me to use thread-safe Map structures like concurrenthashmap; if I use sync event, I only use a hashmap; perhaps the overhead of using concurrenthashmap is heavier than synchronizing the entire event
No
it doesn't force you to do anything
just put the not thread safe shit in a task and run the task on main
this is literally the first line of the chat event block
the difference is, again, that it waits for the task to complete before continuing with the event execution
boxManager#addFriend need be executed on the main thread
i.e. you are delaying all chat by however long it takes for the main thread to pick up the task
actually cache is a hashmap bc im using sync chat event
if i use asynchatevent i'll need to use concurrenthashmap to cache var
I think I am experiencing a dejavu
Tbf im curious why boxManager.addFriend needs to be on the main thread
@EventHandler
public void onAsyncChat(AsncChatEvent event) {
Bukkit.getScheduler().runTask() -> {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
if (cache.contains(uuid)) {
event.setCancelled(true);
cache.remove(uuid);
Component message = event.message();
String target = PlainTextComponentSerializer.plainText().serialize(message).trim().split(" ")[0];
Box box = boxService.get(player.getUniqueId());
if (box == null) {
player.sendMessage(MiniMessage.miniMessage().deserialize(lang.getString("wait", "<red>Wait...")));
return;
}
SlimeWorldInstance slimeWorldInstance = BoxPlugin.advancedSlimePaperAPI.getLoadedWorld(player.getUniqueId().toString());
if (slimeWorldInstance == null) {
player.sendMessage(MiniMessage.miniMessage().deserialize(lang.getString("congrulations", "<red>You did the impossible! Please contact an administrator to report this error.")));
return;
}
boxManager.addFriend(player, target, box);
}
}});
What is it doing that isnโt threadsafe
bc i do player#getName
(You canโt do event.setCancelled in that runTask :p)
that's thread safe i'm fairly certain but that's besides the point
well the whole thing was predicated on him not needing to modify the event
if you do need to modify the event, yes, you have to use the sync event
is not
public GameProfile gameProfile;
what
It's not final, so there's no guarantee of visibility between threads
or volatile or smth
game profile isn't changed in a session unless a plugin explicitly does that, and they won't be able to do that on the same tick a chat message is sent
.
so, you're not really seeing the picture there
And I want to guarantee 100% thread-safety
why
why not
what is it going to read if not the correct data?
a player's game profile, especially the name, is not changing mid-session; if it is, you have bigger problems to worry about than a marginally-stale read
because it complicates a system for no reason, you're trying to introduce thread safety concepts on a platform that is inherently single-threaded
there are cases where you do have to worry about it, this isn't one of them
It shouldn't change mid-session, but it's not declared as final, so the JVM model handles the variable differently
it does not
a read is a read, it doesn't matter whether it is final or not in that sense
only thing final assures is that the value won't change after construction
you are oversimplifying the JMM
a field being plain and nonfinal does not mean 1:1 that it is unsafe to read
I think I've said it before but if you're looking to learn about concurrency, a plugin isn't the best project for it
for example, an object that is itself "published", i.e. made available via volatile memory semantics, and whose fields are written to once before that (i.e. are effectively final) is guaranteed to have visibility for those fields on all threads
unless you twist yourself into a pretzel to try and get around it, this will apply to this gameprofile field
I do like pretzelsโฆ
the only special treatment final gets is a memory barrier at the end of the constructor
what i mean is: variable X = 50. I change the value of X to 100 in thread X. from here, 1 year later, when reading in thread Y, the value of X can be either 50 or 100
If the game profile is changed mid-session, the thread may never see the change
well, it isn't going to be
that is not how it works
And I gave the example of the player's name, but I have vars of my own objects as well
a data race can't happen years later, or heck even miliseconds later is often already too late for that to happen
Do you have a 100% guarantee of that?
I know it's not common, but theoretically it could happen
wdym thread local
i recommend this for reading if you're interested in how the JMM actually works
at any rate, i'd probably make cache a concurrent or synchronized collection and wrapping the rest in a sync task; it will still perform considerably better than scheduling the entire event to main
the issue here is that you're too fixated on the idea that happens-before relationships are only defined by the JMM
regarding the profile changing mid session, if something does that, you have bigger problems, e.g. the uuid could change under you and your cache no longer works
it is not, i don't think, something you should waste energy worrying about
But I have a object like this too:
Object {
private String var
setVar(String var) {
this.var = var
}
}
And I change the value of var in the main thread at any time.
My point is whether synchronizing the entire event wouldn't be more resource-intensive than using structures like concurrenthashmap, etc
it would be
oh man
other option that would solve this issue is probably to just not use the chat for this lol
I feel like Phil in Groundhog Day
feels like a command would be simpler
is this some bukkit conversation api replacement
The best option would be dialogues
yea
I did this a while ago
Is Redis more suitable than MySQL for synchronizing items between servers?
Does spigot have a way to register enchants to the enchantment registry like papermc does?
with nms u get sum like:
MappedRegistry<Enchantment> registry = (MappedRegistry<Enchantment>) BuiltInRegistries.ENCHANTMENT;
unfreeze it, build and register ur data, then refreeze.
alright, thanks
allahu akbar
https://pastebin.com/hnvm4bg7 is this enough datapoints for tracking identity?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
wait... i forgot network interfaces
incredibly based
lets make Spigot's first invasive telemetry API and sell it to the NSA for 10 gazillion sheckles
๐ฎ๐ฑ
TRUE!
I'm gonna explode my computer
getFacing and setFacing are not the same
LIKE
setFacingDirection(BlockFace.NORTH) sets the direction to the south
๐ญ
(1.8.8 is peak)
I do Minecraft server setup & fixes (Paper/Spigot). Plugins, permissions, errors. Cheap starting prices. DM me if you need help ๐
right it is done as if you are looking at the block
so if its facing north then you are looking at it from the south
yeah but its so misleading
also its the opposite of what f3 says
like wtf
also u cant setData for a blockFace with a directionaldata
because why not
if (this.getDirection() != null && materialData instanceof Directional) {
Directional directionalData = (Directional) materialData;
RelativeBlockDirection relativeDirection = this.getDirection();
AbsoluteBlockDirection absoluteDirection = direction.getAbsoluteWith(relativeDirection);
directionalData.setFacingDirection(absoluteDirection.toBlockFace());
}
// Then updates the block
blockState.setData(materialData);
blockState.update();
}
and I have to use setRawData but its fine ig
// If the block is directional, adjusts its facing
if (this.getDirection() != null && materialData instanceof Directional) {
Directional directionalData = (Directional) materialData;
RelativeBlockDirection relativeDirection = this.getDirection();
AbsoluteBlockDirection absoluteDirection = direction.getAbsoluteWith(relativeDirection);
directionalData.setFacingDirection(absoluteDirection.toBlockFace());
}
// Then updates the block
blockState.setRawData(materialData.getData());
blockState.update();
}
you can submit a pr for it, but keep in mind setfacing and getfacing have existed long before all this new stuff now in the game lol
so during that time it made sense
for those of us who been around the api for a long time, still makes sense XD
pretty sure it hasn't changed
but granted it won't be back ported
lol
this is my challenge i doubt u can do it btw, its a yes or no and u have to do it in a week ๐
Can you make a server that runs Minecraft 26.2 Snapshot 4 by remaking paper to support 26.2, and supports paper & purpur 1.8.8 - 1.21.11 plugins by automatically remapping the plugins? It should support eaglecraft and bedrock edition (Port 19132), and should work with bungeeguard.
its ok if u cant btw
?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/
does ANYONE i mean ANYONE know how to do that
lol ik u guys prob cant
I could, but you are not paying me to do so nor could afford it
WAIT
u can
i dont actually want u to do it i just want to know if u can do it @wet breach
can i dm u??
so first, 26.1.2 paper has as an experimental build so there is no need to remake anything
Crazy tech
so the answer is yes its doable
look at my dm?
I don't read DM's
can u do it in one week LOL
@wet breach can u do it in a week
This is embarassing
lol
I mean, what is there left to do when there is builds for that version you want?
This guy...
He doesnt understand anything prob
so u can do it?
I guess? there is nothing left to do
Lmaoo
its the newest snapshot r u ok?
LOL
and there is paper versions for it
He pisses me off so much
what about it?
The work is done @fierce cipher
OH BET do u want dev in a diff server?
What ?
o.O
you will most likely get it
Hes sped omgmfgm
they are sounding like some kind of bot lmao
me???
Chatgpt with mishrioms
u have to do it in a week
i dont actually want u to do it
yo ?
YO WHAT
doubt those who actually could be offended are not here
but I am not sure what the staff would think
Hahahahaha
forstalf do u want dev??
Lolol
you can't afford my rates
Ask for 50k a month
What are they (jst asking)
Yo frostalf can u work 12h a day for free ?
For me plz
And answer my dm quick