#help-development
1 messages · Page 296 of 1
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
that
@last temple I don't wanna be spoon fed a plugin.
I wanna learn how to make one my self.
With out the help on starting from a template.
The issue is I can't get clear answers on how to begin that.
I don't even know what tools I need.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
How about they patch the stupid display controller first to avoid having to plug in external monitors (dell especially) three times until it switches from YPbPr to RGB so 4K@60Hz actually works without crashing the monitor every few seconds. Far more interested in that than in some edge-case security fixes.
huh I don't have that problem
Yeah, it's some rare thing, but when you got it, it really annoys the hell out of you.
I got 3 displays with 2560x1440, two over usb-c and one over hdmi
that sucks
I already modified the com.apple.windowserver.displays.plist to force RGB-Mode, but it still doesn't use RGB the first time I plug it in. If you google this issue, there's like a ton of people complaining and there are multiple hacks which all don't work 100%, and apple does nothing about it. Nothing, just nothing.
presumably not an m1 since they dont support for than 1 display lmao
16" is big
yeah I dont need it to carry it around, it's just so I can do stuff from the bed
wdym "using the original .jar"?
if the jar you wanna install is already maven project, then you dont need this
Yep, would never want to own 16", even tho I love the screen. I'm happy that I went for 14", perfect size for the bed and for carrying around.
you only need "install-file" to install .jar files that are NOT a maven project
you can just run mvn install from inside your project
and then as dependency, use the same group id and artifact for the dependency as the other project has in its pom
you dont need systempath
that's what mvn install is for
yes
and in the other project, you just declare it with scope compile
maven automatically gets the file, there's no need to put it anywhere
you dont have maven intsalled
just run it from within intellij
intellij brings its own copy of maven
Noob question: Is there some sort of way to have an unsigned byte in Java? Or do I have to use an integer, even though my value range is [0;255]?
you can store it is a byte, but any manilpulation has to be an as integer
byte & 0xFF to get the unsigned int representation
Hmm, okay, thanks! :). So I have to reinterpret it before using it, with the overhead of conversion, xDD. Actually, as it has been about semantics and not about memory usage, I think I'm just going to use an integer to avoid all of that.
Yeah. Okay. Way to brag
i got the 15 inch laptop or smth
uhhh

How did you add the dependency? It has to be marked up like any other dependency, there's no differentiation. Check that your specified version is equivalent to the version your lib's POM specifies.
Noooo, we're in 2023, stuff's live by now, xD:
Did you check the versions? What does your lib's POM specify, what did you specify in the dependency entry?
Is there any way to access an OfflinePlayer's inventory ?
Apart from storing a copy if it in a file or something
That's why I usually remove the snapshot suffix on my projects
There sure is, the player inventory is stored as NBT data on the server somewhere (the world? or one directory higher?). The question is whether or not we can elegantly modify it through the bukkit API, which I somewhat doubt.
I believe it is stored under world/playerdata/UUID.dat
Yep, you're right. PowerNBT seems to implement this functionality, maybe you can make it work for your version and for what you're trying to achieve: https://www.spigotmc.org/resources/powernbt.9098/
Seems like there sadly isn't any API available to manipulate this kind of data.
ah
https://www.spigotmc.org/resources/nbt-api.7939/
This API seems to be pretty cross-version capable, you could just access the file yourself and modify it using the lib's wrappers.
I've never really messed around with files/getting NBT data from player .dat files
I'll try to get something working though
It can be tricky if you're new to it, yes. While it would be a cool learning experience for you, you can always just call for help when you're stuck on a dead end and I'll try to implement a basic inventory modifier on top of this library for you. I have no idea yet how they're serializing inventories, but I bet it's just an array of items. And there's an NBTItem wrapper in this library, so you just have to tie a few loose ends together.
I'm just trying to get a copy of an offline player's inventory so I can display it in an invsee-like fashion on command
I can't getInventory on an OfflinePlayer
And that should be writable too, I guess, right?
no, just viewable
but I'm guessing if I can view it, writing to it should not be that much harder
Well, it's 50% more work, as wirting and reading will be pretty symmetrical.
i have an easy fix for you, check how plug woman adds redlib
Don't shade other plugins in if they're already on the server
md_5 in which class does the commands.yml stuff happen?
Idk
I'm trying to do a plugin similar to commands.yml for bungee and I wondered how it parses these $1- arguments
unless it actually does stuff for the server why is it a plugin not a lib
import spigot
import *.*.*.*;gg ez
check how jefflib works
what would that even be in, spigot, bukkit, craftbukkit
bukkit im guessing
so i dont think commands.yml is handled in a file that is descriptive
that is unlikely
cant you check your commi t history to see what you changed?
no git no mercy
sodds law
there is never a need for system path imo
imagine your library has group id me.mfnalex and artifact mylib and version 1.0. Now you mvn install that.
then in your other plugin, you just do this:
<dependency>
<groupId>me.mfnalex</groupId>
<artifactId>mylib</artifactId>
<version>1.0</version>
<scope>compile</scope>
do you relocate
Hi
ah I see, so its a standalone plugin
in that case, use <scope>provided
not compile
you dont want to sahde it then
is the plugin on the server too?
and your plugins must ofc depend: [MyLib]
right now your getInstance() always returns null because the constructor / onEnable never run
since you are using the shaded classes instead of the ones provided by the library plugin
Because there is no Jägermeister in London
London is not a nice place these days
that's sold in literally every place
you can get jägermeister even in zimbabwe
Have not seen it in like 10 pubs now
check out a normal supermarket
your not in the right place then
Bro im literally in the exact center of london lmo
fuck london
wrong place
last time I was in london I accidentally drank water from the thames lol
why
Alex send me some
Dude every pub closing at 11pm I cannot take this anymore
its probably full of sewage
We played darts and got sent out at 11pm =(
we were walking along the thames at night, then suddenly we spotted a wine bottle. it looked to be full. turned out it was just disgusting tasting water. and since we were right next to the thames I assumed someone filled it up with water from it
london is weird
yikes
why would you just drin kit
I was young and drunk and innocent
fair
i was 16 or so
ICANT alex being in london at christmas time and not watching darts
darts is so fucking shit
Then you've never been in a hall with 10k people having the best mood ever
Watching darts
it's fun to play
Singing songs together
common football stadium
Literally biggest cap I have ever heard
your the cap here
No
I experienced both things live in the stadium, and I can say that its literally 1000x better mood
@tender shard Thanks for yesterday, it worked, i set a block somewhere in the world as the enchanting table and the openEnchanting() method worked...
great! np
you could maybe try this:
instead of setting a block, simply do sendBlockChange(...) to the player
so only this one client things there's an enchanting table instead of actually using a real one
it MIGHT work, or it might not work, lol
oh it could work 🤔
e.g. sth like this:
player.sendBlockChange(myLocation, Material.ENCHANTING_TABLE.createBlockData());
player.openEnchanting(myLocation, true);
Depends on if its handled clientside or not huh
Yeah
if it works that would be great
i'll try and get back to you
alrighty
problem with enchanting tables is they rely on the books around them for their function
just another question, is it possible to change the enchanting options?
the offers?
if theyre not in the world then thats a problem
yes
is there any way with spigot api to get particles to stick around
or do I have to use NMS
declaration: package: org.bukkit.event.enchantment, class: PrepareItemEnchantEvent
oh nice I have been using Player#spawnParticle 🤔 clearly wrong spot then
I guess I'll look elsewhere
particles suck so hard
Yes
they are so annoying
youll find that they probably just have to be repeated on a timer
yeah just do a while loop with Thread.sleep on the main thread /scnr
okay thanks
lmao
will do
that does not sound performant at all
If you have 1k particles
yes
great, np 🙂
compile = "maven includes it in your .jar"
provided = "maven lets you use the methods and classes and stuff, but the server itself has to already have those classes from somewhere"
and a few days ago I learnt that maven's compile is gradle's "api" and maven's provided is gradle's "apiCompileOnly" lol
and that gradle needs the "java-library" plugin for these scopes to exist
Tf
is api a kotlin thing
ive never used or seen api in gradle
compileOnly or implementation
everyone in gradle uses "implementation" and "compileOnly" while the correct one would actually be "api" and "apiCompileOnly" in most cases
I still prefer using maven over gradle
me too, I'm just using gradle because I wanna know how to use both
right now I try to use gradle as much as possible, except if I have to shade any dependnencies, because I hate the shadow plugin
then you haven't seen The Matrix
my server keeps freezing after I implemented this any ideas?
in all seriousness though can't find all the Particle api stuff lol I seriously only found the Particle class and spawnParticle method for player which don't really allow what I was looking for.
Hello guys, im trying to open a gui by clicking on a entity, but the gui is in another class, can you tell me how to "import" the gui in the other class?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I have an idea just hanging in my mind randomly right now: for a huge minecraft server private plugin, would it be a smart idea to have heavy data in a database and IF there is a lot of memory available and the server is currently not on high load, load data from the persistant database to a high-performance in-memory database to spare some cpu-power for peak-times?
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Hello guys, im trying to open a gui by clicking on a entity, but the gui is in another class, can you tell me how to "import" the gui in the other class?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
bro you asked the same question 2 minutes ago
I "didn't help"
https://blog.jeff-media.com/getting-your-main-classes-instance-in-another-class/ this blog post explains on how to access your main class from somewhere else. it's not exactly what you're looking for, unless your GUI is in the main class
di article is also perfectly good imho
oph havent seen that, I only saw that you sent the learnjava one
but seriously just read one lmao
they'll ask again in 2 minutes anyway
they are there so no one has to type everything out all the time
since when is this a thing lol
the gif wth
add a ! at the end
I asked because no one responded
at least half a year
oh fuck I added that command, I remember now
lol
Any thoughts?
no, you got sent 6 links
all equally as useful imho
I cant know that links are for me if you dont say that
yeah okay but now you know
Because for complex mc server systems, I usually have RAM free on mass but no CPU power
if they werent for you they would say probably
Yes thanks
the first one is probably the most useful one
lmfao alex we have been afk on the lobby for ages lol
but so far I only made an Alias class and a Command class
does anyone have links to the particle api or something I found the Particle class is that all there is?
you can build a new one
get wakatime
I thought about maybe a forest
it tracks coding time
e.g. with worledit, create some trees that are the "borders" of the lobby
that'd be my idea but do whatever you like
i was gonna build some floating island maybe
nms experts
lies
yeah wait Ill give you op quickly
my client wants me to create something using fake entities
already got it
ah ok
can I simply create a runnable of 1 tick and call the Entity#tick?
to emulate the tick
doesnt the server do that on its own?
fake entities
the entity will not be added in the world
ah ok
I am not sure if tick() will work if the level field isn't set
so try it out
do you think world edit visulizer needs updating
can't hurt, then it stops complaining in the logs
fair
sooo you update WESV, and build a spawn, meanwhile I try to finish the lobby plugin asap
I'll just make it very basic and add the complicated stuff later
yowza
an episode for each of the shows i watch has came out
so ill just watch these and build
alrihty :3
huh
shouldnt intelliJ complain about using "final" on enums?
because enums are final anyway?
it complained when I added the static keyword because enums are also always static inner classes
why does it not complain about final?
you know who does though
sonar lint
all i'ma say vscode
this is hard
another class could extend Command and then override the CommandSenderType
maybe that's why "final" might be useful here
ah now it complains. it didnt earlier because the class wasn't finished yet
I am trying to setup remapping in my Intellij, but I get an error "Unsupported class file major version 63". Does anyone know how to fix this? Here is my pom.xml: https://paste.md-5.net/omazutunew.xml Here is the error: https://paste.md-5.net/anayeciput.rb
Hmmm a Command API, probably I should do something like that for my plugins too lol
set your JDK to java 17 or newer
File -> Project Structure -> SDK
must be at least java 17
?nms
Did anything important happen on Java Update 18?
ah that doesnt tell that yet. gotta add it
It is currently set to openjdk-19
upgrade your maven-shade-plugin to at least 3.3.0
latest version is 3.4.1, so just use that
then it should work
and set the version of the specialsource plugin to 1.2.2
For a custom player head, can't I just upload my own textures and use them as heads?
they have to be uploaded to official mojang servers once
e.g. change your own skin to that head
then you can obtain the URL
after that you can change your skin again
And change it back?
yes
So I can just upload 1000 heads and use them forever?
IIRC, yes
Thats weird but nice lol
yeah the reason is that the client only downlods files from textures.mojang.com or sth
one might think that it would work use the base64 strings, but they also just encode the URL
Well but if I get the UUID, it'll get the newest skin of the player?
Not an older texture
yes
well
yes
lol
Well
But how do I use old textures then
Never worked with heads, im about to tho
you upload skin1. then you obtain a PlayerProfile and can get the URL from that. Save it somewhere.
you upload skin2. get the URL again, it will be different this time
So I just get a Map with Heads and URLs to Heads
not sure what you mean
thx :3
Because it has interesting topics
I've just written everything down there for stuff where I couldn't find a proper explanation for, myself
Yeah
there's still about 25 unfinished posts but I never found time to finish them
Sometimes its hard to find specific topics in plugin dev
yeah especially for newer stuff
Im still gonna cry about everything being clientsided
Ouch, getting data for the playermodel serverside hurts
Im on getting hit bodyparts of bullets and its the hardest pain ever
yeah I still miss the "middle-click on empty slots" click type
Wait that does not work anymore?
not on 1.18+ :<
the fact that riptide is fully client side is also very nice
/:
if ur using essentials ppl can just set playerweather to storm and use it lmfao
I wanted to use that in a plugin
Lol
woulnt it give cheats an easy way to fly as well maybe?
they could probably make it work even without storm
yea very odd imo
yeah ...
it sucks
I get a new ticket every other day about middle click not working anymore in chestsort
and I always just have to say "well sorry I cannot do anything about that" D:
Oh no
alex if your here can you check how my island looks
I have always been a guy trying to dribble and workaround and abuse systems to get crazy stuff happening
in 5 minutes or so
And its getting ruined more and more
And also, f*ck microsoft for making mc require microsoft garbage accounts
Now every second day I can only play minecraft online with VPN somehow
And support does not help at all
Okay, I think I updated the maven shade plugin to version 3.4.1 and the specialsource plugin to 1.2.4 . However, I still get the unsupported class file error. Is there something wrong with my pom xml? https://paste.md-5.net/tufazaharo.xml
do you get that error while running your plugin, or while compiling?
I get the error while compiling with "install"
bungee's config api sucks big time. All this is needed just to recreate the saveDefaultConfig() and getConfig() methods of spigot:
please press control twice quickly, then enter mvn clean package -X and send the full output
can you guys see this picture? for me it doesnt load although it was me who sent it lol
I guess ss or at least the maven plugin doesn't support java 19
Is there any reason you need java 19 in particular, best practice would be java 17 which is lts and the reason used by mc
can you people see the pictures I sent above? If yes, my discord is broken. if not, discord itself is broken
https://paste.md-5.net/riwikunevu.rb Short error is "invalid target release: 1.19"
You can make it work by overriding the SS and/or ASM version used by ss-maven
oooh wait
you used java version "1.19"
it should be "19"
but yeah usually you wanna go for "17"
as md said
And yes that too
Oh, there is no particular reason I am using Java 19. I just thought bigger number means better.
if you set it to 19, it will only run on 19 and later
set it to 17. you can leave your sdk at 19 though
java 19 can also compile for java 17
so yeah, sdk can be anything >= 17, and <java.version> should be 17
np!
Now to see if the code works XD
well that's your problem lol 😛
Nope its bugged
What do you guys use for brainstorming and notes?
I usually use kanban-style things
I am literally using an empty discord self-group lol. Because I always have discord open
for my todo lists and stuff I use wekan, for example for angelchest -> https://todo.jeff-media.com/b/YwRCfv5bf3THiqdNr/angelchest
you can also have different "swimlanes", e.g. here -> https://todo.jeff-media.com/b/AHcurWrkJfvnzaW9c/general
it has a ton of features and you can also create custom fields and stuff
(wanted to send a screenshot but its still not working lol)
Thats interesting
I usually just write 1 ToDo for 1 project. I just write like -Add CommandHandler -Fix Bug xy -Add Function to...
Im more a guy to do one task at a time if you know what I mean, I want to have function xy done before I start working on the next one
Im literally the definition of "out of the box", just doing what I feel like without plans sometimes
@last sleet
Here's a simple implementation based on the NBT library I've sent you previously (https://github.com/tr7zw/Item-NBT-API): https://paste.md-5.net/xepihafefo.java
And this would be a small use-example: https://paste.md-5.net/venaseqigu.java
I mapped the slots in a way that the first row holds the armor as well as the shield, while the following rows represent the inventory contents as the holder sees them in their inventory. If you got any questions, feel free to ask.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Same here, all of my plans are stored in my head, rather than in any apps or todo trackers. If there's anything more complex I'm currently working on, I just add //TODO or //FIXME to the codebase. This is not ideal for huge projects, but I'm almost never working on anything of that size anyways.
If I want to note a ToDo because I really don't want to forget something for a complex system, I just write //TODO and note that down
So whenever I get up the next day I know "ahh this is what I gotta do next"
I usually ping my TODO Manager role and make them add it to the wekan board
But mostly if you write //TODO you already would have it in your head the next time you open your project
sure, but I got over 20 plugins on spigot and with wekan I don't forget stuff about projects I dont open very often
If you write something like that down, its important enough to get stuck in the head
I HAVE to finish a function at a day. I cannot have any problems left, or otherwise I won't sleep lol
I lose all my motivation whenever I cannot fix a bug
And wake up again
I'm invested into my projects to a level where I literally cannot forget almost anything, xD. I still remember what I did months or partially even years ago, and can locate it on my system in seconds, if I need to copy or lookup a implementation I did in the past. Same with things I need to get done.
Same
If I finish a function or bug, I can think: "Ah yes I feel good about succeeding to complete this and now I can wake up in peace and start making something new"
It's funny how we created an abstract way of notating programs, which can - if you spend enough time on them - really grow onto your heart big time.
Hahaha, I feel that one, xD. Just getting stuff done and not ending the day with any open bugs or issues is the best feeling ever.
I am too investigated in my personal projects and problems
Cannot fall asleep without thinking about my code or problems after coding
And I gotta say my code is the biggest mess of all time without "clean" formatting and commentation, but this way I just feel myself and know better what exactly this does and what I need to do next
ah screenshots work again
Nop
wtf
They don't
in general they work
tf
If you feel well around that structure, that's all that matters. Code is a form of art, and as long as you're not forced to work together with people who don't appreciate your artstyle, you're all good, :).
Yeah
beautiful
Im addicted to coding, im in vacation but want to code on my personal project lmao
Looks almost like a skypvp island creation process, lol
Any thoughts now?
is there no boolean persistent data type?
I still think it may be a good thing for my plugin
store a bye
i know
no
there's a million ways to do it
more pdc prob adds it
but why does it not exist
no clue
thats like nearly comedical xd
More PDC Types is probably one of the most useful things I've ever written, because it allows to use basically anything as PDC type, e.g. a Map<String,List<Location>>
Me using SQL,NBT,JSON for everything:
You usually manage database entities separately anyways, so each manager could cache whatever makes sense to cache locally. Your description feels like a monolith anyways, so why bother syncing up with the database all the time. Operate in memory mainly.
would definitely use it if I was writing anything heavily PDC-based
Well because I would need to load tons of data at start and also if the server crashes at a very critical time, it will be fatal
ughm quick question, I didnt find it that quickly. GPL3 means anyone can copy/paste stuff, use it in paid and free things, can change anything, and must not credit original author, right?
I aint loading millions of entries at start
That's the problem all meaningful systems face, yes. You gotta find the balance between synchronization periods and efficiency.
Lazy load them.
What about ORM library for sql that supports in memory Database?
Isnt that MIT
i am not sure
alex are we gonna make this spawn a void world
No credit sounds like MIT, yes.
so GPL3 requires to give credits somehow?
Or just sync important things instantly and unimportant things frequently?
I think so, gimme a second, I'm going to look that up myself now, haha
Im not a fan of that
reason why I ask is, I used GPL3 for my older libraries and I dont want people to have to give credits or anything. I just want people to be able to use it however they want
Copyright notice has to be present, if that's correct
Use MIT then
is there a license that I can use that just says "Do whatever the fuck you want with this"?
how would you automate minecraft server deployment with multiple machines?
MIT basicly permits anything
ok thx
Yeah, MIT
alrighty thanks I'll switch to that in future commits
A cloud
ansible, docker, ...
sure thing
plenty of clouds out
Well, where would you draw the line on "important things"?
wish it was more sunny
I remember some scandal with a photographer who just gave everyone free right to use his photos, and some big company copyrighted his work
Things that would be somewhat not critical to not instantly update
lmao but they would have to have "created it" to have copyright
sorry if its a noob question, i have just come across 4 servers for free
ORMs are amazing
copyright doesn't get "created" or something. you automatically have it
for example if a player has ingame currency, update INSTANTLY
unless the rights to it are free, or if the rights are given to new rights holders
are you maybe confusing copyright with trademarks or similar?
So you can implement observer design patern to track data in important database columns
I might be, don't quote shit I say I'm not a lawyer
copyright is an inherent right that cannot be transferred to other people. the original author always has copyright, no matter what
Or just update things from which I know are important instantly and sync the remaining stuff
the only way to give copyright away is to die and inherit it to the heirs
citation: copyright.gov
(at least in germany)
oh okay, in germany that is different
They are pretty cool, but should not be treated as a blackbox.
I want to inherit your jägermeister
I'm not going to write a last will just for some jägermeister bottles
alex when are we writing a Jägermeister plugin together? Or a barmixer plugin?
but I got a notary-approved last will for what happens with my plugins/source code in case I'd die lol
Wait really?
Wow
and make all the source code public on github
perfect
so was just curious cuz of that
if I don't like the style I'd just merge it, and then adjust it, so no problem
ah alr
so for yk the map data type
DataType.asMap(...) ?
I never got a PR lol
sure, sounds good
huh
do mvn clean package -X and ?paste the whole log pls
the maven-source-plugin version should be defined in the super.pom
do you use maven 3.6.3 or higher?
Aight guys gn8
good night
Cya later alligator
how come you dont pr the boolean, char, float and some of the others into bukkit
actually, the reason why I made that lib was so that I don't have to write "PersistentDataType" everytime lol
lul
yes, that's the only way
you could store it in a string
NBT's "tiniest" datatype is a byte
you could probably also get away with adding uuid
strings are at least 16 bytes in java
a byte is only one byte
location maybe, itemstack and meta maybe
imho all the ConfigurationSerializable datatypes should have their own datatype
however
the reason why only the current PDC types exist is that that's exactly what NBT supports
because it's ConfigurationSerializable
Is it really necessary tho? Not quite sure why you would obscure NBT's true definition.
I added it because I used to save playerdata in a per-player yaml file
it would save people having to convert it to byte/array or use more pdc
then people were like "this is slowing down my backups. I have 18517 players, and every player has a 3kb yaml file" so I said "alright I'll just turn the config into PDC". So i didnt have to rewrite everything, just the load() and save() methods
Then it should be a writer/reader, but not be added directly on top of the API, to make it clear that it encodes these values, rather than stores them directly in the NBT tree.
@ivory sleet pls ping me when you PRed it, otherwise I won't see it
ye
thx
most people would know it uses the byte or byte array if they were using it, any even if they dont does it really matter
Just gonna keep myself out of that discussion. Sounds great!
necessary, no. useful, yes. I mean we also have a YamlCOnfiguration class that let's you do getString(...) instead of having a Map<String,Object> where you then just cast the values
"being neccessary" is no criterium of whether it's useful or not
Hey guys, i'm trying to change the enchantment table offers, but when i do that they change just visually, and when i click the offer it enchants the item as the original offer, not the one i setted. Anyone know anything about that?
show your code please
?paste
Didn't mean to talk it's usefulness down, I personally would just design the API in a way where "exotic" data-types (non-NBT-native) are encoded on top of existing values in a clearly communicated way, kind of like the PacketDataSerializer serializes varints and the like on simple ByteBuffers.
But again, sorry for intervening, I'm just gonna keep myself out of that discussion, as people do not seem to share my view of API design.
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
if(event.getOffers()[i] == null) {
continue;
}
Enchantment enchantment = getItemEnchantment(event.getItem());
int enchantmentCost = 1;
if(i != 0) {
Random random = new Random();
enchantmentCost = random.nextInt(7);
if(enchantmentCost == 0) {
enchantmentCost = 1;
}
}
EnchantmentOffer newOffer = new EnchantmentOffer(enchantment, 1, enchantmentCost);
event.getOffers()[i] = newOffer;
}```
the event is a PrepareItemEnchantEvent
yeah that's a valid reason
maybeeeee
every class / interface could have it's own pdc type
e.g. ItemStack.PERSISTENT_DATA_TYPE
that way, the normal PersistentDataType class would only have the "native nbt" types, while people could still have some more datatypes
and one would easily know whether it's a native type or not
or maybe ItemStack.getPDCType()
idk
it surely can't hurt to add it
I'll bug choco or lynx about it when they appear in this chat
and ask them about their opinion
CHOCO
Weird stuff, I tried looking at the source of this event to learn more about how that could happen but got nowhere so far, as it's extreme spaghetti-code again. I'll have a look at it and tell you when I found something, if nobody else helped you by then.
@eternal night @worldly ingot I'm thinking about pull requesting a lot of new PersistentDataTypes to spigot. For example, we could have a datatype for boolean, itemstack, and more. However, I am not sure where to add it.
Currently we have PersistentDataType.STRING etc. There is exactly one spigot datatype for every native NBT data type. I'm wondering whether I should add them to those, or in another class.
Example: PersistentDataType.BOOLEAN could be very useful. or PersistentDataType.ITEM_STACK. However that would break the 1:1 connection between that class and native types. I thought about creating a public field (or getter) for data types in the respective class, e.g. ItemStack.PERSISTENT_DATA_TYPE or ItemStack.getPDCType(), however that obviously wouldn't work for booleans.
So, you guys got any suggestions / opinions on whether and/or where to add those things?
EDIT: alternatively, maybe we could have a PersistentDataType.forClass(...) method or something? I don't know. Please let me know your opinions
yeah it was just an example
the basic question is, whether or not to clutter the existing PersistentDataType class
I seem to have an issue I cant figure whats happening.
Location l = ((BlockCommandSender)sender).getBlock().getLocation();
int radius = Integer.valueOf(args[2]).intValue();
List<Entity> entities = new ArrayList<>(l.getWorld().getNearbyEntities(l, radius, radius, radius));
for (Entity e : entities) {
if (e.getType().equals(EntityType.PLAYER) && ((Player)e).isInsideVehicle()) {
((Player)e.sendMessage("Your here!");
}
}
if there are more than 1 person inside the radius given here, it only picks 1 person and sends the message instead of everyone and I dont understand why its not sending to all in the radius
for the booleans maybe
for the rest they should probably go in the respective class
but that would break the 1:1 connection between NBT types and existing PDC types
alternatively, maybe we could have a PersistentDataType.forClass(...) method
that returns the correct data type, if there is any
that might work
if it doesnt just wrap it in byte array maybe?
then you can add anything
right now I just wrap all ConfigurationSerializable things into a byte[]
for some things, there'd for sure be a better way
e.g. a Location could be a nested PDC with x: 1, y: 2, etc
couldnt everything be wrapped in byte[]
yes sure
exactly, e.g. for location you could just use a nested PDC that holds double values
maybe you could try to not convert the List to ArrayList? I really don't know, the code looks fine to me
if the name + lore is maxed out it could just die when it gets pdt'd
wdym? they are not "converting" anything
== enums, is it a player, debug
List is just an interface, you cannot instantiate it. You have to use ArrayList (or another explicit List implementation) to create any object
i know, but you could just call the method getNearbyEntities no? Instead of using new ArrayList<>(getNearbyEntities)
getNearbyEntities probably returns an immutable Collection
i would rather use a stream
getNearbyEntities(...).stream().filter( ... ).forEach(...)
sth like that
didn't know that part
oh alex how the hell does bungee reconnect work
I am not 100% sure, but in 95% of cases, any collection you get through bukkit is immutable
packets
PrepareItemEnchantEvent - displaying enchantments in the table
EnchantItemEvent - actual result when enchanting
but like how
how does the player stay connected while the server isnt online
it simply blocks the "disconnect" packet and send some titles meanwhile and acknowledges every incoming packet I guess
why does that work lol
it injects a custom listener to netty
its on the proxy
yeah sure it's a proxy plugin lol
Doesn't matter if the server dies, as the client doesn't connect to the server, but to the proxy. The proxy just keeps the socket alive, doesn't allow disconnect to pass through to the client and sends some other packets in the meantime. It seems like it's magic, but it just uses basic traffic routing logic as well as some protocol trickery.
@tender shard I hate java generics
not fkn structurally typed
anyway
I want your insight
Thx my friend, i will try later.
oh yeah
they suck
anyway I opened a thread for the API PDC types thingy: https://www.spigotmc.org/threads/api-suggestion-more-persistentdatatypes.584707/
maybe some people could state their opinions, would be appreciated
fuck type erasure
I've spent a fucking day to get these asMap(...) methods etc to work properly without dirty casts
especially the arrays were annoying
that's why they require you to toss in an empty array of the correct type while retrieving values
same like List.toArray(...)
You're going to have to cache your generated offers between PrepareItemEnchantEvent and EnchantItemEvent, then use EnchantItemEvent#whichButton to get which of the three offers got clicked (0-2) and clear the map EnchantItemEvent#getEnchantsToAdd to then add your custom enchantments to it.
You have to keep that little state yourself, as the API provides no way to get your offers back in the second event. Quite sad actually.
I often times rather take the dirty casts, lol
public void onPlayerInvClick(InventoryClickEvent event){
if(event.getClickedInventory().getTitle().equals("Menù")) {
event.setCancelled(true);
}
}
``` is there anything wrong?
yes
yes
ok lol
you shouldnt be checking inventory name
^
you should keep a List or Set or Map or whateveer of your custom inventories
and use that to identify them
^^
for example you could have another plugin that creates a GUI with the same title
then you'd be fucked
and not in the good way
or it wouldnt surprise me if there was a packet to just change the name and that would cause more problems
how can i do that
like
you mean like an id?
i think this is the one thing we actually DONT have a packet for (yet)
oh damn
time to PR it
you havent pr'd ur motd and playercount stuff yet
List<Inventory> myInventoes = new ArrayList<>();
///
// create inv
Inventory mvInv = Bukkit.createInventory(...);
myInventories.add(myInv);
player.openInventory(myInv);
// listener
if(myInventories.contains(clickedInventory)) // do stuff
ClientboundSetContainerTitle packet when?
if those inventories are in another class make it a private var and create a getter
im gonna need to redo them i think lolz becos i didn't technically? clone the Spigot repo
ah
like i did with BT but didnt? idk
make sure to create a branch for it too
ye
i fucked up some prs on github by not making a new branch lol
in my honest opinion I think these should not be in the API
why not?
I mean YamlConfiguration also has getString(), getLocation(), getItemStack(), ...
why not also have this for PDC types
dont PDCs hook directly in nbt actually
they do
so u would need to change the underlying NBT api no?
the builtin PDC types are all native NBT types
no
in my opinion, it is better to leave this up for libraries
also, couldnt having those as pdc type make people use pdc for more than it should
hm
you would just declare some public PersistentDataType<?,?> fields or methods
The way you implement an ItemStack[] PDC type may be completely different to the way I do it
hm but - who would get hurt if this would be added at least for some types? I mean, at least for booleans or sth
boolean I can see yea
for ItemStak and Location, I agree, there would be different methods to implement it
yeah that's what others already said too
but not much beyond that in my opinion
oh, booleans still arent native NBT type? wat
nah, bools are just bytes
do we have an int and double as pdc?
in nbt
those also might be useful
I'd appreciate it if you could reply to the thread @eternal night so we have all opinions in one central place, in discord discussions tend to get lost
makes sense for compression/space saving :v but damn
just added it
I actually agree with this. I wouldn't extend much further than a boolean type
but storing uuids, ints and doubles
More or less a thing for libraries to implement. The PDC API is extendable for a reason
the config classes also have getItemStack(), getLocation() and stuff
the ints could be useful for storing task id
I think it would only make sense to keep both "the same" kinda
I think granting developers access to the most primitive of types should suffice
but then why do we have Configuration.getItemStack
if the "most primitive types" should suffice, there also shouldnt be getLocation() etc
yeah NBT isnt, but PDC is
I mean spigot also didnt invent SnakeYaml
PDC wraps NBT
I would not extend further beyond types that Mojang themselves use
So a UUID type would also be fine, but I'd mirror their implementation of an array of 4 ints
Yeah I'm not sure why Mojang opted to use 4 ints
But they did, so again, I'd mirror that behaviour
hm okay I didnt know that they do it like that
yeah anyway choco, would be nice if you could post your opinion in the thread, even though it's the opposite of my opinion
I think it's a relatively recent thing. They have some places where it's two longs (see attribute modifiers) and others where its 4 ints
Like dog owners iirc are 4 ints
lmao I just thought for a second that you talk about real life dog owners
but could you please post your opinion in the thread? That way I get a better overview about what the community thinks, so I wouldn't waste my time writing a PR that would then get denied anyway haha
Yeah that's fine
thxxx
I mean, same reason spigot does not include IF or ACF
well that reason is probably more CLA related
community iterating over concepts is an important part of the API
you get the point tho
anyway, if you guys all say "boolean and UUID is fine, the rest isn't", then sure, no problem,then I'll just PR those
a small improvement is better than no improvement at all :3
yeah but as choco said, mojang uses 4 ints instead of 2 longs
See ^ Lynx
Mirroring Mojang is probably best

Despite it being weird af lol
exactly the point of why shit like this shoukd not be in the API
so we all agree that at least adding boolean and uuid to the original PDT interface can't hurt, right?
At least I don't mind 😝 once you have the PR open I am sure downstream will talk about it too
alrightyyy
so maybe some more input from that side at that point
yeah you'd have to forward that discussion to me lol
90% of people won't, but those 10% that want to integrate with other systems which expect mojang format will.
But then again, on the other hand, they can just use their own implementation. The interface seems like a nice to have, not like you have to use it.
it'll end up on the PR if needed 👍
nobody would however read the NBT tag called "PublicBukkitValues" and expect it to follow mojang's format
PDC uses it's own NBT "container" or however it's called so I don't think there's any problems with doing it differently than them
yeah I just wanted to say - nobody is going to use the mojangson "readUUID" method to read something coming from BukkitValues
inb4 PersistentDataType.UUID_4_INTS & PersistentDataType.UUID_2_LONGS 
hopefully not 🙃 but you'd be surprised on how much stupid stuff people do
like really, really stupid stuff
yeah okay true haha. but tbh when someone messes with NBT, they are using NMS, and those people should know that they are "on their own" when doing that
I mean it doesn't really matter whether it's 2 longs or 4 ints, so might as well do what mojang does
No? Why not? NBT has been created by mojang because they weren't happy with what's out there and wanted something special. You now use that internal representation format to roll your own representation on top of it, rather than sticking to conventions. If we know for a fact how mojang depicts UUIDs, why not follow that implementation 1:1? You just create more possibilities which don't solve any problems (not meant in a bad way! :)).
is it possible to create something like PDT.UUID or PDT.UUID.2LONG
yeah I basically said the same thing in my above message
if mojang uses 4 ints for a UUID, we could also just do that
choco had a kappa behind their statements for a reason 
lmao lynx
it defaults to 4 ints but you could specify 2longs
I love how lynx said "this is not a good idea, there's already libraries for this" and then sent a link to my lib lol
but yeah I get your point
it's definitely a valid point
Everything is possible, the question is just whether it should be done. Why have two different ways of serializing the same type? It just creates confusion and room for errors, while not solving a single problem.
@tender shard alr
true and yeah
The itemstack example is bad because mojang does serialize itemstacks to nbt
FeelsShulkerBoxMan
If ever we were to add an ItemStack implementation for PersistentDataContainer, I would personally rather it be implemented in CraftBukkit and have the DFU handle it if necessary
but I'm still sort of against it lol
but what about adding a boolean and uuid datatype? I mean it can't hurt
it'd be a nice addition without any downsides and would maybe make more people use PDC - somehow way too many people don't even know that it exists
Even though the ItemMeta is an NBTCompound already, I bet people still manage to combine it with it's material as well as the amount in all possible permutations to make it hard to uniformely read them.
UUID seems very logical to me if we stick to mojang's conventions, but to be honest, what do you gain from a boolean? It's like... The >0 check abstracts away for another function call. Well.
many things. Imagine an itemstack of a log or sth.
"naturally generated?" boolean
idk there's a ton of usecases to store a boolean in a PDC
I've had plenty reason to, yeah
player: "hasAcceptedServersTOS" -> boolean
idk whatever, there's a ton of usecases for booleans
ofc, people could use a byte and check whether its 0 or 1
but it also can't hurt to just create a boolean datatype
ofc everyone right now can already do anything they want with PDC. It's not about whether adding new types is required, it's simply about whether it wouldn't be **convenient **to do so. For those things where there's different approaches, like ItemStack, I understand that some people don't want it to be added. But we can all agree that the only way to store a boolean is to use a byte that's either 0 or >0, so why not at least add that?
Using a byte is more optimal if its just internal mostly. Boolean is more useful if something is configurable
I simply don't understand why some people are against a boolean PDC type
boolean isTrue = myItemMeta.getPersistentDataContainer().getOrDefault(myKey, PersistentDataType.BOLLEAN, false);
what's the problem with that
lol
I am not. Just stating and partially agreeing with you that boolean does have a use
I just realized that I'm arguing over an API that I'm not even in the target demographic of, as I would always have a wrapper serializer for anything more complex than vanilla NBT datatypes. I should stop at this point, lol.
Btw, don't forget about bytes being signed, so a != 0 may even be better than > 0.
yeah I wasn't talking about you but rather about the person in the spigotmc thread
Ah ok
here's the thread in case you're interested in the whole discussion https://www.spigotmc.org/threads/api-suggestion-more-persistentdatatypes.584707
Might have to post my two cents worth on it
oh yeah sure, the boolean should only be true if the value is == 0 and not >= 0
my bad
be false
yup, haha
False does not mean 0. False in java just means not equal to 1
yeah frostalf, it's almost 5 am here, we all know what I meant lol haha
If you really want to dive into the intrinsics of booleans lol
I don't want to do that
Where do you have that definition from? Basically every C-like language has 0 as false and everything else als true.
I just want to get opinions, preferrably in the thread and not on discord, about whether people which data types would be a nice addition to the api. basically everyone agreed that boolean and uuid would be nice. I still stand my ground that all other seriazable objects like ItemStack, ItemMeta, Location etc would also be nice, although I understand that some people are sceptical about those
e.g. a location could be stored as byte[] using BukkitObjectOutputStream, or it could be a nested PDC
When i get home i will look at it
but we all agree that having a BOOLEAN or UUID type can't hurt, right?
I agree
please reply to the thread when you have time 🙂
It is more of convenience to have it there then to not have it
I'm open for any opinions, as long as they include an explanation on why one thinks what they think
exactly
You can interpret 0 as being false but that isnt the same as false equalling 0
Two different things. Because 0 doesnt equal 1
If you ever looked at the code for boolean implementation you will see that it compares it to see of it equals 1 or not. Not if it equals 0
Now there could be an implementation that specifically does that since there is like millions of languages lol
I'm searching for an actual implementation right now, it's just hard to find something else than the spec.
yeah in bash, 0 is true and everything else is false lol
It is generally implemented that way because you only need to check for one state not both
So its easier to check for the on state or true. Anything not on or true is false
i just want my shit to work, i don't care how it does it
Lmao

sounds like an average windows/linux user
sudo apt remove Choco
macOS people like: "Wow, the weather is so nice. The flowers are beautiful. My dog has to take shit." They don't talk about their computers bc macs simply always work just fine 😛
Still, C will run your while(128) loop. I don't see how having a zero-check instruction and just swapping both pathways makes anything any harder. I think that all modern languages interpret != 0 as true.
Now in java depending what you are doing it is better to use a byte for 1 or 0 in terms of boolean checking because it takes less resources that way. But that is why if its purely internal you should just use a byte
And I'd love to see the actual JVM implementation, but I cannot seem to find it for the life of me.
Look at openjdk source
NOOO
I would also love to know jvm impl but I'm probably way too stupid to understand any of it so I just don't
The only things missing from openjdk is just the sun packages because those are proprietary.
you should apt-get purge him, so there's no leftovers of choco
sudo apt install ChocoRevamped
OG choco will always be better like gnome
lmao did you play gta san andreas?
"og choco is in da hooouuuze"
why my log is always black & white? I am using color code but its not working
Log strips colors away. So console can be colored but the logs wont
It's just that I have zero experience with the codebase and gonna take forever to locate that exact section of code. But I'll have a look. Downloading that big thing through it's slow hosting server right now.
@quiet ice would know that from the top of their head for sure, but well... Not at this time of the day, lol.
Lol
OG LOC
my lord
You have some slow internet
you can be glad if there's no color codes in your logs
Nope, the server is that slow. They seem to be pretty poor over at OpenJDK industries.
I want to add colors ._.
I mean in console
for my plugin
Hard to make money on free stuff
There are, if you use Bukkit.getConsoleSender().sendMessage() and use color-codes, or whatever it was. They are translated to escape sequences for terminal colors somewhere in chain.
@tender shard i prd btw
Need to use ChatColor to color log output to console. Hex colors dont work for that if i recall
check it when ugot time
Serenity (for example) makes it work too, and they're much much smaller. But hey, I'm happy that we have openjdk, don't get me wrong.
I dont use it
The download finished, thank god.
Always used oracle because it works best on windows
Also encountered less problems with oracle jdk as well
I also don't use chromium, yet I am happy that it is another force on the browser engine market keeping competition up.
And unlike most here i do have a license to use jdk commercially 🙂
i have some gtas saved on gdrive... idk which ones they are
i think rheyre trial versions of 1 & 2
https://drive.google.com/file/d/1vG452ap3-16twSEDKm15wG3d2LhMpJq8/view?usp=drivesdk theyre from official rockstar pages
Gtas 1 and 2 in case anyones curious to find them are not called gta
Its called cops and robbers and their cabinet games
iirc gta 1 and 2 afre free to download
are* free*
no
scrubs?
i forget how i managed to play the ones i have
the GOG versions should run fine on win 11
Yeah but gog emulates for you lol
yeah they do some magic
gog is love, gog is life
That is why though gta starts at 3
isn't gta 3 this "claude" dude who also appears in GTA:SA?
the one who does racing lol
the dude who never talks
well SA is after 3 isnt it
sure
true
From the IntegerValueImpl, not sure if they partially self-host, as I could only find this kind of logic in a .java file, not in c/c++. But it's a nice first indicator.
gta 3, vice city, then san andreas
Yes but not directly after. Next one after 3 is vice city
yee
ah alright, that'll be useful for my shitty PDC pull request
i have like a trilogy pack for the PS2 lol
i got it for $20 at walmart in 2018
Only because you cant really find ps2 games as easily anymore
I once got gifted the whole valve package. e.g. CS, CS:source, half life, half life 2, TF, TF2, ...
I'm just still very much convinced that == 0 is false, and everything else is true. That's how it has always been done in 99% of significant systems. I'm going to take a bit more research tho! :)
yeah sure, what you sent confirms this
