#dev-general
1 messages Β· Page 117 of 1
so I am no good at it
do you accept that it is objectively better than java though?
imagine not using kotlin smh
smh
it has definitely itβs pros yes
so you say it has.. cons?
did someone say kotlin
Yes. More flame.
i did
dont mind me. just grabbing my free xp
did someone just say exp
still gotta get the JAR that jenkins builds with shadowJar on to the build
anyone here used CI before?
teamcity?
yes it is
I'd prefer to stick with Jenkins for now tbh since I've spent ages making it work
you know about how Jenkins Gradle plugin works?
shouldβve used docker smh
I am using docker
then how was it hard to set it up
that wasn't what was hard
thatβs like literally one command or a simple compose file
getting Git and GitHub to work was more difficult
it wasn't difficult to do it's just I couldn't really follow the guides well
so yeah that's my fault
cause you aint using kotlin
but just throw your issue in here
tsk tsk
yes I am sx
SHUT UP
okay, so I've got Jenkins set up to clone and build from my GitHub repo on push, and I've got Gradle set up to use the gradle wrapper and run build followed by shadowJar, which both run. the problem is idk how to get the JAR that's output from shadowJar to upload with the build
you know how CIs like PaperMC have the JAR build and be publicly available on push? yeah I want that basically
do I use the post-build "Archive the Artifacts" option?
actually that's probably not gonna work
@errant geyser It cant work if you want to call the List, when it's null!
What are you replying to?
A moment.Xd
No, I don't imagine they will. You can listen for a PluginMessage on the bungeecord channel though, rather than Event probably. Example code can be found here:
https://proxy.spigotmc.org/414c27a7b37af96e339dcde49e2544f9e0e2979a?url=https%3A%2F%2Fi.imgur.com%2FPgh7wgn.jpg
https://proxy.spigotmc.org/0790eff6b98f35fe7be987e538b1e6bcd44d52be?url=https%3A%2F%2Fi.imgur.com%2FwHVU0nC.jpg
(taken from Spigot forums, so it might need updating)
@errant geyser .
You see the while loop?
Yeah
Yeah idk. You should probably look into more examples of plugin messages
But not a bad idea. Thank you again. :3
I am now using a list. and Im checking if it's empty
After lots of test, I've decided to not use multi arena for my games at all. Firstly, for resetting arena we have simple solution which is load and unload the world but with multi arena system, it makes lag spikes to other arenas in same instance. On the other hand, the bungee arena system using processor and makes slow other servers in the same machine. So, the best way is use only an arena in one instance and using map reloading system except reloading server. Do you have any idea guys?
You can't modify the world async
Nope, for the performance the only way is to use one arena for one instance and restart after a while(an hour maybe more idk) due to memory usage.
Minecraft has own method to save player datas and other structure and that makes a little bit memory leak. So after a while, there will be a memory leak and it doesn't matter the server is vanilla or not.
Oh
https://ci.prevarinite.com/job/BardyBot/ CI finally working
π
also, the way BardyBot was designed, anyone can just kinda download the JAR and self-host it
if anyone wants to test him out
he's not finished yet though
have u fixed the code yet?
take a look
I think that's fixed
it currently only plays music
I've got more shameless adverts
lol
you can get the JAR from the CI as well if you wanna self-host it and do some testing
lemme know how you guys find my CI theme btw
Linked twice in the span of 16 messages.
should've used https://github.com/PiggyPiglet/Framework instead of spring, as https://github.com/PiggyPiglet/Framework has a discord api ;). Infact, a discord api was one of the first things I implemented in https://github.com/PiggyPiglet/Framework, although it probably needs a bit more work before I advertise https://github.com/PiggyPiglet/Framework for that reason.
if ive got a class that has a map, that I have a get method, can I do that fancy kotlin thing where I can like use [] instead of .get?
do i need to do smthn to the method?
Β―_(γ)_/Β―
Piggy you just put 4 links to the same framework in one message smh
also, I'm using Spring because of the project structuring
and ofc the other benefits
but the way Spring helps you stick to SRP is mainly why I use it
yes
so basically you do Spring + JDA + Matt's Framework for JDA = Piggy's Framework
although I doubt your framework is as extensive as Spring is
my command framework is nothing like matt's, jda is a tiny part, and I'm not sure spring is a fair comparison yet
I don't actually know what spring offers
that's an end goal though, to be a competitor
dynamic di bindings
afaik yep
hi
just trying to think of anything rpf may have that spring doesn't
why when pplayer voted,the broadcast said %player_name% instead of displaying player name?
good luck piggy
how do i fix it
@obtuse gale operator fun
@twin thorn #general-plugins
not 20mb
ah ok
you can choose what you put in
actually yeah mine is 44.3 MB
lol
any way to reduce that file size by excluding things I don't use?
guice is ~720kb kotlin
it comes with guava
the other one
Yeah that's it
Forgot then name lol
Ima shut up now
Before I look even dumber
k
biggest thing in my framework is actually the material enums on the mc common api
they're huge
1.16 material list is 54kb uncompressed, uncompiled
@jovial warren I can't think of anything my framework has that rpf may not, unless you count things like platform bindings
I don't think that's a fair comparison though, as spring wasn't made for things like minecraft
yeah true
however
when you take into account the relative sizes
I think what my framework offers is very impressive, compared to spring
I really need to find a way to reduce the file size of this
once I implement load balancing, you could honestly use it as a replacement for spring rest stuff
should probably also replace my use of nanohttpd with something a bit more respectable
I honestly haven't encountered any performance issues with nanohttpd yet though
I suppose another good thing is that your framework doesn't have class names like HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor
or singleton factories
or any other really stupid enterprise logic
mine has both of those actually
logger factories for example, virtually always need to be singletons
as they store the logger implementation, but also provide creation utilities
but it's a bloody singleton piggy
although if you're talking about true singletons, not just managing instances carefully, my framework doesn't use any true singletons
ManagerManager
tf
Ahaha I love it
^^^^
rpf's nomenclature matches that common within this community especially
"My parents named me major major major"
you don't see people calling shit services in spigot
that's enterprise only
oh that's the master branch
woops
don't think I've edited manager api on dev anyway actually
my git best practices are severely lacking
master for the longest time was where all the action happened
dev contains a major rewrite of a bunch of components, which was necessary for papi 3
don't want people running shit code you know
along with the addition of the mc api
to answer your question, right now, no, I wouldn't consider any version of rpf to be stable
that is that plan though
master -> stable
fair enough
spring has got a bunch of annotations, rpf goes mad with generics. you can actually do loads of cool shit with generics
also, when PAPI v3 comes out hopefully we can get working on ECloud 2
papi 3 π¬
ecloud 2 could be in rpf
ECloud 2 is a planned rewrite of ECloud in Spring
I have an ecloud mockup somewhere which uses rpf
it's me, Niall, and BM
unless you have your own plans
current ecloud is already updated for papi 3
I don't know python
Niall came up with the idea to rewrite eCloud in Spring
I despise python
nobody knows Python then
and I can assure you, that idea has been circulating for a long time in private channels
The ecloud is held together with various layers of duct tape
duct tape is pretty strong tbf
I think that was why Niall suggested we rewrite it lol
not that simple
idk, your choice if you wanna let me, Niall and BM rewrite it in Spring or if you want to do it yourslef
=ecloud breakdown
These stats are now in the =stats command as ecloud and ecloud_breakdown
=stats
Command Usage: =stats <object> [days]
Currently Tracking Stats for:
messages, commands, images, words, xp, levelups, wins, daily, users, ecloud, ecloud_breakdown, top_channels, top_users
=stats ecloud_breakdown
=stats ecloud
do top_users too pls
=stats ecloud
nice
Spring can handle that no problem
it's like a walk in the park
services like Netflix use Spring
and they have millions of watchers
netflix also uses guice
because guice > autowired
fyi you can use guice with spring
if Spring can handle Netflix's payload it could handle eCloud easily
considering your 44mb, no harm in trying
idk
anyway, as I said, about eCloud 2, your choice whether you want to let us go ahead or do it yourself
π
if there was going to be a rewrite, it'd probably be done behind closed doors
dw, it'd probably be open sourced at completion. Not a fan of open sourcing popular projects while in development
people just suggest shit that's already on the roadmap
or worse, make an implementation for a feature you've already started on
and their implementation is really, really bad, then you've got to tell them that it's shit
can anyone outside of the admin team work on it whilst it's indev?
like not any old randos
yeah
I'm just asking if maybe we could get whitelisted on that
I'd love to contribute to something like that
most of the papi action takes place in rpf
can't be that hard to use
?
your framework
I'd use your framework if it meant I got to contribute on a project like that
I mean if eCloud was to be rewritten Piggy, not the current PAPI project
would that be AO or could some people get whitelisted to work on it
people could get whitelisted
I mean if people want to get access to papi 3 rn, I usually add them
can I have access?
i mean there's nothing actually on the papi repo, as I said before it's mostly in rpf
but sure
what's your gh
same as discord
Could anyone help me with my Citizens plugin, they don't seem to be spawning
Wew baby we got a tripple
oh baby a triple indeed
404 π’
ask for an invite matt
@prisma wave you got access to that btw
no?
ask for an invite
i'd actually rather not atm
fair enough lol
got work to be doing, don't wanna get distracted with any side projects lol
I see it's under GPL v3
there's nothing to distract you in there
invited all 3
all plugins are under gpl v3 bardy
whatd be the best way to read from a file and put the lines into a list? currently its formatted like
2. item2
3. item3
but im sure i can deformat it pretty easily
only when it's publicly distributed do we have to share the code at request
although the code will be publicly available, not via request
also archiveFileName = "PlaceholderAPI-${project.name}-${project.version}.jar"
π€
?
what's that gonna end up putting out?
PlaceholderAPI-bukkit-3.0.0.jar
@onyx loom String.lines is a thing in kotlin, so you can just do file.readText().lines()
proxies may not be available on initial release
tyty
sPoNgE π
SNAPSHOT means incomplete afaik
like a build that's still being worked on
it gets removed once the build is complete
Softwares are never complete, sounds redundant
projects like papi are never in a complete stage
true
you love to see it
π
like matt said actually, 99% of software is never in a complete stage
therefore the meta of using snapshot, is stupid
it's unnecessary to indicate something is a snapshot, that should be an assumption
hell
put release at the end
that's something I can support
Imo, -alpha or -beta if it's very unstable and just numbers if it's stable
or FUCKED if it just doesn't work lol
just working on the mc api design
for papi to work, we have to have a fully functional minecraft api that supports the functionalities of bungeecord, velocity, sponge, bukkit, and nukkit
I'm trying to think of what I could put in to this
and nms because i'm nice
yeah
or
FUCKEDif it just doesn't work lol
@jovial warren
lol
what you working on atm Piggy?
PlayerInventory.java
player api, which inherently includes inventory/item/material apis
i need an api that will write plugins for me
main design goal is the separation of immutability and mutability, with immutability by default and requestable mutability
sure ori
you got anything I could help you with?
give me 1 sec and pull it out my ass
hot
No sorry
Glare dead dead or just dead?
Okay then porkchop boi
is that frosty's thing?
oh shit was it merged
I pushed earlier
no it wasn't
That's why I'm asking if Glare's dead ee
guess i better review this code frosty
?
Stop violating the license
build what
Smh
license violations when I try to clean build
smh
oh
gradle clean build
:kek:
ah okay
that won't fix the issue, just better practice
yeah might help with third-party projects like this
updateLicenses should've fixed the issue tho
yeah it did
@prisma wave is there a way i can compare a string to another thats stored in a list? but instead of checking if it matches exactly, it just contains the string? if i use in then it seems to check if the string matches an item exactly
it's just indexing
list.stream().anyMatch(str -> str.contains(element));
List#contains would compare equals rather than String#contains
copy that into intellij
^
it'll convert to kotlin
or in kotlin, list.any { element in it } or list.any { it.contains(element) }
what JDK does it use piggy?
okay
check the build.gradle
thanks ill try that π
@hot hull why do they all require plugins ree
well, most
not all
even then passing plugin via constructor seems so wasteful
smh didn't know there was a static ee
okay
how do I force that?
since I've made minor changes
or actually I need to integrate my changes with yours
just was in the middle of fixing massive yellows in the build.gradle, and was gonna write some commands in common
if you've written anything valuable, do a soft reset
I haven't lol
also, I'm working with the one I cloned from your repo anyway
./gradlew shadowJar works for me btw
yeah same for me
I just had to reimport
okay time to fork
wait forking disabled?
How else would you pass in the instance without static tho since static ew?
even then passing plugin via constructor seems so wasteful
forking's disabled Piggy?
You can't fork private repos iirc
how do I commit and pull then?
there's nothing wrong with using a static instance getter on a bukkit plugin's javaplugin frosty
submit a pull I mean
ah, then gimme like 5min and I'll change it
what I'd usually do is fork, clone my fork, commit, push, then submit a pull req
can you open a pr from local?
do you have gh pro?
should let you fork then Β―_(γ)_/Β―
try now
still disabled apparently
aight well you have permission
lemme try with a testing repo
join it and lmk if it lets you fork
I'll check settings
maybe not then
Β―_(γ)_/Β―
maybe it'll update at some point
https://help.github.com/en/github/administering-a-repository/managing-the-forking-policy-for-your-repository @quiet depot you read this?
You can allow or prevent the forking of a specific private or internal repository owned by an organization.
ah okay you gotta allow forking on the organisation first
You can can allow or prevent the forking of any private and internal repositories owned by your organization.
Pushed Porkchop
can you fork the repo frosty?
Gimme 5min for chrome to open
Piggy needs to turn on forking of private and internal repos for the organisation I think
also you should set up Jenkins Piggy
there is a jenkins
private?
https://ci.extendedclip.com/ ah here we are
also did you read my other messages?
ah okay
that one is staff only sorry
alright
did you read my other messages though
about setting forking enabled for private repos on the organisation settings
you're not admin on the organisation are you
doesn't allow me to click it
okay who owns the organisation? clip?
your time is better invested figuring out how to pr locally
try forking it now
who wanna see some cancer 
use replace instead of replaceAll
That config setter hurts
imagine not using object mappers
Imagine not using
this entire plugin hurts
Also, have ya heard of a thing called final π
At the time i had made the plugin, not really no
Missing 5 more Kali
Y r all ur things .java
:))
2 months 
my bf is just watching me have a mental breakdown trying to understand why i did this
Any son know hoer to get them entires message historhu o n a channel with jda? getOteralableHostory says. It only gets the recent history
Oh god
what the fuck
Aj is having a stroke
Itβs 2.30 and Iβm on my phone
Iβll reword that lol
@remote goblet If you don't got a mental breakdown, are you even developing?
Absolutely not
Anyone know how one would get the entire message history of a channel with JDA. Apparently getIterableHistory only gets the recent history
:c
π
Yuck getInstance()
@quiet depot Anything else you'd like changed, or are you gonna let Glare do the judging?
Welp, Iβm off to go scroll through shitty Instagram memes for the next hour before I go to bed
Wish me luck
Or ya know just go sleep?
Yeah but like
r/kotlinmemes is better
My phones got 13% so I should let it drain
execute returns a boolean; whether it should show the command usage or not, fix this: https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/CommandHandler.java#L75
It's handled within the command itself, so is it necesarry?
And it'll always return true
Itβs actually 5000iq, my graphics teacher tells me I shouldnβt sleep with my phone near my head, or with it in my pocket cos it might radiate my schling or smthn, so by letting it drain power Iβm saving myself
Never heard of em
min args and command length
well then name it appropriately
https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/Command.java#L23-L25
don't expose inner components
https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/command/VersionCommand.java#L16-L17 I thought you said you'd never heard of new lines. Anyway, consider moving those two, where they're actually needed
https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/command/VersionCommand.java#L34 don't make this method abstract if it's not always required
The completion is for glare to finish
k
yeah looks like handleUsage & handleCompletion shouldn't be abstract
and i'm not sure about this min/length shit
I've renamed it to proper shit now
https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/command/ListCommand.java#L31-L32 always prefer one message over multiple (use newlines)
When it comes to actual commands, blame clip ;c
progress
Assuming what?
well generally processes happen in steps
e.g.
process begins
process finishes
tell user process result
so message after execution
you tell the user the process result before the process has even happened
replace all calls to PlaceholderAPIPlugin.getInstance() with a constant variable
https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/command/ecloud/PlaceholdersCommand.java#L69 name the exception ignored for conventional reasons, also, final exists.
https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/command/ecloud/RefreshCommand.java#L24-L25 once again, the method call fairy has spoken, and he wants some of the slack to be transferred to variableman.
also does the command completion api actually use the list structure?
surely you can return a set instead
The completion is for glare to finish
And yes I believe it does
https://github.com/Frcsty/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/commands/command/ecloud/DownloadCommand.java#L59-L61 variables make everything better
@quiet depot Also, not sure what you mean by this
Guys, I'm Italian, but I know English well enough. Can you recommend a guide to start developing plugins?
Are you familiar with java?
are u familiar with kotlin π
^
@prisma wave for a plugin would you go for the whole Exposed + HikariCP DB thing or just the native SQL thing + CompletableFutures like I used last time? Bearing in mind I'd only be using SQLite, and not MySQL or smth.
Why would you want connection pooling for SQLite?
Β―_(γ)_/Β―
SQLite connection pooling?
just setup connection pooling for MySQL, MariaDB, PostgreSQL and other databases you wish to support
I recommend sticking to SQL databases though
since NoSQL is a pain, especially MongoDB
Afaik Hikari for SQLite is pointless
But I'd recommend coroutines instead of futures if you're using kotlin
If you're using kotlin
Who isn't using kotlin anymore
Oh Matt I have another issue for you in a sec
π
If you're using kotlin
Who isn't using kotlin anymore
Very true
I'm not using kotlin
Ooh gotcha, yeah i think that makes sense, i think what happened is that I added the global prefix later so i think i forgot that part
π
Not for long
22
I'm sorry to hear that Frosty
Convert your framework to kotlin Matt π
Actually i first started making it in Kotlin
But then Piggy told me to merge it with the spigot one so i made in java to do that later
can't rn
but they're basically callbacks generated by the compiler
With some extra API spice
OOoooooOOOOO spciy
Very spicy
Basically your whole segment run inside a coroutine is split into a few pieces i.e, on every suspend function call,
Every time a suspend function is called in a coroutine it creates a Job in one of the Executors to execute that and passes the the rest of the code as a Continuation function which is executed after your suspend function returns.
Its basically Continuation Passing Style but without the troublesome boilerplate
https://en.wikipedia.org/wiki/Continuation-passing_style
In functional programming, continuation-passing style (CPS) is a style of programming in which control is passed explicitly in the form of a continuation. This is contrasted with direct style, which is the usual style of programming. Gerald Jay Sussman and Guy L. Steele, Jr. c...
@errant geyser
Ok so I'll just write my own way to add hex code support in my messages.yml
Cuz I managed to fail to use oris spoonfed method lmao
so a suspend function compiles down to something like
doSomething(otherArgs...., Continuation continuation)
Oh that's nice
I was continuing my other message btw
Yah
oh also if you are looking for hex in config and stuff minimessage probably has everything you might need
also suppourts hex
https://www.spigotmc.org/threads/minimessage-rich-text-messages-made-easy.433454/page-2#post-3854439
I make my own shit
alrighty
Actually for messages.yml it might be what I need
Mini's lib doesn't work well with hex yet
does anyone here know how to compile a plugin file with eclipse jdk 8
maven build
Zod, try out 1.1.14-BETA it should have been fixed, i couldn't test since i'll need to leave in a sec but seemed like a simple fix
Nice ;p
That logo looks familiar
first thing that came to mind was the ubuntu logo
you're thinking of the Debian logo I think
i compiled a plugin correctly got the jar file loaded it in my server and it hasnt came up
Although yes, it does look more like the debian logo
@topaz bay How can I install my shadowJar to my local repo and use that?
@versed ridge well 1. dont.
you should publish your code only
And leave it up to the end user application to shade necessary dependencies
Heyyyy Sx KM said to use Coroutines for DB calls in Kotlin. Can you give me an example?
What kind of example are you looking for?
Just an asynchronous coroutine
I was going to look into Futures/callbacks but KM said to use this instead
I mean... coroutines are by nature asynchronous
Ok then, can I have an example of one?
Just like how to make it so I can slap my code inside it and hope for the best
@digital patrol you have two of the same plugin in your plugins folder. Delete one
Ok so it's basically for DB calls. So all I'd have to do is
launch {
//my calls here
}```?
yes
Oh, ok, that's simpler than I expected. What happens if I need to grab the value from the DB and then use it? Like I used callbacks for that in java, is there any special way to do that here or do I just put it all inside the launch?
You would change your code to be sequential
Look at this for example
imagine launch as routineWork
everything inside of that is asynchronous, so that method just returns a value
@errant geyser thats for wiipay but that doesnt cause any problems
Then you can use it directly
Oh cool
So I call functions to do the stuff I wanna do with the value from the DB inside of the launch? Or am I completely off track here
Literally just instead of using callbacks, you make your methods return the values directly
@digital patrol it's all from your exams plugin. Update/fix/remove it
Oh ok, thanks
started writing a gradle tutorial https://wiki.helpch.at/piggys-barn/java/gradle/tutorial
someone should fact check it for me
wrote why gradle is better than maven https://wiki.helpch.at/piggys-barn/java/gradle/argument
@quiet depot Why does the example use the bukkit dependency...
fixed
added
You also seemed to have grouped this property with group and version
Which would imply its a part of that
That should be grouped with the UTF-8 specification, as those are both configuration options for the java plugin
You also missed the bukkit dependency in the other code block
fixed both of those
"I could most certainly right the former from memory" write*
Personally I'd also mention that since gradle scripts are code, they're more extendable under pros as well
Damn.... you straight up yoinked my shit
No?
It wasnt a new or groundbreaking idea
Just seems strange considering the one I have is open source and on github
mhmm
Wait so Piggy, I could change all my dependency stuff to have the version of '+', and it would always fetch the latest?
TIL
Don't do that though
I wouldn't recommend it, not good practice
I'll edit the guide to specifically mention that
y tho
problem is the api may change of a dependency
and then your shit is broke
and you can't remember what version of the dep it was last working for
True, but lets say I'm updating a plugin and I want the latest version of everything
then use +
look at the gradle dependencies tab
find the versions, and replace the +
Smort
updated the guide to include a warning about that
In the case of spigot with the multiversions within the same minecraft version, you can append + to the end to stay only within the latest for that version
compileOnly "com.destroystokyo.paper:paper-api:1.15.2+"
And it will only update to the latest that starts with 1.15.2
I tested everything on there
the bungeecord chat api isnt in spigot's repo
welp
you got me there
I've got no idea how my shit compiled
you're right, it does need sonatype
Oh actually wait, I think it is in there now
Looks like they just mirrored them
I think the config I copied from voxmc uses paper
That is unequivocally false.
ok mr vocabulary
That is barely a high vocabulary word
I use that word literally all the time
it's kinda useless
dr phil uses it quite alot
It literally means "without a doubt"
like false and true are already words of absolute certainty.
Except unequivocally doesnt modify that word, it modifies the target of that word
The subject is without a doubt true or false
Also, those words are not of absolute certainty
lol
do i have the patience to use sqlite for this
SQlite best stuff
meh
Thats a strange way of doing it, no?
A wait no
Its the same way I did it just you pass it into the method as a consumer and not return a Future
Those 2 runnables aren't callbacks
They're the task you run
A callback is a function called when the task is complete
Would line numbers in errors be wrong if the things coded in kotlin?
For a discord bot
if im trying to check if an input is an int, what should i do? so toIntOrNull, then should i just return null or what?
Ints.tryParse, or use regex
Caused by: org.hibernate.PropertyAccessException: Null value was assigned to a property
the fuck is this
var user = userRepo.findByDiscordUserId(member.id)
Its on this line tho :////
but then if you look at the error it talks about something completely different
???
Uh idk
If its nullable in db make sure its nullable in hibernate?
Or kotlin maybe
all the fields I assign to anything in the db are non-nullable
@onyx loom yes that'll work
just making sure thats the best way
everything I write is idiot matic
From the third glance, idk why I'm starting to hate 3d prespective rendering into 2d lol
I mean, I did handle it but that's really annoying
Had to take smth from three.js for a while
Say I have something like this
data class Y(
val things:List<String> = listOf()
)
interface YRepo: JpaRepository<Long, Y>
How can I get a Y by something that the list contains
actually there might be multiple with that thing in the list
Define a function called something like findByThings
Spring does the rest of the work for you
If it's a list it will probably need to be findAllByThings
Or possibly findAllByThingsContains
Depends what you want to return really
wait can you even have lists in things?
'Basic' attribute type should not be a container
Use @ElementCollection
@signal tinsel ignoring that Exception catch like its a not an issue 
Ofc i ignore it
It throws an exception if its invalid
is there any files i dont need to add to github repo? such as .idea folder?
@onyx loom
.idea/
.gradle/
build/
out/
*.iml```
they didnt even show up π
^ or more generally, any IDE/ build tool files that aren't necessary to make the build reproducible
https://github.com/Kqliber/RNGExpansion what in the hell
BuildTools committed π
anyways, code review bm?
not that theres much
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.aj3douglas.helpme.core.Request.embedIds, could not initialize proxy
Use @ElementCollection
@prisma wave
@Entity
data class Request(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
var id:Long = 0,
var type:String = "Undefined",
var description:String = "Undefined",
@ElementCollection
var embedIds:List<String> = listOf(),
var channelId:String = "Undefined"
)```
Uh
I guess initialize it eagerly
There will be something in the ElementCollection annotation I think
initialize it eagerly?
oh is that FetchType.EAGER?
Yes
ah
Eager = fetching as soon as possible
Lazy = fetching only once the data is needed
But lazy loading will only work if there's an active connection
Transaction*
Finna experiment with gh packages tmrw
tfw u dont change anything but your bot just stops logging in
Ikr
@Bean
fun setupJDA():JDA{
println("Setting up JDA")````
What would the cause of this just suddenly not being called be lol
the bean is only initialized once
its not being ran at all
It was working literally 5 seconds ago
And I havent touched anything related to it
are you using a jda instance anywhere?
Probably needs to be autowired somewhere
Can I just autowire that class in anywhere in my code?
wait what
dont autowire the class
you don't call bean methods manually
autowire JDA
oh ok
Do I need to do this in my main class?
wait wdym dont autowire the class lol
I've got an example of this in my bot code hold on lemme get a link for you aj
obviously I'm using runCatching there
then I autowire that to other places
Just the class?
I inject jda() in to the commandManager() bean
lemme get where I inject command manager
probably a better way to do that tbh
I meN
In one of my classes I have
@Autowired
private lateinit var jdaComponent:JDAComponent```
but its really weird, I didnt touch anything related to my bot and its just stopped running that method
Lateinit?
constructor injection >>>
The JDAComponent class?
nah
although
wait
send the class
@Autowired
private lateinit var jdaComponent:JDAComponent```
that this is in
well I dont use the JDAComponent anywhere in that class
I just chucked it in a random class lol
I dont need the jda instance anywhere, I can get it from all events
@Autowired val jda: JDA
is it smart enough to get JDA from that method?>
that methods still not happening lol
send code
w h a t c o d e
the full class with the autowired jda
I dont use JDA in that class anywhere
just autowire the bean factory
no
don't do that if you can help it
I dont use JDA in that class anywhere
doesn't matter
@Service or @Component
class MyServiceOrComponent @Autowired constructor(private val beanFactory: BeanFactory) {
fun myFunction() {
val jda = beanFactory.getBean(JDAComponent::class.java)
}
}
```?
no
well I got some rewriting to do then
you shouldn't be autowiring the component in the first place
you autowire the bean
and as I said, you should only use the bean factory when you can't do manual injection
ie when you can't just have the actual object autowired
which in this case, and most cases, you can
@Component
class RequestReactionListener :ListenerAdapter() {
val config = Config()
@Autowired
private lateinit var ticketManager: TicketManager
@Autowired
private lateinit var jda: JDA
override fun onGuildMessageReactionAdd(event: GuildMessageReactionAddEvent) {
if(event.channel.id != config[Setting.SUPPORT_CHANNEL]) return
event.reaction.removeReaction(event.user).queue()
ticketManager.createTicket(event.member, event.guild)
}
}```
^^^^
force spring to provide a value
code?
@Component
class RequestReaction @Autowired constructor(
private val jda: JDA,
private val ticketManager: TicketManager
) : ListenerAdapter() {
val config = Config()
override fun onGuildMessageReactionAdd(event: GuildMessageReactionAddEvent) {
if (event.channel.id != config[Setting.CREATE_A_TICKET_BETA_CHANNEL]) return
event.reaction.removeReaction(event.user).queue()
ticketManager.createTicket(event.member, event.guild)
}
}```
you are restarting the app right?
yes lol
just making sure
print out the JDA instance somewhere
also navigate to the bean definition with intellij
you might have 2 or something
wait
is it a problem that this class doesnt get autowired anywhere until the JDAComponent class is initialized?
@Component
class RequestReactionListener @Autowired constructor(private val ticketManager: TicketManager,
private val jda: JDA
) : ListenerAdapter() {
val config = Config()
override fun onGuildMessageReactionAdd(event: GuildMessageReactionAddEvent) {
if (event.channel.id != config[Setting.CREATE_A_TICKET_BETA_CHANNEL]) return
event.reaction.removeReaction(event.user).queue()
ticketManager.createTicket(event.member, event.guild)
}
}
```that's what I'd have
wdym
same thing
as in
spring initializes them all on startup I believe
unless you have lazy loading configured
worth a try
