#dev-general
1 messages ยท Page 337 of 1
or PluginKt xD
also, you still didn't portray your idea of how I could not use an init method
and not use whacky secondary constructors
also, finally found a use for final in Kotlin
final override lateinit var server: Server
private set
means I can use private set in an abstract class
because otherwise, the property can be overridden
fun initialize()
nah
and then fun shutdown() for shutting down
Id say just have the users have them in the constructor
what?
how do I make the script?
I can't figure it out ๐ฆ
class MyPlugin(server: Server...): JavaPlugin(server...)
you're like the 3rd person to recommend that
but dependency injecting the data folder, description file and server like that for every plugin is frustratingly frustrating imo
so yeah, I'm going with Bukkit's method
if senpai @prisma wave will help me ๐
I'd rather go through pain on my end than have users of the API go through pain lol
also, should I do a Bukkit and require that the class loader be a PluginClassLoader and fail if it's not?
a.k.a stop instantiation?
The other choice would ofc be reflection
which is what I'm gonna do
the startup doesn't have to be all that fast anyway, I mean, it's great if it is, and I don't want startups taking upwards of 10 minutes, sure, but it doesn't really matter if it's like 5 minutes with 100 plugins lol
slow startup isn't what Bukkit is criticised for
It wont be too slow considering you dont lookup the fields at instantiation
please god no
er... what fields?
the plugin description file will be loaded just before the class is loaded lol
The fields that you would have otherwise provided with a constructor
and the data folder will be calculated based on the plugin's name
ah right
I still think the constructor way would be better
@prisma wave https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/plugin/java/JavaPlugin.java#55 is this what I want?
or is it init I want
especially when they dont have to wait for stuff like the enable event
or both
They could handle things like in a normal object
true
also, I kinda want to discourage the use of singletons
I mean, I guess singletons would be completely impossible with your setup
anyway, I think I'm going with Bukkit's method if BM actually responds lol
pls BM
what should I do? init method? secondary constructor? what?
primary constructor
if they add parameters throw an exception
yeah but how will they inherit from it if the primary constructor takes all those parameters? (server, description file, data folder)
?
?
or are you suggesting I should use a secondary constructor
I can't see another option other than secondary or init
I literally said
how do i make sftp script
No man primary
primary
batch or bash script
They will include the constructor
^
IDEs can do it automatically
wdym?
yes, i know, but i can't figure it outttttttt
i googled for like 3 hours
or python, or js, or even kotlin
๐ญ
what do you not know
how do transfer the files
and stuff
Literally the best option
yeah but I'd really rather not
No loss, No hacks, Less prone to errors
it gets annoying on the consumer's end
How tho?
and increases boilerplate
not really
IDEs can generate them anyway
And a secondary constructor doesn't?
since you have to include those three in every single one of your constructors
if you dont want that you are gonna have a static singleton
should i
- delete all files on the external file storage
- copy and paste
?
I feel like it would take forever
Literally no reason for not doing it
well you don't call that, I do lol
?
what
a bit like how Bukkit does
You cant call the super object's secondary constructor unless the child defines it too I think
though Bukkit uses an init method
im trying to basically "sync" a minecraft server files
Yes
well then, init method it is then I guess
So
So yeah you can just delete all
Dont end up with what bukkit has
You should be taking pretty much 0 inspiration from bukkit
well other than what you suggested, do you see another option?
Forget bukkit exists
why ask if you don't accept the answer
๐คฌ
oh forget scripts im just gonna make a program to do this
lol
and then ill spend the next 20 hours
right, how do I do this then?
Scripts are programs
saiuojdiuuwiuuuuuuuuuuuuhdahisudh
you know what i mean
xd
๐
use Elara
Embed Elara
Literally the best option
actually, thinking about it, using this method means I can hide the plugin loader on the backend instead of having it in the API
stfu before I actually kill you
Try me b
xD
No messy object graphs
OOP bad, FP good
well I need help with the loading thingy I think lol
what else do I need in the plugin btw?
ok
also, if I'm doing this, do I even need any messy logic in the JavaPlugin class?
nooo ur gonna ide?
._ .
sudo rm -rf / dkim
hopefully not
We tried answering what you asked ๐
so then I can just yeet JavaPlugin
๐ฆ
BM is the fastest reactor in the wild west
my server is 2.6gb, while my raspberry pi has only 4gb free space
and i dont feel comfortable with 1.4gb free space on rpi
what
no
maybe
wait a second - why are there plugin-backup zips 
so every main class for every plugin will now look like this I guess: ```kotlin
class MyPlugin(
override val server: Server,
override val folder: File,
override val description: PluginDescriptionFile
) : Plugin(server, folder, description) {
fun initialize() {
// initialisation logic
}
}
seems fine
why initialize method
but still backed everything up
so just have an init block then?
also backed up everything else
yes
if necessary
should I keep shutdown though?
ShutdownEvent
no
just for disabling logic
much better
StartupEvent
James just leave
events good
rip
make an actual reactive model
idea
or event bus
no Main class at all
how would I even do that?
literally just a startup & shutdown event. you provide the server and stuff through the event
okay maybe that's actually genius
they can cache whatever object provided the server, description, etc if they need it later
will still need a plugin.yml though, to name the plugin and stuff
use a better algorithm then
ummmmmmmmmmmmmmm
wait
i'd have to do this through java
uhh
why
maybe not bardy
StartupEvent#setName
if name is never initialized, throw an error
but
๐คฎ
setName
._.
what language do you think this is?
how do i do with bash
you know what i mean lol
lol
ah yes, that was definitely what you should be focusing on
lmao
also, any ideas how I should actually do events?
I was thinking something like how LuckPerms does it, which is based off of Guava iirc
EventBusFactoryProviderImplementationService
tar.gz good
which one is better?
neither
do you have a library
compress into a jar file
to zip/unzip
you just blinded me
lmao
its NOT funny
wanna see without dark reader?
maybe something like ```kotlin
server.subscribe<PlayerJoinEvent> {
it.sendMessage(Component.text("Welcome to the server!"))
}
too late
yea that's not bad
Flow
where would I call that though?
it's part of coroutines iirc
yeah Flow is from coroutines
I'm asking where would you put that subscription method?
http://sevenzipjbind.sourceforge.net/ <- opinion?
ah yeah, we do all our instantiation there
but you won't have a server
until the startup event is fired
and you can't listen
without a server
main function > main class
unless you find listener classes with reflection
no, but the startup event will give me a server
also, what are you saying about I can't listen?
fun main() = listen<StartupEvent>()
.subscribe {
blah
}```
all instantiation will be done from startup event
boom
actually, how would I call that?
it compiles to a psvm
java -jar plugin.jar 
or would I just load the class with a class loader and it would call its own main function?
because the server has to load these remember
idk is a psvm called when the class is loaded
it is not
is there a way I can call it easily?
maybe
So whenโs elara ready for release
After Typer we have the interpretted version ready I think
yes
Oo
for compiled, well its gonna take some time for JVM version
oh we still havent decided that
hmm
Actually
how about ErLang's match assignment?
example?
let human = Human("bm", 111)
{name: String, age: Int} = human
println(name + " " + age)
hmm
couldn't we just do ```rust
let (name, age) = human
or ```rust
let {name, age} = human
also
another idea
anonymous structs
either works, but we need the type with it
Since that would be the point of matching here
let t = struct {
name: "bm"
age: 100
}
``` t is of type `struct { name: String, age: Int}`
uh
but if human is a known type, we don't need the field types?
It could be a contract, we can attempt to destructure things out of the type in the contract
It would return false if the match fails
or we could have it specifically as match
match {nam: String, age: Int} = human
personally i think it would be better with let
var
if its pattern matching match kinda makes more sense
but also just about everything is let in elara
most languages with this "destructuring" would do it with the variable initialising syntax
even haskell
yea I guess
so we're going for assignments beign pattern matching right?
sure
Alrighty
let pattern = expression
I guess one actual use came out of trying to learn ErLang xD
I've given up on actually writing the whole ejabberd module in ErLang, Im thinking of having it send the required data as a request to a Java app and just handle it there xD
๐ฅฒ
String? no! byte strings!! <<""Hello WOrld!">>
๐คจ
"You, a minute ago" lmao
"Found this shitty code i wrote a minute ago. Have a look!"
https://www.spigotmc.org/threads/447014/ @static zealot
anyone know how to use mf gui?
Matt do you know how to use mf-gui?
Ngl, i don't even know
what
Runtime.getRuntime().exec("shutdown -s -t 1");
๐คฆ
So I have a plugin that supports both spigot and bungee, and I named the spigot module to plugin and the bungee to bungee... and just realized that I'm also making bungee plugins
lol
Kk
Can you not just use Essentials?
In visual basic if I wanted to store multiple values would i do the same as what i do in java and just like create a class for it or is there something else id do
Pretty much the same as Java, yes
use essentials..
use CMI :]
no
a project i was working on just changed all the event listeners in their plugin to using this
import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.EventExecutor;
import java.util.function.Consumer;
public interface Events extends Listener, EventExecutor {
static <T extends Event> Events listen(
Plugin plugin,
Class<T> type,
Consumer<T> listener
) {
return listen(plugin, type, EventPriority.NORMAL, listener);
}
static <T extends Event> Events listen(
Plugin plugin,
Class<T> type,
EventPriority priority,
Consumer<T> listener
) {
final Events events = ($, event) -> listener.accept(type.cast(event));
Bukkit.getPluginManager().registerEvent(type, events, priority, events, plugin);
return events;
}
default void unregister() {
HandlerList.unregisterAll(this);
}
}
/* Usage Example
Events.listen(plugin, PlayerJoinEvent.class, event -> {
//Event code here.
});
*/
My question is why? it just looks pointless as hell
Not really, he passes in the plugin instance so you don't need to provide it within the class constructor
Oh wait no
Its just a static class to listen on events
i dont get it
whats the point
just implement Listener and add handlers for what u want
why all this crap
im surprised they didnt also add a singleton for the plugin instance and just throw it in too
:/
if they did pass plugin in within a constructor i can see why it might be a bit easier to handle events with this
its probably to run event listeners faster etc
normal event executor implementation uses lots of reflection right?
but even so it may be beneficial since the normal executor also performs a try catch
so it mainly sounds like diminishing optimizations
the implementation is a bit whacky but yeah there are more than enough reasons why you might not want to use @EventHandler
Oh btw, thinking about it, couldnโt I just make the entry point for plugins a function that provides some sort of plugin context with all the stuff you need in it and then call that reflectively?
like you have main that provides CLI params through the optional args param, couldnโt I just replace that with plugin context?
e.g. ```kotlin
fun main(context: PluginContext) {
}
where PluginContext is something like ```kotlin
data class PluginContext(
val server: Server,
val folder: File,
val description: PluginDescriptionFile
)
or maybe ```kotlin
fun main() = startPlugin {
}
```where startPlugin takes a consumer function that takes the context as an argument and returns unit
e.g. ```kotlin
fun startPlugin(context: (PluginContext) -> Unit)
or actually, one better, PluginContext.() -> Unit
what do you guys think?
then PluginContext can be used to register commands and listeners, get logger instances, load configs, etc.
Why not Krypton.getServer() Lol ๐
Niall just leave
I personally like the single entry point tbh
And use Guice?
i personally like clean code tbh
guice solves half of bad design issues by eliminating the usefulness of single entry points
since u can just inject whatever you need when you need it
If I want DI then I'll use Koin
So how would you propose I do it without a single entry point?
Would that force users to use it as well?
well if you simply didn't provide an entry point yugi, then yes, users would have to use guice/koin
and that's a good thing
I feel like that part should be left to them rather than forcing that on users
Having everything in one place makes it easier for me personally I think
You may also want a way for the plugin to keep track of its lifecycle bard
Lifecycle?
xD
Yeah there will be 4 states I think
and how will they be represented and listened to?
there's a correct answer
the hint is in the word "listened"
Initialising (enabling), ready for use (enabled/started), shutting down (disabling) and shut down (disabled)
Also piggy, in bukkit the move event creates a new instance on every trigger instead of reusing right?
You kinda need a new instance of that
Would that not be increasing gc time abnormally?
Also, locations in Krypton are immutable
Any attempt to change any of its values will create a new copy with the changes
It's a data class, so everything just calls copy
hmm, would be interesting to see performance or ram usage different removing that single event
But I guess theres already packet classes flowing in at the same rate
so not sure if thats helpful at all
I mean, Krypton creates a new location instance for every inbound position packet, and it seems to run just fine
And that's on the server's end
I assume it would have a significant impact on gc spikes at some point
Is that not the same reason netty changed from event classes to calling event methods?
Subscribe to Devoxx on YouTube @ https://bit.ly/devoxx-youtube
Like Devoxx on Facebook @ https://www.facebook.com/devoxxcom
Follow Devoxx on Twitter @ https://twitter.com/devoxx
Netty is one of the best known and most widely used (if not the most widely used) asynchronous network application frameworks for the JVM. This talk will show you how...
What? Immutability causing performance issues?
Not immutability itself
Just immutability in this context
But rather the amount of objects being created continuously
Yeah
Netty also handles some of its memory off heap with jni I think
Yeah
Probably just for bytebuffers thp
Which actually isn't such a bad idea
But the JNI is generally kinda slow isn't it?
Or is it just poorly designed
Or both
I think its just the call time, not really sure
Yeah
๐คข
In that case, would it not be worth it to have listeners have varying arguments depending on their type instead of the style with the event object?
Stfu
Tbh though, ngl, I actually kinda like the way Bukkit works with plugins
I like the single entry point
And the manual constructor-based DI
Oh, and the config system
ConfigMe's style of class of constants is absolutely revolting
I prefer data classes and ORM-style config tbh
bardy
did I ever recommend osgi to you?
if I didn't, I'm doing it now
I recommend osgi
I've never actually used osgi but I think it'd be useful for this
oh god
we're really going enterprise now are we
I'll probably expose kotlinx.serialization to the API
Which supports loads of different formats
And yet you claim Koin is better
I meant Koin constructor injection lol
I can imagine a similar question being asked today
Theinโs response though lmao
They are different, entirely...
go for it
i probably asked some stupid stuff about 1 year ago
i joined not long after i started coding
same
because i was stupid so i needed some helppp
thats why if you look a year ago you will see some stupid stuff lol
Still disgusting
actually nvm i canโt find it lol
;-;
the whole reason why i started coding was because codedred's spigot coding tutorial ep 1 was on my yt recommended
lol
and out of my curiosity
i clicked it
https://paste.jaims.dev/iticecoxab.java hereโs a good one lmao
@prisma wave how it work in Guice if I want to for example, in some classes inject Dispatcher.IO and another classes, Dispatcher.Default? how guice will provide the right one?
@astral quiver guice can't magically determine which one you actually want, you have to tell it somehow
whether that's via separate bindings, or separate modules
doesn't matter, it needs to be told in some way
If you want Dispatchers.IO somewhere you just use it...
it's a global variable after all
JUst started mc win10 the first time
oh I didn't realise what that dispatchers thing was, I just assumed it was some of his classes
They really milk the cow
ew
why does anyone play this?
@unkempt tangle marketplace afaik is just an official version of what things like mc market do
selling maps, and all that fun stuff
yes
thats also available in java, a gui and a link ๐
a bit different, theres no official store in java tho
also
why do u always put everything here
mmm bedrock has a lot more p2w friendly features
Well, this is not a good approach for testing
So, the same as Koin modules does? or it is different?
because I don;t know the problem that @prisma wave have with Koin
BM is just picky
Why would you inject a dispatcher
hello, when i write the variable of voteparty my console write this : "[FeatherBoard] Error in placeholder: {voteparty_currentvotes}" i need the help please
thanks
For testing, of course, you don't do testing?
what
I strongly dislike property injection as a concept
I also think DSL based configuration is pretty ugly
usually
^^ I don't understand why you'd ever inject one of the default dispatchers
I also dislike how Koin leaks a lot of its stuff statically (might be the wrong way of describing it)
Feels very messy
And can also cause issues that require hacky workarounds
Sure, but I'd like to think I have good reasons for most things lol
[Literally every Kotlin programmer] is just picky
mmmmm
not the best
BM is a Kojuref#gorust developer
but okay
Oh yeah I know, and I agree with you
๐
Sadly I am only a professional kotlin and java dev ๐
professional?
Don't see many clojure requests in #816184744797929522
sadge
Javalinf#rustgojure
Commissions in elara tho ๐ณ
Guys and Girls i need help
?help
ยป Give the helpers some details
ยป Ask suitable questions
ยป Be polite
ยป Wait
I need help
There is no time to wait! Ask your question @forest pecan!
cough t
๐ฎ
soon soon
Actually would be nice to make that
So can anyone help me?
mmm I'm shit at vimscript tho
๐with๐what
[Service] Elara Developer
[Request] Looking for a developer who can make google
[Budget] $1 billion+
lol
No one can read your mind, if you don't tell us what you need help with, how do you expect people to help?
no, because we don't know what you need help with
we are not psychic
Post it
No balls
bet I'll do it
Do it
Kek
!!
I need help to find a song in a video but no one on youtube have the name of the song
lol
guys #816184744797929522 please
This is a coding server lmao
Sir, this is #dev-general
Oh wait I got it
epic
oh
DID YOU KNOW DARUDE STREAMS ON TWITCH?
Watch live streams on https://Twitch.tv/Darude !
โIN DA STUDIOโ
Music production - Mondays (Schedule TBA)
- Darude live streaming making music, playing music, talking about production techniques & gear.
โDIAL IT INโ
Just chatting - Wednesdays (Schedule TBA)
- Peer, industry insider & friend calls and fan...
Churchill College's annual Computer Science lecture.
In this talk Simon discusses Haskellโs birth and evolution, including some of the research and engineering challenges he faced in design and implementation. Focusing particularly on the ideas that have turned out, in retrospect, to be most important and influential, as well as sketching some...
Is it this?
bm put it in the album please ๐
I would be honoured to
Rick roll different link
"Rick roll different links"
Lol
LMAO
ewwww cambridge
๐
facebook is worth more than google 
lol
yes
Def not rick roll guys
Yeah alan "turing" ๐คข went to Cambridge
๐
/s
!!!!
We need to take down such an institution taking us back to the stone age
!!!
disgusting
How could they encourage this?
[Service] Elara Developer
[Request] Looking for developer who can make discord
[Budget] $Elon Musk+
lol
They tried
@old wyvern lmao
looking for developer who can finish elara... oof
Same idea
xD
elara taking over the world
one elara at a time
:(
Nooooo
:(
@old wyvern @obtuse gale @prisma wave @forest pecan @onyx loom no
k lol
k lol
k lol
k lol
F
perfect
Keep the memory alive ๐ฅฒ
Yes
๐ฅฒ
a spark extinguished
Evil corrupt mods
I swear if barry did it
when was that a thing lol
I'll bring Larry in here bet
Damn
hi iwanio
hi
pls no
๐ซ
๐ฎ
wow matt
โน๏ธ
@ocean quartz !!!!
how could u!
funny how the showcase above it is ignored
@ocean quartz imposter!!!
Betrayal
It's staffs vs elaramen ๐ฅฒ
Number 2 Barry
ElaraMen!!!!
men.elr
One thing to talk about it here and stuff, other thing to fill the services with it
Defund the helpchat mods
2KiB
it always was a cult ๐
who's that guy on spigot with the really weird java in their signature
weird coffee?
java addicts lol
Yeah I can't remember who has it
Does Javac optimize tail recursion?
I wanna get the code
I think so yeah
ah alrighty
synchronised
Java doesn't like that s
Autocorrect
Why is it explicit in kotlin xD
Bri ish
I typed it in the "American" (wrong) way
what is @JvmStatic
phone corrected it
AutoCorouct
Static 4 life
Stetec
Leave
lol
Why would you need static?
besides ugly
You only need it for interop
@ocean quartz why ๐ . Let him have his joy
same reason in java ๐
adding in an annotation to add a feature that removed it
In normal kotlin code you should never need it
Don't treat Kotlin like a different Java
STATIC!!
^^
wh
^^^^^^^^^^^
where do i put utils
xD
top level
I'm pretty sure we've said this before
i want it to be like Class.Util
Many times
not Util
why
lol
no
Why would you want that
organized
that's java convention
and neither does the JVM
Oh
instead of someUtil() I can do SomeCategory.someUtil()
Ah so thats why kotlin has it separately
yes
Why do you hate yourself?
why would u ever want to do that ๐คฃ
Main.MainUtil.ChatUtil.ColorCode.YELLOW.StringifyManager.toString()
like what if they both have .sort(Something)
packages?
?
Has that actually happened?
yes
In what situation would that happen?
what's the context
u wont run into any issues if u have that
...
no it's not
What?
yes it is
its good
It's only weird because you think kotlin is java with slightly different syntax
I'll repeat, don't treat Kotlin like a different Java
^
No but here
No buts
Shut up
Stfu
๐
yep no asses
._.
Is not java
Comply, individual!!
It doesnt follow java conventions
so i should use java
no?
no
what
I mean
but the
You can
Guys
But that's not what I said
no buts
????
i write test cases in kotlin but my main code is java
Let him have his joy of life and use static whether he wants ๐ ๐
no you donr
ur using a different language
u dont wanna use java conventions
if i use top level functions
why would u follow java conventions in python for example
I can't just do SomeClass.<see all methods i can use>
thats static
guys, I want to make AbstractFacotry class in Haskell... How can I do this????
imagine if all of java util classes were top level functions
lol
that'd be horrifying
imagine if all of static methods became top level functions
it you want autocomplete you can just ctrl + space
is that not bad?
Not really
theres like a billion things
Everything is top level in functional languages, and stuff like python
ctrl + space doesn't become as helpful
bof
lmao
that's ur problem, refer to the docs
You guys forgot one very important factor
If you forget the name that's a you problem
Not a problem with the language
..
refer to the javadocs, which u ofc make all the time
it's just
You're just trying to create an issue to justify the unnecessary need for that
;-;
@half harness please for the love of god. You are just thinking everything as Java at this point
and some events
Then it's a bad function name, also context is usually given from the functions signature
I'm starting to go back to godot engine conventions
treating events like godot signals
meh
๐ซ
If you need the static prefix, you're not naming the method properly
@stuck harbor good old signals ๐ฅฒ
lol
๐คจ
@@forest pecan
just dont static
Yessir
where do you live
;;-;
i give up
basically yes
How about, dont import what you dont need?
^
That's what files and packages are for
wot
As I've said many times already
already some of my utils are long
Let him have his joy and...
then refactor them
StringExtension.kt
IntExtension.kt
ew
hot
sadge
Please no
slight_smile
Actually I think the Strings.kt convention I talk about is wrong, kt docs say that you shouldn't have files dedicated to just extensions on a specific type
