#dev-general
1 messages ยท Page 249 of 1
you know like what StringSubstitutor#replace does from commons-text?
I just don't want to add the overhead of bundling commons-text for literally one method
I suppose it's only 211 KB at the end of the day
that won't work anyway
any idea what might?
fun String.replace(values: Map<String, Any>) = values.entries.fold(this) { accumulator, (key, value) -> accumulator.replace("\${$key}", value.toString()) }
```found this on StackOverflow lol
thats exactly what i was suggesting lol
alright cheers
wonder what I could do about ```kotlin
object DatabaseUtil : PunishmentsKoinComponent {
suspend fun getName(player: PlayerEntity) = transaction {
HistoryEntity.find { HistoryTable.player eq player.id }
.orderBy(HistoryTable.time to SortOrder.DESC)
.limit(1)
.single()
}.name
}
maybe convert that to a property with a getter?
but that has to suspend since transaction is suspending
PunishmentsKoinComponent
I use koin
yes
koin is a lightweight Kotlin dependency injection library
KOtlin INjection ?
it's not annotation-based, which is a bit different shall we say
you use inject<MyInjectableClass>() for DI
that one's lazy injection
then get<MyInjectableClass>() for non-lazy DI
probably
oh it is
a few shell scripts in there
it means the library is pure kotlin, not necessarily the entire repository lol
lol
weak coupling ๐คฎ
wat dis
ah okay
you got any idea how I can fix my issue btw?
I gotta find a way to retrieve the name
yes
because of the way my database relations work though, that's easier said than done
wrong channel wops
what's wrong with it
getter and util class = ๐คฎ
fixed it anyway by just not having a method to do that
also, feels like there should be a better way to do this: https://paste.helpch.at/femakadexe.cs
and this: https://paste.helpch.at/okeleriqip.cs
that is horrible
I know
but I can safely say that I didn't write it
any idea how I could possibly make them better?
huh?
I did not write that, trust me
copy and paste from the old project pretty much
who wrote the old project?
my friend wrote the matcher code
ah
and also the format code
also, would anyone have any idea why I get no syntax highlighting or code completions in my build files with the Kotlin DSL?
dsl bad
shut it you
when kali is right, is right
no ๐
Here are some countdowns till each Admin is in the new year.
Happy New Year! ๐
14h 58m 35s
15h 58m 35s
1h 58m 35s
o
happy new year @pallid gale
funnycube#0001 hows 2020 ng+ so far? ๐คจ
ng+?
what
๐
2020.2
well usually rewrites are meant to be better so .. 
2021 pretty good so far
apparently the bug I have has been fixed, but also apparently not according to my IDE
it just won't syntax highlight or code complete properly
if I want to rewrite a project (kinda want to use kotlin on https://github.com/igabytm/guihelper xD), how do I push the new files to the repository?
You mean 2020 pro max plus?
Virus free
o.o
any idea why when I move a kt file to a new package it doesn't update the package?
@obtuse gale por cierto, muchas gracias <3
hey can anyone give me some feedback on this API please? https://github.com/BomBardyGamer/punishments/tree/master/api/src/main/kotlin/com/prevarinite/punishments/api
feel free to ridicule me for anything stupid lol
still a bit of a W.I.P but I wanna make sure I'm on the right track lol
https://i.imgur.com/7AT1S2T.png thoughts about this structure?
not bad
lowercase file names ๐
Miss me with that
The convention for "extension files" is [ClassName]s.kt
Like Files.kt, Lists.kt, Strings.kt
smh
@prisma wave you know how I can get all subclasses of a given class?
which one's better?
lowercase works technically for mutli class files
As far as I know
Does it auto lowercase the package name?
It works but looks messy imo
Since a muticlass file is a package later on
If it doesnt that might end up looking weird with java interop
happy now @prisma wave https://i.imgur.com/YPMTTaW.png ?
Mostly
mostly?
not sure you need to match the package name like that
why do you have a extensions package?
^
ignore that, it was created after I have renamed the package
Extensions should be present as close to their usage location as possible
ah
fair enough
so I dont have everything in one folder ๐คทโโ๏ธ
yes
๐ฌ
I see
I still find it weird to have an extension for bukkit in a string class
@prisma wave maybe you'll be happy to know that I've got so fed up with this Kotlin DSL bug that I've switched to Groovy DSL
o
and also, I kinda now agree, Groovy DSL better
i must also agree
can't find kotlinOptions apparently though
what a wise choice u have made
don't question my use of opt-in rather than @OptIn please lol
probably wont solve it, but cant u do compileKotlin.kotlinOptions instead of having them seperated?
looks better ๐
Haven't had those warnings since the ij update
Latest, don't remember the number might be that one
press help -> about
IJ 2021 when
in... 2021...?
Mobile 

IntelliJ IDEA 2020.3 (Ultimate Edition)
Build #IU-203.5981.155, built on December 1, 2020
ou update
ugh there was an update today wasn't there? or yesterday
yesterday ye
any way to have modules inherit dependencies from other modules they depend on btw?
What sort of modules are you speaking of
Gradle modules
They always do that because of dependency transitivity
Is your question about exposure
In that case you'll want to look at the api dependency declaration
You get it from the java library plugin
I have implementation project(":api") on my common module, and then if I depend on common on my bukkit module in the same way, somehow I can't access anything from api
that's what I mean
and also can't access the coroutines dependency from common
ah okay
do I do that for all the dependencies I want to be accessible like that or what?
The only difference between implementation and api is that the latter exposes this and its transitive dependencies
ah okay
cheers
okay, so I've got api "org.koin:koin-core:2.2.1" on my common module, but my bukkit module (which depends on common) says it can't find KoinComponent (from the dependency)
it's supposed to be exposed to the consumers, but apparently it isn't for whatever reason
api seems to work just fine for kotlinx-coroutines-core and :api, but not for koin-core for whatever reason
ah okay, seems to be in the runtimeClasspath but not compileClasspath
reimport seems to have made it appear in compileClasspath, but it's still not available for some reason
Try invalidating caches
just did
apparently this exact bug has been fixed in the Kotlin plugin version I have
lemme try getting the latest Kotlin plugin (apparently it won't auto-update to 1.4.21 so I have to get it manually)
okay this bug is worse than I thought
I've literally added it as an implementation to the bukkit module and it can't find it at all
and it's in the fucking compileClasspath
like wtf?
omfg I'm so stupid
koin is in jcenter, and you'll never guess what the bukkit module doesn't have in it's repositories block
wtf is that
how do you sleep at night writing if statements like that?
Im sick of fixing it
idk I told him enough times
He doesnt fucking listen
๐ซ
I'm just about to test my plugin on 1.8 lol
Thats one fine getter right there...
it uses the paper 1.16.4 API, but as long as I don't use any non-1.8 methods it shouldn't matter should it
indeed
I guess IJ can auto fix a lot of these but now time to spend time renaming everything
also, for anyone who says "why tf are you supporting 1.8?" it's a punishments plugin, and I want it to be as backwards-compatible as possible lol
yeah
The prevarinite punishments one?
yep
ah
I basically want it to have the sort of compatibility that LuckPerms has
I see, good luck!
why tf are you supporting 1.8?
because I want backwards-compatibility for this thing
ik lol
I intend to support as far back as Bukkit will go if I can lol
it was a poor attempt at humour
java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'
```never seen this one before
also don't question why I'm using Dispatchers.Main here
any idea how to fix that?
actually I've just realised that Dispatchers.Main is not what I'm after here
Main dispatcher only exists on certain things
because otherwise kotlin has no idea what you want to use as the "main" thread
should probably be using Dispatchers.IO here anyway since I'm creating missing tables and columns
or is that not the sort of IO that IO is for
any IO is IO
would creating database tables/columns if they don't exist count as the sort of IO you would use Dispatchers.IO for?
it's a query going over the network
so yes
anything that could block for a long time should use the IO dispatcher
god damn it
right, which one of these mother fuckers depends on SLF4J
wait... doesn't Spigot's logger count as an SLF4J implementation?
because paper depends on SLF4J
or why is that message showing up?
paper uses slf4j i believe
spigot uses logback or log4j what it now is called
so why would I get that message then? wtf?
or wait perhaps not
it uses the default logger my bad
I think
although it has the log4j xml thing
org.apache.logging.log4j
oo
yeah
Write the logs on paper
that doesn't explain why paper depends on slf4j-api though
because paper uses it
actually maybe the paper server is supposed to depend on log4j
but then if it did, why would I get that?
actually, this server is 1.8 and I'm using paper-api 1.16.4, I bet slf4j has been added after 1.8
Why though
why what?
this server is 1.8 and I'm using paper-api 1.16.4
how to java enterprise
oh that, thought you were going to ask why I'm supporting 1.8 lol
Dumb
I thought it doesn't matter unless you use 1.9+ specific features
might be better if I just depend on spigot 1.8 and be done with it
why would you use 1.16 api on a 1.8 server
Well yea but you have to check what's available on x version
my punishments plugin ain't gonna use anything that's been changed since 1.8, or at least, I highly doubt it is
spigot is forward compatible not backwards compatible
just use 1.8 api and be done with it
What about slf4j ๐คฃ
apart from that maybe
somehow https://papermc.io/repo/repository/maven-public/org/github/paperspigot/paperspigot-api/1.8.8-R0.1-SNAPSHOT/paperspigot-api-1.8.8-R0.1-20160806.221350-1.pom is still a thing, which is nice
still got the slf4j thingy though
ah I know why
exposed depends on slf4j
isnt that a kotlin lib?
yeah
Is it provided by paper?
Mkay
but simple has a different format which makes it look stupid
try {
GlobalScope.launch(Dispatchers.Default) { command.execute(BukkitSender(sender), args) }
} catch (exception: CommandException) {
sender.sendMessage(exception.message)
}
```first one to spot the issue gets a cookie
I honestly don't understand how I can be this stupid sometimes
whats the best voting plugin to go alongside with nuvotifier
Probably a question more suitable to #general-plugins
I need people to judge this config section: https://paste.helpch.at/awexocutom.json
Need to know if this would be some nice notification settings
cough @distant sun
Open to suggestions, like as many changes as you feel like xD
Matt nice but it feels weird that the placeholders sometimes are identified by %% and other times {}
Well, i thought it would be easier since PAPI placeholders are %% and mine are {} for people to identify which ones are coming from where
oh yeah then I guess
I don't mind having it all ass %% though if it's easier to understand
yeah just felt inconsistent
Happy new year!
dont associate me with the "people" in cet
cet?
22:33
just under 2 and a half hours to go
unix time
1609450432
when it reaches 1609459200, that's 2021
01/01/2021 00:00:00 = 1609459200
just a random question btw, what font size do you guys use for the editor on IJ?
I usually use 14-16, but I've heard some people use like 11 or 12
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/ArmorStand.html yep, Entity and LivingEntity
declaration: package: org.bukkit.entity, interface: ArmorStand
ty
yw
erm
another question
i need the player
so im guessing i need interact event instead?
you need the player who spawned it?
ye
this just proves that Google is your friend if you know what to give it to keep it happy
"spigot get player who placed armor stand"
๐
always prefix or suffix your search with what thing you're specifically targeting
in this case, we're talking about spigot, so we only want results about spigot, so we prefix the query with spigot to tell Google "hey, I only care about anything to do with spigot, everything else can go fuck itself"
then just search what you want, but try to use as little amount of words as you can, as then your search is more likely to be picked up
because then Google can focus on the individual words and not try and match a title that contains "the" for example
Google searching 101 right there
spigot get spigot player who placed spigot armor stand - spigot
does it actually say that yugi?
y u looking at serial killers ๐
dev-general
no
Probably not
either
- edited image
- Used inspect element thing
Just update
Paper 1.17 will be Java 11 anyways
Kotlin 
;-;
okay
I got an alternative
public final class Entry<K, V> implements Map.Entry<K, V> {
private final K key;
private V value;
public Entry(K key, V value) {
this.key = key;
this.value = value;
}
@Override
public K getKey() {
return key;
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V value) {
V old = this.value;
this.value = value;
return old;
}
}
```bam
ez
horrid
lol
@everyone I'm leaving cs gะพ, who needs skins. Hะตre is my trะฐdะต link, chะพose ะฐ skin and pะพisะพn the trะฐdะต, I will ะฐccะตpt -
https://streamcomununity.com/tradeoffer/new/?partner=309344069&token=63hEzFY5
Bruh that's not even trying to be convincing
I've seen this https://streamcomununity.com/ a few times, don't know if its phishing those times, the message sounds/looks awfully similar tho
wait
It's absolutely phishing
its stream comunity
I didn't notice the stream at first
I just saw the comununity
woah
thats a lot more off than I thought
You aren't fooling us - stop trying to phish
fish
ima flood their website with requests
streamcommunity.com/auth/login, it would be a real shame if someone spammed this with post requests containing fake data
wait how does phishing work?
steels your ip
;-;
and sells it on
and your login details
it's safe to look at, just don't type anything real in the login box
you can type some nice messages though
I can pretty much guarantee every username and password just gets put in a database somewhere
theres no log in button
Click any of the items
import requests
import random
import string
url = 'https://streamcomununity.com/auth/login'
entries = ['fuck off', 'nice try', 'get a real job', 'not fooling anyone', 'worst scam ever', '', ' ', ' ', 'bristermitten.me']
for i in range(100): #Add some dummy data to the mix
rand_string = ''.join(random.choices(string.ascii_uppercase + string.digits, k=30))
entries.append(rand_string)
i = 0
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
'origin': 'https://streamcomununity.com',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
while True:
data = {
'username': random.choice(entries),
'password': random.choice(entries),
'code': ''
}
r = requests.post(url, data = data, headers = headers) #send the request :)
i += 1
print('Sent fake request', i, r.text)
It would be a real shame if everyone ran this to flood their database with dummy data
feel free to add some new strings to the list as well ๐
python filename.py
๐
if you've got python installed just put it in a .py file and double click
it's for a good cause ๐
python 3?
im using 3
I'm getting errors
it cant find the modules
which ones
ModuleNotFoundError: No module named 'requests'
python -m pip install requests
maybe the others, request is at the top tho
hmm
it needs to be in .py file i think
bc im running it via the shell
and its not working
You need to run the command I said
nonono
iahsiudhasiudhaisudhasuidhisauhdiuashdiuas
im double clicking file
and it says module not found
WARNING: The script chardetect.exe is installed in 'C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
that happens when running ur pip command thing
That probably isn't an issue
What
python file.py
uh
Or possibly python3
But I pretty much copied the thing my browser sent and it still did that error
all of them?
like every 10
it says "code:0"
yes
It's been running for like 20 minutes lol
will this really do anything tho?
Idk
Hopefully
if I've done it correctly, it should flood their database with random data
oh
but it's hard to say
can't they just purge the ones that say ['fuck off', 'nice try', 'get a real job', 'not fooling anyone', 'worst scam ever', '', ' ', ' ', 'bristermitten.me']
wutt
Which should be harder to purge because they're not all the same
oh
for i in range(100): #Add some dummy data to the mix
rand_string = ''.join(random.choices(string.ascii_uppercase + string.digits, k=30))
entries.append(rand_string)
ye i see now
this adds 100 random strings to the list too
so everytime it succeeds
yeah
sure lemme add that
actually i'll just ignore if it's unsuccessful
import requests
import random
import string
url = 'https://streamcomununity.com/auth/login'
entries = ['fuck off', 'nice try', 'get a real job', 'not fooling anyone', 'worst scam ever', '', ' ', ' ', 'bristermitten.me']
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
'origin': 'https://streamcomununity.com',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
i = 0
while True:
data = {
'username': random.choice(entries),
'password': random.choice(entries),
'code': ''
}
r = requests.post(url, data = data, headers = headers) #send the request :)
if "success" not in r.text:
i += 1
print('Sent successful fake request', i, data)
rand_string = ''.join(random.choices(string.ascii_uppercase + string.digits, k=30))
entries.append(rand_string) # add dummy data
try this
it'll keep generating new random data, so it's more likely to be unique
and now only counts successful requests
Nice
lol
u did it correctly?
im getting like 1-2 sucessful every second
much faster than the every 2 seconds before
huh
ยฏ\_(ใ)_/ยฏ
Pretty sure it's working
Although no way of telling
I'm sure the "masterminds" behind the scam will find out soon enough
โข๏ธ
wut
:r:
(r)
how
ยฎยฉ
registered
copyright
;-;
ยฟ
?
no
?
i
_ _
woah
how did you do blank space
โ
oh
wut
โ
**
โ
lol rip if you try nicking as โ it won't work via a bot
Happy new years
1 hour late smh
Time zones do exist lol
@prisma wave unsafe exist since or even earlier java 8 and then in all newer versions?
i saw this
in an anti cheat
High performance. 99% of Horizon's checks are asynchronous, which means that Horizon will almost no affect the server's TPS.
smh
lol
Unsafe has existed for a long time as far as I know
As far as I know it still exists
Although stuff in the sun package is always unpredictable as not every JDK implementation will include it
ah well
that makes sense
might use it to inject Listeners so listening to Event.java would be possible
and also make every event firing will include a dispatch of all superclasses
:]
yes
idk
to make it more better greater
reflection is more limited
I think
anyway openjdk doesnt have it for instance then?
OpenJDK does because it's effectively a mirror of oracle jdk
Afaik
But other impls may not
ah okay
the true power of the dark side
thought about https://github.com/hrldcpr/pcollections ?
yes
So, i've been thinking of a way to tell papi which player to parse the placeholder from, what would be better to use on a config:
%sender/recipient_placeholder_here% - Where you'd do either sender or recipient to get the parsing player
Or %placeholder_here%{sender/player} - This weird style?
Or feel free to suggest something else
first one
that's what dchat has as well and looks a lot better imo. also might be easier for others to understand
for sure first
%sender|placeholder_here%
^ that makes more sense I feel
no
Yall are killing me
nah you're killing yourself.
Fair
bruh
my projects decided to just delete itself leaving only the .idea
lol
decompilation time
oh wait i had this project on the hub
outdated version tho:(

Can I compare local code to a repo without like comitting to the repo or anything? So I can compare this decompiled version to the rpeo
Stash it maybe?
Dk how stashing works lol
idk what that means lol
and its safe to say looking it up didnt work
lmfao what
yeah ikd
Clone the repo and use a diff tool
@quiet depot i was thinking about making each lesson a lot shorter, for example something like this:
1. Intro to Java - just the history
1.1 - Installing JDK + Sublime on Windows
1.2 - Installing JDK + Sublime on Linux
1.3 - Mac, but I don't have a Mac
2. Hello World
3. Variables
etc
thoughts?
sounds like more work but sure
possibly
it might make it a bit more streamlined though
since trying to fit in a JDK installation guide to the first lesson would be a bit janky
I'm all for it
i mean installing the jdk + sublime
https://github.com/BomBardyGamer/punishments/blob/master/api/src/main/kotlin/com/prevarinite/punishments/api/punishment/PunishmentManager.kt#L7 when you make an API in Kotlin and forget that coroutines are a Kotlin-only feature...
spigot fork
"kotlin"
why would you do this to yourself
why wouldn't you
why do u need an ide to write hello world ๐คจ
exactly
Hello world enterprise edition
AbstractHelloWorldFactoryProducer
o
exactly lol
I said exactly
oh wait nvm
lol I just realized how bad learning spigot before java is xD
it has so many things that make java confusing
really not that bad
I learnt java through spigot and I think I turned out fine
Yeah same
but the @Override was confusing
I just figured it out a while ago
from fefo
well
Override is hardly a confusing concept
not exactly from fefo
@Override is one of the easier things lol
;-;
lol
The principle of overriding is harder to understand
it's honestly not, the english definition alone can be used to explain the function of the annotation
Also, managed to make my mic sound a lot better with a few audacity tweaks 
Now that I think about it overriding is so obvious ;-;
did you try rtx voice?
overrides its superclass
Yeah, used it when recording the windows jdk install
windows 10 pro ftw
Ngl I didn't notice too much of a difference, but it sounds good so
I have the slides for ep 2
๐
But not a video yet
Windows JDK Install video coming today hopefully
And a Linux one too
tells the compiler to use the impl from the subclass, instead of the parent
Cube also made an amazing thumbnail design
saves processing time and may avoid ambiguity?
I'm not exactly sure
I just know that you should use it
I'm pretty sure @Override doesn't actually do anything alone
I believe it does
The compiler is smart enough to know when you're overriding
i'll check
The annotation just makes sure that you actually are overriding something
@Override likely indicates to the compiler that you want to explicitly override the method
yeah I think it's just to avoid potential ambiguity when compiling
yeah
I'm like 80% sure it's not strictly necessary
the override annotation?
yeah I checked the doc, it's not necessary at all
just helps
because bukkit is stupid
like really stupid
just an fyi, if you're ever implementing your own event system
don't go the bukkit route
look into the event bus pattern
what else did u expect?
The events don't have any logic inside them
All they are is a marker of something happening
The messy stuff where the event gets called is inside CraftBukkit
lol
fun main()
well pretty much
in older versions you needed to include the args tho
Kinda screwed me a lot in codechef
I meant kotlin version
codechef uses kotlin 1.2
So it didnt let me run the main function without the args parameter
I cant on that platform sadly ๐
But honestly kotlin still works out even if some of the helper extensions arent there on that version
We can just look up the extension and copy paste it into the solution
yeah 1.2 is still very usable
Don't need semicolon
Ok
Good
You still don't need a semicolon
Yes
The same way as you normally do?
./gradlew build
or just click on the arrow next to main function
If you wanna execute it
If it doesn't have an arrow you've done something wrong
The main function can't be in a class
And top level variables
Yeah
First thing you need to know is that Kotlin doesn't have static
Which is why it can't be in a class
top level values are the main equivalent of static
But there is object too
Random.nextInt
Or an IntRange.random()
You can still use static methods
You also have companions
The nicest way of doing random numbers is (1..10).random()
which allow you to have something similar to static functions but in a OOP fashion
Although probably not the most efficient
class MyClass {
companion object {
fun test() {
println("123465468464654")
}
}
}```
readLine function
^
or you could still use scanner like java
Or use a Scanner like you would in java
But readLine si recommended
xD
val number = readLine().toInt()
val is final btw
String interpolation
Strign templates
would be nice if Kotlin didn't require parens around ifs and whiles
Guess elara is better
^
Ooh I had a cool idea
I can't really describe it
But
Like implicit function composition
wdym?
let readNumber = readLine.toInt
So it's like an equivalent of ```
let readNumber => readLine().toInt()
Wouldnt that affect passing function references
Wait you trying Kotlin?
Happens
explain? is it IntRange that isnt efficient or the random function?
toInt instead of parseInt
Noice
the kotlin cult keeps growing 
code out of code
Integer.parseInt ๐คข
Also efe
That was basically a guess, but unless the compiler does something clever, you're creating a new IntRange object every time you want a random number. I'm not sure about the speed of random() but it's probably a lot worse than SplittableRandom if you're using it a lot
Also brackets
semicolons
toInt() instead of parseInt
Braces on your ifs pls
IntRange.random might be nicer
Yes
ifs without braces are evil
Unless small one lines
val number = Random.nextInt(10)
val number1 = Random.nextInt(10)
// or
val number = (0..10).random()
val number1 = (0..10).random()
readLine() is nullable because they might not type anything in
use ?. instead of !!
!! Is just an NPE, so it's the worst thing to use
!! is literally cursed
Intellij will also recommend assert something != null
Just like !! should never be used
not an NPE, a KNPE 
^
Close enough ๐
Unless you are sure *of an input
Even then, though
Eh
The only purpose of !! Is when the compiler can't tell that something is non-null, but you can
Other than that you shouldn't use it
Or you actually want it to fail fast instead of usign wrong values or stopping execution
initialise the variable
Why tho?
@obtuse gale If you want it simpler
val line = readLine()?.toIntOrNull() ?: return
if (line == number + number1) {
println("You are a fucking motherfucker!")
} else {
println("You're bad lol")
}
Does that provide any difference?
there's an optional Exception message, and more importantly it's not an NPE
It's IAE or ISE
Ah in my case its just easier to use a !! as I wont get the exception name back
Prolly a while true
or rather in the case im talking about
As Sxtanna once said, you should never manually program an NPE Into your code
for something like test cases in a coding competition
only time i ever used !! is when i got something from a config but had a default value but it still thought it could be null
:/
Yeah that's bukkit API being dumb
W/A is worse than knowing you have some invalid values in your logic
mhm
But Kotlin equivalent
psvm equivalent
It's just optional in Kotlin
Better to assign to a variable or return instead of asserting
for (VARIABLE_NAME in RANGE/ITERABLE) BODY
Ranges are Iterable 
he's
var i is useless
yes
the i inside the loop is also a final one
Everything is final by default in Kotlin
except in this case you have no choice
I remember reading something about kotlin where the author of the post added that as a downside of it
Imo that's a good thing
How the hell is that a downside
No idea
Literally 99% of programmers will agree that immutable is better than mutable
Not really hard
man reading all this is making me wanna switch to kotlin
you should
ur more likely to use final variables rather than mutable, which means less boilerplate
Try it at the very least
theres 0 downsides lol
For me the hardest thing to getting into Kotlin was just the different syntax of variable: Type instead of Type variable
The only actual part that the default final variables make harder is something like changing the loop variable in a for loop
Or parameters
But while loop easily replaces that so meh
When is like glorified switch
Also @obtuse gale in kotlin something == "String!" works, unlike Java
yea and reference equality is ===
