#development
1 messages · Page 144 of 1
[0,3)
thanks
in general first part is usually inclusive and second isnt
oh. I didn't realise that would reset commits. but makes sense. Will try
yes
careful
Thank you SirYwell.
You're welcome
no problem
❤️
Wheres the answer?
You're kidding, right?
Ping it
The one answer you've been ignoring from like 4 different people already
yeah be careful with that, and depending on what you mean with reset, it might not do exactly what you want it to do
in your situation you would store that data in your permission group
prefix - suffix or w.e. will be common in all groups
I Just had 2 commits pushed that I wanted to revert back. I've reset them locally then force pushed and it seems to have done exactly that
then store permissions of that group as a list
I never understood why tho. Is there a technical reason for this? Or just bcz that's what Ombladon decided? (Romanian meme, gaby will understand.)
@dense drift confirm?
🥲
@lyric gyro confirm?
it really just depends in the language, same as how numbers start from 0 arbitrarily
There is a technical reason why it's usually inclusive start / exclusive end for things like arrays/lists etc but I don't think it is justified for PRNGs lmao
starting from 0 isn't arbitrary, it makes sense in the context of arrays
for rng it's probably more for sake of consistency
Yea
yeah. I knew for 0s. I've seen some document explaining why it makes sense. But I've never seen why inclusive/exclusive is as it is
it's obviously a philosophical thing
shut up pig
ok
pig. how is bungee support going?
yes
I understand
I get distracted ok
I've been researching all day
"researching"
I like calling mindless surfing of the internet research
sleeping and eating bacon I bet
that's actually pretty smart
then there is lua
I Might steal that
lua is beautiful
julia my beloved
=multi spin
Php my love
fail
😻
RIP
not fail
oh there you go
epic
WOAH
thank you piggy
idk why cube got rid of the normal commands
oh not fail
Spam
they are okay
slash commands are cool
they feel extremely unfinished
okay-ish
I like them
Can I get configuration help in here?
actually no I remember his reasoning
although the permissions part I don't like
Yeah. and they've been out for how long now? ... xD
but I'm getting used to it
way too long
NO
he wanted to add slash commands so barry could be eligible for verification
even though barry... exists solely in one server
Can we argue about our favourite IDEs?
why does barry need verification for 1 server?
Configuration help please?
yeah dkim
no you stupid brain
Notepad++
Netbeans ftw
idk

he mentioned the normal command thing too but how is discord even going to enforce that
only for bots that are on 100+ servers tho right? or whatever the requirement is.
hm?
Y’all how are you in this beautiful day!
it doesnt really matter, api wont give out message contents soon
and Barry is just in HelpChat
what the fuck
nah, for all bots but they keep delaying it
although you can apply or something for moderation bots
fun fact discord slash command permissions are so bad that you cant give boosters permission in the client, you have to get an oauth token and do it through the api 🙃
Which plugin? 
wait what? why?
and you cant assign individual permissions for subcommands
chatchat alonso
so dumb
Fart
privacy
how?

Help my discord account got disabled
we do not support privacy at helpchat
how can they claim privacy?
we are literally the google of discord servers
to be fair
I love how the chat just became like 10x more active after the multiplier 🥲
My friend got hacked help!!!
there are reports of bots harvesting messages for advertising and stuff
everything you guys say is stored, and correlated
wait a minute
when every single message is stored on their servers even after they're deleted and discord personal can access it??
oh wait nevermind
way too common
Anyway so yeah as I was saying yesterday I was in a voice chat with some random people and there was this one dude that did not take a shower because he needed to take his dog for a walk and he was exhausted as fuck but he did it anyway, so then he joined the voice chat and started livestreaming walking his dog and oh my god it was so cute, then he got tired, went back home and took a shower. No he did not stream that part
carl and a few others apparently spy on your activity status
MEE6 does datamining
dont think they can pull activity anymore
People usually talk at this time 
i do not care
Damn it
Missed the sauce
Oh yeah and he also had the strongest Australian accent I've ever heard
It was hilarious
was it piggy
Bloody hell
No
quite possible
Cube
how do you know?
they are the only 2 australian people on the internet
It was not a pig, it was a human
I almost thought you were going to forget mentioning that
it mustve been one of them
exactly
did you record
It was actually really funny
if there's any evidence, and it's from my city, I'll be able to tell you roughly where
we can track this guy down
is that what we want?
could it have been a shape acting like a human?
#development be like
yeah of course
emily I don a human disguise in public
don
don cheadle
lmao
agony
Making a call to the db wouldnt be efficient just to get their permissionlevel everytime, right? Do you think i should have a hashmap or something with all the players permissions in instead? Or wouldn’t it matter
But yeah I mean at the end of the day many people end up not using umbrellas, they are kind of overrated, getting a bit wet is not that much big of a deal really, and if you're soaking wet you've got bigger problems to worry about
permissions aren't that big, it's fine to store every permission in memory
you can have the entire db in memory
perfectly fine
Ayo 94%
well actually no. It can be piggy, cube or john barilaro
who?
yeah who's cube
who is john barilaro
cache groups and permissions + cache what groups users belong to + their own permissions
well Blitz
haha. last Saturday it rained. LIke heavy rain .I Was driving and I Couldn't see 2 meters in front of me. And my tire popped. It wasn't fun. haha. haha. I go cry now. haha.
Giovanni Domenic "John" Barilaro (born 14 November 1971[2]) is a former Australian politician who served as the 18th Deputy Premier of New South Wales and the New South Wales Leader of the Nationals until 6 October 2021. He was the Minister for Regional New South Wales, Industry and Trade in the second Berejiklian ministry from April 2019,[3][4][5] and a member of the New South Wales Legislative Assembly representing the electoral district of Monaro since 2011 until his resignation in October 2021
Okayyy
thank you very much
Not a problem
did you type that yourself using your knowledge or did you steal it off of the internet
Usually I type below 100wpm but when someone needs information that quick I can just type that
My dad said: "I have not seen heavy rain like this in my life". And he is old. Like half a century old. He has also traveled quite a bit. So it must be the heaviest rain ever.
a or b?
yes
yeah

The global multiplier has ran out and has been reset!
what's the best way of caching the db? hashmap?

Objects 
hmm ok
you really think objects is the best way?
Make an object like a DataPlayer and save the data inside it
Are objects only used in classes? kinda new to java so haven't used those yet
Caffeine
Seems pretty advanced? Is it worth learning? How much better than class objects is it?
If you are a beginner, learn Java oop first
this
I was simply asking whats better.....
define better
If you say “Java class objects” it just means you should learn some OOP first at least lol
Yeah that makes zero sense, and even less in the given context
searching up java objects all that comes up are class objects
so...
idk what your point is
Class is an Object
Object is what all things in Java fall under
Learn the hierarchy and OOP please
Hey does anyone know how I can get a 10 second break between round changes there?https://pastebin.com/bjqs5hdG
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player sender1 = (Player) sender;
if (command.getName().equalsIgnoreCase("spawner")) {
if (args.length < 2) {
sender1.sendMessage(ChatColor.RED + "/Spawner <mob> <player>");
if (args[0].equalsIgnoreCase("cave_spider") && sender1.hasPermission("spawnersplugin.command")) {
Player player = Bukkit.getPlayerExact(args[1]);
player.getInventory().addItem(CaveSpiderSpawner);
}```
why does this not work
specify "not work"
It doesnt give player the ItemStack
First, check if your player object is not null
Also your object CaveSpiderSpawner, where are you getting it?
But where are you getting it from?
So i need some advise on sql storage, i have a plugin where you can have a vault where you can store items and you have x amount of pages, currently i save every page as base64 (all the items) in yml's but i want to have this with sql.
So the problem is the table, i don't want to have a column for every page because there will be vaults with like 150 pages and some with 4
yml example: https://paste.thebathduck.nl/iwixabitat.properties
(its also saved so that slots will always be at the exact spot as before)
have a table called "page" and have each row be a page? then you can collect them by user or whatever
that's a kind of weird setup, though I think that's what i would do
if pages are non-empty then i wouldnt even bother, just store 1 item per row and then convert the list to pages
like if you cant have empty slots
like this?
i think i am either gonna do page1base64;page2base64 or go with the 2 tables plan
yeah that was what I was thinking
might be kinda weird with access if you put them all into one column though
I would at least recommend a separate column per
1 column, multiple rows
that is how you're supposed to do it
table entries should be atomic
thousands of rows per person?
if necessary yeah
they can handle billions of rows with ease
yeah just feels a little scary
and a bit of a waste if each row is literally just a base64 item and an id lol
i save every page as base64
honestly noSQL moment
that's how you're supposed to design sql databases
yeah but this isn't really a relational scenario
would literally be better to just use a Mongo record per person lol
potentially
Is there an easy way with HTML and JS to list any folder that contains a index.html file?
I would like to have something like for my deploy-preview repository, so that if people get on the main page, they won't have a 404.
Here's the repository for further info (Readme explains the folder structure on the gh-pages branch): https://github.com/gh-pages-deploy/Deploy-Previews
I btw only want the very first index file found in a folder, meaning with a structure like
Andre601/
|
|- blog/
|
|- 79/
|
|- index.html
|- posts/
|
|- index.html
I only want the index file from 79 listed
Sounds like an xy problem with your web server?
...
I mean you can just traverse the file hierarchy
But it sounds like you want to route 404s to an index, which you would either do in your web server or in whatever backend software you're using
Have you bothered checking the repository?
or like read my message?
I did mention gh-pages didn't I?
Yeah I did read your message and I looked at the repository. Not exactly sure what the context is.
Is this solely hosted through github pages?
I would've mentioned it if it was anything else
client side JS cannot read server side files
^
it is simply not possible
Hence my assumption of a backend server serving files
as far as the browser is concerned there is no directory structure, just urls
You could also store items with number ID’s to have them be unique, then for each slot reference the number ID (you’ll also need a column for amount in the stack).
if i want to save a base64 in sql, should i just use the variable TEXT in sql?
VARCHAR is usually what I see
doesnt varchar require me to give a length of chars?
is it possible to get an entity in the server by uuid, if chunks are not loaded?
depends on what database you're using
in some, TEXT is just an alias of VARCHAR(65535)
No, if the chunks aren't loaded, the entity basically doesn't exist
i was expecting a "yes" xdd
so basically, if i save entity uuid in file/database
the only way to know if the entity is still available
is that somehow the chunk gets loaded by player or something
well kinda weird the question, but anyways

Well if it is in a file/database, you could do it
Because you'd just check that database instead of the world
i mean, to delete the entity entry (stored data). ik weird question/issue xdd
I am trying to save data to a database at onDisable but the database shuts down before i can save the data, any fix or am i doing something wrong?
console: https://paste.thebathduck.nl/yoyupoyuba.md
Why do you think the database shuts down before you can save the data?
You‘re the one controlling that part
And the exception rather looks like there are multiple connections to the same file
because it says
[09:06:37 INFO]: [com.zaxxer.hikari.HikariDataSource] HikariPool-12 - Shutdown completed.``` before my plugin disables
but i never disconnected the database in the ondisable at all
So it turns out the problem is that i have multiple plugins using hikari
That’s why you should relocate dependencies
just make a redirection to the index.html in a different directory
In this tutorial, you will learn how to use JavaScript to redirect to a new URL or page.
make like a working index.html in root dir with js redirection which directs to your custom index.html
or as an alternative you can register a custom domain with something like andre.com which is top level and redirects to your fake index.html and it will look like its on root
whats that
how do I make a ArrayList not reset when I restart the server
or either I can store the data in a file?
yes you store the data to file
k so I managed to store the arraylist in the config file when the plugin disables
but how do I add the stored data from config back to the ArrayList when the plugin enables
spawners.addAll(config.get("spawners-location")); im trying this but it isnt working
"spawners" is the ArrayList
and its stored like this in the config
- Location{world=CraftWorld{name=world},x=130.0,y=54.0,z=14.0,pitch=0.0,yaw=0.0}
- Location{world=CraftWorld{name=world},x=124.0,y=55.0,z=12.0,pitch=0.0,yaw=0.0}
Create your own serialise and deserialise methods for Location. Mainly because you are currently storing useless data as a “spawner” will always be an exact block number so x, y, z can be stored as ints not doubles and pitch and yaw are always going to be 0 so don’t need to be recorded at all. Then to get that data back out you just reverse your method essentially.
However I will warn you storing large amounts of data in a .yml is going to end badly. A better approach would be json or a proper database
So when i save my data to the database it locks, i don't know what that means but here is a log from the console: https://paste.thebathduck.nl/icowusater.md.
So basicly it starts Warning me for every element i want to save at onDisable()
Any known fix or am i doing something wrong?
SqlLite locks the file while writing, so you cant use multiple connections to write at the same time to the database
Instead, use batched updates or just use the same connection normally
Oh so i should first declare the connection and then use it twice instead of what i did?
thats what you should be doing wherever possible regardless
thats also what hikari does for you, it keeps a pool of connections and distributes them as needed
instead of constantly opening and closing
Your Spigot account has been linked successfully!"....where i can ask help for "VoteParty"?
If you don't put public or private does it automatically assume the instance is private?
No, in most cases it means package private
... So it would be private??? (Which is what I said lol)
package private isn’t private
Ah I see. Thanks.
Access in same package + sub classes
Yeah was thinking something else when I read "package"
anyone know how i could make boats move faster? setMaxSpeed is deprecated and doesnt reference another method to use instead of it
I could multiply their velocity when they move but then theyd still be moving forward even if a player stops moving the boat
Also the Boat.Type class is giving me ClassNotFoundException and NoClassDefFoundError
so
what I did is
for onDisable method I saved the arraylist to the config.yml
and onEnable method I added all the locations in config.yml back to arraylist and deleted the config file and regenerated it
and It works for me
anyways thanks for you advice
only thing is, if the server crashes or you press the kill button it won't save.
how do I look for that?
You can't
just save everytime something changed or smh
Its like if you have the console open and you close the window. Nothing gets saved. (World, player data, etc...)
then how can I fix it
Really not something you can fix. Because you can never tell when someone kills a server or the server crashes.
Your best bet is to leave the data saved or save at intervals. (Could be timed or when something is changed like Skyslycer said)
yes
aight let me try
This isn't Spigot or Paper related, but it's kind of a general Java question though it treats Forge classes
Is there any way for me to avoid repetition in this case:
Entities added by my mod should all override hurt() and take 1/3 of the damage they normally would.
The way I would do this, is having a parent class EarthboundEntity extending Entity, have it override hurt() and write the logic for that there, to finally have whatever Entities I add extend EarthboundEntity and have that logic automatically applied to them.
The problem though is that my entities aren't always going to just be Entity. They might need to extend other classes such as Animal or Monster. In those cases, I have to pick between my entity either extending EarthboundEntity to avoid repetition of the code written in there, or have it extend Animal/Monster to avoid repeating the code that is in there.
What's a solution for this weird issue?
decorator pattern would be the an approach, not sure how well it would work with minecraft and your specific situation
ur a decorator pattern
Decorator pattern?
Does Forge not have attributes?
I don't know, been using Fabric for all this time just jumped onto forge
FileConfiguration config = plugin.getConfig();
@EventHandler
public void onPlace(BlockPlaceEvent e) {
Location location = e.getBlock().getLocation();
ItemStack itemInHand = e.getItemInHand();
if (itemInHand.isSimilar(CaveSpiderSpawner)) {
config.getStringList("spawners-location").add("" + location);
plugin.saveConfig();```
why does this not add the location to config
it resets the config removing everything in it
I tried using a simple text instead of location and it didnt work either
Because you have to get the list, add the location, and then set the list back
so basicly if i want to store many data with diffrent methods i open 1 connection and close it after all methods are done?
what is that
what are you trying to do exactly?
update the same table / database with multiple input?
i have many objects (every vault has its own object) i put them all in one hashmap and onDisable i loop through the hashmap and save each object in the database
okay so since its a loop anyway, why do you need to close the connection
open connection
loop and put in database
close connection
or if the connection is being used often
then keep the connection open and use the reference to it
and close it on disable
How do i listen for the packet when a boat's left/right paddle is moving? im using protocollib
Im trying to figure out if a player is paddling a boat forward so i can apply a speedboost then but i cant figure the packet stuff out
cpulsbt you just get the boats velocity or whatever its called and work from there?
isnt the movement of the paddles clientside only?
yeah i can get the velocity, then speed it up but it would still speed up even when player isnt paddling it because the boat slides forward after you stop paddling
i tried storing the last velocity of the boat and checking to see if it slowed down, but because of the speed boost it always showed it was going faster or same speed
I tried doing math to subtract the speed boost value but couldnt figure it out
Vector vec = e.getTo().toVector().subtract(e.getFrom().toVector());
double speed = vec.length();
Location loc = boat.getLocation();
loc.setPitch(0);
double speedBoost = fboat.getMaxSpeed()/20;
Vector boostVector = loc.getDirection().multiply(speedBoost);
if(speed < fboat.getMaxSpeed() && ((!fboat.boosted && speed>fboat.lastSpeed) || (fboat.boosted && speed>fboat.lastSpeed+speedBoost))){
vec.add(boostVector);
fboat.boosted = true;
}else{
fboat.boosted = false;
}
fboat.lastSpeed = speed;
boat.setVelocity(vec);
this is what i was using before
but even if the player was holding S to slow down it still didnt think it was decelerating
i guess listen to VEHICLE_STEER and print the output to console and read what occurs when and go from there
Ok im there
Ask away @clear aspen
i need to make a drop menu for tebex (i bought a design but wana make few changes)
Ah you mean theme development
yea
Im redoing a plugin i madea while back basically from scratch
I need to generate a spawner with certain parameters as PDC values
Should i make a static class that has methods to generate that?
Also i have a bunch of namespaced keys. I have no idea what to name the class or package to put them in
Would probably be some type of a data package, and then depending on what kind of data would be your class, also yea static methods are probably fine for this
Thank you
I have a "DataManager" class that has methods that saves the dataconfig and all the file work. Then i have a "Data" class that is mapped into a file as the config (gotten with getConfig()). Should i use plugin.getDataManager().getConfig() or should i save object holding the config in my plugin class to do plugin.getConfig()
Maybe im overcomplicationg this
You are yes
lmao
Also i couldve sworn there was a way to make namespacedkeys static?
And to store them in their own class
No?
Well you need to pass in a plugin reference, so you could possibly use the init block
Quick question, is PDC run Async? Cause sometimes I set pdc of a player on quit event and it doesn’t save at all, so maybe when I am setting it it’s already too late?
the player already left the server, the server already saved the player's data. Changing something in the PDC afterwards won't have any effect
Step 1: Realize you can cancel events
Step 2: Find PlayerQuitEvent
Step 3: 
I'm pretty sure you can't cancel it
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player sender1 = (Player) sender;
if (command.getName().equalsIgnoreCase("spawner")) {
if (args[0].equalsIgnoreCase("cave_spider") && sender1.hasPermission("spawners.command")) {
Player player = Bukkit.getPlayer(args[1]);
player.getInventory().addItem(CaveSpiderSpawner);
}```
why does this not work with console
because you cast the sender to a player without any checks
oh
how do I get strings from a database file
So I have always used```java
YamlConfiguration yml = ...;
File file = ...;
public void saveYaml(boolean reload) {
if(yml == null) return;
try {
if(reload)
yml.load(file);
else
yml.save(file);
yml = YamlConfiguration.loadConfiguration(file);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
```To save my custom configs. My question is in later versions is yml = YamlConfiguration.loadConfiguration(file); still necessary? Or have they finally made it adjust the instance of yml when running load and save?
Never used that and it worked fine?
Always had to adjust the instance when saving and (re)loading
Otherwise it never gave me the edits from the yaml.
well if you load it, then I think that you wouldn't have to load it again and create a new instance
and if you save it, then the file already matches what the instance is
I'm gonna test it in a bit to make sure just writing up my new config system.
Figured I would ask though.
pretty sure loadConfiguration is just shorthand for new + .load
With discord.js it's still not possible to delete messages older than 2 weeks right? But bots can edit their own message even if its much older than 2 weeks right?
Correct
Sweet
Sweet? What if people don't talk in your discord for 2 weeks at a time? Your bot can't remove messages you want cleared lol
I mean the edit part
it sucks bots cant delete old messages xd
but it has always been like that
so people got used to it
I use JDA currently
¯_(ツ)_/¯
I only use that for plugins
no libraries allows you to remove messages older than 2 weeks yet right?
Unless discord stopped allowing it I think all but javascript libs do.

Yeah looks like yml = YamlConfiguration.loadConfiguration(file) isn't needed anymore.
you can still remove the messages if you store their id i think
its an api limitation not a library one though
Hey, I need help! Nowa days my server just loses data out of nowhere
And the world gets deleted, anyone got any idea on why or how?
Is there a pre player quit event?
no lol
How would I solve this issue then?
why saving in player pdc?
just wondering
Will that always work?
I mean, its a way to store data builtin spigot
Why wouldnt we?
bc of the issue you got maybe
Well ye, fair enough lol, tbh they also seem to have a bit of latency when getting them
i wouldnt save something in pdc for players tbh
indeed, its better to use an external db
What exactly are you storing is the question
A boolean basically
Lol
Also, would storing block data in a chunks pdc be an issue in any case?
Well what kind of Boolean, context bitte
The boolean is meant to say if said user has placed a special block called Locker
Its the only job it has, its to say if he has it placed or not
And does the locker have data?
The block itself, yes, its its own object
But its not linked to the PDC
Its stored differently
Well why don't you just add an owner to the block data?
Or you know, just set the pdc data when they place it down lol
Cause I use it outside that, I cant just loop all chunks and check if a block has certain data...
That would probably be a pain
Even more if the chunk isnt loaded
I'm trying to simulate a different gravity for entities. I do this by having a loop that is called every tick and runs this code e.setVelocity(e.getVelocity().setY(-he.getGravity())); each iteration. e is the entity modified and he is a wrapper class storing the gravity modifier among other things. However, this line causes massive performance issues on my server. Everything works fine if I continue right before it, but when I include this line I get "server overloaded" in the console and the server drops to ~10 tps
Any idea why?
yaml file
And why are you looping? Just get the block, store it, the end?
he probs want a command like /mylocks
and his example is
- i want to save data in pdc
Then don't store the data in pdcs?
but i cant bc of delay and i can't store in blocks
And use an actual database
bc i wont be able to get all protections since they are in diff chunks
he should use a database or sth
and then load on start
i mean, no point on saving it in player either as it wont be loaded when someone attempts to break the sign
also you making a locker plugins? public? if so, ppl will prob start asking to lock doors too
and i dont remember very well, but you cannot use pdc there right?
might be wrong, never messed with doors lol
Uh no, not really. Different type of locker, but it’s fine,you are right, I shouldn’t use PDC for this

is there a good tutorial for adventure chat api
i haven't been active since the adventure update on paper
so idk where to start
or some link. i checked official docs for adventure but it wasnt really helpful for me
what about the official docs?
well let me check again the docs
actually i remember that it is but its been a while
and i guess docs have changed a little bit
hm yeah it was reworked, somewhat
so should i store components and replace variables if i need to
or just create every time
creating a new Location and spawning an entity there, loads the chunk 100% of the times right?
yeah spawning an entity does that
depends
you can just check by listening to the packet
isn't that standart the despawn time

Chunk unload packets aren't sent if the player didn't have it loaded (so if there's no one nearby, it won't be sent), and it might also be sent even if the chunk didn't unload (docs say that it's "legal" to send)
https://docs.adventure.kyori.net/platform/bukkit.html#usage
or should i do this according to this link for plugin
well for paper 1.16.5+, it's included already so you can just do Audience#sendMessage, etc
Audience can be players or the console
true, no need for packets can just listen to the chunk unload event
for some reason i though they were spawning them for a person
and if not on 1.16.5+, then I think BukkitAudiences.create(plugin).sender(sender) <- Audience
rather than on the server itself
got it but should i create components every time when i want to send a message
yes - or if it's a constant message you can make it into a constant but I just make a component every time 🤷
except for error messages, I make those constant so that I don't keep typing them out
yes
the cost isn't that high but usually I suggest you store messages as constants, like
class Messages {
static Component NO_PERMISSION = Component.text("asd", NamedTextColor.RED);
static Component BLOCK_PROTECTED = Component.text("fgh", TextDecoration.BOLD, TextColor.color(0x23c544));
}
etc
and then you'd just player.sendMessage(Messages.NO_PERMISSION)
or whichever other pattern you like tbh, that's what I tend to do
and so i can replace placeholders with that constant variables
if the message is different
just initialize a new one each time
use constants for actually constant variables
afaik there was a replacement method or sth
alright thanks for everything
initializing an object is not costly, no need to be scared of using it
you want to do init and cache with the case of connection etc
where it actually is costly
well actually i don't want to mess with lots of lines with components
If it's not for config stuff, there is a Component#replaceText method that allows you to configure a text replacement based on a regex pattern
and sometimes i will be using same message in more than one places with just a little differences
i guess that works yeah
little difference is a difference regardless
i honestly dont see a point reusing the same object in the case of the components
its just a data class
i mean a player name for example
wouldn't be better if i just replace it
and use a constant
really not much of a difference
I'd rather have the components already built in a class like I did above and are actually named, than deal with the burden of writing the whole component over and over again - not for any performance reasons or anything, but a readability and usability perspective (and allowing the possibility of maybe, possibly, having two slightly different things where I meant to use the same)
just write them once and use anywhere, performance is not the issue here
yeah i guess that is best approach here regardless performance
Component.text("hi with name1")
Component.text("hi with name2")
for plain text i think this is clean enough
but i agree with this one if your component has a lot of elements
altho i probably would just make a method
rather than a constant in that case
yeah that's the point
for a simple stuff like that sure, but when you get to something like this.. yeah I want to see you try
https://github.com/LuckPerms/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/locale/Message.java
it's ugly as
i mean i did say for components with a lot of parts
i do agree with either caching (or just a method)
just so its cleaner
yeah depends on the situation
its just that i felt from the way they typed that they are scared in a way of initializing objects
in the case of classes like these, java can handle it extremely well
actually that was my first opinion
so from a performance perspective
no need to be scared, thats how its supposed to work
it really doesn't matter
objects are created and garbage collected as needed
short-lived objects are nowhere near a burden to the GC as they used to
exactly
as a rule of thumb, content of the class is what matters and for most objects its no big deal
you mainly want to cache objects that are heavy / take a lot of time (connection to database and reflection are the main examples)
it's a good reminder i sometimes act like paranoiac
😅
If I had previously a class like public GeneratorData(String tier, String nextTier, String type), how would I migrate everything to an update version that has for example one more parameter?
Do it manually?
in which sense do you mean that?
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
if (command.getName().equalsIgnoreCase("oldspawner")) {
if (args[0].equalsIgnoreCase("convert")) {
SpawnerInventory screen = new SpawnerInventory();
player.openInventory(screen.getInventory());
}
}
}
return true;
}
}
help
why does this now work
oh wait maybe it doesnt work coz I didnt add the command in plugin.yml
yep that was the problem
I mean that I already created objects and serialized them using a class with a constructor that contains only 3 params, and now I added a new param, wouldn't it make it impossible to deserialize the others and also make them invalid?
Ohhh
I actually never thought of that hm
Is the extra parameter gonna each have different values for your old already created objects?
I was thinking keeping the old constructor and making it call the newer constructor
Yes
FileConfiguration config = plugin.getConfig();
@EventHandler
public void onPlace(BlockPlaceEvent e) {
if (e.getBlock().getType() == Material.SPAWNER) {
CreatureSpawner cs = (CreatureSpawner) e.getBlock().getState();
Player player = e.getPlayer();
Location location = e.getBlock().getLocation();
ItemStack itemInHand = e.getItemInHand();
if (itemInHand.isSimilar(CaveSpiderSpawner) || itemInHand.isSimilar(CaveSpiderSpawnerOld)) {
spawners.add("" + location);
config.set("spawners-location", spawners);
plugin.saveConfig();
cs.setSpawnedType(EntityType.CAVE_SPIDER);
player.sendMessage("worked");
cs.setDelay(-1);
cs.setMinSpawnDelay(340);
cs.setMaxSpawnDelay(340);
cs.setRequiredPlayerRange(7);
cs.setMaxNearbyEntities(1);
cs.setSpawnCount(1);
cs.update(true);
}```
help
in my localhost server with no plugins it updates the spawner entity type to CAVE_SPIDER
but in another server with a bunch of plugins it isnt working
what could be causing it
What version is it on?
Also, have you checked that your configuration is generating?
1.18.2
yes
it says the msg too
"worked"
wait but will it work if I deserialize it?
Cause I serialized the previous class (with the previous params)
That might be why, I had a problem a while ago with a config option where it was using legacy block ids. I forget how to fix it though
But my problem was with candles
what was the problem?
Oh I think you need to set api-version: 1.18
Or something like that
I could be completely wrong
Perhaps. I mean it would call the old constructor right? And you could maybe load it and set the new property, and then serialize it back into new contents
that is already 1.18
or maybe let me just try deleting plugins 1 by 1 and hopefully figure out which plugin is causing it
Yeah maybe try that
paper 1.18
1.18.2 I mean
Both?
yes
so i am trying to check if the clicked inventory is the same as a other inventory i have in a variable, the problem is that one of them is CraftInventoryCustom and the other is just CraftInventory, any fix?
https://paste.helpch.at/uzilefedap.js shows 0.0 … any fix?
Is there some open source stuff available for working with multiple yaml config files in plugins?
Or can I just merge all my config files into one on plugin startup and then use the bukkit methods for working with it?
u got a link 🥺👉👈
uhh theres no docs on it but try ctrl F on my user and search oldest messages
a little busy atm
yes yes I found the triumph thingy you were talking about 😄
...but I also found some other stuff 😏
CraftInventory (and its variants ) are just wrappers for nms inventories. If you use .equals() it checks to see if the underlying nms inventories are the same
When using 1.8 (or old versions) is there an easy way to differentiate between the durability of an armor/weapong/etc
which is the damage (uses) and the durability for example of a wool (colored) or golden apple (1 when enchanted)
?
Guys does anyone know how to create custom pathfindergoals for entities? Like if I want to make new ai stuff, the actual thing is that i dont know how to make a mob have a rotation of abilities when is in aggro with a player (like I'll check if the player in aggro is in range he'll do a certain ability else it'll punch him if he's close for example) or do something else when he has no threat (Like mythic mobs but for my own stuff I really need to make it myself)
Use inventory holders
yeah, create your own inventory holder and add a identification variable to it.
its the best way
nobody knows js?😭😭
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait
Well, try to keep it in one support channel.
hey
how can I store the mobs spawned by spawners
or how can I remove mobs spawned by spawners with a interval
An easy way to do it would be to listen to the spawner spawn event and attach a metadata key to your entity
you can do
first you can create a task which checks for example every 10 seconds
when a mob spawned by a mob spawner you store a timestamp with the entity
and when the 10 seconds over that will check if every entity you store had 10 seconds if its then remove it
or you can create a task every time when a mob spawns then remove
Thats a bad idea lol
second right
Yeah haha
yeah i wasn't sure to write that 😄
If he wants a timer for every entity he could do with a hashmap probably?
yeah i guess that works
There's CreatureSpawnEvent and SpawnCause.SPAWNER or something like that
aight let me try
:o
Ah, didnt see
or maybe if there is a way to attach some data to entity i have never done that before
or just maps
store entity id
There’s PDC and metadata
If you are on 1.14+, there's PersistentDataContainer
I don’t think metadata remains on restart though yeah?
It doesnt
Yeah thought so. You probably wouldn’t have to use PDC though since I don’t see why you’d wanna store the entities forever lmao
So I created an HTTP file Server in Java using Netty, and I was wondering if there are any attacks I should keep in mind of? I created a regex to prevent against requests that try to do a reverse directory traversal attack (where they use ./ and ../), however, I was wondering if there were any other attacks that I could prevent programmatically?
public void onBlockPlace(BlockPlaceEvent event) {
new BukkitRunnable() {
@Override
public void run() {
int spawnercount = 1;
Chunk c = event.getBlock().getLocation().getChunk();
int cx = c.getX() << 4; // chunks x
int cz = c.getZ() << 4; // chunks z
for (int x = cx; x < cx + 16; x++) {
for (int z = cz; z < cz + 16; z++) {
for (int y = -64; y < 320; y++) {
if (event.getBlock().getType() == Material.SPAWNER) {
++spawnercount;
if (spawnercount >= 5) {
event.getPlayer().sendMessage(ChatColor.RED + "You can't place more Spawners in this chunk");
event.setCancelled(true);
break;
}
}
}
}
}
}
}.runTaskAsynchronously(plugin);
}
}```
why does this not work
don't access the world asynchronously
also, the logic is fundamentally flawed
it's even flawed in multiple ways:
- you're never checking any block other than the one which was placed
- you're therefore either end up with 1 (even if no spawner is set) or 1 + one for each position in the chunk
- you're trying to cancel the event after it was already handled
There is also SpawnerSpawnEvent
instead, just use Chunk#getTileEntities(), count CreatureSpawners and cancel the event based on that - no need to do anything asynchronously
no
hey
does anyone how to code python? i need a bit of help i coded a calculator but idk how to make it into an exe file
(ping and reply pls)
py installer isnt working
😔
guy installer
pie installer
Anyone able to help me with this? Caused by: java.lang.NoSuchMethodError: 'net.kyori.adventure.text.Component net.kyori.adventure.text.TextComponent.font(net.kyori.adventure.key.Key)'
Could you provide some code? (and the full error)
...
return Component.text(stringBuilder.toString().trim()).font(Key.key("colored_pixels:cubes")); this is the code
are you shading adventure?
dont shade adventure
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent e) {
new BukkitRunnable() {
@Override
public void run() {
if (e.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER)) {
e.getEntity().remove();
}
}
}.runTaskTimer(plugin, 0L, 100L);
}
}```
how do I make this somehow work
why are you creating a runnable for it?
if you just want to not allow spawners to spawn
then cancel the event
rather than removing the mob
if you want them to spawn then get removed after x delay
then use runTaskLater
you want to remove mobs every x seconds?
yesd
then you need to create a timer only once
how so?
not every spawn event
on enable?
then loop all mobs and check which ones are spawner spawned
(or even better, cache the ones as they spawn and remove that way)
why this complicated
its not really complicated
what you are doing above is running a repeating timer
every time a mob spawns
that attempts to remove the same mob constantly
what you want to do is run a timer when the server starts that checks the mobs and removes the ones that are spawned by a spawner (if you are doing this for lag reasons, this probably is a really bad idea btw)
Im doing it for my Spawners plugin
public class SpawnEvent implements Listener {
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent e) {
if(e.getSpawnReason() != SpawnReason.SPAWNER)
return;
Bukkit.getScheduler().runTaskLater(<JavaPlugin>, () -> e.getEntity().remove(), 100);
}
}
```Will remove the entity 100 ticks after it spawns. (You should check if its dead or removed already.) Make sure to register the listener.
aight thanks let me try it
Cannot resolve method 'runTask(SpawnersPlugin, <lambda expression>, int)'
runTaskLater. Edited it lol
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent e) {
if (e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.SPAWNER) {
if(!e.getEntity().isDead()) {
Bukkit.getScheduler().runTaskLater(plugin, () -> e.getEntity().remove(), 100);
}
}
}
}```
changed the code a bit and it works perfectly
tysm for the code
np
wait, what?
he checks if entity is dead after spawning and then remove it 100 ticks later
Yes cause a player can kill it before the task removes it
Ah yeah. Didn't read his code properly xD

Uh, if I run a SyncTask inside an Async task it will wait for the async task to finish right?
like callSyncMethod? From the scheduler
It would schedule it for the next tick
And run on the main thread
Unless you are talking about something else? Wdym by sync task
this use case
the idea is to serialize the class, store it and then remove it from cache
after that is done
I may be wrong, but I think it will schedule on to the next tick on the main thread
So, it won't really wait for the async task to finish?
Well in your case, the db operation will be done first, then the sync task will be scheduled on the next tick
Because it’s after
Unless the db operation is also async
the idea is for the db operation to be async too
db operation is async there
cache.get is done on the main thread
your async thread wont wait for the main thread scheduler to finish
it only fires it, rest is handled on the main thread
it does your db.set then it switches back
hi guys what do you guys think of my server host website https://garlic.host
I want to make a plugin that listens to a pixelmon event. https://paste.helpch.at/visocigero.java
Basically, Pixelmon's<event>.getPlayer(); returns a EntityPlayerMP
I want to convert this player into a CraftBukkit Player
In the mohist api, under playerAPI, there is a method getCBPlayer that should take EntityPlayerMP, and return a CraftBukkit Player
It's instead asking for something called oq as an arg, but I don't know what that is.
I was hoping someone could help me figure out what oq is, or more generally how to cast EntityPlayerMP to a Player
its fire 🔥
anyone can teach me how to make a InventoryCreator?
Have you tried checking the docs?
I would suggest a SideMod instead as it'll be pure forge, suggest asking in the Pixelmon Discord server or asking SideMod creators.
This isnt the right channel for datapack support, is it?
It's related to a mod I am making
But it's just regarding structure nbt and worldgen jsons
well its development support, any kind of development, just ask and someone may know the answer
made a structure which generates naturally in the world, though ever since I have added it any time I try joining a world in singleplayer I get this warning here
Expected behaviour
What do you mean?
I mean how can I avoid that from happening
Doubt you can, I'm guessing it's a client oriented warning
But I have never seen this issue with any other mod that adds custom structures
I got that when I ran a 1.19 world in 1.18 now it always says this no matter what version.
Yeah i guess it's expected behavior now
there is a mod to just hide that message if you want something like that
hi
One question, I have a plugin that when you die takes a life from your storage (for example, if you have 3 lives, when you die you have 2), how can I make a life recover after X hours?
I had thought that when you die, the exact date of when you died is saved, and check every second if the current date is greater than the saved date
yea you can do that. just saved the time when you die, have a task that cheeks the death times or something and if a users time is old enough remove it from the death times list and add their life back or something. alternatively you could maybe schedule a task on death that has a delay and when it runs it adds the life back
First one definitely, second would require a task on every death which isn’t ideal lol
DeluxeMenu depend on PlaceholderAPI parsing? (for colors)
huh
huh? 
you can get the item, then the meta, then PotionMeta
then there's probably a method in there to get the level
i have the potion mets but there’s no method for the amplifier
since level is deprecated
it just returns 1
you can do getBasePotionData
and then isUpgraded & isExtended
although as for custom potions...
amplifier 1 means level 2 iirc
wait what method is it
i could only find boolean ones
potion meta .getLevel i believe
declaration: package: org.bukkit.potion, class: PotionEffect
declaration: package: org.bukkit.inventory.meta, interface: PotionMeta
does getCustomEffects also include the base effect tho?
no
no
the base effect only has a boolean (isAmplified) because default potions have only two levels aka normal and amplified
ahh ok that make sense
the base potion is one of a hardcoded type in-game, it doesn't have a "level" because it's either amplified or not (level 1 and 2 if you like)
would that be level 1 and 2
oh
the custom ones are any other effects you can construct and have any other level
ah ok that makes a lot more sense, i was still thinking about like speed pots and such but then i realized i couldn’t find any
yeah
ok thank@you
the potion effects API is so trash
spigot api*
yeah fair, but there are bits that are so noticeably worse than the rest lmao
true
I wonder what working with good api is like, maybe one day
paper or modded
sponge 
Wouldn’t say either cause Minecraft in general has notoriously bad code (Bukkit and Forge sorta)
Id probably say Spring or something
well I was talking about minecraft
We can't really comment anything about Minecraft itself, there is no API to use it, it's all hacks and workarounds to hook up into it
And actual APIs you've got Sponge and Bukkit... let's just say that Bukkit shows its age :')
but at least those APIs can be good lmao
They're a lot newer, bukkit is as expected for something that old
Im trying to figure out a way to make moving with a boat faster, the boats dont have gravity so theyd be moving in the air always
the idea with this code is to try and figure out if between 2 of the event checks the boat was moved by the player themselves by pressing W instead of just the speed boost that was applied, i feel like this code should work but it does not at all
@EventHandler
public void onVehicleMove(VehicleMoveEvent e){
if(!(e.getVehicle() instanceof Boat boat)) return;
FlyingBoat fboat = FlyingBoat.boatMap.get(boat);
if(fboat == null) return;
Vector vec = e.getTo().toVector().subtract(e.getFrom().toVector());
double speed = vec.length();
Location loc = boat.getLocation();
loc.setPitch(0);
double speedBoost = fboat.getMaxSpeed()/20;
Vector boostVector = loc.getDirection().multiply(speedBoost);
if(speed>fboat.lastSpeed){
if(speed < fboat.getMaxSpeed()){
vec.add(boostVector);
}
}
fboat.lastSpeed = vec.length();
boat.setVelocity(vec);
}
are you using the instance as the key?
the flyingboat thing is just to get the max speed and see if its a boat i want to boost
yes but
using the boat instance as key
is asking for trouble
are you providing your own hash
or just using it as key
im not really sure what you mean but that part works fine just the boosting is being an issue
you sure its just not returning?
yep im 100% sure, ive checked with sending the player messages about how fast its going etc
Uhm, when adding an item to a player inventory it returns an hashmap if it couldnt add all items right? My question is, it's a Integer, ItemStack hashmap, if I use size(), will it return 1 (only one itemstack) or the amount of items it couldnt add?
Map#size() returns the number of entries in the map
So in this case it would return 1 and not the total of items left right?
well, it depends on what parameters you input in
If for example your inventory is completely full, then it will just return a map of the same items you put in the parameter
Let's say I try to give 100 of a certain itemstack, but it only added 50, will .size() return 50 (the amount left) or 1 (the amount of unique itemstacks)
So an ItemStack with the amount 100?
then it will return 1
it all depends on your parameter
no
checkArgument checks if it's false
and if it's false, then throw an exception
also can u post the exception?
since the stacktrace will lead to the code calling it
The code above is whats calling it. But yeah hold on
yes but I mean what method call
I'm making it bypass the setItem
Hi! I made a menu in the DeluxeMenus plugin, the point of which is that, for example, there is a spawner, and it costs 100,000,000 dollars to deduct that much, and if the player doesn't have money, don't give it to them. How can I do it? It doesn't work for me.
This is for coding mainly
https://paste.helpch.at/cezumiguze.cs
i remade the enchant system but it doesnt work (no error)
I wonder what seeing a game with an actualy unobfuscated api is like
actually i have seen it space engineer has one of the best game api in the world for features addition
to start, a PDC is not NBT
iirc
and why do you make a like that
just do
List<String> item_lore = new ArrayList<>()
item_lore = item_meta.getLore()
No
Dont
No underscores in variable names
And yes i just came here to say that
↙️ 🐫 💼
just to let you know you can't change boat speed
You get player inputs with vehicles!
So there should be a method to get the player inputs somewhere in bukkit
Velocity is the only way to modify boat speed, really
ping me if you reply or want help with movement stuff
yeah im trying to use velocity for it, how do i get the player inputs?
only way i could think of is comparing the velocities of the boat between events to see if the player pressed W to move it forward or not
no the player literally sends their inputs to the server
PlayerInputPacket
aah okay i havent done anything with packets yet in my plugins
I'm surprised there's no API method for this
I guess because the server never actually uses these inputs
mojang has just left them in either because they forgot or they want to let people make custom vehicles
Take your pick of protocollib or packetevents
Or use reflection to read the variables
probably gonna go with protocollib since my server already has that on
protocolManager.addPacketListener(new PacketAdapter(
this,
ListenerPriority.NORMAL,
PacketType.Play.Server.Player_Input
) {
@Override
public void onPacketSending(PacketEvent event) {
}
});
im assuming it'd be something like this but i cant find the Player_Input one @past ibex
its red when i type it
player input is still red with Client
ill check if i have the latest protocollib
yeah i am
found something that seems like it applies to me https://www.spigotmc.org/threads/help-listening-wasd-vehiclesteer-with-protocollib.325989/
yep this is exactly what i needed
Why do you need Player Input for that?
You need to listen to the STEER_VEHICLE packets
depends on mappings
Steer boat isn't the same packet as player inputs
but steer vehicle sometimes is mapped as player input
how does one spawn only the particle of fireworks? I have searched and according to spigot forums you need to use the particle packet
but there is no data for fireworks in the protocol in wiki.vg
none is data
If you're in a later version, you could just use api methods tbh
As they basically just send packets
What is the difference
Can I update an inventory? I’m trying to make an animation using stained glass like some plugins have in their casino or mystery box GUIs
Also for some reason Everytime i check if an item is equal to an item I want to change, it returns null
Well I fixed the null issue, but it’s not changing the items
Used a different method, it works
You're welcome
@past ibex How do i make it so when the boat's velocity is changed by colliding with a block or something like that, it actually changes?
right now im doing all the movement by storing the velocity in the FlyingBoat instance and it works perfectly except for when the boat collides with something, once the block is out of the boats way it jumps forward
I tried setting the velocity in the FlyingBoat instance through the VehicleMoveEvent and that worked for the block collision thing but then the movement itself is pretty choppy
oh crap theres a vehiclecollision event!
ill try using that
Hm the event doesnt seem to trigger but the boats movement got really choppy still
Why don't you just manipulate the moveevent when there's a collision, and the rest is handled how you were handling it originally
yeah im sorta trying that but the event isnt triggering, ill have to check if i did the listener correctly...
listener's fine, weird
pft apparently that event is bugged
Yeah boat movement is client sided
The server will just replay client movement and not see collision
You should be able to notice collision when their movement in a direction hits 0
Not “perfect” detection but you’ll have to deal with it as long as you use client sided vehicles.
try isValid
I think thats what I needed. Thank you.
how would I be able to get it to return the value entered in my config.yml? I have
sender.sendMessage(Npunish.plugin.getConfig().getString("default-kick-message"));
set and it returns null and everything else I've tried showed an error that practically told me to just remove it
Show error and config.
config where I have the messages defined
#Messages default-kick-message: "Breaking the rules"
no error returned in the above ^
it kicks but the kick message is just empty
is it possible to only make a runTaskTimer run only like 5 times?
or a set amount of times
Debug it then. Check if its returning the string from the config or not.
increment an integer and cancel it when it hits a certain amount.
new BukkitRunnable() {
int count = 0;
public void run() {
count++;
// Your code
if(count == 5)
cancel();
}
}.runTaskTimer(<JavaPlugin>, <delay>, <timeBetween>);
np
Hi so, owner.getInventory().remove() removes an Itemstack, the issue I am having is that it removes all itemstacks that match, any way to only remove it once?
Or maybe I am using the wrong method?
Inventory.removeItem()
pretty sure it isn't that
but it's fine I will just use another method
by setting the slot
thx
I edited it sorry. Don't have my ide open
Im using foreach loop to iterate between messages sent before and send them to the user. for some reason I'm getting an error that is repreducable but on my computer nothing weird happens..
Maybe due to downgrading java version in mvn to java 17 (I'm using replit)?
Error:
Exception in thread "Thread-3" java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967)
at me.fozystyle.JavaChatServer.readThread.run(readThread.java:54)
Code at me.fozystyle.JavaChatServer.readThread.run 54:
if (server.messageHistory != null) {
for (String s : server.messageHistory) {
sendMessage(s);
}
}
btw messageHistory is a String list:
List<String> messageHistory = new ArrayList<>();
Please ping me if you think you've a solution
what does sendMessage do?
You can't use an enhanced for loop on a List and modify the list from inside it
@glass mason show code and also use HelpChat paste
?paste

