#help-development
1 messages · Page 894 of 1
i think i said it incorrectly, im not using a set as a key anymore, but i was always going to use a set for the values.
aha. I have no idea what you mean but ye, gl 👍
map<topic, set<listener>> 😁
map<set<topic>, set<listener>>> 😠
who said Set<topic> as key 🤔
no :( the key would be a set
I need someone smart
i can help you
Yey.
Can you help me prove that the vectorspace of the complex numbers is isomorph to that of the 2 dimensional vectorspace of the real numbers using the inverse identity matrix?
I'm actually not sure if that is even possible...
But who am I to judge, you are smart
have fun, idk what this, i guess you do?
There were two mistakes in there and didn't use the identity matrix, but I'm impressed that GPT actually knew how to prove linearity
:)
When shading dependencies for a bungeecord plugin, should I relocate them all? (e.g. apache commons io, jakarta.mail)
Wondering what's the good practice in bungee development
wdym?
how to spam item on a loc i mean
Is there a way to get the localized name of an enchantment? Currently I just get the namespaced key, but that is always in English of course
I still dont understand? Can you explain what you mean by that
my bad i meant spawn
A bukkitRunmable if i understand corrctly
what
BukkitRunnable?
World.dropItem iirc
he wanted it to constantly spawn
do you know capture the wool
no sadly not
Then yeah just spawn it with a runnable
Depends on how it is handled internally, but it can cause problems as it has to go through all players of that world
Not fired async but probably thread safe give it a go
If I remember correctly, players are a part of a CopyOnWriteArrayList, but spigot has decided to throw exceptions nonetheless recently
At least with sounds. So i wouldn't be surprised
So this returns the full domain that the player used right?
Because I'm making a plugin where players can create referrals in the form of subdomains
Also is .hasJoinedBefore safe to run in the PlayerLoginEvent?
Says some methods on the player shouldnt be run as they havent fully logged on yet
.hasJoinedBefore() is a method from the extension OfflinePlayer so it should be fine maybe
this is my project structure and this doesnt work for me
cough
Also what do you mean by "doesnt work"
not needed
It says right there on the 2nd line
This minecraft version is not supported by the plugin
show yoru NMSHandler implementation in V1_20_R3
iirc r4 doesnt exist
i guess naming issue
1.20.4 is R3
you need to have the nms version in the package bc otherwise it just has 1 of ur nmshandlers
so you named your package V1_20_R3 but expect to find an nms_1_20_4
you need to go back and look at alex code again
ok i will.
same error
show your packages
you didnt add the version to the package
its still me.erano.com not me.erano.com.v1_20_R1 for example
im foolish
they didnt add versioned packages
Nostalgia
I don't like using Intellij for some reason.
Use whatever you want to use
Hi! I'm using custom heads within my plugin.
When I create a head, I use a generic player profile uuid (my own), and then set the textures to something different.
Now, though, I need to be able to get the texture from a head, in the form of an ItemStack.
For some reason, meta.getOwnerProfile() returns null, though. I know this is a bit of shitty question, so let me know if I need to provide some more info. The method where I am trying to this is attached as a screenshot.
In short, I have an enum with things like "RED_BUTTON", which I can then use to get the URL for that specific player head texture. What I need to do now is get the enum from a player head, which first requires me getting the textures for that head.
The error logging is just for debugging purposes so I can see where the method returns null. Currently it's logging "2", which indicates that getting the player profile is returning null
does any1 know if Damageable#damage fires an EntityDamageByEntityEvent?
Hey guys
I want to break any block which i touch with my pickaxe(in the sense left click)
even if its bedrock or barrier
im just not able to get it right
i tried getting location of block in BlockBreakEvent and replace it with air
any suggestions?
pretty sure its one of the few methods historically stated to be async sage (along with sendMessage)
Also, do you know is PlayerLoginEvent.getHostname() is inaccurate? People here have said it is
I think if you use the amount,source arguments
can you be more specific? it will say whatever the client says it connected to
how can i setup hotswap?
.
http://hotswapagent.org/mydoc_quickstart-jdk17.html i am following this but don't know how to run a minecraft server with that flag
just put those before the -jar argument
@proud badge said i had problems with it and you should test
ok
I want to use a feature from a mod (Cobblemon) and a plugin (PlaceHolderAPI) and i am so confused and i just want to know if thats possible
Not supported
How do u use luckperms in mods ?
I mean
Not how in the way of how to add the repo
But how does it work
luckperms has forge and fabric versions
yo which one looks better? the short version or the longer one?
(I mean in general, not for this specific option)
I prefer the left
it's clearer
yeah me too. I'm just a bit worried it's a bit overkill to have 9 lines of comments for such a simple thing lol
Better more comments than less
true
it's also easier to read because of the spaces
first one is better imo
Besides, you're only adding 5 or so bytes for each comment line
So it's not a big sacrifice at all
5 bytes for a line?
4 bytes*
it's not about the bytes lol. more about how many stuff can fit onto the screen
one for the # and one for the \n
the plugin is already at 3.5mb anyway lol
LOL
# is ascii so id guess utf8 treats it as one byte too lol (if you wanna get nerdy)
tf is discord doing
ah stupid markup
markdown
is ascii!!!!!!111
Didnt see left margin, thought there was a tab
how bad is the idea of putting a plugin jar inside a mod and making the mod copy that jar and put it in the plugins directory
Inside a mod?
ye as a resource
Like forge/fabric or what do you mean with mod
What‘s the purpose, forge doesnt run spigot plugins - and all those hybrid forks are quite bad
i will have a pre-built plugin inside the mod's resource, and when a condition is met, it will be copied into the plugins folder and it will be used just normally
Well ofc you can do that
Just be careful if you use gradle‘s shadow plugin
It can‘t handle jar in jar
anyone used maven-assembly-plugin here ?
I think everyone that ever used maven used that plugin
I'd call it quite essential even
then why everyone uses shaded plugin.
the maven-shade-plugin runs after the maven-assembly-plugin FYI
im trying to improving multi-module stuff. No one uses root project.
Everyone producing jars in sub jar modules.
maven-assembly-plugin generates the original "slim" jar, while the maven-shade-plugin uses that jar and adds the runtime dependencies into it
Actually, I think I'm confusing maven-assembly-plugin with maven-jar-plugin now that I think of it. Oh well, there is just too much garbage preconfigured under maven
but you can make more configurations on descriptor files. with maven-assembly-plugin
sorry for my english tho. its my second lang.
i can make mistakes.
Honestly I don't quite see the reason to actually use the plugin directly
getting rid of dist project.
i dont wanna use it. i will try to improve.
If you are familiar with it - sure, knock yourself out. Otherwise uh, I am not entirely sure what it offers that jar or shade does not
Anyways, I realized that I am making a severe error by staying up for any longer. Farewell!
see ya.
ofc you can use the assembly plugin and configure it manually
or you use the shade plugin that does everything automatically
👍
Typically assembly does the opposite of shade by extracting dependency jars into raw classes and groups. And from there it builds a jar, issue here is that you dont have the ability to relocate. So its handy to use when your dependencies are other projects. Maven jar doesnt include dependencies and just compiles but has the ability to sign jars.
you set the score of §c at the beginning, and then you change it to something else at the end
same with §c:
i watched a yt tutorial for it and for him it worked
yt video is the image
^
he is using a different text per line
you are trying to repeat §c twice, but it will correspond to a single entry
something i used that you can copy if you want:
/**
* Creates a new sequence of colors based off of previous generated colors, to enable
* duplicate-like lines to exist within a scoreboard. This color ID is used as the prefix
* to enable duplicates.
*
* @return the next color prefix (will affect successive identifiers)
*/
@CheckReturnValue
public String generateNextUniqueColorPrefix() {
StringBuilder builder = new StringBuilder();
int repeat = 1 + (colorCodeGenerationCursor / colors.length);
for (int i = 0; i < repeat; ++i)
builder.append(colors[(colorCodeGenerationCursor++) % colors.length]);
builder.append(ChatColor.RESET);
return builder.toString();
}
^ above generates a new color each time you append a line to a scoreboard
§1§a
§2§a
§3§a
§4§a
colorCodeGenerationCursor <- is just an internal integer being incremented for each line you append
and use the result of this method invocation as the prefix of your scoreboard line
colors is an array of all colors using ChatColor.values() <- note the auxillary space here is O(n) due to arraycopy
due to the context of what it was written in
it's a content builder
for example I have this method:
@CanIgnoreReturnValue
public ScoreboardContentBuilder appendEmpty(int repeat) {
while (--repeat >= 0)
lines.add(generateNextUniqueColorId());
return this;
}
Scoreboards are pain
yeah
Use fastboards
sumn like this
It’s all fun and games until you want per player scoreboards but global teams
Why not
??
okay...
I mean all you do is shade it into your plugin
FastBoard board = new FastBoard(player);
// Set the title
board.updateTitle(ChatColor.GOLD + "FastBoard");
// Change the lines
board.updateLines(
"", // Empty line
"One line",
"",
"Second line"
);
look how easy the api is
nice
no no
i can't understand that ;-;
What part
Saving the default config.yml from the JAR
Why it works or how to do it?
ye
The creation of the configuration file:
plugin.saveDefaultConfig();
saveDefaultConfig() will write the config.yml file from your plugin's jar file to the plugin's data folder. (If that folder doesn't exist it will be created) It will not overwrite an existing config file.
From that link
so
do you see your resources folder?
probably src/main/resources/
ye i see
write this where
make a new file in there like this "config.yml"
That is your default configuration
then to save your default config you can use saveDefaultConfig() in your main plugin class
Here
Where do I write this?
"plugin.saveConfig();"
where ever you want
Ideally put it in onEnable
It fails silently if the config is already there. However you can put it where ever you want as long as it is called at some point.
how can i access openNavigatorInv from another class
its saveDefaultConfig, he asked about saveConfig
My bad misread lmao
looks like u can probably make this method static, but im not sure how good of an idea that may be if u keep it in that class
maybe a utility class may be a better choice depending on ur uses
i just wanna run openNavigatorInv from another class yk
so i can open the inventory from any class
no, that is static abuse
have a reference to the PlayerConnectionListener class and use PlayerConnectionListener#openNavigatorInv
wdym with #
it means its a instance method of the class
^
ik
having an instance of the listener just felt weird
lemme see
I get a null pointer exeption in line 48
yeah
and your class naming is incorrect
thats why i had suggested like a utility instead
yeah
wdym
its just not to the naming convention
typically lowerCamelCase is reserved for variables
so it could be misinterpreted as a variable instead of a class
i can change that later on but why do i get nullpointerexpection
whats on like 48 of BlockListener
do you want me to show u the class of the opennavigatorinvutil
but see thats where your naming convention is confusing is openNavigatorInvUtil in that context a static reference or a variable?
thet class itself isnt the issue
do you mean the reference to it?
fix the class name first
this is a conflict of interest with names
im guessing openNavigatorInvUtil is null
so what now
just do
OpenNavigatorInvUtil openNavigatorInvUtil = new OpenNavigatorInvUtil ();
instead
I'd really recommend watching a few java tutorials before hopping straight into spigot dev, it'll help a lot
Any kotlang users here know how I should go about shading the stdlib into my plugin
still null pointer exepection @drowsy helm
then your event or player is null
debug it, itll take you 2 seconds with a print statement
like this or what, sorry im very confused
no print out the value of openNavigatorInvUtil and event.getPlayer() itself
and see if its null
Should I create an entire abstract menu class for only 2 different GUI screens?
If you plan on reusing it, I don't see why not
can always reuse in other projects
true
testing
it opens now-
lemme remove the debug
and thanks
def gotta lern java basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
baeldung is love, baeldung is life
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
they used to be the same, with the exception of the Gif
when did that one get updated
How can you disable the experimental API warning in intellij I just want to supress it with @SupressWarnings
Hi i want to create an item with level. Do i need to store them all in database and load them at server startup or is it better to store level in nbt tag of the item ?
nbt
depends what this level is.
If its cross item and is attached to some other thing a database is better.
If its that specific item NBT is the better choice, however I reccomend you use the PDC Api instead of raw NBT
?pdc
if you are pre 1.14
cry
it's an level item that can be place in a custom block. For example i have a block chicken coop and when we click in the block, it's open a gui, where u can place the item level.
the higher the level of the item, the more eggs it will generate
i think i will go for pdc
for now im only developping the items
but for all block, i think i will go for database
item level -> pdc
block where u can put the item -> database and load all block at server startup.
This should be great right ?
no
blocks could be mapped to NBT using chunk data
that would be extremely laggy
you would have to do it on a per chunk basis
imagine loading a million data points on startup
more realistically its a couple thousand :P, but yes best practice is to load per chunk
you should never have something loaded from an unloaded chunk
It's the principle
On every chunk load, i check if the chunk containt custom block, and if yes, then load it ?
each chunk should have an array of data, cache it if its needed
oh yes yes i know my block will not be load when the chunk it's not loaded, i means at server startup i store all block in a map from the database
don't think per block is a good idea either
would be a huge waste of memory
and when you unload chunk it should be cached for up to 30 or so seconds afterwords I'd say
that way you aren't doing unecessary DB calls
yep right
also 'store all blocks in a map' is loading from db
It really depends how much players or world interact you expect on getting
if you don't plan on a huge playerbase then you don't really need to do it super efficiently
but once you suprass a few thousand blocks, it will start using excess memory
if you are making a plugin for others it should generally use best practices
because you never know their situation fully
erm, im having to do CompletableFuture.get(), isn't that hella slow. I mean this system is WAY faster than before went from 30ms -> 1.4ms but im wondering if i could make this faster
correct, I'm assuming this is for a private server
not necessarily
though if you're running get() I'd generally advise you run it asynchronously
anyways as long as get() isn't blocking the main thread which in this case it isn't, you'll be doing just fine
just do thenAcceptAsync?
like i ain't worried about the timings but like i'd rather it not block the main thread:
not super needed as long as you acknowledge that thread has to wait until it loads
oh ye ofc
but yeah that should be fine there really isn't much more you can do to optimize a DB call
mostly because you're at the mercy of your DB communication speed
ye i made it as performant as possible imo: https://github.com/InvoiceMC/Munch/blob/main/src/main/kotlin/me/outspending/munch/connection/MunchDatabase.kt#L115-L126
nice name :P
great name ik
i was just using a thread for async at first without CompletableFuture's but this system is way faster
just more code to write for the user
I'd say my number one issue with this project is AINT NO FUCKING WAY I'm importing MunchDatabase bro someone might get the wrong idea 
what the best way to do it so ?
oh my yes, CompletableFuture is a god send
thats why you gotta do MunchConnection.create() 🙂
lmao
since MunchDatabase's constructor is internal aka protected
ahhh I see
If you really want to optimise, check out how minecraft does their block palette system
and chunk compression
you can get even more optimized than that too :P
damn this seems very complicated for me
dont use the old wiki
and what about NMS ?
Wait i need NMS for checking block palettes ?
keep it simple, for every chunk have an array for each block
you can do per block but indexing it would be a bitch
I will try thank, anyways i think i will also help me with the wildchest plugin source code
With memory mapping and data saved in binary format with somewhat decent layout you can load 10 million blocks of data in 6 seconds and save it in 3
In fact with the improvements to java and more modern systems it actually may be faster now as the numbers i am quoting was from a test about 10 years ago lol
I will do something like this i think i will try:
private final List<Material> gettedBlocks = new ArrayList<>();
private void loadChunk(Chunk chunk, int[][][] paletteIndices) {
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 256; y++) {
for (int z = 0; z < 16; z++) {
int paletteIndex = paletteIndices[x][y][z];
Material blockMaterial = paletteData[paletteIndex];
gettedBlocks.add(chunk.getBlock(x, y, z).getType());
}
}
}
}
Wouldnt make it static
Your y value is flawed
It doesnt factor negatives
Oh yes, thank you. I had forgotten that now, with the update of caves, there are negative Y values. x)
good KISS approach
Does anyone know a mc client that can tell me how delayed my packets are
Tablist should show your latency level to the server
Optionally you could make a command to show this as a number. Also i think F3 shows latency as well
Interesting paper on 1.20.4 didn't remap bossbars to use components apparently?
I wanted to use minimsg for the font stuff
okay so they modify it
they dont use the bukkit class at all i think
they use there own
check the boss bar viewer class out
prob an interface
I run a small Minecraft event server with around 600 members. I need people to help modify existing plugins/develop new plugins for events. Would anyone be interested in helping out? There's no pay or anything, this is purely voluntary work.
lol no
600 members and no donors?
I rather do opensource than doing that
600 players and broke as hell 
you can pay the dev in exposure 
I need exposure. My exposure costs money though :< I'm affraid I don't seem to be a good match for your company
so not 600 active members
600 poor members
somehow i think a server with 600 active members would have way more income than that
they pretty active
whats your average concurrent player base
you need to sell stuff better
😭
I am trying my best
But, I got a partnership from a server host, so I can get rid of our server expenses in 5 months
We also just released a Patreon
but bottom line, no good developer will work for free
Trust me I know this 😭 We had a developer working for free with us and then he went rogue and deleted everything. That's on me for trusting him tho
for 20 dollars an hour
nah, i mean thats crazy for free but for $20
for a good developer, that is reasonable
yeah, ik, nvm I regret coming here devs are toxic
lol
Best I can do I tree fiddy

deal
$20/hr is low for a dev
I'm in HighSchool so its plenty for me :P
ChatGPT will do it for free!
better pay than a grocery store and good enough to make my mom shut up
Sounds like a cracked network
I'm being paid 1k+ to make a single minigame in like a week, no way you're getting that for free
can anyone help me?
plugin not loading. I realized that if i extract the jar file and make it jar again, they stop working. any idea on what this could be? I needed to change the "depend" of 1 plugin to make it load only after another plugin
recompile the plugin from source or get the stuff it needs to load after to modify their plugin.yml to loadbefore: [Towny]
you can probablly just unzip the jar than rezip it idk if you even need any special utils for that
could be wrong
Devs are toxic because they dont want to work for free? Especially for a server that claims to have 600 players with 100 being regular and somehow doesnt bring in income? Nothing sketchy about that at all lmao
i know but seems to me that when i extract files from a jar or when i turn a zip into a jar it somehow corrupts the file, because even if I change nothing in plugin.yml i get a message Could not load 'plugins/Towny.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
could someone very gentle edit this jar to make depend: [SkVault]
cuz i think it's something in my pc idk, every jar i edit dont work
lol
its true, it never works. i tested and even if i just extract jar file and then make jar again it stops working
@drowsy helm After examining the source code of WildChest, they store all chests in a map during server startup, called "unloadChest," using a database. Then, with the chunk load event, they check if the chunk has "unloadChest." If yes, they move the chest to a new map called "loadChest." When the chunk unloads, they remove it.
If I understand correctly, it's better not to store all "unloadChest" because this would consume a lot of memory unnecessarily. Using the block palette is too challenging for me. Therefore, I will simply loop through all blocks of the chunk when it is loaded, check if my block is in that chunk, and then load the block if it is.
Just only extract the file, not the entire jar
Then put file back in the jar
how do I do that? im on a mac and i cant do that here
Drag and drop?
any that lets you inspect zip files
Change it to zip, open it. Drag the file to desktop or whatever. Edit file. Drag it back into the archive. If it asks if you want to overwrite file click yes. Change extension back to jar. Alternatively get winrar
no worry
lmao
What information should/shouldn't be stored in a custom yaml configuration? I am trying to check for alt accounts using ips and I don't want to put anyone's data at risk if there's something unsecure about it
so there's no issue with storing ips on within a flatfile or anything?
IPs are just numbers
ultimately storing data innately puts it at risk
since you, the dev, are not in control of other people's setups
just write them down on a piece of paper
I'll do that. I'll update the piece of paper live any time someone changes something and check it any time they try to do an action
very late but how do you do this font
small caps
wdym
i mean i use this sometimes:
(ugly ik)
val small_caps = mapOf(
"a" to "ᴀ",
"b" to "ʙ",
"c" to "ᴄ",
"d" to "ᴅ",
"e" to "ᴇ",
"f" to "ꜰ",
"g" to "ɢ",
"h" to "ʜ",
"i" to "ɪ",
"j" to "ᴊ",
"k" to "ᴋ",
"l" to "ʟ",
"m" to "ᴍ",
"n" to "ɴ",
"o" to "ᴏ",
"p" to "ᴘ",
"q" to "ǫ",
"r" to "ʀ",
"s" to "ꜱ",
"t" to "ᴛ",
"u" to "ᴜ",
"v" to "ᴠ",
"w" to "ᴡ",
"x" to "x",
"y" to "ʏ",
"z" to "ᴢ"
)
// Convert text to small letters (small caps)
fun toSmallCaps() = text.map { small_caps[it.toString().lowercase()] ?: it }.joinToString("")``` or just <https://lingojam.com/FancyTextGenerator>
try lingojam
tried it and its exactly the same
are you using any other resource packs
paste what you have
§6§lʟᴇɢɪᴛᴘʟᴀʏ
yeah that's right
weird
what MC version
...
but anyway
what scoreboard plugin
coded
how sorry never did that
hook placeholder api into my plugin?
yup
did you reload maven changes?
hold up
yea now works
So.. what i did is put it in my pom with no red marks. Then i rebuilded the plugin and put it in plugins but its still not working
do i only need to add the on enable thing
you have to translate any message you want with placeholders
oof ok
Thanks it works, could you tell me how i can translate & to § so its actually a color
you dont
ChatColor.translateAlternateColorCodes
use ChatColor.translateAlternateColorCodes
where should i put it
use the return value of it
never used it uh
String myString = "blak blah blah"
myString = ChatColor.translateAlternateColorCodes('&', myString);
dont use § in your code
ah
ty
yall are life saving xd
I use this but it still shows with &4 yk
@drowsy helm
strings are immutable
youre not re assigning it
huh
OH
OH
OH
stupid me
thank you
random question but any idea how i can make the scoreboard more pretty xD?
as in horizontal spacing
Also use more lighter colors ?
what event is triggered when someone hits a projectile (ie. hitting a fireball back at a ghast)? EntityDamageByEntityEvent?
I would try the PlayerInteractEntityEvent
Nvm thats just for right clicks i guess?
EntityDamageByEntityEvent seems like a decent guess
tested, it is in fact EntityDamageByEntityEvent
Is it smarter to store player data in JSON or YAML Files, for example I am creating a teams plugin and wanting to Store their team data.
depends if you want it easily readable/editable
If you do then YAML. If you don;t care, then YAML 😛
However, why persist teams data?
Wym persist teams data?
Like I want players to create a team and store info, like factions kinda.
are you wanting to manually edit the data in file?
just use a proper database
best way is to just give the admin an option so they can choose from (at least)
- json / yaml
- sqlite (or h2)
- mysql
there's other fancy things like postgres and mongodb but 99% of people won't have access to any such things
Configuration option
save-type: JSON / YAML / SQLITE / H2 / MYSQL and then you have a section for credentials (probably should have a convenient way of setting it up)
mongo is free to set up
like on their servers
with an account
Do I use .jar, -remapped.jar or -remapped-obf.jar
shortest name
ty
Supabase is a perfectly valid BaaS and Postgres host
It's free tier is really good
Hey guys, i made a database system which i manipulate everything in memory and i just send it to the database when the plugin is shutting down.
This is recommended?
Sure
Some periodic saves or smth is also great
Saving on write if it’s small things are great too
In case of crash?
Ye
if you're ambitiuous you may wanna do optimistic saving
but well, otherwise jantucks advice is 100% on top
Ty guys
my intellij in bugged, i dont get the suggestions when i write a code, how i can fix it?
Try invalidating caches
File > invalidate caches
Select the top 3 checkboxes and press invalidate
not work
thats fine unless you wanna really scale things drastically, in which contention can become high
Then re-enable suggestions you disabled it :P
Ypu gotta look that one up tho
Google your question before asking it:
https://www.google.com/
I'm still trying to wrap my head around the NMS obfuscated, Mojang, and Spigot mappings in 1.20.4.
When I reference a class in a plugin, I use the Spigot mappings?
And then does Spigot remap that to the obfuscated mapping to use when running the server?
When you refrence it you use mojang mappings
^^ well if you've set that up correctly
And then specialsource remaps it to obfuscated when you build
In this case, I'm using TinyProtocol, which is using reflection.
It works with the Spigot name, not the Mojang name.
So how does it work with reflection where I specify the Spigot name in the plugin, but the server is running with the obfuscated names?
Does Spigot still use Spigot mapped classes with obfuscated methods/fields
haven't checked in a while
i think so
isnt it like a mixture of everything that was spigot mapped before retains that name with obsfucated internals but new stuff is just full obf
Or is it that Spigot uses the Mojang names now?
Not during runtime
@young knoll when are you converting spigot and craftbukkit to mojmaps
If I knew how :p
patch all the patches
alright so I did a quick look, the class names are mapped (with Spigot mappings), the fields/methods are not
So what does Spigot remap and when does that remapping happen?
I mean for a plugin.
for plugin you use the special source maven plugin
If you want to remap from Mojang mappings you use the special source maven plugin
and it remaps during packaging of the jar
The plugin jar, right?
yes
Remaps to ofuscated?
yes
Now with the reflection TinyProtocol is doing, there's no Spigot remapping. Anything has to be part of the TinyProtocol code, right?
I'm not using specialsaucesource
gotta use spigot/obsfucated maps then
^^
So the code is like this, with a Spigot name:
private Class<?> OUT_KEEP_ALIVE_PACKET = Reflection.getClass("net.minecraft.network.protocol.common.ClientboundKeepAlivePacket");
ClientboundKeepAlivePacket is Spigot mapping.
for 1.20.4 they have identical package and name
version: 1.20.4, hash: c10116c084
So if the Spigot jar uses obfuscated names, how does the above code get the right class?
I mean presumably it can be automated, I'm just not sure how :p
only fields and methods
Oh, Buildtools remaps to the Spigot names, but it keeps them in the final Spigot jar? I thought that remapping was just for the specialsource stuff.
hm is spigot actually just using Mojang class names
its a jank thing
does look like it
iirc someone said its like older classes are spigot mappings, while the newer or changed classes use mojmaps
alr
For that class above, the Spigot name changed from 1.20.1 to 1.20.2
correct
But once Buildtools creates the Spigot (now the same as Mojang) class names, those class names stay in the final Spigot jar?
yes
OK, I think it's starting to make sense.
But I thought those mappings were "only for development purposes" and can't be used in production. Or does that not apply to class names?
Spigot maps aren't use during server running
Everything is put down to obfuscated mappings
I wonder if you could run special source on cb with it set to remap from spigot to mojmap
@worldly ingot you have loads of free time, fix it. Make cb and spigot use mojmaps for patches then convert every single spigot mapped class name to be the actual mojmap
?tryitandsee
Where the hell did you get the idea that I have loads of free time? 
Guh fine ill make the remapper
i was going to do that today you just reminded me
Then figure that shit out
So with specialsource, you can use the Spigot/Mojang method names, even though they're not in the final Spigot jar file?
Yes
OK, I think I have it stright now.
Now to figure out what new shit Paper is doing with some other version/remapping stuff they've cooked up.
with special source you get full mojmaps, class names and variables but when speical source runs it goes to spigot obf
Mpjang doesn't map variables lol
Nope
no they don't
Parchment does
^^
But that's third party
i can brain, i mean class fields
they don't map local vars and parameter names
Still confused why we relocate CB
@worldly ingot so epic told me you got a lot of free time ✨️ 
iirc it was for two purposes. To ensure that people using server internals kept checking that their code was functional on newer versions, and to dissuade them from even using internals to begin with
At least that's what I've gathered over the years
It should have led people TO DESIGN AND CONTRIBUTE API 
Okay but you'll never have full api coverage :p
Meh some things shouldn't be api but yeah most stuff could be contributed the main issue is designing code for yourself vs stuff that will likely never ever be removed from the server
i think some dmca screwed that
E.g. when designing inventory api for my own lib I through that together in like 10 minutes work s great but for bukkit it's a pain in the ass
I've always found the bukkit inventory api to be a pain to deal with
It's because it doesn't reflect internals at all
Yeah I know
It probably used to
I've made mods with custom inventories, so much easier
Just like how Material.WATCH for clocks was accurate at the time as well
I don't even know if I agree with being able to create inventories but we are kinda stuck with the weird patches I've done
I have an api in my lib that wraps AbstractContainerMeni :P
It's 10 billion times nicer in a few cases
Open source? 
Yes it is
link?
On phone gimme a minute
pineapple?!?
its on 1.0.0 prep
i see it
I don't wtf
It's in nms
oh
My nms stuff is gone 💀
someone reverted it
I think I have a backup somewhere
Oh shit
I need to revert that revert lol
Well that is later me problem
Thank god for git
Otherwise it'd be gone lol
@chrome beacon I'll ping you once I fix this shit lol gonna have to wait till after class unfortunately
review my pr when you do
Good that
git cherrypick time coming soon 🥳
sus
who could help me with placeholders deluxemenus and toprichest top hoursplayed?
i have the code, i dont know whats wrong with it
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Yall whats an arithmetic exception, chatgpt seems to crash whenever I send it the stacktrace
Hey, I am planning on making the backend of my rest api open source. Is there anything wrong with the fact that I will be exposing my password hashing method and database queries?
Usually just divide by 0
Exposing password hashing is a very bad idea. That makes cracking passwords significantly easier. Database queries... depends.
Don't expect ChatGPT to understand your stacktrace
I guess it depends on your table structure. If it's a password table especially, might expose how you store passwords which is also another vulnerability
How do I go about it then? Do I gitignore my queries and password hashing?
If it's just standard data though then it's probably not a huge deal. Depends on how secretive you want your table structure to be :p
I would maybe throw it behind another library or something
Yeah that'd work
bcrypt 🙏
Though I don't actually see why exposing password hashing would be bad
also always salt
Use some magic salt env variable 👌🏻
Well if your passwords are leaked, it's pretty easy to brute force reverse if you have the hashing algorithm
Argon for example gives a prefix that identifies that it's argon
So if a bad actor gets access to the database they already know
If you give me aheuilfawbcawjkl;ehjcawlke, I can now just try standard passwords, run it through your hasher and figure out if it matches
Ofc
If I find a match, ez, I know what the password is now
A salt would help though yes lol
Well in my case I use argon
no, it should be different per user
And an argon string is like $argon$something
So I don't see how hiding the method would help if it's already evident
Idk encryption 🤷🏽♂️ Listen to emily
so even if they have the same password the hash result is different
Yes my salt is user-dependent
if you have a "global" salt then the hashes would be the same
and you can infer that they have the same password
Thoughts?
That's how you know to make fun of those users 😎
OR to let them know that user x has the same password as you
As any responsible front-end developer should do
(/s)
"This password is already taken by user391094. Please create a different one"
you can certainly make the algorithm itself public but not the configuration, e.g. how you apply the salt or the algorithm parameters
Isn't allat also included in an argon string?\
like "yeah we use xyz algo" but without the specific details of how you apply it, basically dictionary attacks are rendered useless
i love this
Example: $argon2i$v=19$m=16,t=2,p=1$ZGVidWdQVFIxMjM0$ux0G0NjPzf+UDMEThlnT3w
Work factor, memory, parallelism, something else idk
Is it still safer to just librarize this?
Not my string btw, an example from https://debugpointer.com/security/argon2-hash-overview (just in case lol)
Δ
@chrome beacon finally got around to fixing it I hope git cherrypick will be my valentine after that one
https://github.com/PineappleDevelopmentGroup/Pineapple/tree/1.0.0-release-prep/pineapple-nms/api/src/main/java/sh/miles/pineapple/nms/api/menu/scene/custom
https://github.com/PineappleDevelopmentGroup/Pineapple/tree/1.0.0-release-prep/pineapple-nms/spigot-v1_20_R3/src/main/java/sh/miles/pineapple/nms/impl/v1_20_R3/inventory/scene/custom
here is the API and implementation feel free to use we are under Apache 2
thanks @remote swallow is the genius behind the name
was i?
should have gone with Pineapple Express
lol fr
I checked and I don't see any businesses using the name
just a movie of course, but movies and businesses can't infringe on each others names as they are not in the same categories 🙂
so its all good
I still need to earn the money to get an official LLC, but we are getting there slowly but surely
return !equals(other) && (this.major > other.major) || (this.major == other.major && this.minor > other.minor) || (this.major == other.major && this.minor == other.minor && this.patch > other.patch) || (this.major == other.major && this.minor == other.minor && this.patch == other.patch && this.modifier >= other.modifier);
``` any ideas on how I could simplify this boolean expression I've never been a boolean algebra savant.
Basically just needs to check if one version is older or newer than the other
e.g. 1.0.0-SNAPSHOT is newer than 0.5.9-SNAPSHOT
or 1.0.0-RELEASE is newer than 1.0.0-SNAPSHOT
you can ignore the strings at the end they are actually collapsed into bytes
private static final BiMap<Byte, String> MODIFIER_LABEL = ImmutableBiMap.of(
(byte) 0b100, "release",
(byte) 0b11, "hotfix",
(byte) 0b10, "snapshot",
(byte) 0b01, "beta",
(byte) 0b00, "alpha"
);
there is :P
I just wanted to see if I could simplify the boolean expression
e.g. reduction of term comparissons
using boolean algebra
the easiest way to do this check is to remove the dots and make it a number
now you only have to do a single check
true
didn't think about that easy solution
that'll probably be easiest here
then your expression turns into number >= number
couldn't you get multiple versions ot add up to the same number that way 🤔 ig not if I bitshift
you don't add the numbers together
all you are doing is removing the dots
so it makes a complete number
ahhh
genius lol that was a stupid question
so, something like 1.20.4 becomes 1204
hmhm yeah smart
in my case 1.0.0-SNAPSHOT collapses into 1003 and 1.0.0-RELEASE 1004 so it works perfectly
I just did a string format idc about speed that much here
its done like once or twice
and its cached
ideally you would keep snapshot versions in between the release versions without them ever crossing over
difference between enterprise and normie code?
IE, you shouldn't have a 1.0.0-snapshot
it would be 1.1.0-snapshot or 1.0.1-snapshot
this way you can't have a snapshot and release at the same version number
wouldnt you get 1.0.0-snapshot which is testing, demo stuff and checking new stuff then you have -release which is the full version
well, if you don't bother changing the version number yeah
you can setup the profiles to be appropriate versions
so if i open a compnay i can call my code enterprise
while quality isn't always there, the biggest difference between enterprise and normal code is that enterprise is more geared to scaling or large scale applications
normal code isn't designed this way typically
don't have to open a company to do so, you could just call it Enterprise whatever lmao
when you say scaling youre telling me to imagine a server with 8 quadridicilion players using my plugin?
well there is different types of scaling
there is horizontal scaling and vertical scaling
horizontal scaling is where you design your application to run on multiple machines
here you are thinking about vertical scaling
where you add more power
so if i have hardcoded connection to mongodb its not horizontal scaling and i should retire
what do i do when i add like 5 features to my plugin and i get lost in the sauce
well, when you use multiple machines, the purpose is to have all those machines either perform the same work but different pieces to complete it faster, or you use it like load balancing. Duplicating your application to do the exact same work isn't really scaling not in the traditional sense anyways
https://paste.rs/XjqII.java
and the plugin errors out wiiith...
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!```
i completely understand _why_ this error occurs - i should not use generic `PlayerEvents` and `EntityEvents` but rather specific ones like `PlayerMoveEvent`, `AsyncPlayerChatEvent`, `EntityDamageEvent`, etc, etc...
but that gets really messy really fast, and i just want to prevent players from doing ANYTHING at all before they've logged in. handling these generic events by checking their type and casting them to whatever i need them to be seems like a really clean solution, and i just wish this worked.
any suggestions on how to do this in a nice fashion?
paste.rs is a simple, no-frills,
command-line driven pastebin service powered by the Rocket web
framework.
Usage: !verify <forums username>
!verify brunoooooooo
A private message has been sent to your SpigotMC.org account for verification!

Guess u gotta wait a bit
got it
enjoy now 
probably better to just use the paste site lol
oh well
oh nvm its not as large as I thought
yeah no it's pretty small
any ideas either way? i don't want to @EventHandler @EventHandler @EventHandler @EventHandler @EventHandler @EventHandler - but is it really the only way?
don't think your generic event is going to work
Most of us decent dev's have our IDE's configured to do it for us 😛
it doesn't.. it doesn't implement the required getHandlerList
declaration: package: org.bukkit.plugin, interface: PluginManager
Hi I have a problem with custom entities on my Minecraft server, as soon as I pathfinder of my custom entity finds me and starts following me, if I move away from the mob by more than about 16 blocks it disappears. And I have an error in the console. If you need more information please do not hesitate and thank you for your help.
?whereami
this would be related to your server settings for entity tracking range
also, how far away before an entity ai stuff stops, and chunks unloading etc
it's literally a mc error
elaborate
the ideal way to solve it if its a public plugin would be to not let the entity get further then 16 blocks away
It’s paper though
but how can this lead to destroying the mob?
if its not a public plugin and on a server you control, just modify your server settings
because it unloads
like if the chunk unloads, so does the mob
and it basically dies
but temporarily
also, custom mobs don't come back as being custom either
but why would there be an error as if minecraft had not expected the mob to unload?
so you have to track where your custom mobs get unloaded so that when they come back, you can ensure to kill the fake one and replace it with the real mob 😉
well its an MC error, but one you are creating by invoking a method
yeah but it's strange the error is not reported to any plugin line
i will try with spigot :D
generic events can be registered this way? or do you want me to loop thru a list and register each one/something similar?
Shouldn't this be true by default?
Generic events typically don't work except for a couple because they are not implemented themselves or called rather extended from
ok so to get it straight, there is no cleaner way than defining a million handlers for every player event i can think of?
Oh wait I think I read the comment wrong
well if all you are wanting to do is to stop them from doing things then you only need just a handful
a good way to stop them from doing stuff without needing to do much, is set them to spectator
oooh that's actually a great idea
spectator + PlayerMoveEvent and PlayerChatEvent cancelled
spectators can teleport?
pretty sure it is, but there is also a teleport event
yeah, if you press a hotbar number on the keyboard a little menu shows up
i don't know how it behaves for non-ops though
time to test it, it seems 😉
i'll also have to handle commandpreprocessevent to only allow the /register and /login commands
or just use permissions?
it's in case someone gets into an op account and runs commands they shouldn't be able to run, before logging in
remove ops
worldguard has a setting where if ops leave they are de-opped and require being re-opped
but i don't have ops atm anyways, it was a general example
to re-op you have to manually run the command
so in this manner you can relegate it behind a permission that can only be added to the player object once they authenticate
server commands have permissions too
as in vanilla commands?
yes
K neato
Didn’t they decommission most of the bukkit converted permissions and commands to just use vanilla a while ago
what do you mean?
vanilla never had permissions o.O
as far as I am aware the default permission for stock server commands should still exist
Idk someone should try