#help-development
1 messages · Page 1079 of 1
I mean, you still might want to base64 it afterwards anyways (maybe even compress it, if you are concerned about DB size)
you can base64 byte arrays
honestly i never serialized itemstacks / inventories before so i have 0 experience. whatever you say is prob better
i did read some threads about it before tho
What I see many times with "complex" data or generally JSON is that people do JSON > Base64 > Deflate > Base64 > Network
JSON > Base64 makes it "uniform" character set, Base64 > Deflate adds compression, Deflate > Base64 makes it URL safe (if you choose to add it as URL parameter)
Also Base64 and Deflate are supported by pretty much any OS / Software natively
If you have some fancy SSO services that handle your public ID data over URL, it can even happen that you find some silly ?id=<Base64 string> that has been going through like 3 layers of this and is triple-base64'd
xD
why would you want to base64 a byte array that you're gonna throw into a db anyway?
no point in base64 as you are actually increasing teh data size
base64'ing any array will only make it larger, and blob db types exist
and, speaking specifically about paper's serializeAsBytes, that is already gzip'd
how should I do it then?
for the serialize method? What I have to do?
now I found this:
https://paste.md-5.net/wutopihevo.java
https://paste.md-5.net/ezitefanur.java
But i have this error:
https://paste.md-5.net/fudekuyiro.md
but the armour also needs to be synchronised
Well perhaps it could be the armor trying to fit into the inventory slots rather than the armor slots?
These inventories are going back to the player right?
yep
this is my only guess then, I can't think of any case where 45 is an incorrect size for an inventory and seeing as it's trying to put an additional 4 items in, that sounds like the armor is not going to the correct slots, iirc the armor slots are accessible through the player.getInventory, so perhaps try and put armor back where it should be?
I added this:
if (size % 9 != 0) {
size = ((size / 9) + 1) * 9;
}
if (size < 9) {
size = 9;
} else if (size > 54) {
size = 54;
}
beacuse, I had another error before:
[22:31:18] [Craft Scheduler Thread - 7/WARN]: java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 41)
iirc the player inventory is technically 45 slots, 41 + 4 armor slots
no I'm lying
41
yeah
36 + 4 armor + 1 offhand
so I have to remove this:
if (size % 9 != 0) {
size = ((size / 9) + 1) * 9;
}
if (size < 9) {
size = 9;
} else if (size > 54) {
size = 54;
}
The player inventory is a total of 41 slots, so yes I would think so
But if I remove I have this:
[22:31:18] [Craft Scheduler Thread - 7/WARN]: java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 41)
Inventory inventory = Bukkit.createInventory(null, size);
Couldn't you just get the players inventory and replace it with the serialized one?
Can i DM you?
I'd prefer not
I'm not the only person who can help here haha
Point being you would get more help here
InventorySerializer.java: https://paste.md-5.net/qudotipiye.java
The Events: https://paste.md-5.net/nakocejako.cs
I'm still guessing on the armor
I think when trying to give the player the inventory you should scan for armor items and put them into the players armor slots
yes, but now I don't have armor on
don;t do it in creative
Do you think my guess is correct elgarl?
I don't wanna keep leading them down a useless path lol
uh, didn;t read
The armor is causing the issue
I just tried survival. The error is the same
(if there is any)
why can't windows count file edit times over 24h
Why are you using Inventory and looping each slot when serializing, then using setContents when restoring?
how should I restore it? and more importantly, how should I serialize it?
Inventory#getContents() Inventory#setContents(deserialized array)
you are storing in a temporary Inventory which has no armor slots
That brings up my next question, if you somehow figured a way to make a player the inv holder, would that help?
Inventory inventory = Bukkit.createInventory(null, size);
as opposed to
Inventory inventory = Bukkit.createInventory(player, size);```?
I am not understanding.
this has two methods at the top. One takes a PlayerInventory and serializes it then adds teh armor https://gist.github.com/graywolf336/8153678
you don;t need to base64 it, just return outputStream.toByteArray()
man
Since when was PlayerInventory an object
This woulda been helpful on like 4 projects lmao
but the first one returns a array of strings. So, if i have bytes, I have to return a 2d array of bytes?
dunno what you are doing with the complicated size retrieving, just read in the size and act on that
or change it to a byte array
no need for string
the main thing is drop the base64 encode
its just expanding the data
um, I wonder if it would be better to keep base64
imagine someone writes a book with an sql injection exploit on a page
Wish I knew enough to understand this
I'd have to see teh output of the byte array
in base64 it would be impossible to exploit
so? what I have to do?
just use teh code as shown
How can I save an Array of strings in a database? I have to use blob?
you can provide multiple values in a varChar
The proper way would be to create a new table for your array
^
one-to-many relation
old people like me would use varChar or concatenation
what does Material#isSolid() check? i want to make sure a player isn't standing on dangerous stuff like lava/water cacti without checking 100 materials, i hope that check helps me
Whoa hi smile
I believe nothing anymore.
,-,
🫡
nope I may be mistaken. javadoc says its fine
isSolid means it's a Block and can be built upon.
checked bukkit source but it goes to an abstract implementation so idk what the hell tha does
that is a bit generic tho
so
CREATE TABLE inventory {
inventory longtext NOT NULL,
armor longtext NOT NULL
}
and then?
https://paste.md-5.net/eyetodinug.cs
is there a way to make a "size" parameter? that basically changes the size of the whole thing
Your scalingFactor seems to do exactly that
that just changes the gap between each particle
ie: the size
Use it as a scalar for this as well
a
you could add more particles per larger scaling ig? idk if that sounds incredibly efficient
3d?
So... you want to scale it. With a scaling factor?
let's say i have an 800x600 image and the "size" is 0.5, then it would display a 400x300 image
why am i so bad at explaining
Ah, ok you can just resize the image then and use an interpolation strategy for each pixel. Java already has those builtin.
where is it builtin?
You can either use awt graphics, or an affine transform:
public BufferedImage scale(BufferedImage image, double scaleFactor) {
int w = (int) (image.getWidth() * scaleFactor);
int h = (int) (image.getHeight() * scaleFactor);
BufferedImage after = new BufferedImage(w, h, image.getType());
AffineTransform at = new AffineTransform();
at.scale(scaleFactor, scaleFactor);
AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
return scaleOp.filter(image, after);
}
ok so i somehow need to turn my ImageData into BufferedImage or implement my own scaling
thanks anyways
Here is the graphics solution
public BufferedImage scale(BufferedImage image, double scaleFactor) {
int w = (int) (image.getWidth() * scaleFactor);
int h = (int) (image.getHeight() * scaleFactor);
BufferedImage after = new BufferedImage(w, h, image.getType());
Graphics2D g2d = after.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.drawImage(image, 0, 0, w, h, 0, 0, image.getWidth(), image.getHeight(), null);
g2d.dispose();
return after;
}
Doesnt matter really. Both are quite slow and the result is the same.
alr
Affinetransform however will allow you to also rotate and stretch the image
*In 2D space that is
alr
@young knoll its been a long time coming I finally am actually doing it lol

I'm sick of using internals for my item stack serialization
How does this differ from javas Serializable interface?
Well mainly the issue would be the serializable ID
I mean I very well could use serializable but I've always noticed things get awkward every time I use it
serializable id?
you mean the long serialVersionUID?
you don't have to specify that, the vm will automatically generate one for the class based on the fields, hierarchy and stuff
won't it change every time a method is added though and then break deserialization
methods don't change the serializable structure of a class, so no
fields do, however, (unless it's transient blah blah), but even then you can have a writeReplace/readResolve methods and stuff
what if bukkit were to add a field and DFU can handle the upgrade
java serialization would fail because of an ID mismatch
I could go regular serializable I forget it exists
but I'll have to explicity define an ID
i mean, dfu can't magically upgrade data
no ofc not, but it'd be better than the JVM just guessing
you have to have a schema and a DataFixer for you to upgrade your data from version x to x + 1
you can totally use java serialization (although, it's pretty bleh) across class versions, just, gotta be careful with it and how you design the data upgrades, readResolve and writeReplace are definitely gonna help with that
https://docs.oracle.com/en/java/javase/22/docs/specs/serialization/version.html but it isn't really designed in a way to handle structural changes in the data, since it's meant to go both ways (old data read in newer versions and new data consumed by older versions)
but you can certainly do it
can i send messages or commands, while having a inventory opened, when using a modded client?
probably a cheat client lol
is this an xy issue?
but, you can just have your inventory closed to send messages
the server literally doesn't know if you have it opened or closed
okay
If you are wanting to send commands/messages from teh client while the inventory is open, why?
it sounds like it 🙂
Tbf it’s not that hard to break :p
Dumb question did anything for plugin loading change between 1.20.6 and 1.21 becaue my plugin works fine for 20.6 but on 21 it's a zip file is closed error exact same jars so Im lost
your jar is corrupt
same jar works just fine on a 1.20.6 server
Don't replace jars with the server still running
Im not it's stop the 1.21 server go over to the folder for my 1.20.6 test server put jar in start and watch it work when it just previously failed
which java version?
everything in Bukkit is ticks
ok thx
why not fps?
because fps is suject to user computer
to add pottioneffect need bukkit thread?
need a constant for all things in server
and is nothing to do with Bukkit
yes, don;t modify game objects async
SHIT
this all code
need be sync because from one buff to 5 buffs
that probably is the bigger issue
just get all teh buffs, then jump back sync to apply them
nothing seems complex there. You may bne wasting cycles running it async
What if I give infinite speed when activating the buff (outside the runnable) and then execute a task to be synchronous in which it removes the effect if the buff ends but the scheduler is asynchronous?
a speed buff has a duration so no need to remove it
there is nothing complex in there which requires async
That's not it, the system would be the same. The runnable is executed every 15 seconds, and I keep giving speed every 15 seconds and then stop giving speed if the buff ends. Instead, I could simply give infinite speed and remove the speed when the buff ends.
Isn't it better this way?
Do you only do async on heavy things? I always did async on operations that could be async
why just keep calling the bukkit method and creating objects when I can only do it once
is there some trigger for removing this buff?
I don;t see why you are even using a runnable
remove time buff
apply the buff with a duration and let it expire, or apply it with an infinite duration and remove uponm whatever trigger you use
why?
only in the form of runnable by time
why are you manually removing the buff?
set teh propper timer and forget about it. No running able, no async or sync
How will I know that the buff has expired without runnable?
Why do you need to know it has expired?
to remove the benefits when breaking blocks or killing monsters
Are you suggesting to always compare the times when you kill a monster etc?
I believe it is worse
.
then apply it with the proper duration and listen to https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPotionEffectEvent.html for when it expires
the buff doesn't just give potions effects
Can you answer me there?
what?
the only thign you are doing in that runnable is repeatedly applying an effect until the time is up, then you send a message
none of that is needed
and modifying the time of a Map
apply effect with correct duration, use Listener to see when the effect expires and do whatever you need to do
none of what you are doing is needed
public static Map<BuffType, Map<UUID, Integer>> PERSONAL_BUFFS = new HashMap<>();
public static Map<BuffType, Integer> GLOBAL_BUFFS;
}
im modifing the integer values on runnable too
unneeded
of course i need
no you seriously don;t
https://paste.md-5.net/raseluboqi.cs for example
you know when you apply a buff, you can check when iut expires. you don;t need toi track anything
if i don't do this from the runnable, i need to check the time with System.currenttime whenever someone breaks a resource block or kills a mob
what? no you don;t you get the buff duration remaining on the effect
NOOO
only one buff has speed
the rest has no effect whatsoever
I give up. You don't need 90% of the code you are showing.
NOOO
I don't understand where you're going with this, but the problem isn't the amount of code, it's the performance.
Now my question is whether I do async or not
YES, because you are doing shit you don;t need to do!!!
lmao
remove ALL the runnables and you no longer have any performance problems
bro, no buff has potion effect. do you suggest giving a "null" potion effect to control the buff time?
no you apply a PDC flag
and another thing, if the player leaves the potion also leaves and the buff time has to be maintained after the player leaves
im on 1.8 brother
10min to talk this pdc shit
wha
I had to say the same shit 1000 times
well you never said 1.8
even so, there is STILL no point in your runnables, even on 1.8
you cna still achieve it without runnables
potion effects go off when a player comes out correct
comes out? What tells his parents he's gay?
but I always asked how the hell I did it without runnable, I always talked about comparing with System.currenttime and you didn't say anything. I had to tell you about 5 times for you to mention PDC
anyone know how I can make my text display fade when it's behind walls like a player's nametag?
currently it stays bright white even though walls
Yes, I can, but in a less performant way.
in our entire conversation you never once mentioned 1.8. Not until the very end after I recomended PDC
whats the way without runnable
what does that even mean here LMAO
The only way that came to my mind is to compare times and that is much worse
comparing times is just a littel math double
You don’t worry about performance when coming out of the closet?
not thaaaat much
it's a rather expensive operation and can only be done by blocking the main thread
Is it better to do this 1000 times in 15 seconds or 1 time in 15 seconds?
Are you implying a runnable does 1 check in 15 seconds?
nm not bothering.
ok I didn't think about that, it should run on every tick but fuck it I'm not going to redo the system now
That's not what's going to make the server explode
If you are sticking with what you have, only loop active buffs. Not every player
track all actives
Honestly you could check it async once a second or so, assuming everything is stored in concurrent collections
I didn't understand but ok. the buff time has to be discounted even with the person offline
And then just handle the removal with a callback
but I have to add the potion to the player
make the runnable all async but then inside the runnable execute a sync task to add the potion?
Pretty much
wdym
Not that the runnable being async probably makes much of a difference
would you say this stops the thread for how many ms
with 500 players
I know there are several factors to consider, but in a good processor
if you are running async it will not stop teh main thread
I'm talking about being synchronous
Do they all have an effect at once
There are 4 personal buffs and 2 global buffs. Only 1 type of personal buff gives a speed effect and gives a 15 second effect to all players, then the speed effect is removed if this buff ends.
think about redoing all the code
Depends on what the effects do as well
have you not abstracted your code?
speed 1 only
then just remove it from the map or modify an int value in the map
I mean if it gives a 15 second effect to all players
Can’t you just add speed for 15 seconds
Are you saying it will take a long time that it won't even be 15 seconds for everyone?
Sure that won’t go down if they are offline, but it’s only 15 seconds
I can give a speed of 20 seconds and execute the runnable every 15 seconds
i thhink gpt did what I asked 😂
save lifes
Either way I can’t imagine a 500 iteration loop with a map get and then comparing 2 longs takes very long
not sure why we are having to keep track of the potion effect times
is something supposed to happen at the end of these effects?
I think some buffs don’t involve a potion effect
Or at least that’s what they said
alright, but....you could just add them as a custom potion effect
That’s not a thing
Well, maybe you could add one server side but the client would freak out unless you intercept packets
I'll just compare it with system currenttime whenever they break a block. It's the best option?
there is a potion effect that does nothing if I recall or you can give the player a poition effect status without it doing anything
are they not on 1.8?
I'm not even going to read the code. I doubted the capabilities of GPT so much and he was right that I already trust him 100%.
Yes
then I don't see why the client would freak out
does clicking this send a packet?
only the newer clients seem to do that
Yes, it also calls an event
not even reading LLM-generated code is a fun way to spend the next few hours debugging
since they like to sync the stuff
oh awesome what name?
Actually idk if opening it calls an event
but definitely packet?
common spigot L
its not right event
lucky im using paper then lel
declaration: package: org.bukkit.event.player, class: PlayerRecipeBookSettingsChangeEvent
for spigot
declaration: package: org.bukkit.event.player, class: PlayerRecipeBookClickEvent
that's settings lol
Ah yeah it should call the settings change event
declaration: package: org.bukkit.event.player, class: PlayerRecipeBookClickEvent
yes, when player clicks on green book
i tested it
ah this is for actual recipe
love you too
lol
Lul
Yes
i have plugin that run command when player clicks green book
omg i love that font
Ah perfect I can make it ban players for using the recipe book
XD
not have pottionendevent idk?
I'll give the exact speed time of the buff. How dumb am I?
I wonder why microsoft still insists on discovering all files before deleting them when doing a mass deletion
gotta know what you're deleting 🤷
they can definitely start deleting before discovering the full 2.5mil files
potions finish if player leaves correct
no
you liying
why ask if you're not going to believe the answer
Selixe
How would I check if a potion effect has expired without using some sort of runnable? Is there any kind of event that I could use? I know that there is custom spigots with these events but I just want to use normal spigot
#1Selixe, Feb 7, 2023
Report+ Quote Reply
Like Agree Funny Winner Informative Friendly Useful Optimistic Creative
TheSniper99
TheSniper99
There are no events. What you can do is listening to PlayerItemConsumeEvent and if the player drank a potion, start a future runnable that will run at the potion's end (so now + potion time)
#2TheSniper99, Feb 7, 2023
OMG HAHAA
You are a dubious source, I need someone more credible
Do you swear on your life?
no, I just remembered I forgot to block you from before so I really don't care if you get this right or not
what
he'll swear on YOUR life 🙂
ðŸ˜
why dont u just test it
they have a duration which ticks. if they are offline, it will not tick
if a duration is for 500 ticks, thats online ticks
"make me a test someone ?
drink potion speed 5m inut
and leave the server
and see if potion was removed on join again "
🙂
what
basically staff slavery
he said ""make me a test someone ?
drink potion speed 5m inut
and leave the server
and see if potion was removed on join again ""
yea
what the fuck is this
Quick question:
Is it normal that hiding default item attributes doesn't work?
Potions do not tick when the player leaves
you have to change the default attribute value
Bruh
meta.setAttributeModifiers(this.item.getType().getDefaultAttributeModifiers());
just do that
if oyu want defaults
Does setting it to null or an empty map work?
For guis icons
Nice
You used to be able to hide them with the flag
But I think Mojang mucked that up with item components
How to teleport player to "safe" place in the end and in the nether?
is the setting clientside
or can iforce them to hide their recipe book menu
@sullen marlin This wasn't an error? https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/d5d0cefc2e70f874a74058c3c9d9c27509579b38
its confusing asf but afaik
getRepairCost -> getRepairCost
getRepairCostAmount - getRepairItemCost
the costAmount is the item cost
@river oracle the original method didn't exist, can you open a PR with the right one? or just let me know what it actually should be
getRepairItemCountCost ?
@young knoll I'm not sure how much you can comment given your circumstances on knowing what paper does but I did a implementation
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/1047/overview
Marked as draft since I'm still thinking about adding list methods for ItemStacks
gotta draft up MenuType now
pyramid of abstraction:
this.enchantmentTypeManager = new IdentifiableRegistryConfigurableObjectManager<>(
new MapRegistry<>(),
new IdentifiableContainerConfigurableFactory<>(
new EnchantmentTypeIdentifiableContainerBuilder(
new SimpleEnchantmentTypeBuilderFactory(
new EnchantmentCostConfigurableFactory(new SimpleEnchantmentCostBuilderFactory()),
new ItemTypeConfigurableFactory(factory)
)
)
)
);
looks bad but works as intended lol
my main purpose of this thick layers of abstraction is to build a base for my mod to be cross compatible between neoforged and fabric
this thicc abstraction allows me to register enchantments in intermediary enchantment registry classes:
fabric version hook:
handler.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntrySet().forEach(entry -> {
net.minecraft.enchantment.Enchantment enchantment = entry.getValue();
net.minecraft.enchantment.Enchantment.Definition definition = enchantment.definition();
this.enchantmentTypeManager.register(enchantmentType -> enchantmentType
.setIdentifier(entry.getKey().getValue().toString())
.setMinLevel(enchantment.getMinLevel())
.setMaxLevel(enchantment.getMaxLevel())
.setMinCost(cost -> cost
.setBaseCost(definition.minCost().base())
.setPerLevelCost(definition.minCost().perLevelAboveFirst())
)
.setMaxCost(cost -> cost
.setBaseCost(definition.maxCost().base())
.setPerLevelCost(definition.maxCost().perLevelAboveFirst())
)
.setWeight(enchantment.getWeight())
);
});
that way i dont need to create specific objects and the intermemediary classes will do the job for the hook, due to how every factory method is platform-aware (it gets the information about brand of the server, version, etc, so it registers it as it should properly according to the loader and version of choice
is this when players first join a server and are given a spawn location?
Maybe it's to check if the location is "safe" to spawn?
i was guessing the same, checking if its underwater / in caves etc
@sullen marlin i want to make a proxy repository in china, but i found something wrong with the spigot nexus repository that i couldn't pull artifacts in my proxy
for example
in the repository 'snapshots' i found the org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml, its content-type should have been 'application/xml', but it's 'org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml'
only the versions after '1.20.4' are correct
can't you compile them yourself
sorry I really don't know what to do about that
it shouldn't affect your ability to proxy
What's the best way to stop hostile mobs from spawning in a certain radius?
I thought about despawning them immediately after they spawn or cancelling the spawn event, but I've found those two to be very laggy on the server
It shouldn't be very laggy, how specifically were you doing it
how do i add placeholder API support for my plugin?
ty
Okay how do yall do config file handling - and by that I mean examples
looking into validation and something that isnt stupidly complex
There is an exception org.bukkit.configuration.InvalidConfigurationException which can check the validity of your Yaml
that will only check for syntax errors, and not match the types
What type of validation are u expecting
If someone put string into your config and u call getLong, class cast exception will be thrown or smth
^
If I change the biome of a block, will the weather change with the temperature?
Yes
wdym
that the potion time does not count, that is, it remains the same time when entering?
bukkit have any method to play sound for all?
https://paste.md-5.net/uwiwurudax.cpp
I didn't know you could do that haha
https://paste.md-5.net/holixoketa.cpp Would it be problematic to call globalService.update(globalUser) after updating the time? This data update would probably still be from another thread of the runnable because the database API is asynchronous
What is global service?
I dont see it mentioned anywhere
Also you need to re think your class names, having 3 User classes which clash in the same project is just bad naming
4 actually
to update the cache and db lol
Hi guys, i know i should not ask that, but is it normal to wait a month for a premium plugin approval? Last time i had to wait just a few days
theres a lot of variables to it, but no it's not normal
they're probs just really backed up
is there anything I can do?
i doubt it
Is there a chance they missed it? Could I try to re-upload it?
They can see pending requests. If you're really adamant about it, email them
but don't re-upload
Hi guys, how to report a bug?
PortalCreateEvent#getEntity always returns null on a spigot server, with same spigot plugin I made on a paper server it works as it is supposed to
I understand, thanks for the support, could you tell me where I can write?
?support
?jira
thank you very much
player.spigot().sendMessage(new ComponentBuilder().append("test").event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "say test")).create());
why does it never run said command when clicking "test"?
Each time I try to click test it doesn't do anything
minecraft:say?
this is gonna sound stupid but you forgot the "/"
istg sometimes it needs that sometimes not
oh nvm I read the docs wrong
also please make a newline after each builder call thingy
commands have the same permission level as a command block instead of using the player's permission level, are not restricted by chat length limits, and do not need to be prefixed with a "/" slash.
yeah I wrote it in disc
Its possible it could be a BungeeChat bug though I'd try it anyways
It 100% works if I do it without a builder
same exact things, just making new components myself
does hover work with the builder?
yep
the only reason players have to use slash is because you dont have to use say when you want to say something
yeah, I am aware
a few specific methods require you to put a / in front though
at least that's how it used to work a few years back
use adventure /s
even if I wanted to use the most opinionated TEXT api that there is, I'd rather first figure out why you can't click stuff ðŸ˜
OH HELL NAH JUDGE TWEAKIN
gg
Im gonna be honest I think I never used bungee chat before lol
Today's challenge
say Hi
In the paper discord
Without getting banned
what if you are already banned?
Wait you’re banned?
Today's Challenge
Go out for a walk.
Ignore paper.
dunno, might be enginehub or paper
How lmao
not necessarily hard
I got banned for asking "hey what's sugarcane"
what 💀
I swear to the heavens above
gettin gbanned in spigot seems to be the hardest thing ever
fr
I WILL ULTRAKILL YOU, YOU INSIGNIFICANT FU-
it doesn't click.
it don't work
nothin
Did they think you didn’t give good advice or smthing lmao
I’ve never been in those discords before
nah they like WE DO THE HELPING HERE
i got banned from an mc event testing server for finding a critical bug 😂
wouldve banned you too
are you fucking crazy
wha
11 DIGITS
Try it with the slash
thats wild
I know docs say it’s optional
I have REALLY good sequential memory, apparently
But just try it with a slash
I can remember like, what, 25 arbitrary digits in a row ðŸ˜
doesn't sound that good but whatev
I never trained it
If it doesn’t work with slash then idk what could be causing it
finally sent it
Does it send the player the text at least
yeah
So the issue is that it just doesn’t run the command
Did it work
testing rn had to brb
yes
hi, i'm having problem developing it, (i made an example in command blocks)
mainly the part of rotating the block display
lol
is there a way to add a listener with just knowing the event class i want to listen to?
(i want to add an uknown amount of listener of uknown event types on runtime)
declaration: package: org.bukkit.plugin, interface: PluginManager
uh what do i need to pass as Listener or EventExecutor?
you can pass anything as listener, it's actually not really needed
you can just do new Listener() { } for the listener
usually the EventExecutor calls the Listener's method but you can also do the event logic in the EventExecutor directly
e.g. like this
Bukkit.getPluginManager().registerEvent(PlayerJoinEvent.class, new Listener() { }, EventPriority.NORMAL, (listener, event) -> {
// Event logic
}, myPlugin);
thanks
does File#listFiles use cached files?
after updating my directory, it still show the same files
nvm it doesnt
What would be the best way to go about clearing the rewarded_players tag in Vaults' NBT data?
I'm hoping there's some magical library or some niche I'm missing so I don't have to resort to NMS
NMS
sad times
what is the best way to restrict any actions made by a player until countdown is done
which event
Probably the events yoh use related to interacting with things
PlayerInteractEvent PlayerMoveEvent
do i just cancel them?
if having cooldown, yes
map uuid to a timestamp, check on event if its past the timestamp, if not cancel, if so remove.
no need for a timer
well timer is needed for a duel plugin
Yo guys
anyways thanks for the help
I think I found a bug
yet just using a timestamp for the cooldown would be the better choice
?jira
not rlly if u have to show timer to the player (countdown)
then you just convert the timestamp 🤔
but you do you
I need to access with spigot credentials or I need to make a new profile?
real
no like i mean it shows message like 5, 4, 3, 2, 1 smth like that
?
new profile
https://paste.md-5.net/copoqovusu.cs
this takes like 3 seconds to draw particles, even if it's a tiny image. is it an issue with spawning the particles or the other stuff?
there are about 20000 pixels in the small image
honestly one thing I would change is cloning the location every time and just clone it once before the for loop, then just using .add and .subtract when you're done
wouldn't that be heavier on the server?
actually lighter, because when you clone the location it's creating/instantiating a new object every time
whereas when you .add or .subtract all it's doing is adding or subtracting to a number
What is the imagedata .setSize doing?
protected void setSize(int percentage) {
int newWidth = (width * percentage) / 100;
int newHeight = (height * percentage) / 100;
Pixel[] newPixels = new Pixel[pixels.length];
int newSize = 0;
for (Pixel pixel : pixels) {
if (pixel != null) {
int newX = (pixel.x() * percentage) / 100;
int newY = (pixel.y() * percentage) / 100;
newPixels[newSize++] = new Pixel(newX, newY, pixel.red(), pixel.green(), pixel.blue(), pixel.alpha());
}
}
this.pixels = Arrays.copyOf(newPixels, newSize);
this.width = newWidth;
this.height = newHeight;
}```
it's not the reason, since it still does it at 100 size
ah okay
honestly just try it with that one change and see if it improved the performance
it barely did anything
honestly it's probably to do with how many packets it has to send to the client
it's 20000 particles right?
i've seen some plugins like this one use packets to send the particles and i was confused on why they did that
i can take a look to see hwo they do it
this is how they render it in the loop:
renderer.setParticleParam(new ParticleParamRedstone(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 4.0f));
renderer.render(player);```
this is the "render" method
```java
@Override
public void render(Player player) {
PacketPlayOutWorldParticles particles =
new PacketPlayOutWorldParticles(particleParam, far, location.getX(), location.getY(), location.getZ(),
size.getX(), size.getY(), size.getZ(), speed, amount);
//Gets the NMS player representation and sends the particle packet.
((CraftPlayer)player).getHandle().playerConnection.sendPacket(particles);
}```
honestly idk how that makes a difference
Is it okay to add listeners on runtime?
okay yea, performant, no
Why isnt it performant?
for example?
when registering a listener, from what I remember, it uses reflection to get the methods
all methods which have annotation
Disgusting
and this is why I created my own event system 😂
fuck reflection
uses the system with reflection
Yeah the whole baking process, while it makes it more performant, is a bit gross :p
Considered using method handles once upon a time
wouldve been a good choice
I mean mine might use a bit... but lmaooo
it's just getters rather than invokes though so...
> insert bounds checking here <
Well I suppose we make it work eh?
I need to look over some custom event examples, I always have a hard time figuring when I actually need to invoke it
My only practice was with my seasons project, and tbf it was more or less a copy / paste from stephen kings udemy on custom events
public class PlayerTemperatureChangeEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final Player player;
private final double temperature;
public PlayerTemperatureChangeEvent(Player player, double temperature) {
this.player = player;
this.temperature = temperature;
}
public Player getPlayer() {
return player;
}
public double getTemperature() {
return temperature;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList(){
return HANDLERS;
}
}```
I mean the thing is with this, all my interfaces should ONLY extend EventListener
why not a PlayerEvent
id probably write an annotation processor at that point
declaration: package: org.bukkit.event.player, class: PlayerEvent
public class PlayerTemperatureChangeEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final double temperature;
public PlayerTemperatureChangeEvent(Player player, double temperature) {
super(player);
this.temperature = temperature;
}
public double getTemperature() {
return temperature;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList(){
return HANDLERS;
}
}
So whats the difference between extending event / PlayerEvent? I see I get a default getPlayer method, anything else particularly useful?
Hello, when I do:
player.setGameMode(GameMode.SPECTATOR);
player.teleport(targetPlayer);
player.setSpectatorTarget(targetPlayer);
The problem is if I do that and the targetPlayer is in another world the client player doesn't seem to be spectating them. (if I do getSpectatorTarget() I do get the targetPlayer so it's as if only the client didn't update properly).
This works perfectly when the player is in the same world with the targetPlayer.
Does anyone know how could I get around this problem?
it just shows more definition of the event type
Kinda figured
Guard clause to verify both players are in the same world perhaps?
Does it need to work across multiple worlds?
Yeah
I tried adding a delay of 10 ticks and it works for me when I didn't have any other world managing plugins but when I tried on multiverse it didn't work even if I gave it a 60 ticks delay.
Is multiverse open source? And does it have an api? If so you could probably just use their world navigation methods
I'm not too sure on how they handle moving players world -> world
Added tick delay to what part of the code?
You should be able to teleport the player and then delay the spectating by a tick or so.
If that fails, you'll likely have to use one of the Teleport or WorldChange events.
teleportation 60 ticks then setting the spectating player
Teleport should be instant.
Spectating should have a delay.
I don't get any errors since it seems like the server does what it's supposed to but the client doesn't update properly.
Yeah I do teleport then I wait 60 ticks then I set the spectating player
Anyone know why the downloads for the pom and jar for the protoclize API don't work? https://mvnrepository.com/artifact/dev.simplix/protocolize-api/2.4.0
Just use 2.4.1
any of you happen to have experience w overwriting vanilla items? Essentially I have custom stats on armour pieces hence why I need to overwrite them, which in itself works, so every item extends from Item() which then has a few methods, custommodeldata for id, name for namespace key, displayname, lore etc, either way the relevant part is
abstract fun recipe(): Array<Array<String>>
abstract fun item(): Material
whichll determine the recipe and the item the recipe returns - this works in the regard that the items will be registered with the recipe and the right material, and items are craftable, though for whatever reason if you take e.g. iron chest and leggings, that goes great - if you do the same thing w the helmet and the boots, it still tries to craft vanilla boots. I suppose it's some magic w which item registers first, but there's not really a good approach to removing the vanilla recipe either.
not using yaml
I already have type validation
event.getdrops.clear on playerdeathevent Does it make the dead player not lose their items?
No that clears all items that would have been dropped
I'm not sure if you wanna mess with the game rules, but that's an option, otherwise I'd say cache the contents of their inventory and give it back to them when they respawn
what is even your question here
How to better override vanilla recipes if I had to guess?
that
jesus i cannot spell
There is a bukkit.recipeIterator method
Could use this to remove / replace with your recipes
yeah, I did find that, but it kinda messes with the recipes too much for what i found
just wondering why it would prioritise e.g. chest and leggings but then for boots and helmet it says "nah I'm good"
You just remove the ones you want for example: iterator.remove(Material.IRON_HELMET), then add your custom recipe back Bukkit.addRecipe();
er
gamerule affects all players
You wouldnt put the material in the it.remove
What is a HolderProviderLookup and why do I need it to call loadWithComponents?
I'm aware
event.getdrops contains null itemstacks?
Put null checks in your code
no
The problem is if they die and the server crashes, they lose their items.
That's true for everything
What is your end goal here?
Prevent items from dropping when a player dies?
of beginner people
less of 4h playtime
e.drops.clear ? .-.
clear in java yes
but
They do the same thing
if i save on map
i get the items on map when he respawn
but if he not respawn?
and if quit
then youd have to cache them in a file / db and retrieve on join
playerquitevent is called before right?
I can edit the inventory if playerquitevent is called before. That way I don't need to save it to the db
The fact is if you're already caching the contents, then just save them to a file / db as mentioned then load the contents and put them back when the player joins again
i very much doubt u can modify playerinv on quit
doing it when the player enters would be a problem, the ideal would be the moment before the player leaves. that way there would be no need for db
you may have the methods ofc cuz player is part of the event but I'd imagine it's very hackery and caching it is the better option
player.spigot().respawn(); but i make this on playerdeath
playerQuitEvent has 4 methods, 2 for the chat message, and 2 for the handlers, you can't do anything but manipulate the leave message with this event
I don't know if it's possible for playerdeath to be called and not respawnevent
it is
If a player quits the server before respawning, the respawn event is not called
even with spigot.respawn? We are ignoring the crashes in between
but i execute spigot.respawn on playerquit
Thats not going to work...
eh no, playerquitevent has player
How are you going to spawn a non existent player
every playerevent has the player method sure, but this doesnt mean you can do anything but cleanup of that players data
At least on quit
maybe because respawn method is part of an already existing player instance?
also not saying that u should
No because the player is currently quitting the server
How can you repsawn a player who is closing their connection to the server?
brother but the player still exists
there is any guide for redis messaging system?
Which is where you can perform cleanup
You can't respawn a player that is in the process of quitting
Why is that so hard to understand
This does not prevent player.spigot.respawn from being executed and this method from calling the PlayerRespawnEvent brother
Idk what to tell this guy
the respawn method can simply call PlayerRespawnEvent
No it cannot
try it then
If the player is qutting the server
how you know?
Because thats basic protocol BrOtHeR
How will I try? I have to exit the game within milliseconds after dying
Becase ✨ experience✨
aka no new things are accepted
so if u try to set something on a clsoed connection
it will do absolutely nothing
nah dude kat can't code in console, he's dumb
Possibly will even error out
This fucking guy
I'd imagine u get a big fat error
fr noob
Ah, on that sentiment
just spent 15 minutes implementing vec3i, vec3d, mat2x2i, mat2x2d and their respective serializers 🙃
I dont see rad out here trying to help folks
boop
that's because i am implementing item models into kotlin
Lovely
btw Kat while what u said in regards to armour, ye sure works, though interestingly enough, it's not that mc really cares
though then again if I add an iron ingot anywhere on the recipe itll craft the helmet, I stg
registry stuff, that's where the item will take the data components from
There is a bukkit.removeRecipe method but it takes a namespacedkey so I'm not sure if you could play with that
it's not about the removal really
the removal is fine
no, you just simply can't craft the item at all although the recipe exists, and even the great crafting book tells u it exists
I'm confused then, if you can't craft it then what's the problem? Just replace it with your recipes
Or is it the custom ones that aren't crafting?
it is replaced with my recipes and it doesn't care
yeah it's great really
...Where can I get one?
like the book will tell u it's here
so you'd think cool, I'll just tell the book to fill the recipe and surely that'll do it, but oh how wrong you could be
Yeah I'm a bit confused myself, just removing / adding your own should work
I wonder whether it's cuz boots technically have 2 recipes
Send us some code and errors if any I guess
but that'd be stupid and kinda shouldn't be a reason for one of them to work
How you remove, how you add, how you are handling recipe creation
I wish there were any errors
ye sure
Add some debugs then
it has a loving amount of debugs and I know for a fact the recipe is registered with the right shape :D
Well it appears in the book so yeah
Entity, Level, MinecraftServer
have a registryAccess method
?paste just show us some code
import net.kyori.adventure.text.Component
Isn't this paper btw?
sure kyori is
I'm confused why are we mixing spigot and paper kek
Hi, I'm looking for Brazilians interested in helping with the creation of a factions server. The requirement is to be trustworthy, know how to program and have basic brain capacity to help. thanks. come dm (pv) for proposals.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
This has me stumped really at first glance I can't find anything wrong with the function
question
Anyone run into the config serialization not applying flags back to itemstacks on deserialization?
Code/Serialization text, may be overlooking something after being up for 15 hours https://paste.ee/p/7yPi3
- why tf are you using colour codes with components 🤨
- why not static import
text()
well if it was something with the function, the other items wouldn't work which is why I'm prm huh
cuz it fucks with the colour otherwise
🤨
cuz why yes
then you are doing something wrong if you need to
hi, how can I make the player's hitbox one block smaller? lower it into the ground, or are there any dependencies that can implement this? version 1.20.1
There's no direct api method, I think you'd need to use nms for this? Or some other packet lib
you may be able to fudge it using the hit event and checking the attacking player's pitch compared to the player that got hit's location
Yeah you could probably figure a way to do this with the api but I can't imagine it to be very clean
using math*
of course math isn't clean
But hey if it works it works ig
but it's cleaner than NMS
performance wise definitely not
Fair enough, but this is why I use packet events
true
calculating on every hit some abstract maths? doesnt sound very resource friendly
you do realise the game does just that.. right?
^
it's less resource intensive than sending extra packets
you have maths from the game and then on top of that you re-calculate for every hit what mc already calculated uh huh
thank god the game doesn't shit itself every time you hit someone and the math is cheap
Didn't we get methods to change the size of the player?
hmmm
there's the scale attribute yeah
it's a new attribute
Aha
fuck my internet
but you can't just change the scale in one axis
#WideBodyPlayer
a question, it's better to use PDC to save data in armor stands or it's better use a database? If I use database how can I get the exact armor stand I click?
Can I change pdc data?
?pdc
ie: pdc.set(someNamespacedKey, PersistentDataType.SomeType, insert some type of data here)
yes, but to change the data I have to delete the pdc and add it again?
hello, how do i disable git plugin to automatically add the the files to git staging area without doing manually the use of the command git add. I cant find how to disable it, thanks!!
ith you can just override the same key / data type
it depends on what you’re doing lol
Take that with a grain of salt I don't actually remember
if you need to ever query data then the database is vastly superior because there’s no real way to query data from the PDC of all entities
(not to mention how slow it would be)
That too
given the context ith he just needs to verify it's his "custom armorstand"
declaration: package: org.bukkit.persistence, interface: PersistentDataContainer
An upgrade system of an Amor stand (custom minigame)
"This method will override any existing value the PersistentDataHolder may have stored under the provided key."
so you’re just storing an int corresponding to its level?
PDC 100%
pdc
also for a minigamr since state is not persistent you can use memory too
db would be better with a larger set of data being like player stats for example
I’m guessing there’s only like 4 or so of these so I’d probably do memory especially if there’s already a type that it would go under suitably like a Team with a armoryUpgradeLevel field
Set<Door> doors = doorRepository.findAll();
this.doors = doors == null ? new HashSet<>() : doors;
Should I do this when the plugin turns on and associate all the doors placed in the game in the cache, or simply create a get method that takes from the cache and if this value is null, take it from the database.? What would be the best option? But if for some reason the door is placed on the ground (Minecraft door) and is not in the cache or in the database and someone keeps spamming this door, it will always be taking it from the database (perhaps a heavy operation even though it is asynchronous to the database)
iirc writing to and from a PDC is memory based until the world is saved so it’s effectively the same just with more steps (and less efficient)
What would you do? Maybe sacrifice some memory by keeping more than 5000 ports in the cache, for example, to save processing? It shouldn't use up much memory, right? I think it will use up a few MB of memory.
Well I'd think you'd load your data / cache it to memory whenever needed, that being said onEnable sounds fine to load whatever you need from the db
for me?
show your Door type
im not using pdc because im on 1.8
no I even sent that message before you
breh
like how could that have been a response LOL
k, thanks
mate why in the world are you storing the owner as a String of its name
^
instead of a UUID
this seems like a Lockette plugin
you can create a really complex caching system that caches the most used doors and then all the ones attempted to be loaded during the plugins enabled time
or you can just cache them all on startup
I'd just cache them all
I’d just cache them all too, until you hyper optimize memory usage you won’t really notice it
but it is very difficult for what I said to happen xd, it would only be in the database without having the door in the world if I placed the door, gave the auto-save (I believe that the auto-save is in the thread itself, if so then this is impossible to happen) and then the line that saves the door in the database is not executed (a matter of milliseconds). but this would be impossible if the auto-save is in the thread itself, but if it is asynchronous this is possible but very unlikely. Could you tell me if the auto-save is asynchronous or synchronous?
Uh
what does auto save have anything to do with this though
legacy code
but this is no problem
my server is cracked
lovely kek
w/e it’s not a problem with offline mode
world data coherence with my data brother
probably because it's 1.8
1.8 has uuid
1.8 have uuid
oh
I get that but are we assuming that the door will disappear before auto save if a crash and now the database has an entry that isn’t true?
then just use that
it’s cracked so the UUID is equally irrelevant
worldsave is on minecraft thread?
Every operation happens on some thread
in spigot, to my knowledge, all world operations in 1.8 are on the main thread
In paper even in 1.8 I believe the same
All world operations (.) are done on the main thread
it’s just chunk loading in paper that’s async, pretty sure writes are sync but I’m not positive
thats because minecraft is single threaded right? So that make everything running in only 1 thread
minecraft is not single threaded
that wasn't a thing in 1.8 however
Right
As for Minecraft being single threaded, the vanilla server implementation is indeed single threaded is it not?
no
imagine: onblockplace event:
door = new ...;
service.update(door); (save on db).
player put a door and auto-save is called between this 2 lines. the db not has an entry but the world have the door
it’s sync it won’t happen between the two processes
This is only possible if the world's auto-save is asynchronous, which I don't know if it is
just said it’s not
nothing in 1.8 is async, I don’t even think player chat is yet right?
btw anyone have any ideas on this?
so, keeping all doors in the cache would not be a good alternative
exists asyncplayerchat on 1.8
I thought there were two, main thread and the networking thread?
the only things that run on separate threads in 1.8 are probably just chat, networking and auth, lol
why not keep all doors in cache and then a separate cache of database modifications then attach to the auto save operation and write it to the database post auto save?
indeed the case I messed up
because there is no case where there would be a port in the game and not in the DB to prevent malicious people from spamming the DB
yep, from what i know yes. Networking is taken by Netty, which internally use some threads, i know one is for workers and another for another process, not really sure its name
I didn't understand why there was so much complexity
If you’re so worried about inconsistencies then you need to do the database operations after it has been written to the world
so you can either engineer a method to write the door to the region file pre-save or write to the database post-save
there’s not many options lol
also remember this is minecraft, you are not doing a business
