#dev-general

1 messages ยท Page 84 of 1

prisma wave
#

hmm

topaz bay
#

why is it caps

lunar cypress
#

lol frosty

hot hull
#

I've legit got 0 braincells to cope with this rn

#

Been doing school shit for like 5 hours already

prisma wave
#

i think i've got it

jovial warren
#

@topaz bay hey you can't call me weird anymore because I started writing in Kotlin now lol

prisma wave
#

haha

#

@hot hull you want answer?

jovial warren
#

no idea what the fuck I was on about before but Kotlin >>>>>>>>>>>>>>> Java any day

hot hull
#

nah KM

onyx loom
#

๐Ÿ™‚

prisma wave
#

okey doke

#

@jovial warren finally

onyx loom
#

kotlin good @hot hull

topaz bay
#

@jovial warren I dont know who you are

onyx loom
#

@hot hull did u know kotlin good

topaz bay
#

But good job

hot hull
#

It's simple, just didn't click in my head at first

topaz bay
#

Very proud of you

prisma wave
#

lmao

#

yeah it's pretty simple

jovial warren
#

@topaz bay you can't remember the guy who said Java + Lombok is better than Kotlin? lol

topaz bay
#

Absolutely not.

jovial warren
#

fair enough xD

prisma wave
#

I remember

#

it was painful

jovial warren
#

well once I found out that Kotlin compiles in to JS as well that definitely steered me toward it

prisma wave
#

how come lol

jovial warren
#

because I want to write a plugin with a built-in web interface

#

and knowing I don't even have to touch JS lol

#

you know how litebans has the php bans page?

prisma wave
#

ah fair point

#

yeah

jovial warren
#

my friend told me I could put is it ktor? embedded in to the plugin

#

so you don't even need to install a web server with php

prisma wave
#

yeah Ktor is pretty nice

jovial warren
#

I'm not sure yet though if I should also provide some sort of php-based web interface as well

#

or I should just add the stylesheet as an optional dependency in like the plugin's data folder or something

topaz bay
#

php is trash

#

theres no reason to ever use php

#

LOL

jovial warren
#

good point

#

I want this web interface to be fully customisable though so idk

heady birch
#

spring

jovial warren
#

spring?

obtuse gale
#

big rip, my next year course at school focusses on php

jovial warren
#

heard of it before, got no idea what it is or how it works

#

yeah php is a weird language

#

I don't really think JS is that much better though

#

as a language

#

js is probably a better option than php though, since it's more responsive

prisma wave
#

@lunar cypress i just realised after I submitted that I could've removed all my imports ๐Ÿ˜ญ

lunar cypress
#

rip

#

thing is

#

in this category, python always wins

prisma wave
#

possibly

#

my actual functionality is 2 lines

#
    val N = readLine()?.toIntOrNull() ?: return
    for(i in 1..N step 2) println(i)```
remote goblet
#

skript always wins

jovial warren
#

I don't know whether I could agree with that @lunar cypress

#

Kotlin wins since it compiles to Java and JS

lunar cypress
#

..what?

prisma wave
#

oh yeah python still wins

jovial warren
#

so you only need one codebase

prisma wave
#

@jovial warren we are talking about something else lol

jovial warren
#

python for what?

#

ah okay

prisma wave
#

trying to get the smallest code possible to print odd numbers

lunar cypress
#

Ruby won

#

lol

prisma wave
#

yeah lol

jovial warren
#

yeah python usually wins things like that

prisma wave
#

poor guy using Java

topaz bay
#

(1..(readLine()?.toIntOrNull() ?: return) step 2).forEach(::println)

#

lol

lunar cypress
#

This is my code ```clj
(run! println (filter odd? (range (inc (read)))))

#

But I need to specify an entry point and a namespace unfortunately

jovial warren
#

Java usually comes last in tests like that

prisma wave
#

๐Ÿ˜ญ

jovial warren
#

Kotlin comes somewhere in the middle I think

lunar cypress
#

that is correct

jovial warren
#

it's usually the language with the most boilerplate comes last and the language with the least boilerplate comes first

lunar cypress
#

this was the result

prisma wave
#

not bad

#

4th

jovial warren
#

nice

lunar cypress
#

got kicked out again

#

sick

prisma wave
#

rip

jovial warren
#

thing is though Java wasn't built for compactness, it was built on it's WORA policy

#

probably why it's got so much boilerplate

topaz bay
#

that.... isnt true

lunar cypress
#

whoever "CumBoi69" is, good job

#

lmfao

prisma wave
#

I mean, WORA doesn't mean it has to be verbose

#

yeah lmao

jovial warren
#

but Java was heavily built around that policy

prisma wave
#

even so

#

there's no connection between WORA and verbosity

jovial warren
#

yeah not an excuse for so much verbosity

rotund egret
#

Probaby has more to do so with that Java is built for readability

jovial warren
#

sounds about right

prisma wave
#

possibly

onyx loom
#

hey guys

prisma wave
#

yo

onyx loom
#

who wants to do a code review

prisma wave
#

sure

jovial warren
#

go on then

onyx loom
#

๐Ÿ˜…

#

main goal was mainly for exception

heady birch
#
}
catch (e: KotlinNullPointerException) {
prisma wave
#

Don't catch NullPointerException

heady birch
#

๐Ÿ˜ 

prisma wave
#

don't catch any RuntimeExceptions

onyx loom
#

aw

prisma wave
#

most of the time using !! is a bad idea

jovial warren
#

yeah don't catch null pointers

heady birch
#

You need to add a lie checker

onyx loom
#

it was recommended by IJ

prisma wave
#

IJ is dumb

#

unless you have VERY good reason you should never use !!

#

it doesn't solve any problems, it just defers them

jovial warren
#

IntelliJ sometimes tells you to do smart things and sometimes tells you to do stupid things

onyx loom
#

interesting

#

i enjoyed the ted talk

prisma wave
#

I would null check number, if it's null, send a message and return

lunar cypress
#

clash of code don't kick me challenge 2020

prisma wave
#

lol

ocean quartz
#

Just do return null!! easy

prisma wave
#

@onyx loom you could also do something like kotlin var number = calc() while(number == null) { println("Invalid Input") number = calc() }

#

ew

jovial warren
#

what does !! do again? sorry I'm still kinda new to Kotlin lol

ocean quartz
#

Asserts not null

jovial warren
#

ah okay

onyx loom
#

hmm i was thinking of looping it at first

prisma wave
#

basically throws an NPE if it's null

jovial warren
#

that'll throw a null pointer then if it's null

#

yeah

ocean quartz
#

We should call it the Java operator

jovial warren
#

why?

#

lol

prisma wave
#

because java loves NPEs

#

!!. is equivalent to java .

jovial warren
#

yeah I can agree with that

#

I used to get a lot of NPE's in Java

prisma wave
#

They're unavoidable

jovial warren
#

ever since I started using Kotlin though I haven't seen a NPE in ages

lunar cypress
#

share code @prisma wave

prisma wave
#

You can't null check everything

rotund egret
#

Certainly you could

prisma wave
#

Thought I did

#

oh yeah you could've shifted it left

jovial warren
#

Java is very discrete with NPE's sometimes though

#

I remember the days of sitting there on debug mode just looking for them

prisma wave
#

indeed it is

#

it can get very frustrating at times

brave minnow
#

is there a way to save a default folder (stored in the plugin) ?

topaz bay
#

cant relate

jovial warren
#

yeah when your command just runs but doesn't do anything

#

then you gotta run it in debug mode to find out it's a NPE

#

happened to me all the time

#

is there a way to save a default folder (stored in the plugin) ?
saveDefaultConfig()?

#

you can't save folders from what I remember

#

you can only save files

brave minnow
#

then other than saveDefaultConfig() ?

topaz bay
#

You can save folders, but not through the spigot api

jovial warren
#

and for things other than the config use saveResource()

brave minnow
#

thx ๐Ÿ˜„

topaz bay
#

I did it in voteparty

jovial warren
#

voteparty?

#

which one?

prisma wave
#

these are pretty fun @lunar cypress

lunar cypress
#

yeah they are

topaz bay
brave minnow
#

if I can't do a full folder it's not a problem it's like a config file and a custom file

jovial warren
#

ah okay

#

yeah I was gonna say

topaz bay
#

Use it to save the language files

jovial warren
#

is it glaze? something like that, his one is premium

#

and it doesn't have any DB support

topaz bay
#

It will

jovial warren
#

they working on it?

topaz bay
#

they?

jovial warren
#

glare and clip

#

I'm talking about his one

brave minnow
#

can I use saveRessource() in an expansion ?

jovial warren
#

you mean your one's gonna have DB support

#

nice

lunar cypress
#

this one was a joke @prisma wave

prisma wave
#

it was really easy

topaz bay
#

What are you talking about?? @jovial warren

#

xD

prisma wave
#

it seemed really complex at first but no

#

just an if expression

#

or even a min lol

topaz bay
jovial warren
#

@topaz bay is that vote party plugin you sent a link to gonna have database support?

#

ah okay

#

so it's yours and darbyjack's

topaz bay
#

Its glare..

#

Its the one youre talking about

jovial warren
#

wait that's open-source?

hot hull
#

All of Glare's plugins are

jovial warren
#

they're premium and open-source?

hot hull
#

Freemium yes

prisma wave
#

yes

ocean quartz
#

Yeah

hot hull
#

You're paying for support

jovial warren
#

ah okay

prisma wave
#

which is very good imo

ocean quartz
#

Agree

hot hull
#

Everyone should do that

prisma wave
#

^

brave minnow
#

hulp me pls :c

jovial warren
#

does he have his own spigot page?

brave minnow
#

@hot hull ๐Ÿ‘ PlusOne

jovial warren
#

because clip's page for it doesn't mention anything about source code

jovial warren
#

that's the one I'm on

#

actually yeah it's not on clip's page

#

sorry the art being the same confused me

topaz bay
#

art by funnycube

#

lol

jovial warren
#

same guy who makes clip's art

topaz bay
jovial warren
#

no mention of source code on that page though

topaz bay
#

Wow... I'm offended...

#

@frail glade update it

#

LOL

brave minnow
#

is there a way to use saveRessource() in an expansion as long as it's not extended from JavaPlugin ? :c

jovial warren
#

you can't use saveResource() outside of JavaPlugin or an extension of it

#

you'd have to use a built-in method

prisma wave
#

Files.copy

jovial warren
#

actually you could either have the main as a singleton or pass an instance of the main to the subclass using the constructor

ocean quartz
#

It'd save in the extension's plugin's folder if you did it with it's instance

brave minnow
#

can you show me an example pls ? I don't really understand ^^'

prisma wave
#

@lunar cypress anymore?

lunar cypress
#

yeah, our mate is still lost lmfao

prisma wave
#

oh yeah lmao

#

poor guy

#

@brave minnow you'll probably need to read from ClassLoader#getResource and copy to your file. Have a look how saveResource does it

#

i am pretty sure there's a method somewhere in Files for this

ocean quartz
#

It gets resource as inputstream i think

prisma wave
#

getResource is a URL, getResourceAsStream is an InputStream

#

might be a URI actually

jovial warren
#

@topaz bay why are some parts of VoteParty still in Java?

#

even though most of it's in Kotlin

prisma wave
#

@brave minnow Files.copy(InputStream, Path) may be useful

#

yay

lunar cypress
#

we ended his suffering

prisma wave
#

poor guy

#

tbf it was very strangely worded

ocean quartz
#

Imma join that on my phone

jovial warren
#

also for DB support I'd recommend just removing raw text file support completely and setting h2 as the default flat file driver, then maybe for people with the old versions you could have it migrate to h2 on startup if the old raw text file still exists or something @topaz bay

ocean quartz
#

Then take like 30 minutes to type it xD

brave minnow
#

isn't getRessource good for it ?

lunar cypress
#

HA

#

got em

prisma wave
#

getResource won't work in an extension misunderstood, use getResourceAsStream

#

WHAT

#

HOW

topaz bay
#

@jovial warren thats not my decision to make

#

ask glare

prisma wave
#

i was pretty proud of my 1 line factorial function

lunar cypress
#

by 2 seconds lol

jovial warren
#

how do I ask glare?

topaz bay
#

?

jovial warren
#

what's his username?

topaz bay
#

hes literally in this server?

jovial warren
#

oh is he

#

okay

prisma wave
#

using java is just shooting yourself in the foot here lol

lunar cypress
#

what was your solution bm?

prisma wave
#

IntRange.reduce

#

i'll share 1 sec

lunar cypress
#

nice one

#

same as me basically

prisma wave
#

yeah pretty much lol

jovial warren
#

@topaz bay couldn't recognise his username lol

onyx loom
#

wat

jovial warren
#

he's got dm's from server members turned off, don't really blame him to be fair lol

ocean quartz
#

The waffle king

jovial warren
#

yep

#

I mean I could always fork the plugin, make my changes, then submit a merge request

#

probably best to talk to him about my proposed changes though

#

@frail glade I heard you were planning on adding database support for VoteParty, thought I'd propose a plan. I think you should just use relational databases and scrap raw text files completely, preferably using H2 as the default driver, then possibly adding in a migration system for the old raw text file system to H2, since there isn't really a reason to support raw text files once you support H2 anyway.

onyx loom
#

Type mismatch.
Required: Int
Found Int?

#

OK BUDDY

jovial warren
#

lol

onyx loom
#

how do i fix this ๐Ÿ™ƒ

prisma wave
#

Int? != Int

#

Int? can be null, Int cannot

#

send code

jovial warren
#

needed a notnull int and got a nullable int

onyx loom
#

hmm k

jovial warren
#

? means nullable

#

same as @Nullable in Java

onyx loom
#

im in the dark here so ignore me

jovial warren
#

number is of type Int

#

it's inferred

#

toIntOrNull() returns a nullable integer, or Int?

onyx loom
#

when u said number = calc(), it was throwing a different error, so i put it to number = 0

jovial warren
#

try val number: Int? = 0

#

that will tell kotlin explicitly that you want a nullable integer

#

also I'd suggest just parsing number as a parameter to calc()

onyx loom
#

ye im not quite there yet ๐Ÿ˜…

#

i just started, as u can tell

jovial warren
#

fun calc(number: Int?)

#

yeah I can tell

onyx loom
#

also i cant use val as its being reassigned

#

so do i remove the = 0?

jovial warren
#

either that or change it to var

onyx loom
#

then it can be ig

prisma wave
#

Realistically number shouldn't be a global variable

jovial warren
#

or just remove it entirely

#

^^^^^

#

you should parse it as a parameter to calc()

prisma wave
#

1 method should parse the user input and return it, another method should check the input

onyx loom
#

ill get there eventually haha

prisma wave
#

eg kotlin fun main() { val age = readIntFromInput() validateAge(age) } something like that

jovial warren
#

also, repeated code

#

just put the println("You are $number years old.") outside of the if statement

frail glade
#

I probabaly won't add database anytime soon. It's not a priority.@jovial warren

onyx loom
#

ig i could

#

just looks nicer with stating the age first idk

hot hull
prisma wave
#

it could still be first

#
println("age blah")
if(age >= 18)```
onyx loom
#

thats how i had it at first, idk why i repeated it actually

jovial warren
#

@frail glade alright, I could just fork it and implement it myself then submit a merge request I guess

frail glade
#

If you want to

prisma wave
#

you've got a bit of spaghetti logic going on here @onyx loom . you go from main() to calc() and then back to main() over and over. You should have 1 function that loops until they put in a valid int, and then return that int

frail glade
#

I don't plan to rid flatifle support tho

jovial warren
#

H2 is flatfile

frail glade
#

Idc, I like json

jovial warren
#

alright

frail glade
#

You're welcome to offer a MySQL implmentation.

jovial warren
#

I'll keep the JSON and add an option then

#

sound good?

prisma wave
#

this is why OSS good

jovial warren
#

OSS?

prisma wave
#

people do the work for you lol

#

Open source software

jovial warren
#

like sonatype?

#

ah okay

frail glade
#

Ikr. I can go back to bed now.

jovial warren
#

alright good night

#

I'll see what I can do

prisma wave
jovial warren
#

get that out of here right now

hot hull
#

What the fuck lmao

onyx loom
#

ye i will do that when i get parameter passing, but for now spaghetti good.

#

@prisma wave ^

prisma wave
#

spaghetti bad

onyx loom
#

๐Ÿ˜„

lunar cypress
#

@prisma wave who tf is that

#

also the website sucks

prisma wave
#

no idea lmao

#

does it?

lunar cypress
#

yeah

#

my clojure io did not work

#

it simply didn't register the last line

prisma wave
#

๐Ÿ˜ฆ

lunar cypress
#

I tried in the repl

#

no problems

#

did the same thing in python

#

works too

prisma wave
#

strange

brave minnow
#

@prisma wave what should be the input stream to get the file in the plugin ?

prisma wave
#

ClassLoader#getResourceAsStream

brave minnow
#

kay :p

prisma wave
#

or just Class#getResourceAsStream

#

so eg getClass().getResourceAsStream("config.yml")

#

that one might not work tho

brave minnow
#

why ? ๐Ÿค”

prisma wave
#

because papi & spigot both do some weird classloader stuff that can cause problems

#

Class#getResourceAsStream has never worked in my experience but you can try

#

@lunar cypress any more?

lunar cypress
#

missed the last one, currently waiting

prisma wave
#

oh rip

#

ok

lunar cypress
#

ok, most of the others left

#

so that's it for now

#

if enough people from this server participate, we can also do that some time

heady birch
#

Lmao

prisma wave
#

๐Ÿ˜ฆ

#

ok

#

we need to organise a thing to do it

jovial warren
#
repositories {
  jcenter()
}
dependencies {
  compile("org.jetbrains.exposed", "exposed-core", "0.24.1")
  compile("org.jetbrains.exposed", "exposed-dao", "0.24.1")
  compile("org.jetbrains.exposed", "exposed-jdbc", "0.24.1")
}

anyone know why Gradle says that's invalid?

#

never used gradle before, just got that from exposed

prisma wave
#

What does it say is wrong?

#

The groovy syntax is slightly different

lunar cypress
#

The snippet up there only works with kotlin

#

With groovy you can't separate artifact, group and version like that

brave minnow
#

@prisma wave sry a bit late but what should go in copyOption ? ^^'

prisma wave
#

You don't need any

#

Unless you want to overwrite and things

brave minnow
#

so null ?

prisma wave
#

it's varargs

#

So you shouldn't need any

old wyvern
#

Umm shortness of breath is not a initial symptom of covid right?

brave minnow
#

Paths.get("plugins/PlaceholderAPI/mli/") how can I make a relative path ?

old wyvern
#

Relative to?

onyx loom
#

its a symptom ye

hot hull
#

Yugi, rip you

obtuse gale
old wyvern
#

But I only have the breath issue

#

No other symptoms

obtuse gale
#

Guys smh

#

gotta maintain social distance

onyx loom
#

thats the same with my mum

obtuse gale
#

Someone put a 2min cooldown here

hot hull
#

lol

obtuse gale
#

gotta have the social distancing

onyx loom
#

u got covid buddy

old wyvern
#

Uh but I didnt go out till day before yesterday

#

3 days is too less to show any symptoms

onyx loom
#

shouldntve went out ๐Ÿ™ƒ

#

thats not true

obtuse gale
hot hull
#

You drink much?

obtuse gale
#

Welp

#

Good luck

old wyvern
#

I havent drunk since like jan

onyx loom
#

๐Ÿ˜‚

old wyvern
#

Well I have had breathing issues jn thw past so Im gonna wait till I get any other symptom

#

Just gonna take some asthalin for now

onyx loom
#

u dont always get more than 1 symptom

#

but sure

obtuse gale
#

gl

old wyvern
#

โ˜ ๏ธ

brave minnow
#

InputStream config = this.getClass().getClassLoader().getResourceAsStream("Language.yml");is it correct at least ?

#

@prisma wave help my deadass brain pls '-'

prisma wave
#

Looks good

brave minnow
#

why is null then ? :c

prisma wave
#

That's a good question

#

The answer might be Papi and spigot being weird

#

Is the file present in the jar?

hot hull
#

What is you even trynna do btw

brave minnow
#

yes it is

obtuse gale
#

Is that....

brave minnow
#

is that ?

obtuse gale
#

eclipse....

#

Requesting backup

brave minnow
#

yes don't try to understand I also have ij '-'

prisma wave
obtuse gale
#

fuuuuuuuuuuuuu

#

eclipse

brave minnow
#

yes it is x)

obtuse gale
#

white theme as well tho

brave minnow
#

I got in on every load lol

prisma wave
#

@brave minnow 2 things:
make sure the file is inside the jar
try Class#getResourceAsStream

#

if both of those fail then you might need to try something cleverer

brave minnow
#

I like the pain

onyx loom
#

i love pain too

prisma wave
#

don't we all

onyx loom
#

reeeeeeeeee

brave minnow
#

still fail ;-;

#

btw

#

hulp ;-;

prisma wave
#

is the file in the exported jar?

brave minnow
#

yus

#

@prisma wave is it possible to grab from jar file with those ? ```private FileConfiguration customConfig = null;
private File customConfigFile = null;

prisma wave
#

Not really, you need to get the file from inside the jar somehow. does getClass().getResourceAsStream work?

brave minnow
#

no :c

#

well I think I'll generate it with java ... '-'

prisma wave
#

wdym?

jovial warren
#

it is possible to get files from those configurations

#

as long as you initialise them

#

I think File has a load() method

prisma wave
#

FileConfiguration does, the difficulty is getting a File

jovial warren
#

this is why you're supposed to load configurations using the main class

#

since that one has the data folder

#

getDataFolder() in Java

prisma wave
#

this isn't a plugin

jovial warren
#

what is it?

prisma wave
#

an expansion i believe

jovial warren
#

an expansion of a plugin?

prisma wave
#

for papi

jovial warren
#

ah okay

#

the only time you make PAPI expansions though is with a plugin

#

unless you're trying to make an expansion to bridge PAPI and another plugin that doesn't use PAPI

#

which seems like a bad idea

prisma wave
#

you can have standalone papi expansions

jovial warren
#

purpose.exe not found

brave minnow
#

yep but I would say generate the file and the config from api methods

jovial warren
#

what are you actually trying to make?

brave minnow
#

the expansion or the file ?

jovial warren
#

the whole project

brave minnow
#

translatable placeholders

jovial warren
#

placeholders that can be translated in to other languages?

brave minnow
#

yes

jovial warren
#

what files are you trying to write? locale files?

brave minnow
#

yes

jovial warren
#

ah okay

#

what are you using for configuration? YAML?

brave minnow
#

yes

jovial warren
#

YamlConfiguration config = new YamlConfiguration()?

#

then config.load()

#

?

brave minnow
#

yep but can't put one in the java archive and extract it :/

jovial warren
#

you using maven?

brave minnow
#

nope

jovial warren
#

gradle?

brave minnow
#

neither

jovial warren
#

any form of build automation tool?

brave minnow
#

nah

jovial warren
#

if you're using build path that's the first thing I would change

#

but that's not important

#

for the moment

brave minnow
#

why ? ๐Ÿค”

jovial warren
#

makes dependency management like a million times easier

brave minnow
#

I guess ^^

prisma wave
#

easier, platform agnostic, more extendable, handles things like shading, etc

jovial warren
#

^^^^

prisma wave
#

but I think the problem is that papi's (and spigot)'s loading of classes suck

jovial warren
#

I would've thought PAPI's API would have some way to get the data folder

prisma wave
#

it's not the data folder

#

it's the loading of resources inside the jar

jovial warren
#

ah okay

#

so there's not a problem saving the file to the right place or what?

#

or is it just not bundling properly

brave minnow
#

there's a problem to grab the file not save it

jovial warren
#

ah okay

#

where's the JAR located and where's the file located?

prisma wave
brave minnow
#

file in jar jar in papi folder

jovial warren
#

yeah that's definitely questionable @prisma wave

prisma wave
#

i tried to make a kotlin script expansion for papi

#

the amount of class not found errors I experienced was horrific

jovial warren
#

making an efficient, user-friendly, working, actually looks like programmer gives a shit about end user API is harder than you think

#

although when the entirety of your project is an API you'd expect it to be written well

prisma wave
jovial warren
#

also why is it loading classes?

prisma wave
#

For the expansion to run

jovial warren
#

ah okay

#

why's it using URLClassLoader?

prisma wave
#

to load the classes from the jar?

#

but loading all the .class files is a questionable decision when URLClassLoader can load full jars in 1 line

jovial warren
#

sorry I don't know much about loading classes

prisma wave
#

hence the issue

#

i don't know a lot

#

but i've got a bit of knowledge

jovial warren
#

I've never ever had to load classes

prisma wave
#

I had to make a module system a few years ago so I picked up a lot then

jovial warren
#

so that should be used to just load entire JAR files rather than separate classes?

prisma wave
#

indeed

#

there's no reason to iterate over the JarEntries when URLClassLoader can just load the entire jar

jovial warren
#

also yeah I've never made an API before so probably why I haven't ran in to things like this

prisma wave
#

which will include resources as well

jovial warren
#

if I want to optionally hook in to PAPI though I'll need to use this API won't I

#

though that method won't apply for me since I'll <scope>provided</scope> the PAPI API maven module

prisma wave
#

yeah PAPI won't need to load any classes in that case

#

the classloading is done for standalone expansions that aren't plugins

jovial warren
#

if you're wondering what I'm working on it's a free and open-source punishments plugin with built-in web server, bukkit and bungee support, possibly placeholder support, and as if not more customisable than paid alternatives such as LiteBans

#

also with a better API than LiteBans

#

currently a WIP

#

but anyway

brave minnow
#

is there a way to grab all file name in a dir ?

prisma wave
#

File#listFiles

#

yeah i remember you mentioning the Litebans rewrite a while back

#

sounds nice

jovial warren
#

it's written from scratch in Kotlin

#

the bukkit and bungee plugins will be separate JARs, unlike pretty much every other punishments plugin I seem to be able to find, mainly because I personally think having separate JARs is easier to distinguish between the versions

#

oh I forgot to mention that it has full database support as well

#

H2, MySQL, MariaDB, hopefully PostgreSQL, and SQL server I think

#

can't add MongoDB because it's not relational

#

anything else you think I should add?

prisma wave
#

hmm

#

what are you using for the web interface

#

ktor?

jovial warren
#

yeah probably

prisma wave
#

nice

jovial warren
#

something I can embed in to the plugin

#

so that it doesn't even depend on an external web server like LiteBans does

#

not sure how I'm going to make it configurable

prisma wave
#

I think you should release the webserver as a standalone jar

#

so people can run it on a vps or something if they want

jovial warren
#

could do

#

it's gonna be written in JS though I think

prisma wave
#

Kotlin/JS ?

jovial warren
#

(a.k.a Kotlin since Kotlin compiles to JS)

#

yeah

#

my friend said he uses angular

prisma wave
#

even so

brave minnow
#

in case I'm making a placeholder expansion stored in papi folder the path to it (from the jar of expansion) will be plugins/placeholderapi/expansions isn't it ?

prisma wave
#

allow people to run it where they want

#

make it a separate module at the very least

jovial warren
#

should it be a JAR if it's got no Java in it though?

prisma wave
#

@brave minnow yes

#

no I don't think so

brave minnow
#

well gud ๐Ÿ˜„

prisma wave
#

i'm not actually sure what Kotlin/JS builds to

#

just .js files I guess

jovial warren
#

yeah

brave minnow
#

so File("plugins/placeholderapi/expansions") will show me the dir of it no ? ๐Ÿค”

jovial warren
#

I want to make it be able to run standalone though

#

I mean the plugin

#

without actually requiring that the web server be added to be able to use it

#

if you know what I mean

prisma wave
#

yeah

#

but people should have the option

jovial warren
#

yeah

prisma wave
#

@brave minnow I don't think so. new File("") will be `plugins/placeholderapi/expansions I believe

jovial warren
#

I could bundle it in to the JAR and then make it configurable

#

and yeah should be

#

also where's the PAPI maven dependency?

#

please don't tell me it doesn't have one

hot hull
#

sec

#
<dependency>
            <groupId>me.clip</groupId>
            <artifactId>placeholderapi</artifactId>
            <version>2.10.6</version>
            <scope>provided</scope>
        </dependency>
        <repository>
            <id>placeholderapi</id>
    <url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
        </repository>
jovial warren
#
    <repositories>
        <repository>
            <id>placeholderapi</id>
            <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
         <groupId>me.clip</groupId>
          <artifactId>placeholderapi</artifactId>
          <version>{VERSION}</version>
         <scope>provided</scope>
        </dependency>
    </dependencies>

got it? I'm guessing that's it

#

cheers

#

found it on the wiki

#

was just confused because it wasn't on the front page lol

#

also if I implement it in my plugin you don't need to make an expansion for it right?

hot hull
#

Nope

jovial warren
#

these expansions are just for the plugins that don't have it implemented in them right?

hot hull
#

Yes

jovial warren
#

ah okay

#

nice

#

where you storing that?

hot hull
#

So close to being finished damn

#

Storing as in during runtime or?

jovial warren
#

that answer is memory

#

I mean where are you storing it as in: if the server goes down, what happens?

hot hull
#

End goal for warp storage is gonna be mysql/flatfile

somber tulip
#

Is that per player warps too frosty? c:

jovial warren
#

if you want DB support I'd suggest just scrapping raw text file support

hot hull
#

None of it actually implemented yet :p

#

Harolds, Server and Player

somber tulip
#

Good man

jovial warren
#

what I mean by that is just use H2 or SQLITE as the default driver

#

and scrap things like JSON, YAML or Plain Text

hot hull
#

We'll see what's easiest to use I guess

jovial warren
#

just, I wouldn't implement MongoDB support

#

since MongoDB isn't a relational database

#

also I'd suggest using some sort of object-relational mapping software

#

for Java I recommend ORMLite and for Kotlin I recommend Exposed

#

if you don't know what ORM is basically it just takes executing raw queries out of your hand by using objects that represent columns in a database

heady birch
#

Spring

jovial warren
#

Spring?

ocean quartz
#

Don't listen to him, he suffers from SDD

prisma wave
#

Spring everything

jovial warren
#

tf even is spring lol

hot hull
#

Spring?

prisma wave
#

"tf isn't spring" you mean

#

it does everything

#

and more

jovial warren
#

wdym "everything"

prisma wave
#

spring literally does everything

#

websockets, persistence, http

#

security, oauth, dependency injection

#

reactive streams

jovial warren
#

I've got a use for exactly one of those

heady birch
#

Then you need it

prisma wave
#

^

heady birch
#
  • 45mb jar
jovial warren
#

I don't need Spring for dependency injection

heady birch
#

you dont need

ocean quartz
#

Until you do

heady birch
#

but you could

prisma wave
#

you do

hot hull
#

Do you?

prisma wave
#

you always need spring

heady birch
#

I wanna try out the reactive stuff at somepoint

jovial warren
#

koin does just fine

prisma wave
#

no matter how simple your app is

heady birch
#

Hello world

jovial warren
#

and koin is made for kotlin

#

Spring is made for Java

prisma wave
#

koin is nice tbf

#

spring has lots of support for kotlin though

heady birch
#

Besides the point

hot hull
#

What's the cleanest way of validating that an input string exists as an enum?

heady birch
#

Spring

prisma wave
#

spring

hot hull
#

Cause valueOf throws ew errors if it doesn't

prisma wave
#

Enums.getIfPresent or something iirc

heady birch
#

A DTO

prisma wave
#

Enums.valueOf maybe

heady birch
#

Then @Valid annotations

hot hull
#

Km boi

heady birch
#

Build a validation

prisma wave
#

yes

ocean quartz
#

Enum's value of throwing error is so annoying, just return null

heady birch
#
final class final MyStringInput {
  final @NotNull
  final @MyEnumExists
  final private final String final input;

  final public final void final setInput(final String final input) {
    final this.final input = final input;
  }

  final public final String final getInput() {
    final return finalinput;
  }
}```
prisma wave
#

not enough kotlin

#

and not enough final either

jovial warren
#
class MyStringInput {

    private val input: String;
}

isn't that literally enough for Kotlin or is it just me lol

hot hull
#

Matt, exactly

heady birch
#

Make your own static method

prisma wave
#
data class MyStringInput(val input: String)```
#

even better

ocean quartz
#

^

jovial warren
#

there ya go

prisma wave
#

equals, hashcode, toString and all the other stuff done for you

hot hull
#

Niall, effort

heady birch
#

not enough boilder plate

#

Cleanest way

prisma wave
#

you're right

jovial warren
#

"not enough boilerplate"

prisma wave
#

boilerplate = clean code

#

lmao

jovial warren
#

"not enough boilerplate"
I should put that one on a T-Shirt

prisma wave
#

you should

#

I'd buy one

heady birch
#

enum MyCoolEnum {
  COOL,
  COOLER,
  COOLEST;

  public static MyCoolEnum whichCoolIsIt(String coolEnumName) {
    for (MyCoolEnum coolEnum : values()) {
      if (coolEnum.name().equalsIgnoreCase(coolEnumName)) {
        return coolEnum;
      }

      //there is no cool enum
      return null;
  }```
jovial warren
#

class? CLASS????????

heady birch
#

Lol

prisma wave
#

smh

ocean quartz
#

Dammit spring boi

heady birch
#

Too much kotlin

#

made me think enum class

#

wiht no enum

jovial warren
#

I haven't quite got to that point yet lol

#

I only really started using Kotlin a few days ago

hot hull
#

How would I have a param for any type of enum, so I can just loop through those enums values

prisma wave
#

wdym

jovial warren
#

Enum<T> @hot hull ?

#

or Enum<Any?>

heady birch
#

what

#

idk what hes asking lol

prisma wave
#

enums can't have type parameters i don't think

ocean quartz
#

Any doesn't exist in Java

jovial warren
#

How would I have a param for any type of enum, so I can just loop through those enums values
@heady birch ^^^^^

#

Enum<Object> then @ocean quartz

heady birch
#

Enum and interface

hot hull
#

I mean so I can just input that enum, and loop through the values, instead of having a method in each enum

jovial warren
#

Enum and interface
^^^^ yeah that's probably a better idea

heady birch
#
enum DefaultCoolEnum implements CoolEnumNamable {
    COOL {
        @Override
        public String getName() {
            return "Cool";
        }
    }
}
hot hull
#

Niall, ew.

prisma wave
#
public static MyCoolEnum valueOf(String name) {
  MyCoolEnum[] values = values();
  List<MyCoolEnum> notMatching = new ArrayList<>();
  while(notMatching.size() <= 1) {
    for(MyCoolEnum value : values) {
      if(!value.name().equalsIgnoreCase(name.toLowerCase())) {
        notMatching = new ArrayList<>(notMatching);
        notMatching.add(value);
      }
    }
  }
  return notMatching.get(0);
}``` I've not tested this but behold - valueOf in `O(n!)`
jovial warren
#

put that in a code block @heady birch

heady birch
#
public static MyCoolEnum valueOf(String name) {
  MyCoolEnum[] values = values();
  List<MyCoolEnum> notMatching = new ArrayList<>();
  while(notMatching.size() <= 1) {
    for(MyCoolEnum value : values) {
      if(!value.name().equalsIgnoreCase(name.toLowerCase())) {
        notMatching = new ArrayList<>(notMatching);
        notMatching.add(value);
      }
    }
  }
  return notMatching.get(0);
}``` I've not tested this but behold - valueOf in `O(n!)`

@prisma wave No

prisma wave
#

nvm that won't work

heady birch
#

Not enough OO

prisma wave
#

this needs improvement

heady birch
#

Not enough boiler plate

jovial warren
#

lol

heady birch
#

Not enough enterprise

jovial warren
#

I hope you're not actually being serious @heady birch xD

hot hull
#
public static boolean isValid(final Warp.Category inputEnum, final String input) {

Warp.Category being any enum I desire

heady birch
#

I think I misunderstood what he wanted anyway

hot hull
#

You get what I mean now?

prisma wave
#

not enough boilerplate you say?

heady birch
#

Why do this

prisma wave
#

bear with

heady birch
#

Just make isValid static in the Warp.category enum

#

Then a nice try catch

hot hull
#

Because that's not the only enum I'm gonna be using it for

heady birch
#

Well then it wont work

jovial warren
#

also @hot hull you should learn Kotlin

hot hull
#

Bardy, be gone.

jovial warren
#

lol

#

you be gone for still using Java xD

heady birch
#

use type

hot hull
#

type?

heady birch
#
public <T extends Enum<T>> boolean isValid(Enum<T> theEnum, String theEnumValue) {
  for (T val : theEnum.values()) {
    if (val.name().equalsIgnoreCase(theEnumValue)) {
      return true;
    }
  }
  return false;
}
ocean quartz
#

Frosty is a hater ๐Ÿ˜ข

jovial warren
hot hull
#

why is that a void and a boolean Niall :p

prisma wave
#

smh

heady birch
#

Lol lmao

#
public <T extends Enum<T>> boolean isValid(Enum<T> theEnum, String theEnumValue) {
  for (T val : theEnum.values()) {
    if (val.name().equalsIgnoreCase(theEnumValue)) {
      return true;
    }
  }
  return false;
}
#

Havnt tested it should work

#

I cant even remember where the T definition goes

#

Do you like my apihttps://github.com/Niall7459/KiteBoard-Documentation/wiki/Developer-API

jovial warren
#

you want me to pick it apart?

heady birch
#
Criteria.Factory<MyCriteria> factory = MyCriteria::new;```
#

Uses nice genreics

#

pick it apart?

#

if you mean criticize yes

#

would like to know how/if it can be improved

prisma wave
#

well boys

jovial warren
#

by pick it apart I basically mean go through it and find pretty much every fault there is lol

prisma wave
#

it's done

#

what do you think

jovial warren
#

also if it's an API it always be improved

heady birch
#

Oh I like that

prisma wave
#

I made it as slow as possible

jovial warren
#

lol

prisma wave
#

Including useless concat() and toLowerCase() calls

heady birch
#

Oof

jovial warren
#

oh and it's written like that

prisma wave
#

Should probably add some Thread.sleep calls so we can make a nice progress bar

heady birch
#

Yes!

jovial warren
#

yeah

hot hull
#

I'm lost Niall

heady birch
#

BM do you like my api

prisma wave
#

I've not seen it much

jovial warren
#

what's it an API for @heady birch ?

heady birch
#

Kiteboard

hot hull
#

=pl kiteboard

compact perchBOT
#

v3.0.8 by Niall7459
The enterprise scoreboard and tablist solution, hook into any event!

Downloads:

493

Likes:

134

Reviews:

69

hot hull
#

This bad boi

prisma wave
#

"enterprise" ๐Ÿ‘€

heady birch
#

Also I documented one part wrong

prisma wave
#

Does that mean what I hope it does

heady birch
#

Do what

jovial warren
#
RegisteredServiceProvider<KiteBoard>serviceProvider = getServer().getServicesManager().getRegistration(KiteBoard.class);

not sure about that one

heady birch
#

๐Ÿ˜ 

#

Frostry told me to use that

hot hull
heady birch
#

Over .load(

jovial warren
#

I'd suggest just having some sort of API singleton main class and then just getting the instance

heady birch
#

๐Ÿ˜•

jovial warren
#

pretty sure LuckPerms does it the way I'm thinking of hold on

heady birch
#

@hot hull I will try in ide

jovial warren
#

then lucko registers the API in the plugin I think

#

might be wrong there

#

yeah common depends on the API

prisma wave
heady birch
#

Ah you gotta use reflection

#

Cool I'll take a loo

prisma wave
#

wait that's wrong

hot hull
#

That's hella quick KM

prisma wave
#

nvm it's not that slow

#

i can't math

heady birch
#

@hot hull

public <T extends Enum<T>> boolean isValid(Class<T> theEnum, String enumName) {
    for (T val : theEnum.getEnumConstants()) {
        if (val.name().equalsIgnoreCase(enumName)) {
            return true;
        }
    }
        
    return false;
}
#

Reflection to get the constants

jovial warren
#

you've passed that a Class object though

#

I wouldn't've thought that object would have the getEnumConstants() method

#

or am I just talking out of my arse

heady birch
#

Yeah you would just give it the class of the enum

#

It doesn't apparently

jovial warren
#

so Class<Enum<T>>?

#

no

#

Enum<T>

#

yeah

heady birch
#

Warps.Category.class

jovial warren
#

ah okay

#

never had to do what he's doing before

#

also someone put that in to kotlin

#

I'm just curious what it'd look like

#
fun <T : Enum<T>?> isValid(theEnum: Class<T>, enumName: String?): Boolean {
    for (value in theEnum.enumConstants) {
        if (value!!.name.equals(enumName, ignoreCase = true)) {
            return true
        }
    }
    return false
}
hot hull
#

ayy, works

jovial warren
#

that's what I got from IntelliJ

prisma wave
#

Ew

#

I think you can do it in 1 line

jovial warren
#

probably

prisma wave
#
inline fun <reified T : Enum<T>> isValid(name: String) : Boolean {
  return enumConstantsOf(T::class.java).any {
  it.name.equals(name, true)
  }
}```
#

I believe it would be that

#

but I typed it on mobile so

#

Then you could do like isValid<Material>("stone_bricks")

heady birch
#

@hot hull Thank you thats 49.99

#

What does reified mean in kotlin?

jovial warren
#

fun <T: Enum<T>?> isValid(theEnum: Class<T>, enumName: String?): Boolean = theEnum.enumConstants.forEach { it?.name == enumName } @prisma wave ?

prisma wave
#

You can access the class of a type parameter

jovial warren
#

actually no that returns Unit

hot hull
#

Niall, you owe me 50$ for advertising kiteboard

#

W're even

prisma wave
#

reified means you can do T::class

hot hull
#

We're*

heady birch
#

when

onyx loom
#

frosty, u owe me 50$ for advertising FJ

hot hull
#

U already got your clout

onyx loom
#

NO

#

MONEY

hot hull
#

What's that?

onyx loom
#

mooney

prisma wave
#

@jovial warren enumConstantsOf is a thing that does the reflection for you, and I would avoid the nullability, and use any instead of forEach

hot hull
#

Happened two times within 2 days already, anyone got any idea why?
Cannot create resource output directory: C:\Users\Frosty\Desktop\Projects\IntelliJ\Warps\target\classes -> [Help 1]

prisma wave
#

Bad pc

hot hull
#

Thanks

onyx loom
#

bad pc

prisma wave
#

Usually that's windows being dumb

jovial warren
#

fun <T: Enum<T>?> isValid(theEnum: Class<T>, enumName: String?): Boolean = theEnum.enumConstants.any { it?.name == enumName } so this @prisma wave ?

prisma wave
#

I've noticed it seems to happen a lot on win 7

heady birch
#

Whats your fav template engine for spring BM?

hot hull
#

It hasn't happened in the last 6 months i've been using IJ, and now it started, sus af

prisma wave
#

@jovial warren that would work but for QoL I would not allow nullable things

#

I've only ever used thymeleaf

jovial warren
#

that return type can also be inferred

prisma wave
#

What others are there?

#

Expression bodies are nice

#

And yes it can

heady birch
#

freemarker and mustache, never used them though

jovial warren
#

I think the rule with inferences is if it's nullable it must be defined explicitly, otherwise it can usually be inferred

prisma wave
#

But you should be careful with inferred return types, unless the body is clear then it can be somewhat difficult to read

#

Nullable types can be inferred too

jovial warren
#

lemme correct that

heady birch
#

And goovy templates

prisma wave
#

Which can actually work against you

heady birch
#
yieldUnescaped '<!DOCTYPE html>'
html {
  head {
    title('Spring Boot - Groovy templates example')
    link(rel: 'stylesheet', href: '/css/bootstrap.min.css')
  }
  body {
    div(class: 'container') {
      div(class: 'navbar') {
        div(class: 'navbar-inner') {
          a(class: 'brand',
              href: 'http://beta.groovy-lang.org/docs/groovy-2.3.2/html/documentation/markup-template-engine.html',
              'Groovy - Template Engine docs')
          a(class: 'brand',
              href: 'hhttp://projects.spring.io/spring-boot/') {
            yield 'Spring Boot docs'
          }
        }
      }
      div("This is an application using Boot $bootVersion and Groovy templates $groovyVersion")
    }
  }
}
#

That's intersting

prisma wave
#

yikes

jovial warren
#

the rule with inferences is: if the type you want to return is being returned by the method you're using, it can be inferred

ocean quartz
hot hull
#

Also KM, I wouldn't be surprised if it's IJ since I'm using version 2018.3 :kek:

prisma wave
#

could be

jovial warren
#

why are you still on a 2018 build?

hot hull
#

Reasons

prisma wave
jovial warren
#

that must've bugged you every time you opened it up that it needs an update

hot hull
#

Still does

jovial warren
#

I'd highly suggest updating that

hot hull
#

Can't

jovial warren
#

why not?

prisma wave
#

Pc bad

jovial warren
#

latest not compatible with your machine?

onyx loom
#

reasons

hot hull
#

Not just latest

#

Any never than 2018.3

#

:))

onyx loom
#

but why

jovial warren
#

OS?

prisma wave
#

@ocean quartz destructuring is hands down of Kotlin's best features

jovial warren
#

how does it work?

#

never used it before

#

very new to Kotlin lol

prisma wave
#

some things can be destructured if they override the component operators

ocean quartz
#

Ikr, it's amazing

jovial warren
#

one of my favourite features is the ability to add methods to existing classes

prisma wave
#

So for example ```kotlin
playerXP.entries.forEach { (player, xp) ->
}

jovial warren
#

ah okay

prisma wave
#

Which is a lot more useful than it sounds

#

You can destructure lists like in Matt's example

jovial warren
#

yeah right now I'm like "usage.exe not found"

prisma wave
#
val (first, second, third) = listOf(1, 2, 3)
#

It's mostly for QoL

#

Makes working with regexes a lot nicer for example

ocean quartz
#

Basically any data class can be destructured into their independent variables

jovial warren
#

what are your thoughts on being able to add methods to existing classes though?

#

sounds useful

prisma wave
#

Ah yes extension functions

#

they're also very nice

jovial warren
#
fun LocalDateTime.add(duration: String): LocalDateTime? {
    if (!duration.matches("((\\d+)\\w*)+".toRegex())) return null
    val matcher = "(\\d+)([a-z]*)".toPattern(Pattern.CASE_INSENSITIVE).matcher(duration)
    var result = this
    while (matcher.find()) {
        val amount = matcher.group(1).toLong()
        val unit = when {
            matcher.group(2).matches("s(ec(onds?)?)?".toRegex()) -> SECONDS
            matcher.group(2).matches("m(in(utes?)?)?".toRegex()) -> MINUTES
            matcher.group(2).matches("h(ours?)?".toRegex()) -> HOURS
            matcher.group(2).matches("d(ays?)?".toRegex()) -> DAYS
            matcher.group(2).matches("w(eeks?)?".toRegex()) -> WEEKS
            matcher.group(2).matches("mo(nths?)?".toRegex()) -> MONTHS
            matcher.group(2).matches("y(ears?)?".toRegex()) -> YEARS
            else -> SECONDS
        }
        result += Duration.of(amount, unit)
    }
    return result
}

that is so useful to have

prisma wave
#

Pretty much the first thing I write in any project is String.color to process color codes

jovial warren
#

you wanna know what that was in Java?

prisma wave
#

Some hideous helper method probably

jovial warren
#
public static long convertDuration(final String duration) {
        Matcher regex = Pattern.compile("(\\d+)([a-z]*)").matcher(duration);
        long milliseconds = 0L;
        while (regex.find()) {
            int amount = Integer.parseInt(regex.group(1));
            switch (regex.group(2)) {
                case "s": case "sec": case "second": case "seconds":
                    milliseconds += amount * 1000L;
                    continue;
                case "m": case "min": case "minutes":
                    milliseconds += (amount * 1000L) * 60L;
                    continue;
                case "h": case "hour": case "hours":
                    milliseconds += ((amount * 1000L) * 60L) * 60L;
                    continue;
                case "d": case "day": case "days":
                    milliseconds += (((amount * 1000L) * 60L) * 60L) * 24L;
                    continue;
                case "w": case "week": case "weeks":
                    milliseconds += ((((amount * 1000L) * 60L) * 60L) * 24L) * 7L;
                    continue;
                case "M": case "mo": case "month": case "months":
                    milliseconds += ((((amount * 1000L) * 60L) * 60L) * 24L) * 30L;
                    continue;
                case "y": case "year": case "years":
                    milliseconds += ((((amount * 1000L) * 60L) * 60L) * 24L) * 365L;
            }
        }
        return milliseconds;
    }
#

that mess

prisma wave
#

Oh dear god

onyx loom
#

YUCK

jovial warren
#

yep

jovial warren
#

that was the only option

#

ikr @onyx loom

prisma wave
#

I'm pretty sure there are ways to clean that up even more

#

Iirc you can destructure a Matcher for example

#

But you should definitely be caching those regexes

#

toRegex() is the same as Pattern.compile so it should be cached

lunar cypress
#

why not use a proper parser for this

#

this is horrible

jovial warren
#

the left one was stolen straight out of MaxBans lol

#

Kotlin really clears up your code a lot though

prisma wave
#

it really does

hot hull
#

ngl, the second one is spicy af

prisma wave
#

buildString exists too

#

which is arguably nicer

jovial warren
#

mostly because I was using an inefficient method

prisma wave
#

Declarative programming in kotlin feels dirty imo, it should almost always be imperative

jovial warren
prisma wave
#

@jovial warren that is hideous

jovial warren
#

yeah I know

ocean quartz
jovial warren
#

my friend literally used the anydesk drawing tool to draw the line on the left of the code and said it looked like the himalayas lol

prisma wave
#
fun lazyString(body: () -> String) = object {
    override fun toString() = body()
}``` this entire thing is useless
#

kotlin can do lazy loading for you

jovial warren
#

that is only there because lazy {} wasn't working properly

prisma wave
#

@ocean quartz cute

jovial warren
#

kept saying "Lazy field not initialised"

prisma wave
#

what's wrong with lazy?

#

oh in the debugger?

jovial warren
#

yeah

#

when I was testing it

prisma wave
#

yeah that does happen

#

You can always evaluate it to provoke initialization though

jovial warren
#

hold on I'll get my CommandTest class

#

only reason that's got `this` for method names is because it's easier to read

#

and I don't have to call them anyway lol