#dev-general

1 messages ยท Page 85 of 1

jovial warren
#

I have a lot of testing things in this

prisma wave
#

Yeah unit testing is nicer

#

Mockk is really nice

jovial warren
prisma wave
#

Although unit testing commands based on messages is... Ehh

#

Maven reeee

jovial warren
#

yeah

#

people say kotlin maven is a big pain in the ass but I haven't had a single problem with it yet

prisma wave
#

It's not that it's bad

#

It just doesn't compare to gradle at all

jovial warren
#

I use maven because I find it easier to read, but mostly because it's what I've been using for pretty much ever

prisma wave
#

You find 5 lines of XML easier to read than 1 string?

jovial warren
#

kinda yeah

prisma wave
#

๐Ÿค”

#

Well

jovial warren
#

it tells you the group id, artifact id, and version

prisma wave
#

Rest assured you'll be assimilated into the gradle masterrace soon

#

So does gradle's syntax lol

jovial warren
#

gradle does this: "groupId:artifactId:version"

#

I'm mainly using maven because it's what I'm used to though

prisma wave
#

not for long

jovial warren
#

maybe I'll learn gradle at some point

prisma wave
#

:)

jovial warren
#

if I find a need to switch to gradle I'll switch to gradle

prisma wave
#

I don't know how you can stand maven's speeds

jovial warren
#

yeah the build speed is a bitch

prisma wave
#

I find compilation after a tiny change takes 20-30 seconds

#

whereas gradle is almost instant

jovial warren
#

takes around two minutes just to shade all of these modules

prisma wave
#

๐Ÿ˜ฌ

#

shadowJar takes 30 at most

jovial warren
#

so you're saying gradle is faster?

prisma wave
#

yes

#

Ridiculously faster

jovial warren
#

might have to look in to gradle then lol

prisma wave
#

Incremental compilation means tiny changes will compile almost instantly

jovial warren
#

wait, gradle or groovy?

prisma wave
#

gradle

#

Groovy is a language

#

that gradle scripts use

onyx loom
jovial warren
#

doesn't gradle's syntax look like compile("", "", "")?

prisma wave
#

it's not exclusive to kotlin

jovial warren
#

or is that outdated now

prisma wave
#

that's with the DSL

ocean quartz
#

PHP can do it as well

#

And a bunch others

jovial warren
#

@onyx loom that is a really useful Kotlin feature, probably in other languages though

prisma wave
#

the kotlin DSL that is - if you don't like groovy you can write gradle scripts in kotlin

onyx loom
#

sexy af being able to add numbers inside a print

prisma wave
#

Yeah string interp is in a few modern languages

onyx loom
#

kotlin is the most modern ๐Ÿ˜Ž

jovial warren
#

DSL is probably a bad idea

ocean quartz
#

You can use it to create monstrosities as well, let me find the image just a sec

prisma wave
#

implementation 'groupId:artifactId:version'

#

The DSL is kinda personal preference

#

I don't really like it

#

but I think it has potential

#

^^ that's in groovy

ocean quartz
jovial warren
#

one of the main reasons I switched to Kotlin though is it means I don't even have to touch J... cough cough J...cough cough sorry, I can't say it

prisma wave
#

@ocean quartz you disgust me

ocean quartz
#

I know

onyx loom
#

oh no

#

uve ruined me now

prisma wave
#

imagine having to write getters and setters in your language

jovial warren
#

and that J is not Java by the way

#

I can say that

prisma wave
#

Oh?

#

Oh yes

#

I know

#

The dreaded JS

jovial warren
#

AAAAAHHHHHHH

prisma wave
#

@ocean quartz I wonder if you could write an entire plugin inside of a String

jovial warren
#

don't say that word

prisma wave
#

Sorry

jovial warren
#

lol

prisma wave
#

Typescript is ok tho

ocean quartz
#

Oh my god

#

I kinda wanna try

jovial warren
#

never used TypeScript

prisma wave
#

It's somewhat nicer

#

But you can't beat static, strong typing for anything big

jovial warren
#

never used anything other than Java, very basic Python, Kotlin, even more basic C, a really really small amount of PHP, and maybe touched on C# a little bit

onyx loom
#

give a language review for TS

prisma wave
#

I've not used TS much

#

It's nicer than JS because static typing

jovial warren
#

AAAAAAAHHHHHHH

#

lol

#

alright I think I should be good now

#

anyway

#

JS is all over the place though

prisma wave
#

I won't lie

#

I don't think js is that bad

#

if you use it for its intended purpose then it's fine

#

small scripts on webpages

jovial warren
#

yeah it is lightning fast

#

PHP takes a bit more time to load

#

though it's type inference is a joke

#

it's not even type inference

#

it's what is it called, duck typing?

prisma wave
#

Yeah I think so

jovial warren
#

"This" = true, "" = false

#

true + true = 2

#

that's where I draw the line

#

and then

#

we get to the libraries

prisma wave
#

JavaScript's type coersion is a mess

#

Without a doubt

#

But like

jovial warren
prisma wave
#

As a language it's not that ugly, it does the job, it's reasonably fast, and interacts well with html

jovial warren
#

I agree with that

prisma wave
#

npm is a joke

jovial warren
#

the libraries are a joke though

prisma wave
#

Yes lmao

jovial warren
#

why would you even depend on a one-line package that would literally take me 5 seconds, if that, to write in myself

prisma wave
#

The amount of 1 line packages is ridiculous

#

node_modules is usually like 2gb

#

npm install is just an illusion of being productive while you wait for thousands of packages to download

jovial warren
#

let's do a test of how long this takes me to type

#
function isPromise(obj) {
    return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}
#

about 20-30 seconds, including the time it took me to read what was written in the post, and include the ```js

#

literally nothing

onyx loom
#

das crazy

jovial warren
#

what is the actual point in a one-line package?

prisma wave
#

idk

#

it takes longer to download it

onyx loom
jovial warren
#

just to be able to implement it in multiple packages?

prisma wave
#

than it does to type it

jovial warren
#

exactly

#

now that's a joke

#

can anyone here explain to me what angular is and how it works by the way?

#

is it an alternative to node?

prisma wave
#

No

#

It's a framework for frontend JavaScript

heady birch
#

I was thinking about this a couple hours ago

prisma wave
#

or just frontend websites as a whole

jovial warren
#

because my friend said he uses angular for frontend and Kotlin + Ktor for backend

heady birch
#

I cam across a 4 line npm package

#

vec2-copy

prisma wave
#

Angular is rendered on the client side

#

Node is processed server side

jovial warren
#

is node.js backend?

prisma wave
#

Yes

jovial warren
#

so Ktor + Kotlin is a node alternative

prisma wave
#

I guess

#

Pretty much any language will work for backend

jovial warren
#

and definitely a better one since it means if you're writing stuff in Java it all stays in one codebase

prisma wave
#

It's not so much of a node alternative as it is a backend solution

#

you can do full stack kotlin which is nice

jovial warren
#

and what I mean by that sentence is if you're writing stuff for java in Kotlin

prisma wave
#

Full stack Java is more difficult

jovial warren
#

like a plugin

prisma wave
#

Yeah

#

You could quite easily write backend in Kotlin/JVM, frontend in Kotlin/JS and share code between the two

heady birch
#

Web applets ๐Ÿ˜ญ

prisma wave
#

๐Ÿ˜ญ ๐Ÿ˜ญ

jovial warren
#

since I've learned all the things Kotlin can do I'm not writing another line of Java unless I have to ever again

prisma wave
#

too soon

jovial warren
#

also hold on

prisma wave
#

lmao

jovial warren
#

if I write an API in Kotlin can people use it if they're writing in Java?

prisma wave
#

since I've learned all the things Kotlin can do I'm not writing another line of Java unless I have to ever again
this is pretty much what everyone thinks

#

Yes

#

99% interop

onyx loom
#

ima write the best api uve ever seen

#

and everyone gonna use it

prisma wave
#

good idea

jovial warren
#

yeah most of the time the question I'd be asking when learning Kotlin would be "WHY TF IS THIS NOT IN JAVA?!?!?!?!?!?!?!?!"

onyx loom
#

most of the time i just stare in awe

#

it just looks so good

jovial warren
#

unless the code is written in allman style

prisma wave
#

this is such a circlejerk

#

but i agree lmao

#

the sheer amount of quality of life stuff compared to java is crazy

jovial warren
#

doesn't allman actually defeat the point of things like expression whatever they're calleds?

prisma wave
#

I could talk about how good the standard lib is for days

#

wdym?

jovial warren
#

expression bodies that's the one

#

I thought everything had to be wrapped in curly brackets

prisma wave
#

I'm not actually sure

#

since the code style was written for java

jovial warren
#

yeah

#

probably why it looks seriously bad in Kotlin

prisma wave
#

Personally I would say expression bodies are an exception

jovial warren
#

and when I say seriously bad, just take a look at VoteParty's source

prisma wave
#

Allman looks a lot nicer inside the IDE imo

jovial warren
#

I agree

#

but I still think it doesn't look right

prisma wave
#

like on github it looks ugly as hell, but combined with intellij's highlighting and things it becomes a lot more expressive

jovial warren
#

I don't like how the first { isn't on the line of the declaration

#

that bugs me

prisma wave
#

it's kinda personal preference

onyx loom
#

lol

jovial warren
#

and if statements taking 4 lines to do one action instead of just one line

prisma wave
#

if statements without braces are a bad idea in any code style imo

jovial warren
#
if (condition)
{
    return
}

down to if (condition) return

prisma wave
#

they can lead to some nasty bugs

#

especially since unreachable code is only a warning in kotlin

onyx loom
#

ye id brace ifs

jovial warren
#

I hate having to brace things

rotund egret
#

I made a habit of bracing every if, no matter how annoying

prisma wave
#

^

#

wise words

jovial warren
#

thing is though, my style is based off of literally the rest of my life: function, not form

ocean quartz
#

I brace every if unless it's very small things like return or continue

prisma wave
#
if(player.bal < 10)
  sendMessage("You're too poor")
doSomethingElse()

if you wanted to return here and didn't notice the lack of bracing

if(player.bal < 10) 
  sendMessage("You're too poor")
  return
doSomethingElse()```
#

lack of braces can cause mistakes very easily

jovial warren
#

yeah fair point

#

thing is though, my style is based off of literally the rest of my life: function, not form
as I said though, ^^^^^

prisma wave
#

fair enough i guess

#

i'd advise adhering to an existing code style on any public project though

jovial warren
#

yeah but I'd be surprised if there's a code style that looks like mine

#

my style is based around compactness and efficiency (and that's efficiency meaning the time it takes me to write it, not how fast it runs), not readability

rotund egret
#

I'd say so long as you're consistant, and provide a style guide you're okay for the most part.

onyx loom
#

^

jovial warren
#

probably a good idea

onyx loom
#

consistency is key

prisma wave
#

I'm very inclined to say that readability should be prioritised over everything else

rotund egret
#

Well if you're using java, ideally yes. That's pretty much the point of the language

prisma wave
#

concise code doesn't mean it's good code, especially if you're sacrificing readability to get the concisity

rotund egret
#

If you want a functional language something like scala might be better

prisma wave
#

never used scala

#

kotlin can do functional stuff reasonably well

onyx loom
#

kOtLiN

rotund egret
#

Maybe, I haven't looked too much into kotlin

onyx loom
#

u wont regret it ๐Ÿ™ƒ

prisma wave
#

any language with first class functions is a step up from java lol

rotund egret
#

I want to though lol

ocean quartz
#

dew it

brave minnow
#

is there way to add commented line in a Yaml with a FileConfiguration object ?

jovial warren
#

I'm assuming by the fact that comments aren't actually part of YAML (they're just skipped, they don't actually count) I'd probably say no

prisma wave
#

sadly not

#

snakeyaml completely ignores comments

#

and I don't believe you can set them

jovial warren
#

why would you want to write comments like that anyway?

rotund egret
#

hocon ๐Ÿฅฐ

brave minnow
#

because I still can't extract a default config from my jar

jovial warren
#

so you've written the config file in to the correct folder right?

#

if you've written it you don't want to read from the embedded one you want to read from the one you just wrote

prisma wave
#

he can't use the embedded one

#

so imagine he's setting the defaults manually

#

i'm fairly sure there's a way to get this working, I just can't remember it

jovial warren
#

this was probably already answered but, why exactly can't he use the embedded one?

prisma wave
#

weird classloader stuff

#

resources from a classloader are never loaded in by papi

#

HOWEVER

#

i've had an idea @brave minnow

#

this is gonna be a disgusting hack

#

but it might just work

jovial warren
#

also can't he just save the resource himself directly?

#

actually I'm not getting this

#

that method we mentioned earlier only loads classes, nothing else

prisma wave
#

yes

#

so getResourceAsStream returns null

jovial warren
#

but then won't it load his class which then saves the file?

#

I'm saying if he didn't try and save a resource using is it PAPI's API? idk

prisma wave
#

it loads the classes into the classpath

#

but it doesn't load the resources

jovial warren
#

ah okay

#

that's a bit stupid isn't it?

#

what's the fix?

#

I'm talking about the fix on PAPI's end, not on the expansion's end

#

if it's a simple fix I'll fork this right now, fix it, and submit a merge request

prisma wave
#

The simple fix would be to add the Jar's URL to the URLClassLoader rather than each individual entry like piggy's issue

#

but since most people will probably be on older versions

#

Time for a fat workaround

jovial warren
#

so what would need changing?

#

try (URLClassLoader cl = new URLClassLoader(new URL[]{jar}, clazz.getClassLoader()); JarInputStream jis = new JarInputStream(jar.openStream())) that line?

prisma wave
#

Yeah I think s

brave minnow
prisma wave
#

So

jovial warren
#

hold on a second

prisma wave
#

@brave minnow this solution will support comments and won't need to do it in code

jovial warren
#

I recognise those colours

#

I've got just the meme for that

prisma wave
#

Uh oh

jovial warren
prisma wave
#

THERE WE HO

#

go*

jovial warren
#

probably why he's using build path

brave minnow
#

@prisma wave It's done and honestly it is executed only when the config folder is empty so it's like saveDefault with extra steps ๐Ÿคท

jovial warren
#

you misspelt generateDefautlConfig() by the way @brave minnow

onyx loom
#

damn did they get rid of that faq meme

jovial warren
#

what FAQ meme?

onyx loom
#

that image used to in faq list

brave minnow
jovial warren
#

I said they should replace Eclipse and IntelliJ with Java and Kotlin in that meme @onyx loom

prisma wave
#

I AM EXTREMELY CLEVER

onyx loom
#

yep they definitely should

#

why so @prisma wave

jovial warren
#

also, PAPI expansion depending on spigot-api?

#

hmm...

ocean quartz
#

white theme, my eyes

jovial warren
#

that's gonna make it massive since he's using build path

#

in maven you'd do <scope>provided</scope> and in gradle I can't remember what it is

#

that would stop it from bundling the spigot API in to your plugin

brave minnow
#

I prefear gradle don't know why

#

maybe maven is too much xml for me '-'

jovial warren
#

THEN WHY AREN'T YOU USING IT?!?!?!?!?!?!?! lol

prisma wave
#

as I said, i'm extremely clever

#

that should work for getting the file from the jar

brave minnow
#

too late I won't change that it's staying like this maybe in a future version ๐Ÿ‘€

jovial warren
#

also I think I'm probably gonna convert to gradle if it's definitely gonna be faster

prisma wave
#

@brave minnow your loss

brave minnow
#

@jovial warren because I don't know well how to use it lol

prisma wave
#

It's definitely going to be faster

#

I will mention that example is extremely hacky

jovial warren
#

bad dev bingo:

  1. Uses eclipse
  2. Uses light theme
  3. Uses build path

we have a bingo!

prisma wave
#

And won't work unless the class is run inside a jar

#

Bit harsh lol

brave minnow
#

well fuck off I decided to use your code you boy smarter than me ! รจ_รฉ angry upvote

prisma wave
#

But yes use gradle

#

Gradle good

jovial warren
#

yeah I didn't mean for it to come out that harsh

prisma wave
#

Gradle good, not gradle bad

brave minnow
#

@jovial warren

  • making a plugin for fun
  • not giving a shit because it's the beggining
  • well I'm use intelliJ stop to bully me ๐Ÿ˜ข
onyx loom
#

there is no excuse for using light theme

jovial warren
#

as I said, that came out a little more harsh than I intended

#

there is no excuse for using light theme
I definitely second that though

brave minnow
#

you made me angrily better รจ_<

#

you boys are fkin cool I like to deal with you !!! much agressivity is for love :p

jovial warren
#

๐Ÿ™‚

prisma wave
#

that's both funny and nice

#

bullied into being better

#

that happens a lot here

hot hull
#

Bardy, no.

jovial warren
#

that happens a lot anywhere lol

#

@hot hull what?

hot hull
#

I definitely second that though
There is not.

onyx loom
#

wot

hot hull
#

Dark theme, or no theme

onyx loom
#

oh yes, of course

jovial warren
#

that's exactly what I meant...?

brave minnow
#

no theme is like you coding on invisible IDE ? '-'

onyx loom
#

no

jovial warren
#

that's called using black theme with black text

onyx loom
#

u dont code at all

jovial warren
#

that's not dark theme

#

no theme is essentially what happens to websites when the CSS doesn't load in properly

hot hull
#

No, no theme is deleting your IDE

jovial warren
#

true

brave minnow
#

no, no theme is getting rid of your screen

jovial warren
#

well, time to clear out my SSD

onyx loom
#

o

jovial warren
#

apparently 5.74 GB isn't enough for photoshop's scratch disk

#

and by the way, that's a 250GB SSD

#

and I just emptied the downloads

onyx loom
#

disk clean up too?

brave minnow
#

wtf bro my eclipse turned into red/blue/yellow/purple logo and it goes dark thonking

onyx loom
#

yeah thats just eclipse being eclipse

#

that dont happen with IJ

brave minnow
#

you didn't understand ๐Ÿ‘€

onyx loom
#

i dont have the capabilities to understand eclipse

#

thats why

brave minnow
#

๐Ÿ‘€

onyx loom
#

oh now i understand

#

now we talking

jovial warren
#

lol

#

if you're a student I'd recommend applying for the GitHub Student Developer Pack lol

#

gives you all JetBrains products for free

onyx loom
#

o

#

link?

jovial warren
#

it gives you much more than just free IDE's though

onyx loom
#

o wow

jovial warren
#

for any high school/secondary school and above students who haven't applied for it, I highly recommend you apply for it

#

don't ask why my computer's in Spanish

tame jolt
#

Hey, I really hope there's someone who can help me out.
I'm currently messing around with uploading files via PHP (https://www.w3schools.com/php/php_file_upload.asp) and I'm trying to find out if there's a way I could randomize the name of the file it uploads.
Anyone who can help me?

jovial warren
#

don't know PHP sorry

heady birch
#

there is no excuse for using light theme
@onyx loom ๐Ÿ˜ 

onyx loom
#

NO

#

EXCUSE

jovial warren
#

please don't tell me you use light theme @heady birch

heady birch
#

Uh

#

No?

jovial warren
#

was gonna say

onyx loom
#

hes lying

#

๐Ÿ˜ 

jovial warren
#

lol

heady birch
#

Well

#

I use it during the day

onyx loom
#

NO

#

EXCUSE

#

my eyes burn

#

i am sorry for anyone ive just traumatised

prisma wave
#

imagine not using material theme

jovial warren
#

orange text for imports

#

get out

onyx loom
#

hey my imports are orange ๐Ÿ˜ฆ

jovial warren
#

orange text on light theme get out

onyx loom
#

i dont use light theme ๐Ÿ˜ฆ

heady birch
#

Cos you got the weird new theme

jovial warren
#

yeah I know

onyx loom
prisma wave
#

use constants

heady birch
#

Original theme better

jovial warren
#

farrenheight's type can be inferred

prisma wave
#

for the multipliers and things

jovial warren
#

@heady birch

  1. Java
  2. Light theme
#

xD

onyx loom
#

AND A JAVA USER

#

WTF NIALL

#

ur a disgrace

heady birch
#

This was before I knew the true power of kotlin

onyx loom
#

THEN LEARN KOTLIN

jovial warren
#

oh thank god

onyx loom
#

like me ๐Ÿ™‚

jovial warren
#

I nearly had a heart attack lol

prisma wave
#

@onyx loom const val FARENHEIGHT_MULTI = 0.555555555

jovial warren
#

const is a thing in Kotlin?

prisma wave
#

could probably use a fraction too

#

yes

onyx loom
#

its using the same variable as celcius

brave minnow
#

@jovial warren I was student this year but it's finished lol

prisma wave
#

const val gets inlined

jovial warren
#

inline val?

onyx loom
#

i didnt really know how to optimise the calcs of farrenheight into celcius

#

im using 2 lines for the calcs thonking

prisma wave
#

inline val isn't exactly a thing

jovial warren
#

good point

#

there's probably a converter out there somewhere

#

also it's fahrenheit

#

not farrenheight

onyx loom
#

idc ๐Ÿ˜ 

#

its the ugliest measurement going

jovial warren
#

I agree

prisma wave
#

val inCelcius = (farenheit - 32) * 0.55555555

onyx loom
#

i tried that before but it was saying something

#

ill try it again

jovial warren
#

I personally call the better one Centigrade

heady birch
#

I use feet mainly, or metres

#

For height

prisma wave
#

but please use const val

jovial warren
heady birch
#

Lol

onyx loom
#

ok ๐Ÿ˜„

heady birch
#

Farenheight?

jovial warren
#

yeah

onyx loom
#

i have no fuckin clue

prisma wave
#

magic numbers bad

jovial warren
#

I personally use imperial measurements over metric

prisma wave
#

ew

#

metric good imperial bad

onyx loom
#

is me using BigDecimal good or bad?

heady birch
#

bad

#

well

prisma wave
#

idk

onyx loom
#

i heard kotlin has its own rounder

heady birch
#

depends

jovial warren
#

see in most countries you're either full imperial (like the US), or full metric (like most of Europe), but in the UK, we like to do a bit of both

prisma wave
#

BigDecimal is still used, but it's not really necessary here

#

Double will do

#

@jovial warren only in height and distance

#

metric > everything

jovial warren
#

for example: the fuel that you put in your car is measured in litres (metric), but the consumption of that fuel is measured in miles per gallon (imperial)

prisma wave
#

ยฏ_(ใƒ„)_/ยฏ

jovial warren
#

@prisma wave you are fundamentally wrong sir

heady birch
#

I do use kotlin

jovial warren
#

imperial was here first

#

metric is the outsider

heady birch
#

For any new non-spring projects I will use kotlin

#

Until I learn kotlin and spring nicely

jovial warren
#

I don't use Spring

#

but who the hell uses Spring for Minecraft plugins anyway?

onyx loom
#

@prisma wave and how would i go about rounding to a certain d.p with double?

ocean quartz
#

We should just use Metric everywhere

jovial warren
#

I agree we should just use one universal system, don't agree that should be metric though

onyx loom
#

the kotlin system soon โ„ข๏ธ

prisma wave
#

@onyx loom iirc Double.round exists

ocean quartz
#

Metric is the most consistent

jovial warren
#

true

#

there's just something about it that doesn't quite sit right in my head though

prisma wave
jovial warren
#

also Double.round isn't a method

#

unless it's not static

#

no it's either roundToInt() or roundToLong()

ocean quartz
#

Yeah was gonna say it's roundToInt

prisma wave
#

ah ok

jovial warren
#

but you can just use %.xf

#

replacing x with the D.P.

onyx loom
#

but does that truncate or actually round?

errant geyser
#

When I try to use FontAwesome on a webpage, why do the icons appear like this? I have it in my page because I have html <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> in the head section. The two I'm trying to use are html <i class="fas fa-search"></i> <i class="fas fa-shopping-basket"></i>

jovial warren
#

@onyx loom rule with truncation is usually if it doesn't truncate explicitly it's rounding

#

@errant geyser sure the icons you're looking for are called search and shopping-basket?

errant geyser
#

yup

jovial warren
#

sure the sha integrity is the same?

errant geyser
jovial warren
#

what web interface you using?

#

or whatever it's called

errant geyser
#

Web interface? You mean browser? I've tried Chrome and the new Edge beta

jovial warren
#

you just using bootstrap?

errant geyser
#

Yeah

jovial warren
#

not browser, for example: angular, npm, etc.

errant geyser
#

Ah yeah just Bootstrap and its dependencies, so jQuery and popper.js too

jovial warren
#

I know it's a bit insecure, but have you tried it without the fingerprint?

errant geyser
#

No, I'll try it now

#

Still nothing

jovial warren
#

didn't think that would do anything

prisma wave
#

check the chrome network tab

#

to see if it's being reached properly

onyx loom
#

i did the cleanup thing

errant geyser
jovial warren
#

BM?

prisma wave
#

@onyx loom getting better

#

BM is me

errant geyser
#

KM*

prisma wave
#

old fashioned name

onyx loom
#

๐Ÿ™‚

jovial warren
#

yeah I know that @prisma wave was just wondering if he meant something else lol

prisma wave
#

@onyx loom a few things
variable names should be lowerCamelCase
farrenheight could be inferred (ie without the :Double)
the magic numbers (32 and 5/9) should be extracted to constants

jovial warren
#

@onyx loom why tf does the bin see it as coffeescript lol

#

and also fix your god damn spelling

prisma wave
#

the detection algorithm isn't perfect

jovial warren
#

"farrenheight" -> "fahrenheit"

onyx loom
#

I DONT CARE

#

ITS AN INFERIOR SYSTEM

#

i will not change its spelling, as it represents how shit it is

jovial warren
#

and "celcius" -> "celsius"

onyx loom
#

oh shit

#

right

#

i should change that

jovial warren
#

also, making that better depends on scalability and readability

#

if you want to use that conversion in more than just one place I'd suggest using a constant

onyx loom
#

why is using constants better?

jovial warren
#

read my message again

#

makes it scalable

onyx loom
#

i had to google that.

jovial warren
#

also hold on

prisma wave
#

scalable yes. using magic numbers is bad because there's no implication on what the number is actually for, so it's less readable

jovial warren
#

val farrenheight: Double = reader.nextDouble()

onyx loom
#

ive removed Double

#

as KM said

#

and alright i understand now

jovial warren
#

"Farrenheight temp?" Enters: hello
error

#

cannot parse string to double

onyx loom
#

yeah ik ๐Ÿ˜†

#

ill start catching shit later

jovial warren
#

also hold on

onyx loom
#

hold on

#

holding

jovial warren
#

println("Celsius: $celsiusfinal degrees") can be replaced with is it printf("Celsius: %.1f degrees", celsiusfinal)?

#

which takes out the need for an extra variable

onyx loom
#

o.o

jovial warren
#

I think that's the method?

onyx loom
#

ill try it, ty

jovial warren
#

actually I don't think printf() is a method in Kotlin

onyx loom
#

nope

#

โ˜น๏ธ kotlin bad

jovial warren
#

System.out.printf() still works though

#

actually hold on

#

println("Celsius: ${String.format("%.1f", inCelsius)} degrees") should work

#

probably a better way to do that though

onyx loom
#

god

#

thats better

#

thanks ๐Ÿ™‚

jovial warren
#

your welcome

prisma wave
#

"%.1f".format(inCelsius) can also be done iirc

jovial warren
#

sounds about right

#

println("Celsius: ${"%.1f".format(inCelsius)} degrees")

old wyvern
#

Wha

onyx loom
#

even more concise

#

i love it

ocean quartz
#

There is always a way to make things smaller

jovial warren
#

^^^^

old wyvern
#

println("Celsius %.1f degrees".format(inCelsius))

jovial warren
#

println("Celsius %.1f degrees".format(inCelsius))
that's even better

#

just please surround it with `` lol

onyx loom
#

gods

old wyvern
#

On phone , I hate typing that char on this keyboard

#

๐Ÿ˜‚

jovial warren
#

fair enough

old wyvern
#

Its so awkwardly placed

jovial warren
#

what kinda phone you got?

old wyvern
#

Moto OP

jovial warren
#

I think android puts it on the 2/2 page

#

or is that just samsung's keyboard

onyx loom
#

ye its on 2/2 for me too

errant geyser
#

same

prisma wave
#

same here

#

very annoying

onyx loom
#

wew

prisma wave
#

same with =

onyx loom
#

u could prob customise it

jovial warren
#

that's why you put two ` characters in then go back and put in the code

old wyvern
#

Its on sec,
But its like-> symbols-> page change -> char-> type msg-> same char stuff again

#

๐Ÿ˜‚

#

Ah

#

Welp

jovial warren
#

that's why I use my PC to type a mere most of the time

old wyvern
#

Welp electricity just came back on rn

jovial warren
#

nice

obtuse gale
#

@old wyvern

old wyvern
#

I have been sitting in darkness for 1.5 hours

obtuse gale
#

How I could create a ticket?

#

I need help

loud gyroBOT
#

Theres not time to wait! Ask your question @obtuse gale!

old wyvern
#

What ticket?

obtuse gale
#

support i think

old wyvern
#

For?

jovial warren
#

go in to one of the support channels and ask your question

#

simples

obtuse gale
#

I bought DeluxeQueues recently

old wyvern
#

Oh

errant geyser
#

We don't have a ticket system, just ask your question

obtuse gale
#

and I have some problems

jovial warren
#

no ticket system

ocean quartz
#

What if you do fun Double.inCelcius(): Double = (this - 32) * 5/9 then "Celsius %.1f degrees".format(farrenheight.inCelcius())?

obtuse gale
#

Ah ok

#

So where I can ask the question?

old wyvern
#

Link your spigot and u get access to the specific channel I think

jovial warren
#

@ocean quartz :bigbrain:

#

why no third-party emojis smh

ocean quartz
#

Only boosters can

obtuse gale
#

Hey matt

jovial warren
#

okay

ocean quartz
#

Oh nice xD

jovial warren
#

that's better

prisma wave
#

lmao

onyx loom
#

#spigot-linking to verify DeluxeQueues then ull get access to the channel @obtuse gale

jovial warren
#

that one's from TSC by the way

obtuse gale
#

Alright thanks

jovial warren
#

what's Deluxe Queues lol

onyx loom
#

glares plugins

jovial warren
#

ah okay

onyx loom
#

google /shrug

jovial warren
#

aren't all of glare's plugins open-source?

onyx loom
#

freemium ye

#

not sure about queues tho actually

jovial warren
#

you basically pay for the support and to support the dev

onyx loom
#

yup

hot hull
#

Queues ain't iirc

obtuse gale
#

Where I can found my id of spigotmc?

hot hull
#

Url

obtuse gale
#

I already putted the discord in

onyx loom
#

ik guilds and VP is freemium

ocean quartz
#

On your profile, it's the number after your name on the URL

jovial warren
#

also how tf did you manage to create a web GUI for LiteBans @frail glade

obtuse gale
#

neprez_.331402

#

this is?

ocean quartz
#

Yeah

jovial warren
#

I'm not asking how you did it I'm asking how you put up with the API

obtuse gale
#

thanks !

jovial warren
frail glade
#

That's a fork of the original. I haven't updated it in a year or two since I fell out of web development.

#

Not sure if it still works.

jovial warren
#

ah okay

obtuse gale
#

I already linked my id

frail glade
#

I just found the original design boring so I put a twist on it and made it a kind of stand-aline site.

jovial warren
#

just curious though, have you seen LiteBans' API?

frail glade
#

Not for a few years

obtuse gale
#

Now Where I should go to ask for DeluxeQueues plugin

#

?

jovial warren
#

trust me, it probably hasn't got any better

onyx loom
#

Nicoo, when did u buy DQ?

jovial warren
obtuse gale
#

I bought it 5 minutes ago

#

or 10

onyx loom
#

ull need to wait for the database to update then

obtuse gale
#

Idk

#

xd

#

Alright

jovial warren
#

oh and as an added bonus, tells you to execute commands using Bukkit.dispatchCommand()

onyx loom
#

database can only be updated by clip / cube iirc

jovial warren
#

somebody should pin LiteBans' API as an example of how not to make an API lol

#

if you can even call it that

frail glade
#

Don't hate on Ruan. It still works.

prisma wave
#

"""API"""

jovial warren
#

@frail glade but it's the biggest nightmare to use ever

frail glade
#

The website side wasn't too bad

#

Though I wouldn't write that in raw PHP ever again

#

I'd use something like vue butt that would be harder for people to host.

jovial warren
#

you write in Kotlin right?

frail glade
#

I was watching some videos on Vue last night and it was pretty hawt, ngl.

#

I attempt to, at least.

jovial warren
#

if you want a web interface use Ktor

#

that isn't going to work for LiteBans though since it uses PHP

#

but just when you make your own ones use Ktor

frail glade
#

I mean you can rewrite it to not use php

#

Lol

jovial warren
#

you can literally embed the web server in to your plugin so it doesn't even require a separate web server

frail glade
#

But I'm not invested enough in that

#

Idk how that got on the first page for most downloads

jovial warren
#

wait what?

frail glade
#

It's the 9th most downloaded web resource on SpigotMC KEKW

jovial warren
#

oh and also, please research expression bodies

#

๐Ÿ™‚

onyx loom
frail glade
#

Last time I checked that resource it was like just barely hitting the front page

#

Now we top 10

#

LOL

jovial warren
#

basically it turns this:

fun example() {
    return whatever
}

in to this: fun example() = whatever

frail glade
#

ยฏ_(ใƒ„)_/ยฏ

#

I'll write it in Skript if I damn well please

jovial warren
#

I saw a lot of instances in vote party

onyx loom
#

smile

prisma wave
#

it's a design choice

#

not necessary

onyx loom
#

SKRIPT

#

๐Ÿคข

frail glade
#

80% of the code had to get approved by Sxtanna

#

so

jovial warren
#

I can do some cleaning up if you want

#

I'm guessing Sxtanna is a big fan of the allman style

#

or is that you

#

one of the two

#

or both

onyx loom
#

ud have to get approved by sx by the sounds of it

jovial warren
#

yeah

onyx loom
#

that might be a little difficult

frail glade
#

It's Sxtanna

onyx loom
#

because, y'know

jovial warren
#

true

onyx loom
#

that ^

frail glade
#

It was one of the only reasons I could get him to contribute to the project

jovial warren
#

lol

#

is it you or him who's a fan of:

fun example()
{
    // do something
}
#

a.k.a the allman style

errant geyser
#

Sx

jovial warren
#

imo it looks horrendous

errant geyser
#

Same

prisma wave
#

most people think that

#

and yet you get used to it within like an hour of using it

frail glade
#

Yo what's the IJ shortcut to go to the uh

#

What's it called

#

Where a method is declared?

#

Made?

prisma wave
#

Ctrl + Click or Ctrl + Q

errant geyser
#

alt + f7?

prisma wave
#

i believe

errant geyser
#

Nope, thats find usages

frail glade
#

POG

onyx loom
#

allman looks better imo but the expression body that u recommend dont look too bad either, but its too compact for me

errant geyser
#

nvm

jovial warren
#

Ctrl + Q is documentation

frail glade
#

It's been that easy this whole time

jovial warren
#

Ctrl + Click is the one you're looking for

frail glade
#

My life just got a whole lot better

jovial warren
#

Ctrl + Alt + O on your classes

#

and then Ctrl + Alt + L

#

O removes unused imports, L formats

onyx loom
#

i have noticed the high levels of shortcuts in this program.

jovial warren
#

yeah

onyx loom
#

theres quite the lot

jovial warren
#

@frail glade running Ctrl + Alt + L is gonna make it look better lol

prisma wave
#

there are hundreds

frail glade
#

I'm aware of that

#

I use it a lot

prisma wave
#

you can configure a code style to work with ctrl + alt + l

jovial warren
#

๐Ÿ‘

ocean quartz
#

This is so dumb, discord messages will scape \n on messages, so to use it I need to do body.replace("\\n", "\n") lmao

onyx loom
#

.\n.

jovial warren
#

also @frail glade it's your plugin, you're supposed to be the one who dictates what goes in to it?

frail glade
#

I really don't know what I'm doing, so I do enjoy input from others.

jovial warren
#

yeah

#

if you don't want it written in a certain style though you can say you don't want it written in a certain style

frail glade
#

I don't really care what it's written in. I just adapt to what I have in front of me.

jovial warren
#

fair enough

frail glade
#

For example I just recoded a forge mod today and I had never touched forge before.

jovial warren
#

yeah

onyx loom
#

wew

frail glade
#

Yeah. I just mess around with code until something works for the most part.

#

If it doesn't crash, I call it good.

jovial warren
#

exactly what everyone else does lol

#

and anyone who tells you they do otherwise is lying

frail glade
#

Facts.

jovial warren
#

why does he use BukkitRunnable smh

#
internal fun Plugin.runTaskTimer(period: Long, task: BukkitRunnable.() -> Unit) {
    object : BukkitRunnable() {
        override fun run() {
            task.invoke(this)
        }
    }.runTaskTimer(this, 0L, period)
}
#

BukkitRunnable was deprecated ages ago

#

or the methods using it were

frail glade
#

Not really sure why it matters

prisma wave
#

BukkitRunnable isn't deprecated

#

runTaskTimer is

jovial warren
#

the methods using it were weren't they

#

isn't it recommended to use Runnable instead now?

prisma wave
#

depends

jovial warren
#

actually there's another method

prisma wave
#

BukkitRunnable.scheduleTaskTimer exists iirc

#

BukkitRunnable can cancel itself

#

Runnable can't

jovial warren
#

ah okay

#

also apparently runTaskTimer isn't deprecated

#
public synchronized BukkitTask runTaskTimer(@NotNull Plugin plugin, long delay, long period) throws IllegalArgumentException, IllegalStateException {
    checkNotYetScheduled();
    return setupTask(Bukkit.getScheduler().runTaskTimer(plugin, (Runnable) this, delay, period));
}

at least, that one isn't

#

also can someone please explain to me what the point of using Kotlin is if you're writing in allman style?

hot hull
#

You need to stop.

jovial warren
#

wdym?

#

complaining or criticising others? or both?

hot hull
#

First dissing java, now allman, what's next the entire concept of programming?

onyx loom
#

dissing java is allowed when kotlin exists

jovial warren
#

^^^^

hot hull
#

Sthu Kali

onyx loom
prisma wave
#

also can someone please explain to me what the point of using Kotlin is if you're writing in allman style?
that makes no sense

jovial warren
#

things like expression bodies can't be used if you write in allman style

prisma wave
#

they may be an exception, but they shouldn't be used all the time anyway

jovial warren
#

they should be used where applicable

prisma wave
#

just because you have all these conciseness features available, doesn't mean they should be used all of the time

jovial warren
#

they should be used where applicable
^^^^^

prisma wave
#

tbf

#

the official code style is opening brace on the same line

jovial warren
#

where did you find that?

#

just curious

jovial warren
#

I wanna see how close to the conventions mine is

#

it's probably miles off

#

"As a general rule, avoid horizontal alignment of any kind. Renaming an identifier to a name with a different length should not affect the formatting of either the declaration or any of the usages." what does that mean?

#

tf is horizontal alignment?

onyx loom
#

&8&m----------
Hello
&8&m-------------

#

@ minecraft servers

#

thats what horizontal alignment sounds like but i aint got a clue

jovial warren
#

that's vertical alignment?

onyx loom
#

wait huh

jovial warren
#

idk

onyx loom
#

then uh

jovial warren
#

it looks vertical to me

onyx loom
#

|
|
| Hello
|
|

jovial warren
onyx loom
#

ye it is

#

cus the letters at the end are in the same column

jovial warren
#

so I'm guessing horizontal alignment is the opposite?

onyx loom
#

yep

jovial warren
#

writing code like this:

var example = 1
var longerExample = 2
```?
prisma wave
#

@jovial warren I believe horizontal alignment is like kotlin when(value) { is_A_LongCondition -> blah() short -> blah2() else -> blah() }

#

artifically adding more spaces

jovial warren
#

yeah I hate when I see that

#

you know that article I linked actually recommended you do that

prisma wave
#

ew

onyx loom
#

yuck

jovial warren
#

also is it just me or does IntelliJ like to just add a random new line at the end of say a class code block

#
class Whatever {

}
// empty new line here
#

with an extra empty line

prisma wave
#

it does

heady birch
#

Learn something new everyday

jovial warren
#

wait that's actually recommended?

onyx loom
#

thats interesting

jovial warren
#

actually I'm reading that wrong

#

it isn't recommended

#

it's recommended to end with a \n character

onyx loom
jovial warren
#

never seen that one before

#

actually I'm reading that wrong

#

nothing can be both abstract and final I'm just being dumb

heady birch
#

looks liek it

prisma wave
#

no it can't

#

it's abstract / final

jovial warren
#

yeah I know

ocean quartz
#

Does Kotlin even have final?
Where would you use it? Classes?

jovial warren
#

probably

#

actually

#

isn't there something else for that?

ocean quartz
jovial warren
#

yeah

#
public / protected / private / internal
expect / actual
final / open / abstract / sealed / const
external
override
lateinit
tailrec
vararg
suspend
inner
enum / annotation
companion
inline
infix
operator
data
#

that's a lot of key words

ocean quartz
#

Quite a few there that I have never used

prisma wave
#

you use final to override an open property

#

but yeah there are a LOT of keywords

jovial warren
#

get is a keyword

prisma wave
#

yeah

#

for custom getters

jovial warren
#

and so is set

#

for custom setters

prisma wave
#

for example kotlin abstract class Parent { abstract val age: Int } open class Child1 : Parent() { final override val age = 3 } class Child2 : Child1

jovial warren
#

annotation?

prisma wave
#

this is where you'd use final

#

annotation class = @interface

ocean quartz
#

Ooh interesting ;o
infix sounds interesting as well

prisma wave
#

infix is cool

jovial warren
#

what does infix do?

prisma wave
#

you can invoke the function without parens or a .

jovial warren
#

parens?

#

()?

prisma wave
#

eg ```kotlin
val x: Pair<Int, Int> = 1 to 5

#

yeah

jovial warren
#

ah okay

prisma wave
#

without infix it would be 1.to(5)

jovial warren
#

where's the infix keyword used though?

#

wait hold on

prisma wave
#
infix fun <A, B> A.to(other: B) : Pair<A, B>``` is the definition
jovial warren
#

that's like the most useful feature of Kotlin

prisma wave
#

kind of

#

it should be used with care

jovial warren
#

the absence of ternary operators in Kotlin is a little bit of a disappointment but I imagine there's a valid reason for it

prisma wave
#

if is an expression

#

so ternary is useless

jovial warren
#

good point

ocean quartz
jovial warren
#

alert expression body not found alert

#

xD

onyx loom
#

๐Ÿ™„

#

matt, what would it look like without infix?

prisma wave
#

(1..5).rand(5)

ocean quartz
#

Basically the one under

#

Yeah

jovial warren
#

val randomNumber = (1..5).rand(5)

#

I think

prisma wave
#

can't do you (1..5) rand 5?

ocean quartz
#

It's not useful in this situation but pretty cool anyways

#

Yup that works as well

jovial warren
#

infix is what allows you to map keys to values using to

#

isn't it?

prisma wave
#

yes

#

same with step

jovial warren
#

step?

prisma wave
#
for(i in 1..10 step 2)```
jovial warren
#

so a bit like Python's range(start, stop, step)

#

it allows you to step up

prisma wave
#

yeah

jovial warren
#

in Java that would be for (int i = 1; i > 10; i += 2) I think

prisma wave
#

precisely

onyx loom
#

yuck

jovial warren
#

which? the Java or the Kotlin @onyx loom ?

#

I'm assuming the Java

onyx loom
#

ofc

jovial warren
#

just had to make sure

onyx loom
#

i think the java is similar to visual basic for that, cant really remember tho

jovial warren
#

and the C

#

C is exactly the same

#

that's why it was kinda easy to learn

#

until I got to static declaring local variables

#

that's where I draw the line

#

or is it global variables

heady birch
#

static local variable?

jovial warren
#

think so

heady birch
#

๐Ÿ˜ฎ

jovial warren
#

to quote geeksforgeeks: "a static variable remains in memory while the program is running. A normal or auto variable is destroyed when a function call where the variable was declared is over"

#

so basically static declares global variables

#

actually no

#

it allows you to declare a field inside of a function

prisma wave
#

what's that scope pollution

jovial warren
#
#include<stdio.h>

int fun() { 
  static int count = 0; 
  count++; 
  return count; 
} 
   
int main() { 
  printf("%d ", fun()); 
  printf("%d ", fun()); 
  return 0; 
}
#

that's an example of how static works in C

#

the output of that by the way is 1 followed by 2

#

C is weird like that though

heady birch
#

Oo

jovial warren
#

basically static stops the variable from being destroyed when a new instance of the function it was declared in is called

prisma wave
jovial warren
#
#include <stdio.h>

int main() { 
    static int x; 
    int y; 
    printf("%d \n %d", x, y); 
}
#

that one returns 0 for x and "some garbage value" for y

prisma wave
#

some garbage value?

jovial warren
#

to quote the source

prisma wave
#

๐Ÿค”

jovial warren
onyx loom
#

oh ty bm, ill keep it in mind ๐Ÿ™‚

prisma wave
#

np

ocean quartz
#

I have failed, was playing around with infix to make something like val test = randBetween 5 and 10 but doesn't work like that xD

jovial warren
#

basically static variables initialise to 0 automatically

#

I have failed, was playing around with infix to make something like val test = randBetween 5 and 10 but doesn't work like that xD
you'd need something more like randBetween(5 and 10) or something

ocean quartz
#

Didn't work either, tried as well xD

prisma wave
#

infix has to be between 2 values

#

you'd need something more like randBetween(5 and 10) or something
this should in theory work

#

although and already exists

#

for bitwise and

jovial warren
#

yeah

#

"Prefer using an expression body for functions with the body consisting of a single expression."

prisma wave
#

indeed

jovial warren
#

isn't the entirety of Kotlin built around fixing Java's problems?

prisma wave
#

that was the original purpose

jovial warren
#

yeah

prisma wave
#

java with less boilerplate but faster than groovy and scala

#

it's grown since then tho

jovial warren
#

has it achieved that?

prisma wave
#

absolutely

jovial warren
#

isn't scala another java-based language?

prisma wave
#

yeah

#

scala, groovy, kotlin, clojure are the main 4 non-java JVM languages

jovial warren
#

also isn't Kotlin built around conciseness then if it's purpose is to remove Java's boilerplate?

prisma wave
#

to some degree

#

concise while still maintaining clarity

jovial warren
#

compact yet easy to read

#

yeah

prisma wave
#

for example getters and setters are completely useless when you think about them

onyx loom
#

thinking intensifies

jovial warren
#

yeah

prisma wave
#

and if you need anything fancy that's what the get and set keywords are for

jovial warren
#

all they do is stop you editing the actual value

#

there's definitely a reason for it

#

can't remember what it is though

prisma wave
#

if you don't want the value edited you just make it a val