#help-development
1 messages · Page 451 of 1
um
Well I think the issue is that the memory keeps going up. Didn't know if people knew how to avoid that with generating chunks
From what you trying to explain
Your ram usage is increasing while your chunks are being generated. It get a points where it doesnt enough ram so its crashes?
Yes I think thats whats happening
Right, what i explained before
How many worlds are you generating?
1
Mostly issue with chunks generation
just one, lots of chunks?
Yeah i think
yeah
Because if server crashes he must be loading huge amounts of chunks
That why you should use work distribuitors while working with worlds or chunks
Okay sigh
generate x chunks, save, then force unload them.
Isnt that done inside a work distribuitor? Just wanna see if they similar
okay. the load and unload methods mess with generation. What Im doing is generating specific chunks so that I get a square of generated chunks. load and unload cause more than what I try to generate to generate
It would be best to, but to test you can do a simple repeating task/queue
any idea why i cannot tab players?
it sounds like there is natural world gen happening
in yoru generate square does it simply replace blocks?
if your chunks save/load affects the chunks it doesn;t sound like they are using a generator
No it uses a ChunkGenerator. It is the natural way world gen happens
link me to teh plugin you are using
You didnt mention you where using an external api, Thats crucial info while having problems
World#load generates surrounding chunks
msg is a bungee plugin btw
For none programming questions you should use #help-server - Thanks
its programming question
i coded that plugin
okay
Can you link code causing the issue
did you modify your bukkit.yml?
?paste
you mean command class? because i dont really know whats causing it
World#getChunkAt() doesn't generate surrounding chunks. World#load() does
Use paste md5 for sending the code
Have you implemented a tab completer for your command?
Okay thats the issue i think
Yes its, but maybe another plugin its overriding it
Mainly caused by protection plugins from
none of my other plugins use command /msg
yeah i have commandblocker (regex one)
I mean general tab completaation
Its on bungee?
It should be reason of not default completation
Those protections plugin listen to tab completation
So try adding a completer to your msg command
well when my msg plugin was on spigot it was working fine but when i moved on the network with a lot minigames and recoded msg plugin to bungee tab completion broke
i use same command blocker plugin on spigot
right, that why i prefer spigot side plugins working against Redis
So then i can do cross server communication, even communicate multiple proxies
In my case im obcess with redis haha
how do i add tab completer? (if its not already added(?))
If im not wrong in Bungee, your command should implements completer
Let me find it i dont remeber
Did you implement on the class?
ah so i just need to add implements TabExecutor?
And return a list of player names in the method
Yes but he has a protection plugin
So its overrind the default completation
but why isnt it workinggg then
Its what i explained to him, commonly protection plugin blocks default tab completation
For security reasons
Security reasons, they wanna block proxy commands
if i didnt register the command it shouldnt even be working now. tabbing players is the only thing that isnt working
So most of those plugins listen to tab completation too
implement what
why should they listen on my "msg" command tab completation?
He is using Bungee
I swear they replace null returns with player names
anyway. my command class looks like this
And spigot doesn't
He is using Bungee !!!
@young knoll but if you don't add any tab complete at all
i think it does player names
it doesnt
does InventoryOpenEvent work?
:/
is it because of the "new ui" shit, or is your screen actually only like 1280x800?
wdym
its 1366 768 as far as i remember
Yes the event works
Also he is using remote Intellij, i dont remember the name, that why UI looks different
InventoryOpenEvent does work fine, but it won't trigger for the player's own inventory
remote intelij? whats that
(Nor will the close event)
i read a thread in spigotmc about it, somebody tried to prevent players from opening their inventory using this event and he failed, he used Packets instead.
actually lemme try and see
the player's own inventory is client sided and you cannot detect whether it's being opened in new versions
Which is a bit unfortunate but makes sense
Why would the server need to know if the client has their inventory open
How are you setting up items data? For example used to tell itemstack the glass color
Because in newer versions its totally different
anyway... can anyone help me fixing issue?
Colored never have been done thru material
it's been Material.GREEN_STAINED_GLASS_PANE since at least 7 years now
You sent wrong link your supposed to send vscode
they have been since at least 1.9
Since 1.13
1.13 was the flattening
maybe i have to get open inventories every tick and close them
He?
IJ Gatway is fully IDE like IJ community
oh yeah 1.9 was the version that deprecated item ids
Yes
Bukkit made their own impl called MaterialData
But that is also now deprecated
So?
anyway, materials are used for colors since at least 5 years now
Im really mixed right now?
If you are on 1.13+
you cannot see whether they have that inv open
It's all just different materials
Material.GREEN_WOOL, GREEN_STAINED_GLASS_PANE, etc
Why didnt make it like that, from the start? Just to learn tho
ask mojang
Because that isn't how it used to work
All wool was WOOL internally
And the color was based on the data value
Knowing that Microsoft 💀 💀 buy it we can figure everything
use xseries if you are supporting multiple versions
An API to check if an area is claimed
Yes, better than shity World Guard which makes resources going ass fucking
Im opening for args
Or can you give trusted only certain perms
Can I make my own ranks for my claim with specific perms
actually this works
Using World Guard is useful for those small servers, but for big ones ofc not. Because the plugin its resource intensive ass fucking
Pretty sure hypixel still uses a fork of worldguard
is the Pause menu an inventory? lol
No
Wack
LMAO
Is your claiming api open? Or just a private api?
can anyone look into my issue
forbid players from leaving ever
perfect plugin for server owners who want high online
where is it?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
nice music choice
?paste
Result objects huh
yea i love eminem, cannot code without hes musics
same
players?
with how many constants?
Ah, well I’d have used exceptions personally morice
He is not having default bungee tab completation done. So i asked if he has any protection plugin, were he answered yes. And i told him that may be the cause because commonly command protection plugins block commands and also tab completation
But yea
returning or throwing them?
why exceptions
Its better than using results
Because you have to compare them and make you to use more code
Well because that’s the convention usually, if a method is not able to fulfill its contract then an error should be yielded
I didnt say you can't close it, I just said you won't know whether they have it open
Not if you use proper exceptions ?
You compromise usability too much when you go for result objects
The first example from that article is stupid, because it catches exceptions that obviously are handled by your average dev
doesn't matter, just wanted to close it by force
So far getOpenInventory() returns the current inventory open 🤔. I try checking if getOpenInventory() was equals to PlayerInventory and told me true, only while opening the player inventory
How
?cba i saw it the first time
Pluggg#0001 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
:(
You can still do that??
Try next pseucode:
(!getOpenInventory().getType() == InventoryType.PLAYER) return;
getOpenInventory().close();
Whether you use result objects or exceptions doesnt dictate that
yea sure already done, thanks
yes, but thats good
Because then you see that the plugin didn’t handle all cases of the command outcome
Did i solve your issue? or it wasnt that? Too much curious
Which version
The first example is supposed to be a „bad, dont do this“ example
I try it on 1.16 and worked
well if you make an enum and the plugin author decides to do a switch block on it, they'll know everything they need to support
because the ide will tell them
The problem with result objects is that they dont leave behind a stacktrace, and you its less visually enforceable. Im not saying result objects are always bad, just look at Optional and CompletableFuture
but the convention is that if a method is not able to fulfill its contract, an exception should be thrown
Wut
Problem with enum regarding result objects is that you cannot encapsulate context specific data to the result regarding the result’s outcome success
Anyway that’s another design debate
My point is just that you heavily compromise usability for design right now
It has a lot of benefits also, so its not all bad
Yea
Indeed
Or Optional<Boolean>
great idea for the terrible plugin
Optional<Boolean> might make sense if you have some generic shit, where a type implementation is boolean
but yeah, see little reason to have it
Also a usability compromise for design
return Optional.of(Logic.UNTRUE)
yes
!!Logic.UNTRUE you mean
sry mb
!!!!!!Logic.UNTRUE
probably something like this could be added to the BooleanFactory
AbstractAbstractBooleanFactory
implements AbstractFactory<Boolean>
extends FinalizableBaseBooleanSupplierGeneratorAbstractAlex
and it needs at least 27 unit tests
Lmao
Alright so i just got a chance to try this but im getting this error now.
?paste your code
HeadUtils.getHead("https://textures.minecraft.net/texture/366ff9319776ff3aa48109882f0fce8fa6f499475bd258284948e5c6e1da308b")
try to call setTextures after doing setSkin
that fixed it thank you
alrighty, np. gotta update my blog post then
IIRC it wasnt required in 1.18.1
updated
70*105€
69,99
at least $500 ezpz
yep, and for some reason i ended up charging 115
wtf
precisely
i'm 15 😭
Thats... eh
that's a fucking ripoff
25/hr at least
Bust honestly i would go for minimum wage for a free time project.
So 12€ * 70 = 840
I used to charge 15/hr when I was 15
thats my pay with irl job now 
well this took me 10 days of 6-8 hour long days after school
it's all about experience and confidence
the thing is, i have a dilemma
now you charge 18/hr
the lower the price, the lower my desire to work is
the thing is, i lack both 
the higher the price, the less chance i get a buyer is
no I charge 25/hr because inflation 
I started charging 20/hr around when I turned 17
well I could do my main job during that time instead, so it makes little sense to charge less. and if people say "that's too expensive", then they'll just look for someone else
or well, my lack of confidence makes me think i probably lack experience
brain is bad
hello, how I can make from this a function that I can call anytime in code?
if (item.getAmount() == 1) {
item.setAmount(0);
} else {
item.setAmount(item.getAmount() - 1);
}
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
make a function and pass the item as an argumemnt
Hey,
I want to disable that the player can enter a bed and also prevent to set a new respawn point.
It should still be possible to place blocks on the bed.
So I can´t cancel the full interact event.
I have tried this with the BedLeave and BedEnter events, but the new spawnpoint message is still displayed on the first bed interact
`@EventHandler
public void onBedEnter(final PlayerBedEnterEvent event) {
event.setUseBed(Event.Result.DENY);
}
@EventHandler
public void onBedLeave(final PlayerBedLeaveEvent event) {
event.setSpawnLocation(false);
}`
Has anyone an idea what I can do to prevent the new respawn point to be set?
public static void reduceItem(ItemStack item) {
if(item.getAmount > 0) item.setAmount(item.getAmount()-1);
}
thank you ❤️
I'm gonna start charging more when I actually learn different topics that link back to java
like making web APIs
same
but i'm increasing my prices as we speak
i don't wanna get ripped off again lkmao
if you charge anything less than 40€ or so, people assume you have no clue what you're doing
if you start with an extremely high price, they immediately assume you must know your shit
well
in my country shit is less expensive but in return shit is less paid for
ofc it helps if you can send your spigot resources list and if it's all 5 stars, or not, lol
so if i asked for example 105 euros an hour i'd probably get flipped off instead of ripped off
here in this industry you charge 30-40$/hr if you have the experience required to run a multi-server network from scratch
yeah but you could make more than 1.60€ per hour by collecting bottles on the street
I live in Portugal, where people make less than 1k/mo working full-time
same wage here on average
and I believe I have the knowledge required to just... make the same amount by working 10h/week
or in my case, average around 18 hours and live a bit better
I'd charge more if I actually lived by myself or quite really needed the money
yeah it always depends ofc. I sometimes can make over 1000€ per hour on simple cases (stuff like being around during a company audit), but for spigot plugins, I just always do 105€ and say "take it or leave it". about 50% take it, 25% try to negotiate, and 25% never reply again
You dont need that method. item.setAmount(item.getAmount() - 1); does the same thing on its own.
but I'm at a stage where I get to eat out every day, buy whatever I want, whenever I want
and that's all I need
sure I'm not buying a car every day because I don't even have a license
and instead of spending mad money with cars or bikes or something I just pay 3€ for an uber and stop worrying
well now this is my required pay
translation:
Commented source code - 2.26 eur (well shit i always comment my code anyway so it doesn't hurt to get some extra money)
Average complexity - 125 eur (3-15 hours on WakaTime)
High complexity - 260 eur (15-30 hours on Wakatime, anything higher means extra pay)
Minigame complexity - 730 eur (if it takes no longer than 24 days, otherwise extra pay)
All plugin strings translated into English - 7 eur (literally free money)
Cancel the PlayerInteractEvent if the player doesnt have blocks in their hand
and now take like 20% off of this and that's the amount of money i'll ACTUALLY get
oh okay thank you for teaching
because this freelancing website takes a huge cut off of my pay
forgot that i even posted a resource on spigotmc.org
I wonder what happens when one sets it to -1 or sth
unfortunately this is the best i can do
I'd rather charge for my time than actual complexity
fuck around and find out 
because you're paying me to do work, regardless of how complex it is, it's still work
Why do you get payed in pokemon currency 
I did F around, but that resulted in 2 stds, so not gonna do that again
?jd-s maybe its documented on what negative does
Punishing me for writing filler code rather than actual interesting stuff is a waste of time
how did you manage that one
- the total amount of these options is approaching the limit (80000 rub) i can't make it any higher
- there are no good russian freelancing websites that allow for per-hour pay
- this website allows for end-to-end security (i'll get the money, they'll get the product)
I know that for '0' the item gets removed
nvm its desc is just sets amount
ruble is very weird
I messed around with this dude called Andres
for a few weeks
How can I optimize pasting schematics with fawe?
how did you get 2
lies
I can't even get girls to look me back in the eye
Or does anyone know a queue system implementation to prevent multiple stuff from happening at the same time?
yet online people call me the "rizzard of oz"
Wait... Dont tell me you actually take ruble as a payment. With the current course it will
be worth 40-50% less in about a year.
have you heard of men yet
unfortunately i have no other options
the magic of grindr where every stranger is like "yo wassup, wanna ***"
living in russia, if i get paid in foreign currency and take one wrong step, i might earn myself the title of a "foreign agent"
rather would not take the risk

you live in russia?
unfortunately
move.
move
planning to
Or just "
"
unable due to no financial stability and being a minor
do it quicker
age harder
ok i'll age quicker
ty for the hint actually
didn't think of that
my bad
Age++
maybe if u explain to Putin that u write code for Minecraft servers he'll give u a government job
jsut run that twice
oh right
just dont get on his bad side
i literally developed a game plan
when i graduate hs i enroll into a uni immediately as an IT student
that way i avoid serving in the mil
Putin official minecraft server
i think for legal reasons and human safety u should not continue typing
I got muscles dawg but it doesn't work like that
muscles attract other guys
then I support putin of course!!!!
i love russia so much!!!

my favorite country!
while in the uni i DO NOT seek an IT job that allows to not enroll into a uni
I have a question how to change the nametag above the player's head
and then i DO NOT move to another country
viva la vladimir
It implies something else i was told
I told my coworker I hit the gym and he now spends all his time talking about how he uses steroids and how 35g of protein for 80 cents is a bargain
gotta have that HGH
we got whey at my job and it smells like ass
it smells like ass if you don't wash the cup properly
you gotta wash with hot water, immediately
and tons of soap
no its the powder itself
like not even out of the packaging container 
breast milk 😳
Summer is coming. Stock up in iso clear until its too expensive again.
I've had this whey on my room for the past 3 years
International standards organization comes in clear?
missed the word clear and was like why would u need to stock up on ISOs?
gotta love when summer hits and your city's population increases by 10x
i already got like 7 different distros saved
new jersey 👍
it's gonna be so wack
everybody wants to go to the fuckin beach
tiny ass town with like 30k people
gonna have 300k
just because 50 cent is coming
and travis
and cardi b
and meek mill
So its gonna be 250k of trash
just go to america or canada while its happening
and a bunch of other irrelevant people that live in their own lil bubble
I'm going in september
Try not to get crushed when travis is around
go sooner
Where can I find info on setting up a task queue, I want to prevent some tasks from overlapping and make sure they are added to a queue so it can do them 1 by 1
it's a trip paid by the guy at work, I can't really pick dates
You can if you kill him
?workdistro
I was meant to actually be on a bus to the airport rn but I told my mom I'd spend easter at home
What
7smile7 is the goat
Dont they grow on trees or bushes?
Lol
clown

mom's going back to her village until may
thing is... my "internship" starts in may
the internet is where u ask a question and find out it was answered 11 years ago
and I have classes before that
Maybe airport people are on strike again. Better be early
I got a 2 week easter break, then 2 weeks of classes
and then internship
aka early holidays for me
Why do IT students always go to classes but they never go to interfaces
Uhhhh smile, so your guide is to not have to use fawe
But if I use fawe I wouldn’t need your guide?
Its not a task chain perse but it will achieve the same consecutive workload execution
Why am I getting overlapping problems with fawe then
I thought that did the same thing
The guide is about doing what fawe does but for everything.
Huh
Yeah I assumed that
lmao
But I’m using fawe to paste stuff and still having issues
Doesnt fawe return a CompletableFuture when the action is done?
yeah there's a smoke break
probably not, it's fawe
Hmmmm
I wonder if then I’d be better off using your implementation for everything
To make sure stuff doesn’t go haywire
how the fuck is my mom on facebook right now she has no wifi
Instead of just pasting
Spring break and summer break be like:
Otherwise the beach is pretty cool
beach is nice
especially at night
I spent my 18th birthday drinking at the beach
me n my homie downed like 2 bottles of champagne and like 4 beers
he was struggling to go down the stairs while I was just vibin
we should all switch to goat profile pics on april 12th
and then not tell anyone why
everyone mark this in your calender: apr 12th is goat pfp day
Spring break is so bad here that they have ordinance laws on the beach for spring break
Smile so you’re sayin with your implementation I could have something like:
Player 1 joins: Starts doing stuff for player 1…
Player 2 joins: waits until next in queue
Player 1: finished stuff
Player 2: start stuff
Pretty sure the population here drops during spring break
That’s the concept right?
no one cares about such laws
also I was drinking at like 9pm, doubt there'll be anyone patrolling
we had a few couples just "chilling" around, too
but then the spawnpoint is still set if we interact with a block on the bed
why not? wouldn't it be against the constitution to prohibit that
I had to go to a vape shop to buy a lighter to light my candles
got my cake cut at a borger chain and the cashier stole a slice
is there a more optimal way to create an if-else statement in jvm bytecode?
Idk America doesn't like public drinking
in germany, some cities banned public drinking but courts always said "nah bs you cannot do that"
I wonder who the fuck actually goes to court for sth like that lol
but apparently there's many people who do it
i will get staff to kick all of you because this is not general chat 😠
you must be fun at parties
or you can do that yes
🔫
What would an alternative look like even?
idk
Then cancel the bed event
Or at least dont let it set the spawn point
I tried that but it still setting the spawnpoint
I think you have to use the spawnpoint event
yo bb guys, I gotta meet my stupid neighbour
Or maybe the bed leave event
Even though I swear spawnpoint is set when you click the bed not when you leave
Smile
I don’t think your guide is what I need
Player 1 joins: Starts doing stuff for player 1…
Player 2 joins: waits until next in queue
Player 1: finished stuff
Player 2: start stuff
well you can cancel it there
yes
but i am getting no effect from there 😖
Fawe is pasting my stuff correctly but the issue I have is when multiple players join at the same time because of the other stuff going on, so that’s why I need what I explained
Yeah but this is not a problem regarding queues. You need a way to detect if FAWE is done with its first operation.
I think what I need is just a List as a queue, it might be that simple
Hmmm you’re right, what if I don’t use fawe
I just need to make sure a bunch of stuff is done for a specific player before it goes into the max
Next
I wanna be like, “your data is #whatever is queue” and make sure stuff loads 1 by 1. It’s not for everything just for specific actions
What is this for
Schematic paste + region assignation + other stuff
Happens only first time player joins, after that I have no issues
And why does it overlap?
Only when multiple players join for the first time*
Make it instantiated
I assume cause I’m using async
async is painful
The thing is
Hear me out
I make a paste with a player UUID
Like, the UUID of the paste is the exact player UUID, so it’s completely unique
But if players join at the same time, somehow, the data is literally mixed, and 2 players can share the same schematic UUID when it’s literally a player UUID
bad code
I thought it was a queue problem
Like, stuff is happening at the same time and overlapping somehow
Which is why I was asking for advice
nothing actually happens at the same time, even when async
What does overlapping mean?
Like, when I paste a schematic for UUID1. Somehow if a player joins at the same time he will somehow br linked to the same UUID1 even though stuff like Bukkit.getPlayer(UUID) actually is unique
And it applies to multiple players
It’s not in the data itself
What do you mean by linked?
Cause I checked the output. The UUID only corresponds to 1 player, yet both share stuff like a teleport point
What does overlapping even mean?
If I teleport a player from the unique UUID data, it will somehow teleport both players to the same
When Bukkit.getPlayer(UUID) is unique
Show your code
I did think about this
Maybe a UUID field XD
But I had a fail safe
If it already existed
I don’t add it
But yeah, let me do some checking for a bit
Thanks
Is a UUID field bad?
Uhm... if you want to map data to players then you should always use a Map<UUID, Data>
A field will just correspond to one player at all times.
Well
I’m using List<UUID>
But I get what you mean actually
That’s actually smart
Gonna do that change rn
oh 7smile while ur here, is it possible to run a task async, wait for it to be done then return the value sync with completeable futures
I used your Cache implementation and you use Hashmap<UUID, Object>
you can wait but that freezes the calling thread
isnt there an isDone on futures
What happens if I try to add a key that already exists in a hashmap
replaces
yes if you want to keep polling
better to not poll and run code sync when done
YES
caps
uh
you can make an executor that delegates to the main thread
Even just
Bukkit.getScheduler().getMainThreadExecutor(plugin)
might be paper specific
yeah it's paper
but you can make your own
i was thinking if i need call join on bukkit scheduler async task, but i then have no way to return that stuff sync
yea thanks
ignore the shitty conventions but we do this
ill go do some googling
update role runs any completeable future imguessing
it returns a future
you know what i mean
eric barrac
just before i set on adventure, can i return the value of the future that is runnin
that wouldnt run async though would it
I mention it here
huh
Hi is there a way to modify the name tag above a player's head without using packets?
scoreboard
Caused by: java.lang.NullPointerException
at volt.dev.vcore.utility.utility.replacePrefix(utility.java:15) ~[?:?]
at volt.dev.vcore.commands.GodCommand.onCommand(GodCommand.java:39) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[Spigot.jar:git-Spigot-21fe707-741a1bd]
Utility 15 (1st image)
GodCommand (2nd Image)
Config.yml
your config is null
Why is this happening, everything is ok
because you probably never initialized it
whats the MainThreadExecutor in this
just tried it, still cant return the value sync
ye
thats true
i never initialized it
lol
Hello, I am making a plugin to use inside the proxy (at the moment I am using waterfall 1.19), the code looks good, no errors but the plugin won't load because I get this error:
java.lang.IllegalAccessError: failed to access class net.md_5.bungee.api.plugin.PluginClassloader from class net.minplay.proxy.pluginmanager.PluginUtils (net.md_5.bungee.api.plugin.PluginClassloader is in unnamed module of loader 'app'; net.minplay.proxy.pluginmanager.PluginUtils is in unnamed module of loader net.md_5.bungee.api.plugin.PluginClassloader @25ffd826)
is the command also in plugim.yml
register the command in plugin.yml
you shaded bungee
what's that, I put the normal plugin which wasn't shaded
how could I kill an entity that is on a unloaded chunk?
Load the chunk and kill the entity. What do you need this for?
will chunk.load() freeze the thread?
yes
and I need it to despawn a vehicle
why did no one tell me i can just call #get on completable future to get it when it returns
Because that blocks
Why is it in an unloaded chunk?
join blocks
get also blocks
get as well
the player can spawn the vehicle and run from it
why cant i run my sql async and return a value sync 
or he can teleport
Because a return value must be returned right away so execution can continue
"Calculate me the value somewhere in the future. But give me the result right now plz, i need it."
A future will not complete right away
yeah
exactly
i dont want to recode this just to support mysql
3 options:
- load the chunk -> delete the vehicle.
- invalidate the vehicle ID and destroy when the chunk loads
- always unload the vehicle when the chunk unloads and only load it again if its valid when the chunk loads again
You should have made all your data sources async from the start
but they dont need to be
File io can still take time
thread safety scarey
All data sources need to be accessed async or you will create performance problems.
Unless you just store everything into memory when the server loads.
I'm fairly sure you're safe to read from a collection even if another thread is modifying it
You just may get outdated data
Multiple writes is the problem
Single read yes, iterate no.
coll make my storage async for me
Just implement something like this
public interface DataLoader<K, V> {
CompletableFuture<V> loadData(K key);
CompletableFuture<Void> saveData(K key, V value);
}
Copilot also suggested adding those:
public interface DataLoader<K, V> {
CompletableFuture<V> loadData(K key);
CompletableFuture<Void> saveData(K key, V value);
CompletableFuture<Void> deleteData(K key);
CompletableFuture<Collection<V>> loadAllData(Collection<K> keys);
CompletableFuture<Void> saveAllData(Collection<Map.Entry<K, V>> values);
}
Player in server always has an Inventory open called CRAFTING (the type), also it depends on his game mode for creative its CREATIVE
when you close the CRAFTING inventory also Pause Menu, Chat and anything alse gets closed too
i just want to prevent the player to open his inventory, does player send a packet when he opens hes inventory or what? is there any way to close the inventory when he opens it?
public class AsyncStorageHandler {
private final Executor executor;
private final StorageHandler delegate;
public AsyncStorageHandler(Executor executor, StorageHandler delegate) {
this.executor = executor;
this.delegate = delegate;
}
CompletableFuture<Integer> getPlayerData(OfflinePlayer player) {
return CompletableFuture.supplyAsync(() -> delegate.getPlayerData(player), executor);
}
CompletableFuture<Void> incrementPlayerData(OfflinePlayer player) {
return CompletableFuture.runAsync(() -> delegate.incrementPlayerData(player), executor);
}
CompletableFuture<List<PlayerData>> getTopPlayerData(int start, int count) {
return CompletableFuture.supplyAsync(() -> delegate.getTopPlayerData(start, count), executor);
}
CompletableFuture<PlayerData> getPlayerDataAtPosition(int position) {
return CompletableFuture.supplyAsync(() -> delegate.getPlayerDataAtPosition(position), executor);
}
}
Problem solved
How can I send a plugin message from a spigot server to proxy? I have registered the channel inside the proxy but I still get the error when I am trying to send a plugin message from spigot, that the channel doesn't exist
how would i use an executor
new AsyncStorageHandler(Executors.newSingleThreadExecutor(), someStorageHandler);
*For example
It needs a threadpool of 324545345 threads
that reminds me
i need to make my sqlite handler cache data
so i run sql for every placeholder
Humble object principle
Very good


can someone please help me? what is wrong with my code:
public boolean setAndSave(MinigameData data) {
Lock lock = RepositoryPlugin.getLock();
lock.lock();
try {
set(data);
RepositoryPlugin.save(); // This just does a simple saveConfig()
return true;
} catch(Exception e) {
return false;
} finally {
lock.unlock();
}
}
private void set(MinigameData data) {
FileConfiguration config = RepositoryPlugin.config();
String path = "temp_database.minigames." + data.getMinigameName();
for(MinigamePlayer player : data.getMinigamePlayers()) {
String subpath = path + "." + player.getId();
config.set(subpath + ".wins", player.getWins());
config.set(subpath + ".losses", player.getLosses());
}
}
it runs fine and returns true, but does not create the section; there is no section temp_database.minigames in config.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
just before i go and sleep while forgetting you gave me that, im guessing i replace my storageHandler calls with async handler calls
You will need to do quite a bit of tinkering. The basic idea is:
- get future<data>
- call
thenAccept(data -> bukkitscheduler.runTask(() -> { use data }))
uhhh thats a lotta effort
Alternatively you write a new facade class epicebic
Doesn't thenAccept already sync back to the calling thread
oh no man wants to multithread and use futures but doesn't want to work
anything that deals with concurrency ends up being overly complex
yes it appends to the thread that’s being used by the completable future
It uses the same executor unless you run acceptAsync or any of the other async methods
it uses even the same thread
im lazy
So you don't need to wrap it with the runTask
You do need to sync back to the main thread
Alternatively you can also do this
future.thenAcceptAsync((data) -> {
System.out.println("Data: " + data);
}, Bukkit.getScheduler().getMainThreadExecutor(yourPlugin));
paper only
Ah
So wait
iirc spigot doesnt have the main thread executor sadly :(
Future.acceptAsync.thenAccept will run the thenAccept on the same thread that handles acceptAsync
Yes
Are you writing the FileConfiguration back into a File?
Then what thread does thenAcceptAsync run on
yeah, the RepositoryPlugin.save(); does that
iirc common pool by default
Not sure tho
public static void save() {
instance.saveConfig();
}
Add debug messages to see how many players are getting saved
Can be an Executor e = runnable -> new Thread(runnable).start() also coll
Common Fork Join Pool
if the parallelism of the common pool is like 1 or 2 or 0
hmmm
🥲
oh thanks, the set is empty and i didn't check it '-.-
And we have so much more you probably didn’t touch then
how tf do i do this in jvm bytecode
even worse the value could be either a type 1 or 2 computational type
oh wait isnt everything on the stack 64-bit
You writing a compiler?
scripting language which dynamically compiles to jvm bytecode
so basically yeah
wait maybe
dup_x2
swap
but idk wtf dup_x2 does
What did you learn about if I may ask? :0
oh wait i think dup_x1 works
How to check if a ProxyServer is running (listening)?
well just like
there's no easy direct way iirc
but you can check some things
- online mode?
- does it have bungeecord: true on the spigot.yml
Ah thats nice
school doesn't teach much
I'm in a 3 year programming course
we learned a bit of sql
Altho sadly sql is becoming a bit obsolete, from what I can perceive
Lot of web dev stuff too
Oo
make me a website
why cant java constructors just push back the instance to the stack
I'm about to finish school in about 2 weeks
why no invokeconstructor
Constructors are just methods 
Ugh, finally -.-
Scrum 💀💀💀💀💀💀💀
lovely
yeah but they could introduce a new instruction to invoke them with
invokeconstructor would just not consume the instance you call it on
i mean they could, but are they gonna do it? Probably not 
and would otherwise to the same as invokespecial
meanwhile at work
im scared for how to compile constructors with more than 3 args
theres dup_x2 which dupes the top 3 things down
but how do you do
1 2 3 4 5 6 instance
instance instance 1 2 3 4 5 6
Im no jvm bytecode expert sorry
i should look at generated bytecode
Yea thats smart
Uh custom goals
?
run whatever-123
Wanna do some things before the bungeecord initialization
createCustomGoal("whatever-123", (queue) -> { whatever });
On a spigot server?
bungee
I mean
Isnt there an event for that? Didnt use bungee in a while
Hey, I have probably a dumb question, but I have some questions about how I should design my plugin/plugins
I currently just duplicate code between one project and the next, which probably isnt the best idea, since it makes updating code that I use between each project more difficult to maintain between plugins.
Should I use a gradle multi-module project (I have literally no idea how to do this, I just have seen it recommended in similar stack-overflow questions)
Or should I make like a libs.jar then just make each of my plugins depend on that?
If I understand the multimodule project concept, it is essentially the same as having a libs.jar, but gradle shades the libs for you (Maybe? I don't really understand it tbh)
using bungee 1.8
You can probably just run stuff in the init block of ur plugin
that event isn't available at
Isn't bungee cross version
Most devs write a standalone library for common code and make it a dependency for their plugins.
i need to get the exact moment of the bungee initializes xD
You can also shade and minimize your own little library
Ah
Tis what I do
MrMcYeet look at luckperms for instance, it has a common module which both the bungee and bukkit module shade in when building a jar for respective platform
Multi module project only makes sense if you have common code for different platforms
^
Library is when you have common code for different plugins of same platform
(Mostly)
At least in terms of spigot
@lost matrix Hey, I just used your simple linear distribution example for workload distribution for this world gen stuff. It worked fine before when the generation was all happening in a single tick, but now that it is spread out this is happening:
- 2 extra chunks are generated surrounding the chunks that I called for
- the furthest chunk out doesnt get decoration
Ok, this explains what I need to know.
Thank yall sm <3
No idea what could cause this
damn
Btw, I wanna say thank you so much. I would not have figured out this far without you 🙂
@young knoll
it has a lore:
inventory.setItem(15, ItemStack(Material.SANDSTONE).apply {
itemMeta = itemMeta.apply {
displayName = "Block Clutches"
lore = listOf("Type: Block")
}
})```
what was i doing
Smile makes you smile
I mean
"org.bukkit.inventory.meta.ItemMeta.getLore()" is null
Evidently the item does not have lore
Ah decoration might happen one tick later. Try to simply wait a few ticks.
The reason I switched to distribute it across multiple ticks is because if I didn't, the memory would slowly creep up until it was too much for my pc and the server
anyone?
it waits 5 ticks per chunk
because I think it takes around 150ms to generate one
Look in the window of proxy server 🤷
Are you running on an AMD Phenom II ?
Or you could see if the message channel is running
Its a custom chunk generator. TerraformGenerator on spigot
its a lot slower
what you mean?
You using bungee as proxy? // or forks
waterfall
https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
Could try using this then
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Try getting ther ServerInfo from ProxyServer#getServerInfo(String)
After that you could even ping it.
oh no
its a bungee plugin
i have the ProxyServer instance
i just wanna get the moment of the proxy initialization (listening)
i don't think the proxy server has a server info
Wait so you want to do something before the proxy is initialized?
Not a mc server
Hello guys why do i get this error?
"org.bukkit.inventory.meta.ItemMeta.getLore()" is null
if (event.getCurrentItem().getItemMeta().getLore().contains("Type: NPC") == true)```
yeah
because getLore() returns null
itemeta.hasLore() {
do your stuff
}
Well then just run it in your onEnable, lol
no, i cannot perform at the onEnable
like that?
if (event.getCurrentItem().getItemMeta().hasLore().contains("Type: NPC") == true)
i need it before the listening
Before this Listening on /0.0.0.0:25577
after all plugins get enabled
No this will result in the same exception
but how can i check if the lore cointains that?
No
if (item.getItemMeta().hasLore){
if (item.getItemMeta().getLore().contains("string")
}
}
Try running it onLoad
if (item.hasItemMeta()) {
ItemMeta meta = item.getItemMeta();
if (meta.hasLore()) {
List<String> lore = meta.getLore();
// do stuff
}
}
before listening to players//connectors
hasLore.contains isn't even valid
onLoad is performed after the plugin constructor instancing
not works for me :,C
What are you even trying to do?
Some janky ass stuff
I'm creating an API, i'm planning to MyAPI#load it after server loading
"after server loading"
What is that supposed to mean? When is the "server loading" finished per your definition?
same error
all plugins loaded
So you want to load your API after all plugins have been loaded?
sure
But before they have been enabled
no

Why
I cant think of a single good reason for that
api users will be able to change my plugin api before MyAPI#load
allowing to the server load their custom apis
This sounds like a flawed design. What you could do:
- Make your API ready in your onLoad
- Let other plugins define "LoadBefore: [YourPlugin]"
- Then they can modify your API in their onEnable
- In your APIs onEnable you simply enable all the other features
*Since i dont think BungeeCord has service providers
i disagree with your suggestion
it may fail in some cases, and produce some warns either
In which case would this fail?
help pls
?basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
How you will be able to change the api of my plugin without the plugin classes loaded
and it will produce the classic warn that said you are using plugin classes without the softdepend or depend
no?
The classes are already loaded in the onLoad
Great then
but how about the second one?
please just explain it to me, the code of the other guys also didn't work so
i'd prefer my design
What is your design even?
getLore() is null
you need to verify before using hasLore()
There is nothing to explain. .getLore() returns null and you call something on null.
Dont do that.
Creating my default API at the onLoad (or plugin class constructor), wait all plugins load (or server load) and perform the Api#load
looks more simply and bukkit friendly for me
Alright. Then the only option you have is to schedule a task using the executor and hope that all plugins are enabled
when your task is executed.
🤔
i will test it, thanks 🙂
isn't their a plugin load event?
^
you could do some magic things to see if the last plugin has loaded
using 1.8, the ServerLoad events isn't available
Nope
This doesnt even exist in Bungee
i mean for the spigot
but anyways, you're right, sorry.
ok, it does have a lore. But i added it and you can see it when you hover on the item:
inventory.setItem(10, ItemStack(Material.STONE_BUTTON).apply {
itemMeta = itemMeta.apply {
displayName = "Standard"
lore = listOf("Type: NPC")
}``
})```
what the
🤔

yessir
oh, that makes sense
i could compile it to java if you wan't
Most of us understand that code dw
Dont use kotlin if you are startled by a simple null pointer exception.
You dont understand the biggest selling point of it.
Use Java instead.
this
but kotlin looks fancy guys
plushTeddy if sth is nullable you can always do
Uh ?! incoming
nullableStuff?.let {
//if not null run
}
Ye
Think same goes for ur apply blocks
(:
Hahah i agree
I understand it, and i also did check if it's null, but the code still runns the error!?
then you're doing it wrong
You are probably checking more items than you think during an interaction.
try:
if (item.hasItemMeta()) {
ItemMeta meta = item.getItemMeta();
List<String> lore = meta.getLore();
if (lore != null) {
// do stuff
}
}
as kotlin
look:
code:
if (event.currentItem.itemMeta.hasLore()) {
Bukkit.broadcastMessage("I ${event.currentItem.itemMeta.lore.toString()}")
}```
the message pops up
error:
```Caused by: java.lang.NullPointerException: Cannot invoke "java.util.List.contains(Object)" because the return value of "org.bukkit.inventory.meta.ItemMeta.getLore()" is null
The code he posted should work. The problem is something else.
lol
please try it
let us see whats the result
wait
I don't think thats valid kotlin code wouldn't it be like val or sum
same errorrrrrr
bro what te fuck
inventory.setItem(10, ItemStack(Material.STONE_BUTTON).apply {
itemMeta = itemMeta.apply {
displayName = "Standard"
lore = listOf("Type: NPC")
}
})
This is not the problem
You are checking an ItemStack which you didnt anticipate
im feeling like i should get that insertDefaultFunctions() out of there
off topic question: Why the methods on kotlin starts with a fun? xD

