#help-development

1 messages · Page 990 of 1

storm crystal
#

I dont know what to do at this point

#

and everytime I get a different answer

buoyant viper
#

chatgpt 🫡

#

jk ai doesn't teach code

storm crystal
#

I want a way to store this data:
-custom enemies, items
-menu and stash inventories
-player information (deaths, kills, etc.)
is there really no possible way to do it all in one type of data holding shit?

valid burrow
# storm crystal I dont know what to do at this point

Okay look ima give you one final answer completly explained and you can disagree all you want anyone with a brain will be on my side

It depends what you are storing, there are 2 options:

A GUI displaying player personal data: deaths, kills, achivements, skills, friends, anything like that
-> Dont store the GUI store the data (kills,achievments,skills etc)
or
A Inventory holding actual items like an enderchest. Items that arent just normal GUI-Buttons
(Store each Item as an Itemstack)

For both you can use either a file or database. Databases are usually faster and more secure than your average file but of course also a bit more complicated. Either way both will work. Just make sure to store what you actually need depending on your case

valid burrow
#

you can serealize them for example

#

meaning

#

they get turned int a long String

#

or if you are using yml files

#

you can store it just as is

storm crystal
#

sqlite database

young knoll
#

Serialize it to a byte array

#

With BukkitObjectOutputStream

storm crystal
#

cant I just make it a string

#

its easier

#

than whatever that shit is

young knoll
#

Okay, and how do you do that

storm crystal
#

.toString?

grim hound
young knoll
#

That won’t give you a valid representation of an itemstack

grim hound
#

Kyori and then by hand deep to string

storm crystal
grim hound
#

And even that might not work

valid burrow
#

give me a sec

#

maybe i have a method laying around

#
 public static byte[] serializeItemStack(ItemStack itemStack) {
        try {
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);

            // Write the itemstack to the stream
            dataOutput.writeObject(itemStack);

            // Close it
            dataOutput.close();

            // return the result
            return outputStream.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
#

that should be it

remote swallow
#

Smh use twr

young knoll
#

^

storm crystal
#

well it doesnt work anyway

valid burrow
#

wdum it doesnt work lol

#

it does

storm crystal
remote swallow
#

You removed the try

valid burrow
#

^

storm crystal
#

why would I keep it

remote swallow
#

Because it catches the exceptions

valid burrow
#

cause it throws exeption(s)

#

or can

storm crystal
#

if theres an error then there will be an error

#

kinda whatever

remote swallow
#

No

valid burrow
#

not in this case

young knoll
#

It’s a checked exception

#

You have to catch it

valid burrow
#

yep

remote swallow
#

Whats that i hear? Is it the learnjava command

#

?learnjavs YES IT IS

#

?learnjava

undone axleBOT
#

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! 🎉

storm crystal
#

so I wont use it

young knoll
#

It’s not

valid burrow
#

invalid?

#

no its not

#

what xd

#

this is with twr if youre wondering. Both work

    public static byte[] serializeItemStack(ItemStack itemStack) {
        try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
             BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream)) {

            dataOutput.writeObject(itemStack);
            return outputStream.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
remote swallow
storm crystal
#

okay whatever how about the other way around

remote swallow
#

wdym how about the other way around

storm crystal
#

I can put it to database

#

how to get it out

#

and read it as itemstack

valid burrow
#

u need the same method reversed

#

i could spoonfeed but how about you try to do it youself

storm crystal
valid burrow
#

no idea what that means lolz

remote swallow
#

if you dont try to do anything yourself and rely on us to do everything for you that isnt gonna get you far

storm crystal
#

its just a personal project

#

lol

#

nothing serious

#

I would never touch java to begin with but im forced because its minecraft

valid burrow
#
public static ItemStack deserializeItemStack(byte[] byteArray) {
        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(byteArray);
             BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream)) {
            return (ItemStack) dataInput.readObject();
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
            return null;
        }
    }
``` - here u go
storm crystal
#

finally

remote swallow
#

if you dont want to touch java and dont learn it properly pay someone to do it for you

storm crystal
#

no

#

what do I set byte array as

remote swallow
#

blob

cursive kite
#

I have a command that I set the permission default: false because I only want specific players using it, but it is denying permission to console, how can I give console permission?

remote swallow
#

default: op

cursive kite
#

In this case I do not want OP to have this permission

storm crystal
#

doesnt work for this

valid burrow
#

you dont want op to have the permission?

remote swallow
eternal night
#

(or just use getBytes/setBytes)

remote swallow
#

smh lynx stop spoonfeed

eternal night
storm crystal
#

so which one is it now

cursive kite
#

I do not want OP having a certain command for my project, but I'd like Console to be able to.

remote swallow
storm crystal
valid burrow
#

you simply shouldnt give people OP if they arent supposed to do virtually anything

#

OP is the supreme

cursive kite
#

I get that, I just want to know if this is possible or not?

valid burrow
#

well sure you could test onCommand

#

allow op to use the command but check inside the command if they fullfill what ever else you are looking for

chrome beacon
storm crystal
#

why it doesnt work

#

isnt it literally 0 bytes

valid burrow
#

0 bytes would be nothing

young knoll
#

That’s how epics brain is stored

remote swallow
#

real

valid burrow
#

i share a boolean with @quaint mantle

storm crystal
#

lets hope that it works

valid burrow
#

2 negatives is a positive yk

remote swallow
#

i love the explanation of 2 negatives = positive

valid burrow
storm crystal
valid burrow
#

dawg

#

why are you asking questions here

#

if you dont trust us

#

brreh

remote swallow
#

average helpdev interaction

valid burrow
#

go ask gpt then

storm crystal
#

I dont trust you 100% of course

#

that would be idiotic

valid burrow
#

then trust the hivemind of spigotmc

remote swallow
#

spends 2 hours trying to get spoonfed and then comes back 10 seconds later because they failed to copy code

valid burrow
#

epic how large is a boolean

storm crystal
valid burrow
storm crystal
#

how do I write it into sql database now

#

do I just type bytes or what

remote swallow
#

wdym type bytes

storm crystal
remote swallow
#

blob

#

setBytes/getBytes and type is blob

valid burrow
# storm crystal

i would also recommend you to seperate stuff into different tables

storm crystal
#

no

valid burrow
#

alr

#

then dont

remote swallow
valid burrow
#

its not my server suffering

storm crystal
#

im only testing it

remote swallow
#

everything i ever store is 1 table

storm crystal
valid burrow
#

alright ill stop helpin u sure

#

my god

storm crystal
#

I want to check a single thing and you already act as if you just jumped out of boiling water

valid burrow
#

it aint that deep

storm crystal
#

where did I ask for help in that

storm crystal
valid burrow
#

i understand why eveyrone wants to block u geez

storm crystal
#

well then do

valid burrow
#

oh i will

storm crystal
#

they still help me anyway so whats the difference

#

thats just bluffing

remote swallow
#

voss i thought you sent a bug gif but there was an actual bug on my screen

valid burrow
storm crystal
#

haha of course

#

gotta show everyone how you blocked me just to then talk with me even more

#

classic

valid burrow
#

anyways ill make a custom tree plugin now

#

have fun yall

night gorge
#

I have a configuration file layed out as so:

data:
- key1: value1
  key2: value2
- key1: value3
  key2: value4

I'm currently trying to read in the ConfigurationSections with conf.getList("data"), and casting it to a List<ConfigurationSection>

However, when I attempt to loop through the ConfigurationSections with

for(ConfigurationSection section : sections) {
```I get thrown an error:
> class java.util.LinkedHashMap cannot be cast to class org.bukkit.configuration.ConfigurationSection
I haven't been able to find a solution or post on the spigot forums, so thought I'd ask here. Sorry if I'm interrupting a conversation
valid burrow
#

and add it to the hashmap

buoyant viper
#

she linked on my hash till i map

remote swallow
#

use getMapList it returns a List of hashmaps with the data

valid burrow
#

didnt know that method exists lolz

storm crystal
#

how do you add commands

remote swallow
remote swallow
buoyant viper
buoyant viper
#

that outline how to get started

storm crystal
remote swallow
#

i go months without touching java and still remember

buoyant viper
#

why would u not check the docs if u didnt know/remember how to do something

night gorge
remote swallow
night gorge
#

Ah

#

Thanks, I'll try that 😄

storm crystal
remote swallow
storm crystal
#

Im on new OS so I have most of my things wiped

flint coyote
flint coyote
#

His new OS wiped google

storm crystal
storm crystal
flint coyote
#

Why don't you sync your bookmarks with your google account?
Helps a bunch especially since they are available on all your devices

storm crystal
#

and who are you to magically care about me out of nowhere lol

#

I didnt do it and thats the end of the story

flint coyote
#

You sure are a fun person to be around huh? Fine, I'll ignore you

plucky rock
#

any1 know where to donwload the spigot 1.20.5 dependency

remote swallow
#

1.20.5 got replaced by 1.20.6

plucky rock
#

ah

#

do uk where it is

#

the link i used seems to not work anymore

storm crystal
flint coyote
#

Are you using maven or do you need an actual jar?

storm crystal
plucky rock
#

i need the jar

plucky rock
#

tysm

storm crystal
#

is byte[] itemstacks or itemstack

glass mauve
#

?

storm crystal
eternal night
#

depends on what you write to it

#

a byte[] is just that, an array of bytes

storm crystal
#

okay

#

but

#

its irrelevant

#

is stack one byte or array of bytes

eternal night
#

a stack is an array of bytes

#

so is an array of stacks

storm crystal
#

if I want to store several itemstacks do I neeed to make array of array of bytes

#

or what

eternal night
#

well, you'd flatten them into a single byte array presumably

#

but yea, you serialise each item stack into its byte[] and then combine them all into a format you can read later

buoyant viper
#

byte[][] would go crazy frl

storm crystal
#

how to read it

valid burrow
storm crystal
#

do I use inventory.addItem(byte[]);

#

will it add several items at once

eternal night
glass mauve
eternal night
#

no

storm crystal
eternal night
#

there just use that

storm crystal
#

no idc about that

eternal night
#

aight, gl 💪

storm crystal
#

why did you even help at this rate

#

lol

glass mauve
#

?

eternal night
#

You don#t seem to have any clue what is happening

storm crystal
#

thats why im asking questions

valid burrow
#

dusk please just leave the server

eternal night
#

That is too much for me, so I am just gonna go

storm crystal
#

I dont expec tto have something thrown at me with "here, take it or leave it"

eternal night
#

and wished you good luck

glass mauve
#

well if you would put a little bit of effort into your question it would be easier to help you

eternal night
#

no, I just don't have the energy to walk you through this

#

maybe someone else will

#

a binary format is a tedious topic

storm crystal
valid burrow
#

"How do i do x"
sends link on how to do x
"NO!"

storm crystal
#

you attempt something ure not capable of for no reason

eternal night
#

I mean, I started with just "what is a byte[]"

#

We solved that

#

and then you asked for more

storm crystal
eternal night
#

at which point, I dipped

glass mauve
eternal night
#

Its a gist that spoon feeds you exactly what you asked

storm crystal
eternal night
#

conversion of an Inventory to byte[]

#

in this case, byte[] is encoded in base64

valid burrow
#

No context??? The code is entire commted

eternal night
#

but that should not matter

valid burrow
#

from top to bottom

river oracle
#

He's encoding item stacks in base64 even though I said that'd be idiotic earlier...

eternal night
#

it is yea

river oracle
#

Nice glad to see he needs to be thrown the code

eternal night
#

but its still a good jump of point

#

that isn'T their gist @river oracle

storm crystal
#

because people just throw code at me with no explanation and expect me to be thankful for that

eternal night
#

its a somewhat popular gist for ItemStack[] -> base64

glass mauve
eternal night
#

I don#t expect you to be thankful OMEGALUL

young knoll
#

Why would you ever need an item as base64

storm crystal
#

how would I know?

eternal night
#

It should still give you an idea on how to write a full array of items

storm crystal
#

I dont give a shit about that code its out of context and I wont be using it at all

#

also its apparently shit

eternal night
#

loop over the array

eternal night
#

write each of them into the bukkit output stream

glass mauve
eternal night
#

(okay but y2k_ is an idiot /s)

young knoll
#

I guess like, storing it in a config but non readable?

#

Idk why you’d need that but yeah

river oracle
eternal night
#

sorry OMEGALUL

valid burrow
#

no clue how we ended up with bas64 though

#

i blocked him at some point

eternal night
#

write each ItemStack[] into the BukkitObjectOutputStream

valid burrow
#

for your sanity

#

go to sleep

eternal night
#

as seen here

#

make sure to write the length of the array first, so you can reconstruct that too

valid burrow
slender elbow
eternal night
#

they are on ItemStack[} now

eternal night
slender elbow
storm crystal
#

okay I cleared my project out of every single idea that has been passed there

#

and now I will ask again

storm crystal
#

how do I save inventory (menu or stash) into a persistent data holding structure

plucky rock
#

any1 have any reasources on updating my plugin to 1.20.6

valid burrow
valid burrow
#

?

#

U go to ur pom.xml or what ever

plucky rock
valid burrow
#

and change the number

plucky rock
#

thats it?

valid burrow
#

yeah

storm crystal
#

im tired of getting an answer, someone goes and says that its shit so I need to clean my code off it

eternal night
#

Convert either the inventory or stash to ItemStack[].
Create a BukkitObjectOutputStream.
Write the length of the array
Write each item in the ItemStack[]
Grab the bytes the from the OutputStream the BukkitOutputStream was based on
Profit

#

I don't know of a better method on spigot

plucky rock
#

Dependency 'io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT' not found i get that error

slender elbow
#

sir, this is spigot

storm crystal
#

what does that mean

eternal night
#

When you go the other way around, create a BukkitObjectInputStream
Read the lenght
Create a new ItemStack[readLengthHere]
Read length times an ItemStack from the BukkitInputStream.
Set it to the created Array
Return it

eternal night
#

and the second is a for loop and a write object

young knoll
#

Pretty sure those things can just take an Itemstack[]

valid burrow
#

coll

eternal night
#

I would not pray on it

valid burrow
#

can you convince md to automatically send the gif every time someone mentions paper

storm crystal
#

but how the fuck do I write length of array

eternal night
#

you call writeInt

#

as I wrote above

storm crystal
#

what does that even mean

eternal night
#

you call writeInt on the BukkitObjectOutputStream

young knoll
#

Okay but what does that mean

slender elbow
#

what does that mean

river oracle
#

what does that mean

glass mauve
valid burrow
#

what does that mean

eternal night
#

Trolls

#

unprofessional spigot staff team as per usual coll

river oracle
#

smh so true

river oracle
#

if this was paper you'd be demoted

glass mauve
storm crystal
#

isnt there sizeOf kind function like in C

eternal night
#

.length

#

on the array

valid burrow
glass mauve
#

real

valid burrow
#

luckily it aint

warm mica
#

you need to chill

valid burrow
#

Dust out here trying to clutch a 10vs1

glass mauve
#

dust?

warm mica
#

i think its more a 10vs1 trying to deal with somebody acting like hes still in puberty, be more respectful man

valid burrow
#

dusk

#

same thing

storm crystal
valid burrow
#

Im talking about you thats a big difference lol

#

also i showed U

storm crystal
#

you cant even show that you are better than that lol

valid burrow
#

cause u said something along the lines of "youre bluffing anyways"

storm crystal
#

so yeah

glass mauve
#

for me it seems like lack of java knowledge

storm crystal
eternal night
#

because only that thing is able to write your ItemStack to a byte array output stream

plucky rock
#
  <dependencies>
      <dependency>
          <groupId>io.papermc.paper</groupId>
          <artifactId>paper-api</artifactId>
          <version>1.20.4-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
  </dependencies>```
im sorry this is my first time doing something like this how would i swap this to 1.20.6 since if i swap the number 1.20.6 it errors and if i swap the paper to spigot it still errors i have the spigot 1.20.6 api in my dependencies alrdy
valid burrow
#

perhabs even maven clean install

storm crystal
plucky rock
plucky rock
valid burrow
#

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

#

here u go

eternal night
plucky rock
#

ty

warm mica
valid burrow
#
      <repository>
          <id>spigotmc-repo</id>
          <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
      </repository>
plucky rock
#

tysm guys ur the best

remote swallow
#

Smh voss stop spoon

storm crystal
#

what does this mean

glass mauve
#

basically just using the outputstream

storm crystal
#

how do I know when itemstack ends and when starts

#

if its right on another place

#

is itemstack just one byte

eternal night
#

no

#

the BukkitObjectOutputSTream handles that for you

storm crystal
#

so what, I get byte[] array and for each element I get ItemStack[] array element or what

eternal night
#

hm?

#

no you'd convert ItemStack[] <-> byte[]

storm crystal
#

?

#

why the fuck do I need to convert into byte[] if I WANT itemstack from OUTPUT

#

?

glass mauve
#

output is not for reading from database

#

not sure what you mean

eternal night
#

oh

eternal night
storm crystal
#

I dont get it

#

why do methods from Voss not give out ItemStack[]

storm crystal
#

if my byte array has 3 itemstacks in it

eternal night
#

Presumably because you didn't ask for it?

storm crystal
#

?????????

#

I was literally asking for making it for INVENTORY, not one singular itemstack

eternal night
#

again, both a single ItemStack and an ItemStack[] are represented in a byte array

storm crystal
#

once again giving half assed help

storm crystal
#

that byte array

storm crystal
#

into itemstacks

glass mauve
storm crystal
#

yeah exactly, so that method is fucking useless lol

#

for what I need

eternal night
#

Yea

storm crystal
#

im not even hour into coding after several month break and I dont know what I hate more

#

java or you all

eternal night
#

I mean, we can only do so much here :/

glass mauve
#

Well you are making it hard yourself

eternal night
#

I already laid out the method logic above

#

I don't think I can really do more that isn't just "here you go, spoonfed code"

storm crystal
remote swallow
#

You are relying on spoonfeeding, do a java course and refresh your memory and use google before coming here

glass mauve
#

lack of java knowledge, you ever heard of serialization? also helper laid out full logic for your question

storm crystal
#

or object oriented shit

glass mauve
#

well thats fine

storm crystal
#

I work with C if anything

glass mauve
#

but it will make it harder to create java projects then

storm crystal
#

and?

#

did I ask for any of this?

glass mauve
#

what?

storm crystal
#

its not my fault that minecraft is in java

ivory sleet
#

i mean using byte[] is just a way of representing a stream of bytes, or well bits yk

storm crystal
#

and I want to do minecraft oriented project

glass mauve
#

well no, but you need to accept it

eternal night
#

Yea but relying on strangers to walk you through every little detail with the attitude of "I don't work in java, idc about learning it" isn't really nice towards said strangers

glass mauve
#

and either grab some java knowledge or you wont get far

storm crystal
storm crystal
eternal night
#

oki 👍 I guess you are free to leave

storm crystal
#

well I wont, I want help, not appreciation

glass mauve
#

but why? spoonfeeding wont give you anything, and the questions you asked got answered

remote swallow
#

I love thr fact that this is hour 3 of him wanting help

ivory sleet
#

if I so may ask

storm crystal
ivory sleet
#

did u solve the issue, or is there still something left that u're confused abt

storm crystal
#

issue is still

glass mauve
#

so what is stopping you?

ivory sleet
storm crystal
#

I still dont know if I should SQLite database for it

#

or anything else

#

because everytime I get a different answer

ivory sleet
#

well what did you initially want to do?

storm crystal
#

persistent storage for:
custom inventories (GUI, storage)
custom item and entity data
player statistics

valid burrow
#

Anyone here fuck with custom world generation? Im trying to find a way to modify the trees on world generation

ivory sleet
valid burrow
#

But i was yet unable to find a way to retrieve where trees are usually spawned

ivory sleet
#

is this project merely for learnings, or do you have any more formal "business requirements"

storm crystal
#

its my personal project

ivory sleet
#

well I mean, obv different storage types have pros and cons, if its ur personal project you get to decide 100% on which one to pick

#

:>

storm crystal
#

of course

#

thats the answer im getting there all the time

#

the most vague and useless shit

ivory sleet
#

yea, well its hard for me to dictate which one you should pick

storm crystal
#

nobody is even bothered to list anything

#

or give examples

valid burrow
ivory sleet
#

well if you want examples
flat file, that is using raw files and store it in json, yaml etc

file database, like sqlite

an actual database service, like mongodb, postgresql

#

i think are most common

ivory sleet
valid burrow
#

ah damn

ivory sleet
#

unsure how helpful that is tho

#

:,)

young knoll
#

Yeah worldgen is pain

#

What do you want to do

valid burrow
#

replace trees with custom ones

young knoll
#

I’m not sure if any events fire for them during worldgen

#

Hmm

storm crystal
#

and I dont know pros or cons of any of this

valid burrow
#

afaik they dont

glass mauve
young knoll
#

Yeah doesn’t look like it

#

So you’d have to dive into NMS

valid burrow
#

😭

#

my worst nightmare

#

world generation

#

and nms

#

in the same class

#

oh no

storm crystal
#

I dont care what some random sites say about it

#

I want answer based on experience specifically from minecraft servers

glass mauve
#

but you care what some random person says?

eternal night
#

Well, the best solution is a proper database service, list postgresql or mariadb

#

But that'll be overkill for a small personal project

#

and has a steeper learning curve

#

SQLite works too, has some of the SQL advantages but is a flat file, less setup for you

#

YAML/Json are probably the easiest, but terrible for long term plugin maintenance or any form of data analysis down the line

ivory sleet
#

when I write a larger project I always write a mock persistence system using flatfiles just to make it integretable w other modules of my project

storm crystal
#

I can use yaml for it

#

"but it will look ugly"

eternal night
#

Yea I mean, again, your decision

#

idk your skill set in SQL

ivory sleet
#

yaml is maybe a good start

#

you can eventually change it later

eternal night
#

The bukkit yaml api is dead easy for it, iirc even has getItemStackList methods

#

or something close

storm crystal
eternal night
#

Then probably stick to yaml

twilit wharf
#

How do I send packet bundles using NMS? I cant seem to figure out and no one has made any documation for it.

eternal night
#

ClientboundBundlePacket just takes an Iterable<Packet>

twilit wharf
#

oh wait what

#

I didnt know that class existed, I thought it was PacketBundlePacker

young knoll
#

Bundle packets my beloved

eternal night
young knoll
#

I wonder what happens if you send a bundle start but never a bundle end

sullen marlin
#

?xy

undone axleBOT
eternal night
#

death

young knoll
#

I assume the client will just give up after a while

eternal night
#

yea, at the timeout kick KEKW

quaint mantle
#
e.renderer((source, sourceDisplayName, message, viewer) ->
                    Component.text().append(
                            Component.text(),
                            Component.text(ChatColor.WHITE + e.getPlayer().getName() + " : " + ChatColor.WHITE), message
                    ).build()
            );

It is not work on 1.20.4 spigot. how to fix it?

#

it is using in AsyncChatEvent

eternal night
#

That looks like paper code sweating

#

not spigot code

quaint mantle
#

oh shit

#

then how to use it on Spigot?

#

setFormat doesn't work too

eternal night
#

The AsyncPlayerChatEvent

#

but yea, setFormat it would be

#

make sure your thing is registered as a listener

quaint mantle
#

                    e.setFormat(ChatColor.RED + e.getPlayer().getName() + ChatColor.GRAY + ": " + ChatColor.WHITE + e.getMessage());

Just like it?

eternal night
#

no that is not the format

#

see the setFormat javadocs

#

String.format(String, Object...) compatible format string

ionic thicket
#

if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
saveResource("custom.yml", true);
}

#

java.lang.IllegalArgumentException: The embedded resource 'custom.yml' cannot be found in plugins\plug

quaint mantle
#

hmmmm?

worldly ingot
#

setFormat() will use a string format where the first argument is the player's display name and the second argument is the message. So ChatColor.RED + "%s" + ChatColor.GRAY + ": ' + ChatColor.WHITE + "%s" is the format you would want

#

Yes, it would work, if you have a custom.yml file in your plugin's resources

ionic thicket
#

well if it doesn't exist it should create one by itself

worldly ingot
#

Are you trying to create an empty yml file? Or are you trying to copy one from your plugin?

ionic thicket
#

onEnable it should check if there's or there's not a "custom.yml", if there is.. fine. else make one

worldly ingot
#

Okay, so you just want to make a file. saveResource() copies one from your plugin folder

#

Here I do saveResource("categories.yml", false)

worthy yarrow
#

Choco you use eclipse?

worldly ingot
#

But if you wanted to just make a yml file without copying one from your plugin's resources directory, you can make a new File object and use createNewFile() instead

#
File file = new File(getDataFolder(), "custom.yml");
try {
    file.createNewFile();
} catch (IOException e) {
    e.printStackTrace();
}```
#

createNewFile() already checks if a file exists so you don't have to do it yourself

worldly ingot
worthy yarrow
#

And your eyes don’t hate you?

worldly ingot
#

Nope 🙂

young knoll
#

He even uses light mode

#

Can’t believe hypixel allows this to happen

ionic thicket
#

maybe that's the secret

quaint mantle
worldly ingot
#

That's the fun part. Most of them don't know 😎

quaint mantle
#

WHAT THE F***

ionic thicket
quaint mantle
#

a user with white mod and eclipse

twilit wharf
#

I have a system that adds fake entities as passengers to all living entities. How would I go about showing their nametag? It hides it, and currently I have a bukkit runnable to manually detect for it, but is there an easier / more efficient way?

worldly ingot
#

Bro, I got so cooked when I joined into the onboarding and I had to say "I uh... I don't use IJ"

quaint mantle
#

ba* him

young knoll
glad prawn
#

that doesnt look like ide

worldly ingot
#

I'm not on the anti cheat team!

twilit wharf
quaint mantle
worldly ingot
#

Though I don't tend to ask

ionic thicket
#

md_5

young knoll
#

Maybe they’ll hire MD

ionic thicket
#

Choco how long have you been programming and how much time since you started developing plugins?

quaint mantle
#

I think hypixel should revive invaders. it is fun. or make server pack for us.
BECAUSE I USED 500 dollar in hypixel

worldly ingot
quaint mantle
#

WHAT THE F***

worldly ingot
#

Yeah. Lua scripts

#

Roblox and whatnot

eternal night
worldly ingot
#

I was so proud of my Lua calculator

quaint mantle
#

I started coding with skript plugins at 11...

#

and now is 15....

eternal night
#

my only touch point with lua was ehh

quaint mantle
#

ummmmmm......

eternal night
#

what are they called

worldly ingot
#

ComputerCraft?

eternal night
#

YES

worldly ingot
#

The Minecraft mod

#

Great mod

eternal night
#

the dumb turtles

ionic thicket
eternal night
#

tbh, ever since they added import from gist

#

shit got too easy

worldly ingot
#

fr though

quaint mantle
#
@EventHandler
    public void onChat(AsyncPlayerChatEvent e) {
        Scoreboard b = e.getPlayer().getScoreboard();
        Team team = b.getEntryTeam(e.getPlayer().getName());
        if (team != null) {
            switch (team.getName()) {
                case "RED":
                    e.setFormat(ChatColor.RED + "%s" + ChatColor.GRAY + ": " + ChatColor.WHITE + "%s");
                    break;
                case "YELLOW":
                    e.setFormat(ChatColor.YELLOW + "%s" + ChatColor.GRAY + ": " + ChatColor.WHITE + "%s");
                    break;
                case "GREEN":
                    e.setFormat(ChatColor.GREEN + "%s" + ChatColor.GRAY + ": " + ChatColor.WHITE + "%s");
                    break;
                case "AQUA":

                    e.setFormat(ChatColor.AQUA + "%s" + ChatColor.GRAY + ": " + ChatColor.WHITE + "%s");
                    break;
                default:

                    e.setFormat(ChatColor.WHITE + "%s" + ChatColor.GRAY + ": " + ChatColor.WHITE + "%s");
                    break;
            }
        }else {
            e.setFormat(ChatColor.WHITE + "%s" + ChatColor.GRAY + ": " + ChatColor.WHITE + "%s");
        }
    }

It doesn't work.

eternal night
#

is it registered

#

do you have other plugins messing with chat?

quaint mantle
#

SHIT RED COLOR IN /pl

eternal night
worldly ingot
#

That'd do it

quaint mantle
#

@worldly ingot My dream is working in hypixel.

Can you give me some advices?

worldly ingot
#

Just get as much practice in as you can :p The more experience you get, the better. I've worked on like 5 different networks before applying to Hypixel

#

Each incrementally larger

sullen marlin
#

dedicate a year of your life to doing the 23 different interviews required

eternal night
worldly ingot
#

fax

#

It literally took a month

#

I'm not even exaggerating. My whole October was interviews lol. I had 6

#

Shit's like the NSA

eternal night
#

Only a month Sadge

#

I wish

quaint mantle
#

hmmmmmmmmmmmm

#

WHAT THE F***

worldly ingot
pearl forge
#

hi, how could I make it so that if I hit a mob that is in a boat, it will get out of the boat?

worldly ingot
#

At one point I had 3 interviews back to back to back

eternal night
quaint mantle
#

@worldly ingot Hypixel closed anticheat development applications. do you know the reasons about it?

worldly ingot
#

The only reason it took as long as it did is because they do it in waves of people, so even if I did my interviews quickly, I had to wait for everybody else

worldly ingot
eternal night
#

oh my god

#

there it is, an opening

worldly ingot
#

Yeah they're always open

eternal night
#

ah fuck

#

Deep understanding of CraftBukkit/Spigot

#

thats it for me, craftbukkit is a mystery

ionic thicket
#

Choco ever worked with forge?

worldly ingot
#

Plenty, yeah

ionic thicket
#

Harder than spigot api? xD

worldly ingot
#

Much, but very fun 🙂

quaint mantle
#

Why hypixel updates only skyblock so many times?

quaint mantle
ionic thicket
#

coems 🤑

quaint mantle
#

how to fix it

kind hatch
#

Use a Material?

young knoll
#

Yo social media coordinator opening

#

Perfect

quaint mantle
worldly ingot
#

If you want an ItemStack, you're looking for ExactMatch

quaint mantle
#

What is it?

storm crystal
#

how to use yml

worldly ingot
#

RecipeChoice.ExactMatch

quaint mantle
#

Oh

kind hatch
young knoll
#

Dang the terminator requires a trident and a netherite block now

#

New skyblock update is wild

quaint mantle
storm crystal
quaint mantle
#

I can't understandd this code

ionic thicket
kind hatch
storm crystal
kind hatch
#

Can you be a little more specific?

#

Cause there's two ways to do it with spigot.

storm crystal
#

How to use yml for information that changes over server time

#

Like player kills

kind hatch
#

That's just writing the data to the file no?

ionic thicket
#

I want to check if a player has executed a command thru a boolean value.
I would add this player to a list in the command's class and let the code execute only if this guy is not in that list. What happens if another player executes the command? doesn't another instance of it get called?

kind hatch
#

Depends on your code. :p

storm crystal
ionic thicket
#

that's what a config is used for

kind hatch
ionic thicket
#

so everytime a command gets executed it goes to check the same instance?

kind hatch
#

Every time a command is executed, the command logic is triggered.
So if your list that you are checking against has already been initialized outside of the command logic, then yes. Your command code would be checking against the already created instance.

storm crystal
#

Can I use caching for yaml just like for sql database?

sullen marlin
#

the bukkit config API is in memory once loaded, so caching shouldnt be super necessary

storm crystal
#

So what I can just open and edit yml files in demand?

sullen marlin
#

I dont quite understand

kind hatch
# kind hatch Every time a command is executed, the command logic is triggered. So if your lis...

@ionic thicket

public class MyCommand implements TabExecutor {

  private List<Player> players = new ArrayList<>();

  @Override
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    // Do your instanceof check beforehand here.
    Player player = (Player) sender;

    // This is an access method.
    // The List has already been initialized and won't be reinitalized unless you assign it to another list.
    players.get(player);
  }
}
ionic thicket
#

Alright, but what if i wanted to clear this from another command in another class

#

I should be making it static

kind hatch
#

You can either make a getter method for the list or have the data live in another class that you can manipulate.

#

Multiple ways to do it really.

worldly ingot
#

List#get() doesn't exist btw

#

;p

kind hatch
#

wut?

worldly ingot
#

Or, at least, not in the way that you've described it

#

You probably wanted contains()

storm crystal
#

I can just save it immediately to yml file?

kind hatch
ionic thicket
#

cuz if i don't make it static and create a new instance in another class to erase that list - that wouldnt have effect since the new instance would have an empty list

kind hatch
ionic thicket
#

that's why I was trying not to use it

storm crystal
#

What if I need to do it frequently

#

Isnt it better performance-wise to cache?

kind hatch
#

If you need to do it frequently, then you can periodically write the updated data to disk.

#

Spigot's yml files are basically cached already, so you would just need to delay the write to disk by putting the save method on a timer.

#

There are other caching strategies that you can use, this is just one of them. (Known as Write-Behind)

ionic thicket
storm crystal
#

I want it to be updated as soon as it can

sullen marlin
#

Then put a .save after each .set

kind hatch
kind hatch
storm crystal
#

So I will cache

#

And save only on server restart/disable

kind hatch
#

That's all well and good, but you have the potential problem of server crashes and if you only save on restart/disable then you risk losing the data.
Which is why it's a good idea to periodically save on top of saving regularly.

storm crystal
#

I dont care about it for now

worthy yarrow
#

Will you care about it eventually?

#

If yes, then just implement now. No reason to wait

pearl ferry
#

Hey all. I'm trying to run the BuildTools GUI but I'm having trouble getting it to detect the right java version. It can detect versions 1.8 and 18, but not versions 17 or 22. Even when I manually select the java.exe for either 17 or 22 I still get the error saying that BuildTools could not find the necessary Java executable. Does anyone know why it would detect only those two versions? My 1.8 install is in program files (x86) and the other three versions are in program files

sullen marlin
#

Please post the log

#

You can also try without the gui

kind hatch
pearl ferry
#

No log shows up from what I can tell. I click build and this error pops up

BuildTools could not find the necessary Java Executable to build latest.
Java 17 or Java 22 is required to build latest.

You can download the necessary version using one of the following links.
The provided links have downloads for all operating systems.

Make sure you install the executable file and not the .zip / .tar.gz!
Windows (.exe / .msi)
Mac (.dmg / .pkg)
Linux (.deb / .rpm)

OpenJDK
https://adoptium.net/temurin/releases/

Azul
https://www.azul.com/downloads/#zulu

Oracle
https://www.oracle.com/java/technologies/downloads/

Once you have installed the necessary java version, please restart BuildTools and try again.

If you believe this error to be a mistake and already have the required java version installed, please follow these instructions:

1. Go to the Options tab
2. Enable the `Override Java Executable` checkbox.
3. Provide the correct java path.
4. Try again. :)
pearl ferry
storm crystal
#

I cant be arsed with it right now

pearl ferry
#

That's unfortunate. Let me try removing any references to other java versions and setting JAVA on my path to version 22 and see if that helps

sullen marlin
#

What java did you install btw

#

From where

pearl ferry
worthy yarrow
pearl ferry
#

I got it fixed 🙂
Previously I had my path setup so that when I ran java from the command line it was version 1.8. I updated my path and JAVA_HOME to version 22 and now it's detecting and I got it to build

copper scaffold
trim quest
river oracle
#

oh you have that

#

you just left it out of your message lol

trim quest
quaint mantle
#

Please tell me how to forcefully change the player's item durability.

#
ItemStack stack = e.getPlayer().getInventory().getItemInMainHand();
                                Damageable old = (Damageable) stack.getItemMeta();
                                old.setDamage(old.getDamage() - 1);
                                stack.setItemMeta(old);
                                e.getPlayer().getInventory().setItemInMainHand(stack);
#

It doesn't work

sullen marlin
#

What's the item?

#

Code seems fine to me

grim hound
#

1 is just very subtle

#

Almost not noticeable

viral temple
quaint mantle
#

full -> full

#

no -1

brittle geyser
#

DeluxeMenus use inventory holder, is this a problem?

viral temple
brittle geyser
viral temple
viral temple
viral temple
#

And do you have any errors in the console?

#

Or maybe, does your item have the unbreaking enchantment?

sullen marlin
viral temple
upper hazel
#

why section.contains(path) works so crookedly? If a section has a path with a value, it finds the path, but if there is no value despite the presence of a path in the section, it returns false

#

and even if I put "null" in the section path, it still won't find the path.

viral temple
upper hazel
#

its yml

upper hazel
#

can give link?

viral temple
upper hazel
#

i see null this mean "empty" but it still doesn't answer the question obaut section.contains(path)

#

this shold return true if there is a path regardless of its value

glad prawn
#

{} empty map

#

[] empty list

hazy parrot
#

even tho its supported by yaml specs

upper hazel
#

even if there is no null there but just an empty path it will generate false documentation bukkit does not follow the logic of the method should not look at the value in the path it should know if the path itself exists.

hazy parrot
#

if there is no null, it means that path isn't even parsed -> path doesn't exist

#

as it contains no value

native ruin
#

RayTraceResult rayTraceResult = p.rayTraceBlocks(distance);
When looking at an entity (within the distance), rayTraceResult.getHitEntity() is null always null
new fixed it

upper hazel
#

this mean not exists? But i see it

#

bukkit not see it in file?

hazy parrot
#

every yaml is parsed to key-value in memory and is read from it

#

if value doesn't exist, path will not be parsed

hazy parrot
upper hazel
#

why doesn't he see it as an empty value?

hazy parrot
#

afaik yaml preprocessor in snakeyaml doesn't support null values

upper hazel
#

bruh..

tropic totem
#

hello im new on developing plugin and ihave some issue about this? any idea?

C:\Users\reyro\IdeaProjects\sampleplugin\src\main\java\net\ghostplays\template\api\Parser.java:17: error: cannot access ServerPlayer
        return Cobblemon.INSTANCE.getStorage().getParty(player.getUniqueId()).get(slot - 1);
                                              ^
  class file for net.minecraft.server.level.ServerPlayer not found
chrome beacon
#

How are you depending on nms?

#

And how are you building?

tropic totem
#

this is reporsitory from abandon developer and i cant reach the developer and i already debug some of the error but the nms is my issue

#

this is the code from that error

package net.ghostplays.template.api;

import com.cobblemon.mod.common.Cobblemon;
import com.cobblemon.mod.common.api.storage.NoPokemonStoreException;
import com.cobblemon.mod.common.pokemon.Pokemon;
import org.bukkit.entity.Player;

public interface Parser {
    String getID();

    void register();

    Object parse(Player player, String[] args) throws NoPokemonStoreException;

    default Pokemon getPokemon(Player player, int slot) throws NoPokemonStoreException {
        // Handle NoPokemonStoreException if necessary
        return Cobblemon.INSTANCE.getStorage().getParty(player.getUniqueId()).get(slot - 1);
    }
}

chrome beacon
#

So the answer to my question would be that you don't know?

tropic totem
chrome beacon
#

That would probably be the issue

#

You should add it

tropic totem
#

any idea how i add it? becuase i cant see any info on internet?

chrome beacon
#

What version? Maven or Gradle?

tropic totem
#

1.20.1 gradle

chrome beacon
#

Start by running BuildTools for 1.20.1

#

?bt

undone axleBOT
chrome beacon
#

(With the --remapped flag)

tropic totem
tardy delta
#

what even is the end user of that parser supposed to do with an Object?

chrome beacon
#

To your project

tropic totem
#

Cobblemon player data

tropic totem
onyx fjord
#

any alternatives for paper userdev for gradle?

chrome beacon
blazing ocean
#

?whereami

onyx fjord
eternal night
#

read up half a page xD

onyx fjord
chrome beacon
#

Yeah I sent that like 4 messages above your question

eternal night
tropic totem
chrome beacon
#

Try and see if it works

onyx fjord
#

how do i open bt gui from the jar?

eternal night
#

iirc a --gui flag was added

onyx fjord
#

oh yea

tropic totem
sullen marlin
eternal night
onyx fjord
eternal night
#

Who even has a file manager OMEGALUL

onyx fjord
#

not sure if its nautilus fault

eternal night
#

idk if you even get javaw on a linux installation

#

I doubt it

#

or well, something the like

sullen marlin
#

Anyway, just use the gui arg then

#

Ubuntu at least associates a double click in nautilus

onyx fjord
#

probably depends how the package is installed

sullen marlin
#

(The official packages)

onyx fjord
#

is it a snap

#

or a deb

eternal night
#

What kind of java installation do you install that is a snap KEKW

sullen marlin
#

Deb, apt install openjdk-17-jdk or whatever

eternal night
#

27 stonks

#

md_5 leaking new spigot version

onyx fjord
shadow night
#

Damn bro be using java from 2039

eternal night
onyx fjord
#

yea im moving away for that reason

#

on my servers

eternal night
#

debian stonks

onyx fjord
#

what happened here

rustic crown
#

Trying to wrap my head around the potion-related changes in 1.20.6. Previously I'd look to see if a potion type startsWith("long_"), for instance, and then set the extended boolean in the PotionData instance accordingly. Same with strong_. Is there a backwards compatible way to do the same thing now? The 1.20.6 post says to use API that's been around since 1.9, but the only such API that seems remotely compatible between versions is the custom effect methods.

eternal night
#

which makes sense given that well, it aint a version on mojangs end either with .6 instantly yanking it

onyx fjord
#

lol ok

sullen marlin
rustic crown
#

But these weren't in 1.19 for example. Like, they didn't exist as PotionType enum values from what I can see.

#

Even in 1.20.4 it seems.

quiet ice
rustic crown
#

I guess maybe for full context, the syntax my code tries to parse is potion:<type>:<amount>, where prior to 1.20.6 I'd do the startsWith stuff to "chop off" part of the <type>, like long_swiftness would just become swiftness with the extended boolean set to true. It seems like now I can just omit the chopping, but then I break backwards compatibility. Even if I do a bit of "try-catch juggling", I still end up with a PotionType that I don't know exactly how to deal with without some form of reflection-based approach when I need to set the type on the PotionMeta, because the old setBasePotionData is now replaced with setBasePotionType.

sullen marlin
#

backwards compatability just isn't a thing

rustic crown
#

If there is no backwards compatible way to approach this without reflection, I will just have to live with that, but I'd obviously prefer to not have such a hard cutoff between versions.

sullen marlin
#

@lone jacinth might have some ideas about forwards compatibility

rustic crown
#

Yeah, forwards compatibility is what I'm looking for, thanks.

#

Or well, whichever way you turn it, really. I'd be happy working with the newest version of the API if it is backwards compatible, but working with 1.19 API that works with 1.20.6 is also fine.

sullen marlin
#

only that second option is a possibility of being supported

#

will look into it

rustic crown
#

Though I also have an issue with the whole sign open event vs. player interact event that requires a bump to 1.20.2 at least, so it might be a good time to make that hard cutoff.

rustic crown
sullen marlin
#

it would only be temporary though, the API is deprecated

rustic crown
#

Yeah I noticed PotionData has been deprecated for a while. A lot of my code is just little maintenance tweaks on top of a messy code base that's been mostly "stable" for over a decade. With all the things that happened in 1.9, 1.13, etc., it's really starting to crack 😛

#

But I'd also be perfectly happy to move away from PotionData to something non-deprecated that's available in the pre-1.20.6 API that is forwards compatible.

sullen marlin
#

it's compatible 1.20.2+

rustic crown
#

Right, there's a setBasePotionType in 1.20.2, I see.

#

And that's also when the open sign event was introduced, right?

onyx fjord
#

is there no 1.20.3 either?

civic sluice
#

nope skipped like .5

sullen marlin
rustic crown
#

Ohhh exciting! Do I just run BuildTools with --rev 1.20.6 to get a build with this commit?

sullen marlin
#

give it 10 minutes

#

I'll tell you when it's up

rustic crown
#

Thanks!

sullen marlin
# rustic crown Thanks!

ok should be up, use --rev 4156 if you get cached and it says its building an earlier build

rustic crown
#

I'll give it a whirl. Thank you 🙂

storm crystal
rustic crown
stiff sonnet
#

any idea why the drop click type isn't triggered in an inventory? I'm using event.getClick(). do I have to use something like event.getAction() instead?

#

middle click doesn't work either

chrome beacon
#

Which inventory?

stiff sonnet
#

an inventory inventory - one that I opened using openInventory and a Bukkit.createInventory

chrome beacon
#

Show your code

stiff sonnet
#
                else if (action.clickType == ClickType.RIGHT) { // works
... 
                else if (action.clickType == ClickType.DROP) { // doesn't trigger
...

return new WidgetActionResult("block.note_block.bell"); // falls through to this instead (just plays the bell soudn)
chrome beacon
#

You can use a switch instead of spamming elseif

#

Anyways how are you dropping?

stiff sonnet
#

enums in java are stupid

chrome beacon
#

Just pressing Q

stiff sonnet
#

drop key

#

yes

chrome beacon
#

So you're not holding ctrl or anything else

stiff sonnet
#

nothing else

#

you know what let me print the event name

chrome beacon
stiff sonnet
#

you cannot just switch enums easily

glad prawn
stiff sonnet
#

you have to do some random stuff around it

chrome beacon
#

?

stiff sonnet
#

[STDOUT] DROP
I don't get it

chrome beacon
#

You can switch an enum just fine

stiff sonnet
#

I used it before and intellij complained about some bs

#

so I just ignored that

#

you need to do some funky garbage

chrome beacon
#

Sounds like you did it wrong

glad prawn
stiff sonnet
#
switch(variablewithenumvalue): {
case EnumValue.Something: -> { // just doesn't work
}
}
chrome beacon
#
        ClickType type;

        switch (type) {
            case DROP -> System.out.println("You dropped smth");
            case RIGHT -> {
                System.out.println("Right clicked smth");
                System.out.println("This does work just fine :)");
            }
stiff sonnet
chrome beacon
#

Also do note that this syntax is for newer versions of Java

stiff sonnet
#

I know

chrome beacon
#

not Java 8

stiff sonnet
#

java 8 isn't even supported for newer minecraft versions anymore

chrome beacon
#

(in the old java 8 way)

stiff sonnet
#

you know what I figured it out.

#

you can't case Myenum.VALUE, you can only case VALUE

#

for whatever reason

drowsy helm
#

first case is how C# does it

stiff sonnet
#

it does seem more sensical to me since you know exactly what you're switching

#

even at a glance

blazing ocean
#

rust match my beloved

chrome beacon
#

They're quite simillar to the Java ones, no?

#

hm does look like the rust one support ranges and such

granite owl
#

is this approach redundant in java? ```java
public Boolean readFromBytes(byte[] bytes, Charset charset)
{
return false;
}

public Boolean readFromFile(String path)
{
    if (path == null) return false;

    String[] pathDelimited = path.split("\\.");
    if (pathDelimited.length <= 0) return false;

    String extension = pathDelimited[pathDelimited.length - 1];
    if (extension.equals(String.valueOf(this.settings.fileExtension)) != true) return false;

    File file = new File(path);
    if (file.exists() == false) return false;

    String content = "";
    try
    {
        content = Files.readString(file.toPath());
    }
    catch (IOException e)
    {
        e.printStackTrace();
        return false;
    }

    return this.readFromBytes(content.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
}
#

trying to get the data into a common format before processing it

tardy delta
#

Boolean?

brave pivot
#

If readFromBytes always returns false, why call it in the first place rather than returning false directly?

granite owl
#

ill approach it with regular expressions and theyre annoying to write

tardy delta
#

what are you even doing

granite owl
#

and the reason to read from byte array is because i want to be able to read encrypted data on the harddrive, decrypt it and then read from the decrypted byte array

brave pivot
#

And what is "content" for? You don't seem to be doing anything with it

granite owl
granite owl
tardy delta
#

parse Files.readString(Path.of(path)) ?

#

split every line on = ? (i assume ini syntax is like x=y)

granite owl
#

thats what i will do

#

the question is

#

does it make sense to cast it into a byte array

#

if i want to read decrypted data in memory as byte array

tardy delta
#

bruh looks like toml

granite owl
#

?

tardy delta
#

casting it o a bytearray vs String::charAt?

#

what even is the question

tardy delta
#

if you wanna have fun reading bytes, sure

granite owl
#

i want a generic way to read data

#

from different sources

tardy delta
#

how is it decrypted? the whole file content or what

granite owl
tardy delta
#

i think you missed some explenation

granite owl
#

but why is that relevant how exactly its decrypted

tardy delta
#

decrypt the file first and then parse it?

granite owl
#

im looking for a generic way to read data from different sources

#

from harddrive

#

from memory

#

thats the question

tardy delta
#

if it needs to be decrypted, accept a byte array

granite owl
#

its supposed to be decrypted before passed to the reader

#

the decryption process is its own thing

#

not implemented in the reader

tardy delta
#

what reader, the parser?

granite owl
#

yes

tardy delta
#

yes

#

dont think a parser would like it if they have to decrypt a file first