#dev-general

1 messages ยท Page 154 of 1

fading drift
#

discord has made it into mc

ocean quartz
#

Oh yes

analog crater
#

Like does closure work for soo little

split talon
#

ice ice baby

lunar cypress
distant condor
#

guys I need to say something important

#

kotlin good

#

java bad

#

clojure okay

prisma wave
distant condor
#

fingergun to you too

prisma wave
#

@heady birch thank you for vouch! The plugin will segfault if there are more than 3 players. I can't fix it. Have a nice day!

ocean quartz
distant condor
#

it's not kotlin so...

ocean quartz
#

Well it's a lib so, i gotta suffer through Java

prisma wave
#

๐Ÿ˜”

distant condor
#

๐Ÿ˜”

ocean quartz
onyx loom
#

the classic

#

matt is this just a fun project ur doing? im not sure why ur making it ๐Ÿ˜…

#

its very cool tho

ocean quartz
#

It's going to be a lib, making it so i can use on my plugins but also for anyone else who wants to use

#

Would be a cool chat plugin

onyx loom
#

๐Ÿ‘

#

make deluxechat use this ๐Ÿ‘€

ocean quartz
#

if clip wants he can use it

onyx loom
#

no, force him

#

๐Ÿ˜„

lunar cypress
#

I really like the idea of having a convenient markdown-style language for mc chat. Let us know when it's public, I'll definitely use it

prisma wave
#

Yeah it seems very handy

onyx loom
#

matt always with the cool stuff

#

he must be such a cool guy ๐Ÿ˜ญ

ocean quartz
#

Will definitely do!
Gonna have to change it a bit if i want to do gradient
Also a bit worried about performance, doesn't seem awful right now, but needs more tests

prisma wave
#

I mean chat is async anyway

#

It shouldn't be that bad

pastel imp
#

ok @chilly jungle after some thinking a found the issue in DM.. the /dm list is returning the wrong names...

#

for ex..

#

the real name is advanced_menu

prisma wave
#

KOTLIN

obtuse gale
#

LULW

#

A KAREN LUL

#

TRUE LULW

#

Any TRUERS?

prisma wave
#

Athelete

#

lol

obtuse gale
#

The blade can only be as sharp as your mind.

#

anyways i got a couple weirdass quotes that im gonna rant about in #off-topic

prisma wave
#

damn ghost pinging

#

That's new

solar talon
#

@obtuse gale needs to be banned

#

spam pinging everyone

#

@distant sun @chilly zenith

#

please hel p

chilly zenith
#

@obtuse gale Wrong channel

prisma wave
#

๐Ÿค”

ember mesa
#

a

#

Help

obtuse gale
#

same

ember mesa
#

Does anyone know uses the leaderhead plugin?

obtuse gale
#

Many people probably do

tranquil crane
#

you ever just looking over your code and you remember a monstrosity of a method that you wrote not too long ago
https://prnt.sc/txjxqf

obtuse gale
#

getWhat?

#

getStream, gotcha

#

getSortedNonInteractableBlockNonSpawnerMaterialStream

tranquil crane
#

ended up renaming it to getPossibleStackableBlockMaterials() so I wouldn't keep making it worse

#

it was fun while it lasted

obtuse gale
#

If you keep extending the name, there's a point it's more readable to just inline the stream method instead of wrapping it in another method

tranquil crane
#

yeah I know, it's only ever used in one spot, I mostly just did it for organization but then it quickly grew into a joke

heady birch
#

@prisma wave will it work 3.5 players we never reach 4

obtuse gale
#

Is there some cases where !! is ok?

hot hull
#

Aj please

#

sPaCinG

obtuse gale
#

no

hot hull
#

Any luck with mcdev?

obtuse gale
#

whats the error again lol? Imma just ask it in the mc dev server

hot hull
#

Incompatible version for this plugin

#

Or something along those lines

obtuse gale
#

oof ok, the issue is with me tryna run the IDE in IJ i remember

distant condor
#

Kotlin good java bad

#

I'm just saying this everyday now I guess

obtuse gale
#

fair enough

heady birch
#
private void traverse(Criteria criteria) {
  if (criteria instanceof CriteriaGroup) {
    CriteriaGroup group = (CriteriaGroup) criteria;
    for (Criteria subCriteria : group) {
      traverse(criteria);
    }
  } else {
    System.out.println(criteria);
  }
}```
```java
Vs:
private void traverse(Criteria criteria) {
  System.out.println(crtieria);
  for (Criteria child : criteria.getChildren()) {
      traverse(child);
  }
}
#

NiallToday at 10:14 AM
Take into account here the api design, which is the best?
Because most criteria never have children
Only a few will

#

API is the criteria class

#

Two snippets are to show how the criteria is structured

hot hull
#

Fellas, using Monitor and not actually modifying the state of the event just sending a message if a condition is met should be fine right? (To ensure nothing else modifies it afterwards)

heady birch
#

fine

regal gale
#

No placeholder match in comment codes

empty flint
#

Any Kotlin Missionaries here? I could use some help

heady birch
#

I have a little knowledge

obtuse gale
#

kotlin good java bad

empty flint
#

Can I use default values in the constructor parameters that take up values from previous parameters?

heady birch
#

I dont know about that one

empty flint
#

Say something like:

Person(var name: String, var birthName: String = name) {}

#

huh

#

Eclipse isn't throwing anything shady at me with this syntax so I guess it's fine:

class Context(val id: String, val type: ContextType, val priority: Int = type.priority) {}

obtuse gale
#

Why you using eclipse with kotlin tho

#

thats like

#

one of the sins, kinda like maven with kotlin

empty flint
#

Shush. I'm on vacation and my internet is too shitty to download IntelliJ ๐Ÿ˜›

prisma wave
#

I prefer the second

#

And yes it can do 3.5 players

heady birch
#

thanks

steel heart
#

I like the first one

#

seem more boilerplaty

prisma wave
#

boilerplate bad

#

also the first one kinda defeats the point of polymorphism

steel heart
#

who cares

#

I like to violate solid and the oop principles on a daily basis

prisma wave
#

๐Ÿ˜ 

#

functional programming is better anyway

steel heart
#

thats true

#

massive xp message from johnny incoming

lunar cypress
#

Polymorphism fortunately isn't an OOP concept ๐Ÿค“

hot hull
#

Ayy, IJ is cucked angry_fingerguns

heady birch
#

Using that material them again I bet

hot hull
#

Shut up Niall

#

It worked fine, until you brought that up yesterday

heady birch
#

Remove the theme

prisma wave
#

material theme more like malicious theme

heady birch
#

Darcula is literally fine

hot hull
#

The theme has nothing to do with it

prisma wave
#

liberals owned

heady birch
#

Spending more time using that theme than writing

obtuse gale
#

material good

heady birch
#

Delete the theme save time

hot hull
#

You're the one to talk when you use white theme

#

smh

heady birch
#

Yeah but it doesnt use 4GB of ram

prisma wave
#

hyperbole

#

bad

hot hull
#

IJ is using 800kb of ram

#

So fingerguns

heady birch
#

Bet

#

Bet

obtuse gale
#

bet

heady birch
#

No

#

Not in a million years is it using 800kb

hot hull
heady birch
#

Probably misread it for MB

#

or GB

#

Yeah windows BUG

hot hull
#

800GB, ah yes ofc

heady birch
#

that K is a G

#

I am not at liberty to discuss this matter

ocean quartz
#

That's 809MB, that's not that much

prisma wave
#

pretty low actually

#

must be that damn material theme

hot hull
#

Doing wonders

#

I mean it's not like it can use more :kek:

quiet depot
#

da hek

#

800mb

heady birch
#

Material theme

quiet depot
#

my ij idles at 1.3gb

#

material theme gud

versed ridge
old wyvern
hot hull
#

Piggy, it phisically can't use more

heady birch
#

593mb

quiet depot
#

phisically

old wyvern
#

Kill me

quiet depot
#

pls

obtuse gale
#

you guys are measuring in mb/gb?

#

weak

#

Why so many classes in one package ahhh

versed ridge
#

good design

quiet depot
#

because the author clearly has no regard for other developers

versed ridge
#

:)

obtuse gale
hot hull
#

Yugi, have you seen GriefPrevention lmao?

obtuse gale
#

Btw finally done with my rocket

quiet depot
#

nothing beats slimefun

old wyvern
#

Also, I just realized the one thing america doesnt have a diff unit for than the other countries.... data

obtuse gale
#

What do you recommend me for flame particles?

old wyvern
#

Yugi, have you seen GriefPrevention lmao?
Not yet xD im scared now

hot hull
#

Go check

versed ridge
#

oh god

hot hull
#

I wanted to cry

versed ridge
#

don't

#

You'll regret it

old wyvern
#

Wish me luck, diving in gp

obtuse gale
hot hull
#

I PRed a fix yesterday, didn't include my package sorting cause it would probably break something, which I can't be bothered fixing

quiet depot
#

woowie

#

that seems familiar otdan

obtuse gale
#

Yeah it is in the theme of vehicles

quiet depot
heady birch
#

That is damn cool

obtuse gale
#

It's a commission

quiet depot
#

take a look at the way I did it

#

might help

#

it has particles

obtuse gale
#

Oh you have a galacticraft plugin damn

old wyvern
#

@hot hull had a look, My eyes are bleeding now. ๐Ÿฉธ ๐Ÿ‘€

quiet depot
#

lol never finished it

#

was for a contest

#

it has a rocket which flies

obtuse gale
#

Ah okay

quiet depot
#

and particles

#

which is what you want, so that's all that matters

obtuse gale
#

Yeah just need better particles

#

Okay gonna take a look thanks

quiet depot
#

take a look at the vid on the readme, make sure it's what u want

obtuse gale
#

Unfortunately I had to use armorstands for the model

#

My mind went ahhh

#

I spent my whole yesterday on this plugin

onyx loom
#

o i remember that

#

that was cool

hot hull
#

My laser tag was better Piggy fingerguns

quiet depot
#

pf

#

my plugin has great potential

#

the concept of modded in vanilla in general has great potential imo

old wyvern
#

Mars dimension

quiet depot
#

my plugin had the moon

hot hull
#

Imagine if mc didn't have a 256 block height limit

#

or there was a way to bypass it in vanilla

obtuse gale
#

Can I not send images too here?

quiet depot
#

=imgur

compact perchBOT
#
Uploading Images

Please use imgur to share screenshots and other images.
โ€ข Imgur

obtuse gale
#

Yeah just asking

versed ridge
#

You can at like tier 2 or something

#

or 3

obtuse gale
#

500+ lines of goddamn model lmao

quiet depot
#

ah yeah feelsbadman

obtuse gale
#

Yeah I know it could be optimized I will do it later

hot hull
quiet depot
#

why couldn't you use an rp?

obtuse gale
#

But it was for the model itself I didn't even want to think about it

#

rp?

hot hull
#

resource pack

quiet depot
#

resource pack

obtuse gale
#

Oh because it had to be in the theme of vehicles

heady birch
#

pure blocks is cool

obtuse gale
#

Its a commission

#

Just doing what the client wants

hot hull
#

I had a great project idea the other day

quiet depot
#

o

#

what was it frosty?

hot hull
#

Not telling, it's got to do with either armor stands, or actual structures with entities

obtuse gale
#

Vehicles is a plugin that uses armorstands too for mutliple vehicles

quiet depot
#

ah that narrows it down

hot hull
#

Told the guy I've been doing plugins for, and let's see if he comes up with any ideas for it fingerguns

old wyvern
#

Also dan you can possibly reduce all that repeating part into a function

obtuse gale
#

Yeah yeah as I said I can optimize the code but I wasn't looking at it while doing the model

#

It's just one day of work

heady birch
#

hi frosty under the 2000 freedom of information act, for the sake of "vital to the functioning of a democratic society" you are required to tell me your idea

obtuse gale
#

I am gonna finish it today

hot hull
#

Niall, switch to material dark theme, and I'll think about it

prisma wave
#

lol

heady birch
#

Lol

hot hull
#

Get r3kt nerd

heady birch
#

"He will never use material dark theme"

prisma wave
obtuse gale
#

atom one dark at least

hot hull
#

I found the issue, turns out IJ wasn't broken completelly, just acted weird when not casting an Object to a String

obtuse gale
#

Wasn't there a way with intellij to make the repeating code into a function?

prisma wave
#

IJ ultimate duplicate checking can sometimes do that

heady birch
#

Oh dear what is this

#

Heh

#

This theme is quite nice

#

Yeah that didnt last long

prisma wave
#

lol

#

no information for you

#

๐Ÿ˜ฆ

hot hull
#

We'll see what the guy decides it can be used for, and I'll perhaps show sneak peaks if I do work on it fingerguns

heady birch
#

i was joking i dont really wanna know

hot hull
#

Okay sad_fingerguns

heady birch
#

is 1.16.2 nms update?

onyx loom
#

๐Ÿ˜ฎ

ocean quartz
#

I think so, because of the Brute mob

heady birch
#

Sad

obtuse gale
#

@quiet depot what was the particle name for the flame ones you used?

versed ridge
#

How can I make that highlight better

hot hull
#

wdym?

calm marlin
#

I am having a problem starting my server, its keeps giving the message:
FAILED TO BIND PORT
The exceptopm was: jave.net.BindException: Cannot assign requested adress: bind perhaps a server is already running on the port?

I get that message every time i try to start it :/

obtuse gale
#

it says the issue lol

#

In the ide

hot hull
#

Go to code style and turn on the opacity or what'

obtuse gale
#

theres already something running on that port

#

Yeah

#

also not really the right channel

heady birch
#

Idk wether this is a good design

#

Only a few criteria would have children...

obtuse gale
#

Ahh white

quiet depot
obtuse gale
#

Yh found it already thanks anyway

hot hull
#

Any cleaner ways I could approach this?

                final ItemStack item = getItem(value);

                switch (key) {
                    case "HELMET":
                        entityEquipment.setHelmet(item);
                        break;
                    case "CHESTPLATE":
                        entityEquipment.setChestplate(item);
                        break;
                    case "LEGGINGS":
                        entityEquipment.setLeggings(item);
                        break;
                    case "BOOTS":
                        entityEquipment.setBoots(item);
                        break;
                    case "HAND":
                        entityEquipment.setItemInHand(item);
                }
heady birch
#

its pretty nice

#

Map<String, EntityEquipmentApplier>

#

interface EntityEquipmentApplier {
apply(final EntityEquipment equipment, Item item);
}

#

map.put("HELMET", .........

obtuse gale
#

sucks that people are actually recommending MineAcademy to these beginners who want to learn Java.

heady birch
#

is it bad

obtuse gale
ocean quartz
#

@hot hull Save EquipmentSlot as the key, instead of a String
Then when you loop through the map you do entityEquipment.setItem(equipmentSlot, item)

hot hull
#

Smart fingerguns

versed ridge
#

You see how test in the println is highlighted

hot hull
#

Although no

#

That doesn't seem to be a method on 1.8

versed ridge
#

But String test is like barely highlighted

#

How can I make the String test look like the other one

remote goblet
hot hull
#

DeathRealms, have you played around with the codestyle?

versed ridge
#

I've looked at, don't really see anything related to that though

ocean quartz
#

Maybe because of the color your line is, since the line is much darker than the rest it'd be harder to see the color so IJ changes it? Idk xD

hot hull
#

Just set your background as darker if you want to enhance the text brightness

prisma wave
#

@remote goblet kill it

remote goblet
#

appreciate it

ocean quartz
#

Or use Atom One Dark, since it's the superior theme

versed ridge
#

um

#

hm

#

ok then

hot hull
#

Material Oceanic best

versed ridge
#

Literally just restarted intellij and it fixed?

#

wat

hot hull
#

That's ugly

versed ridge
#

How did restarting just now fix that lmao

#

What's ugly

ocean quartz
#

Frosty ;p

hot hull
#

Matt, you were working on a pets plugin right?

ocean quartz
#

Yeah

hot hull
#

How's it coming along?

ocean quartz
hot hull
#

Sheesh

heady birch
ocean quartz
#

I'll get back to working on it soon though, just gotta finish the messages lib, then update mf-gui, then work on mf, very little things

hot hull
#

Then work on aliases fingerguns

#

When you fork a plugin, and then you clone it and everything is red (not due to a missing sdk, but actual errors)

heady birch
#

When the plugin isnt in rust

heady birch
#

@lunar cypress Hello reckon you could advise me on this

#

track_list is an Arc<RwLock<HashMap<i32, Track>>>

lunar cypress
#

You need to use Arc::clone or whatever it's called and move that to the other thread

empty flint
#

How do I declare the default getter as private and override it with a custom public one in Kotlin?

obtuse gale
#
val x = ""
  get() = "AHHH"```
#

I think

lunar cypress
#

You don't, as far as I'm aware

empty flint
#

When the member attribute is declared in the primary constructor

#

You don't, as far as I' aware
@lunar cypress Kotlin bad then...

obtuse gale
#

no

#

kotlin good

lunar cypress
#

Well subclasses don't have access to private

#

Try a different modifier

prisma wave
#

When the member attribute is declared in the primary constructor
not possible

#

there is a workaround

#

although i'm not sure why you need this

#
class SomeClass(blah: Type) {
  val blah = blah
    get() = blah.something
}
``` ?
empty flint
#

Well subclasses don't have access to private
@lunar cypress It has nothing to do with subclasses

lunar cypress
#

You talked about overriding

empty flint
#

overriding its own default getter

#

I basically don't want a getter for an attribute of a class

#

and a separate method to get and set the value

lunar cypress
#

wait what

empty flint
#

whatever, I think what Clojure did might work

prisma wave
#

write what you want to do in java

lunar cypress
#

You don't want a getter but a method to get the value

#

I think the terminology you're using is a little misleading

empty flint
#

Maybe I'm going at this all wrong

#

So I have a mutable map in a class

#

I don't want any outside class to be able to just change the values in the map directly

#

I want them to use methods to do it

#

so I want the map to be private

heady birch
#

no not possible

empty flint
#

and a getter and setter used to make changes within the map

heady birch
#

nothing works

empty flint
#

nothing works
@heady birch shut up ๐Ÿ˜„

prisma wave
#

but that's not a getter and setter?

hot hull
#

Any reason why you don't want people to directly change the map?

empty flint
#

but that's not a getter and setter?
@prisma wave No, it's not

heady birch
#

error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after error after with rust

lunar cypress
#

I told you that's rust for you

heady birch
#

๐Ÿ™

lunar cypress
#

Btw you shouldn't modify the type of track list, just where it's used

heady birch
#

wot

#

Is alias

lunar cypress
#

Meh

prisma wave
#

@empty flint kotlin class ClassName(private val map: MutableMap<Blah, Blah>) { fun put(key: Blah, value: Blah) { map[key] = value } } ?

heady birch
#

Playin around with those little life time thins

empty flint
#

Any reason why you don't want people to directly change the map?
@hot hull Because I require a specific format for the map contents and if anybody can just input anything that's bad

prisma wave
#

restricting mutability good

empty flint
#

@empty flint kotlin class ClassName(private val map: MutableMap<Blah, Blah>) { fun put(key: Blah, value: Blah) { map[key] = value } } ?
@prisma wave Yes, that's what I was thinking of. Ty. Didn't know you could set the private modifier in the parameters of the constructor

prisma wave
#

yeah lol

ocean quartz
prisma wave
#

modules?

ocean quartz
#

Yeah, so for example if you don't want italic, you can disable it

prisma wave
#

hm

#

i would do a blacklist rather than a whitelist, because I can't think why you'd want that apart from in a few specific circumstances

#

or like

#

yeah, have it takes excluded rather than included modules

#

or both

#

static factory fingerguns

frail glade
#

How's pdm going?

prisma wave
#

decently

#

pushed some nice updates

lunar cypress
#
let first_ref = Arc::new(RwLock::new(HashMap::new()))
let second_ref = first_ref.clone() // move this to the other thread``` @heady birch
frail glade
#

Is 0.0.2 out?

prisma wave
#

apart from the lack of relocation it's going pretty well

onyx loom
#

more than 0,.0.2 now

prisma wave
#

I had to skip 0.0.2 lol

onyx loom
#

were on 0.0.12 OMEGALUL

prisma wave
#

I published to gradle and it failed and wouldn't let me try again

#

so I had to skip to 0.0.8 lmao

frail glade
#

Can I get a TLDR of the changes from 0.0.1?

ocean quartz
#

Was thinking about both yeah, just gotta think of a good way to do it

onyx loom
#

i would like that too

empty flint
#

What's pdm?

onyx loom
#

downloads dependencies at runtime

errant geyser
#

MLM doubly intensifies

#

Its GREAT

lunar cypress
#

Do that for pdm

ocean quartz
#
Message.withModules(whitelist);
Message.withoutModules(blacklist);

This sounds pretty dumb right? xD

prisma wave
#

mostly bugfixes
the gradle plugin is a lot more reliable now (doesn't need kotlin plugin etc),
a few refactors (you use PDMBuilder instead of making a PluginDependencyManager now)
Johnny added some method that means you can do dependency loading before the plugin actually gets loaded
it supports parsing <parent> tags so things like Jackson should work

errant geyser
#

Matt, I'd have them all enabled, and then if they don't want certain bits, have a way to unregister the modules

prisma wave
#

and might be a little bit faster too

frail glade
#

So can I just put this onLoad and let it do its thing now?

prisma wave
#

I think Johnny's way is inside a static block

#

@lunar cypress can you confirm?

lunar cypress
#

Yeah, but it doesn't make a difference unless you use code from dependencies on class load

#

Which is what I needed

frail glade
#

Ahh

#

Do you put it in your onLoad or in your onEnable?

lunar cypress
#

Before any dependency is used

#

That's the most important part

#

Would make sense in onLoad rather than onEnable of course

prisma wave
#

normally you probably want onEnable just so you can callback any initialization

frail glade
#

I would've thought 1.4 Kotlin be out by now.

prisma wave
#

๐Ÿ˜ฆ

frail glade
#

I know it's in RC

prisma wave
#

yeah it's close

frail glade
#

Did you look at the stuff I sent you?

#

How he was downloading from json and just relocating when it's loaded it?

lunar cypress
#

No callbacks needed if you just slap a join there ๐Ÿ˜Ž

frail glade
#

Loaded in*

prisma wave
#

oh yeah, I'll probably end up doing something similar

frail glade
#

Waiting on the day relocation works (:

prisma wave
#

although i'm gonna try and look into classpath isolation, which might be better than relocation

#

iirc lucko does something like that but only for a few dependencies

frail glade
#

Yeah that could work too

#

Yeah he does it to make SQLite work on 1.8.8

lunar cypress
#

Never heard of that

prisma wave
#

I really hope that's possible bc it's probably a lot easier than relocation lol

frail glade
#

So does that just mean you don't relocate in the shadowJar?

prisma wave
#

yeah I think it would mean that each plugin has its own classpath and can't interact with classes from other plugins

#

making relocation redundant

#

not sure how possible it is though

frail glade
#

Might be more of a headache

prisma wave
#

possibly

#

worth a try

ocean quartz
frail glade
#

Yeah I ended up fixing the jar size by simply removing runtime from everything and then runtime Kotlin. That alone made the jar small enough ๐Ÿ˜‚

prisma wave
#

that'll do it lol

lunar cypress
#

What if you have compileOnly dependencies like apis from other plugins

frail glade
#

Okay so July 27th was Kotlin 1.4RC

empty flint
#

How do compile-time unknown generics work in Kotlin?

#

List<?> does not seem to be a thing

ocean quartz
#

List<*> I think

empty flint
#

ty

heady birch
#

track_list is expected to remain throughout the program executiion

#

So I would make that <'static> right

lunar cypress
#

Do you even need a lifetime there

#

Because at least in your typealias you don't

heady birch
#

Wait

#

the Arc<...> doesnt need to be mutable does it

lunar cypress
#

No

#

You don't change its content

heady birch
#

Lol

#

Also Im kind of worried

#

I will be locking/unlocking this thousands of times a second

#

@lunar cypress and how would I get something from that Arc now?

#

For some reason my ide is playing up and thinks the type is my hashmap when its actually a RwLockReadGuard<TrackList>

#

my bad I actually need to write to it

#

well not to the hashmap

#

but the object in the hashmap

#

I dont want to deref it surely

hot hull
#

๐Ÿคธโ€โ™€๏ธ

๐Ÿฆฝ ๐ŸŒ๏ธโ€โ™‚๏ธ

errant geyser
#

YES

coral hazel
#

don't really know where to put this, since it doesn't feel like a thing for #738969312051593249 ,
anyways,
i'm looking for someone to just chill with and code together, maybe show each other what were working on, or work on something together, just all around coding buddies, you know?
(im pretty new at this minecraft plugin dev thing, just fyi)
anyways, dm me

old wyvern
onyx loom
#

eeeeeeeeeeee

hot hull
#

Why is everything green yugi

old wyvern
#

I swear Im about to close this shit and move on

#

theme frost

hot hull
#

You can change it sheesh, that's too much green

old wyvern
#

I have to finish this for server to open today and its fucking impossible to find where what happens

errant geyser
#

Thought you were doing the parser cryingkitty obligatory /s, do whatever you want

onyx loom
#

what triggers me the most is the fact theres no space between the if

hot hull
#

Yugi, have you checked out Grief Prevention?

old wyvern
#

Yes I am

#

Have to finish this

#

its just a simple ignore N deaths

#

But this shit is wired so badly god knows what happens when

#

Im just going to drop it in the beginning of EntityDeath listener and just hope it works ๐Ÿ™ƒ

heady birch
#

Johnny wait!

#

I think I got it wokring

lunar cypress
#

@heady birch you should just be able to call functions on the arc directly

heady birch
#

Yeah

#

I was wondering why it was autocompleting with the hashmap functions

prisma wave
heady birch
#

Its working

#

Perfectly

lunar cypress
#

And use read()/write() respectively

heady birch
#

Johnny you are a hero

#

Im using mutex at the moment I played around with the two

onyx loom
#

@prisma wave wrong date mate

heady birch
#

Which is more appropriate, considering:

  • lots of threads writing very quickly
  • 1-2 reading every now and again
onyx loom
lunar cypress
#

Well mutex works too but will be a lot less efficient

prisma wave
#

They say to use ISO format ๐Ÿ˜ฆ

#

Year month day ๐Ÿคฎ

onyx loom
#

but still

#

it should be 8

#

not 7 ๐Ÿ™‚

prisma wave
#

oh yeah

#

i just fixed that

#

lol

#

got confused there

lunar cypress
#

Ok yeah it may actually be more appropriate

#

Most recent comes first @prisma wave

#

I think

prisma wave
#

oh

heady birch
#

Damn rust is neat

versed ridge
lunar cypress
#

But gj bm

#

In most of my new projects I do that now too simply because leiningen auto generates such a changelog

prisma wave
#

well

#

oh that's cool

#

Would be cool if GitHub could do it based on commit tags

hot hull
#

Would be cool if GitKraken worked on 32bit

heady birch
#

kite board OS

onyx loom
#

would be cool if frosty got a 64 bit system

hot hull
#

Indeed it would :((

lunar cypress
#

GitKraken works on 32 bit

#

I know that for a fact

heady birch
#

Hello who wants to help me on a design decision

onyx loom
#

frosty ur the reason why we still have 2 different installers for programs

lunar cypress
#

I had my former computer science teacher install it on the school machines

#

Which were all still 32 bit

heady birch
#

Only a couple criteria have children though

hot hull
#

Must've missed an old versions tab then Johnny

heady birch
#

Which is why I had the original GroupCriteria interface

#

because it seemed silly giving the pure Criteria interface children when most implementations wont have any

#

************ bump ************

empty flint
#

Is there a kotlin way to do this better?

contextualValues.toSortedMap().values.first()

If contextualValues is an empty map it will result in a "NoSuchElementException". In java I'd check this with an inline-if

contextualValues.empty() ? null : contextualValues.toSortedMap().values.first()

Is there a kotlin expression that does something similar?

#

I want to avoid checking for emptiness in an if block if this is possible with a oneliner

#

Nvm

#
...firstOrNull()

is a thing

prisma wave
#

Kotlin good

#

Also, if is an expression if you didn't know

lunar cypress
#

why isn't it a sorted map to begin with

empty flint
#

Also, if is an expression if you didn't know
@prisma wave How do you mean?

prisma wave
#
val blah = if (blah) a else b```
#

Instead of ternary

empty flint
#

oh interesting. so it's different from java there

#

cool

#

thanks

#

why isn't it a sorted map to begin with
@lunar cypress Right you are. Kotlin good. Blocky bad

#

Hm what's the best way to create a new empty map like a sorted map?

#

sortedMapOf<...>() ??

#

Or is there something like new SortedMap() ?

#

or SortedMap::new

#

or whatever

ocean quartz
#

You can do something like val map = sortedMapOf(Pair("c", 3), Pair("b", 2), Pair("d", 1))

prisma wave
#

ew manually making Pairs

#

a to b >>>

ocean quartz
#

Copypasted it from the documentation xD

rotund egret
#

Ooh didnt know I could make pairs like that

prisma wave
#

๐Ÿ‘€

empty flint
#

Is there a datastructure that is an order list equivalent where each element occurs only once in the list and every element of another collection or an enum or whatever has to occur in it?

prisma wave
#

that is incredibly specific

#

LinkedHashSet will preserve ordering and doesn't allow duplicates

#

Not sure about the final thing

#

How would it work if the original collection changed?

lunar cypress
#

you're basically describing sets

#

if all elements of a set are contained within another set, you have a super/subset relation

#

you enforce that with checks, not by baking it into some data structure

empty flint
#

I like baking though ๐Ÿ˜ฆ

#

LinkesHashSet will suffice I guess

#

Ty

ocean quartz
hot hull
#

Very bad

empty flint
#

there dpesn't seem to be a linkedHashSetOf(...) function

lunar cypress
#

HashSet(arrayOf(x, y, z))

#

Or listOf

empty flint
#

Oh nvm

#

im dumb

#

Kotlin good.

#

Blocky dumb

hot hull
#

Is there a key in IJ to import everything in a class?

empty flint
#

This is harder than I thought

heady birch
#

Johnny

#
println!("{:06x} {:04x} {:08} {}",
                     track.address,
                     track.squawk.unwrap_or(-1),
                     track.call_sign.as_ref().unwrap_or(&"--".to_string()),
                     track.emergency_status.as_ref().unwrap_or(&EmergencyStatus::None).get_name());
#

Anyway to make squawk, call_sign and emergency status to give empty string

#

when they dont exist

#

Or should I just concatanate as usual

prisma wave
#

there dpesn't seem to be a linkedHashSetOf(...) function
Because that's what mutableSetOf is

#

@empty flint

#

or just setOf afaik

empty flint
#

But a setOf doesn't preserve the order...

#

Or a HashSet rather

prisma wave
#

you sure?

empty flint
#

Positive

prisma wave
#

Last I checked setOf and mutableSetOf used LinkedHashSet

#

Returns a new read-only set with the given elements. Elements of the set are iterated in the order they were specified. The returned set is serializable (JVM).

#

?

empty flint
#

Idk maybe I'm confused by learning a new language rn

#

I might be mistaken but doesn't setOf... return a HashSet?

prisma wave
#

no

#

The function itself returns a Set

#

But I am confident that the implementation is LinkedHashSet

gusty fulcrum
#

is there anyway to revert pvp to like 1.8 style for newer versions? Ive seen some attempts but nothing looks updated/well made

hot hull
#

You can't fully replicate it

#

Since shit just works differently

gusty fulcrum
#

fair enough, know any that have given it a good attempt?

rotund egret
#

Forge can probably do it super well :^)

empty flint
#

Hm how do I format this xD

prisma wave
#

liskov

#

please

#

newContextPriorities.size == ContextType.values().size pretty sure this check is unnecessary

empty flint
#

the hastebin won't save ๐Ÿ˜ฆ

#

gimme a sec, my internet is shite

prisma wave
#

lol

hot hull
#

L

empty flint
#

Nope, won't work

#

newContextPriorities.size == ContextType.values().size pretty sure this check is unnecessary
@prisma wave You're right, because it's a HashSet...

#

So just the setter this time:

set(newContextPriorities: LinkedHashSet<ContextType>) {
                  if(newContextPriorities.containsAll(ContextType.values().asList())) {
                    contextPriorities = newContextPriorities 
                  } else {
                      throw IllegalArgumentException("New context priorities failed to meet criteria. The new set has to contain each context type exactly once.")
                  }
              }
prisma wave
#

well that's just the contract of sets in general

#

that the elements are distinct

empty flint
#

yeah

#

that's what I mean

prisma wave
#

Declaring as LinkedHashSet is kinda ew

empty flint
#

What would you declare it as?

#

Just a set?

prisma wave
#

i guess

#

is the order important?

empty flint
#

Yes

prisma wave
#

is ContextType an enum?

empty flint
#

Yes

prisma wave
#

hmm

empty flint
#

I'm not sure how else to do it

#

I could give the enums some values that indicate the order

#

but then they would be fixed

#

and couldn't be changed anymore

#

So nothing cleaner then? That setter definition is fugly af

prisma wave
#

it's not great

empty flint
#

I mean I guess I could do away with the else, negate the if and put the throw inside and the assignment outside

#
set(newContextPriorities: LinkedHashSet<ContextType>) {
                  if(!newContextPriorities.containsAll(ContextType.values().asList())) {
                    throw IllegalArgumentException("New context priorities failed to meet criteria. The new set has to contain each context type exactly once.")
                  }
                  contextPriorities = newContextPriorities 
              }
prisma wave
#

pretty sure you should use field = newContextPriorities

#

or something

empty flint
#

pretty sure you should use field = newContextPriorities
@prisma wave I am

prisma wave
#

contextPriorities = newContextPriorities ?

empty flint
#

ye

prisma wave
#

that's different

empty flint
#

then I didn't understand what you mean

#

pretty sure you should use field = newContextPriorities
@prisma wave What is that?

prisma wave
#

literally that

#

paste it

empty flint
#

ah right

#

what's the difference tho?

prisma wave
#

not sure that there is one

#

it's just convention

empty flint
#

right

#

ty

empty flint
#

How do you make the primary constructor private?

prisma wave
#

private constructor(blah)

heady birch
#

WAHDWg-n9qedfw

#

Son

errant geyser
#

Its ok guys

#

Just the daily Niall stroke

#

He'll recover shortly

heady birch
#

I ASK 3 times

#

ONE person reply

#

NO open source KITEBOARD

#

NO E-CLIUD

errant geyser
#

I have no idea what you're on about, just gonna let you wear yourself out

prisma wave
#

you are mad

heady birch
#

No im not

#

๐ŸŒ

rotund egret
#

Cheese

heady birch
#

Lmao

#

MOON!

#

Not cheese

#

Please remove my previous messages I have come to my senses

errant geyser
#

Told ya he'd recover shortly

empty flint
#

private constructor(blah)
@prisma wave If I do not specify a constructor?

#

class Context(val id: String, val type: ContextType) : Comparable<Context> {

#

how do I make this constructor private?

prisma wave
#

class Context private constructor(val id: String, val type: ContextType)

empty flint
#

ooooh

#

nice

#

ty

#

looks ugly af

#

but works

prisma wave
#

better than java

empty flint
#

well yes but no

#

not every time

hot hull
#

Yes, every time.

errant geyser
#

Welcome to the circlejerk

lavish notch
#

Am I missing something?

String name = Bukkit.getOfflinePlayer(f.getKey()).getName() || "Unkown";
errant geyser
#

why have you got the or operator there?

lavish notch
#

I'm wanting "Unknown" to be returned if Bukkit.getOfflinePlayer(f.getKey()).getName() is null

prisma wave
#

this isn't JS

#

or kotlin

#

๐Ÿ˜ฆ

lavish notch
#

buuuurrrr

prisma wave
#

you can't do that in java

#

you gotta null check manually

errant geyser
#
val name = Bukkit.getOfflinePlayer(f.key).name ?: "Unknown"``` in kotlin, come over to us Molloy
empty flint
#

You can do

Bukkit.getOfflinePlayer(f.getKey()).getName() != null ? Bukkit.getOfflinePlayer(f.getKey()).getName() : "Unknown"

or save Bukkit.getOfflinePlayer(f.getKey()).getName() in a variable and do the above thing with the variable

prisma wave
#

uh no you can't

empty flint
#

Or switch to Kotlin. I'm slowly starting to believe

lavish notch
#

@prisma wave If you teach me - sure ๐Ÿ˜›

prisma wave
#

ok

#

well

#

depends what you mean by teach

empty flint
#

uh no you can't
@prisma wave Sure you can

lavish notch
#

Teach me the fundamentals, and get my kick started.

prisma wave
#

@empty flint you edited it, that's cheating

#

@lavish notch val a = 3 = final int a = 3;

#

that's all you need to start

#

a lot is similar to Java

#

the kotlin docs are really good

#

any questions ask me and I'll write a paragraph or something

errant geyser
#

Bossman loves his free xp

prisma wave
#

i do

empty flint
#

@empty flint you edited it, that's cheating
@prisma wave It's called delayed compilation

prisma wave
#

about 10k xp away from #5 ๐Ÿ‘€

#

lmao

empty flint
ocean quartz
#

Whenever i see this message I always think it sounds weird to have "return void" lmao

lavish notch
#

What's the most efficient way to create a leaderboard?

#
ConfigurationSection cf = main.getplayerData();
                cf.getValues(false)
                        .entrySet()
                        .stream()
                        .sorted((a1, a2) -> {
                            int points1 = (int) a1.getValue();
                            int points2 = (int) a2.getValue();
                            return points2 - points1;
                        })
                        .limit(3) // Limit the number of 'results'
                        .forEach(f -> {
                            int points = (int) f.getValue();
                            System.out.println(f.getKey() + " " + points);
                            String name = Bukkit.getOfflinePlayer(f.getKey()).getName() != null ? Bukkit.getOfflinePlayer(f.getKey()).getName() : "Unknown";

                            p.sendMessage(name + " " + points);
                        });
#

I have that - but it lags the server

empty flint
#

it won't do much for performance but I'm fairly sure you can prettify the sort lambda to ((a1, a2) -> a1.getValue().compareTo(a2.getValue())) or something of the sorts. It's definitely a one-liner.

In the forEach lambda, try to remove the second bukkit offline player call like so:

.forEach(f -> {
                            int points = (int) f.getValue();
                            System.out.println(f.getKey() + " " + points);
                            String name = Bukkit.getOfflinePlayer(f.getKey()).getName();

                            p.sendMessage((name != null ? name : "Unknown") + " " + points);
                        }
lavish notch
#

I notice bukkit.getOfflinePlayer is deprecated

#

what's the replacement?

empty flint
#

Getting Player or OfflinePlayer by name is deprecated. You're supposed to get them via UUID

#

The thing is you can't really get the UUID if the player is offline ๐Ÿ˜›

#

There is a trick tho

prisma wave
#

another good spigot api design

empty flint
#

let me look for my piece of code

#

where I got around that

errant geyser
#

You could get the UUID from name via a Mojang API call, but thats prolly slower than just getting by name in the first place

hot hull
#

Anyone else have that frustration when a plugin is like .3 over the discord upload limit

lavish notch
#

Nope

prisma wave
#

You could get the UUID from name via a Mojang API call, but thats prolly slower than just getting by name in the first place
that's what getOfflinePlayer does behind the scenes iirc

#

just with caching

lavish notch
#

nitro crab_rave

empty flint
#

You could get the UUID from name via a Mojang API call, but thats prolly slower than just getting by name in the first place
@errant geyser I think that's exactly what I was doing

#

Anyone else have that frustration when a plugin is like .3 over the discord upload limit
@hot hull Why would you upload a plugin to Discord?

errant geyser
#

to send it to whichever kiddo wants it

hot hull
#

Why would you upload it to GH or some shit when it's gonna be used by a single person?

empty flint
#

Hm should I go with the == nullcheck or with ===?

#

if(worldUuid != null && network == null && rank == null) or if(worldUuid !== null && network === null && rank === null) ?

hot hull
#

==

lavish notch
#

@empty flint so can I fetch a username faster with getOfflinePlayers with a uuid?

#

or does it not return UUIDs?

hot hull
#

it returns OfflinePlayer's

#

An array iirc

lavish notch
#
OfflinePlayer[] players = Bukkit.getOfflinePlayers();
                p.sendMessage(String.valueOf(players));
hot hull
#

String.join(", ", players)

lavish notch
#

wat

empty flint
hot hull
#

replace String.valueOf(players) with that

lavish notch
#

Cannot resolve method 'join(java.lang.String, org.bukkit.OfflinePlayer[])'

hot hull
#

String.join

#

bRuH

lavish notch
#

p.sendMessage(String.join(", ", players));

#

That is what I have bish

hot hull
#

What string are you importing?

lavish notch
#

OfflinePlayer[] players = Bukkit.getOfflinePlayers();

hot hull
#

Some wack thing

empty flint
#

You can also do players.stream().collect(Collectors.joining(", "))

hot hull
#

ew streams

empty flint
#

ew streams
@hot hull fuck yeah streams

#

I love them

#

I mean

#

Kotlin good

lavish notch
#

So what exactly does getOfflinePlayers return?

hot hull
#
final List<OfflinePlayer> playerList = Arrays.asList(Bukkit.getServer().getOfflinePlayers());

String result;
for (int i = 0; i < playerList.length; i++) {
  if (i == playerList.length -1) {
    result = result + player.getName() + ".";
    continue;
  }
  result = result + player.getName() + ", ";
}
#

boom

#

It returns an array Mackenzie

empty flint
#
final List<OfflinePlayer> playerList = Arrays.asList(Bukkit.getServer().getOfflinePlayers());

String result;
for (int i = 0; i < playerList.length; i++) {
  if (i == playerList.length -1) {
    result = result + player.getName() + ".";
    continue;
  }
  result = result + player.getName() + ", ";
}

@hot hull I just vomited a little in my mouth

hot hull
#

That was the point

lavish notch
#

There isn't a more simpler and, less taxing way?

hot hull
#

Not really taxing

lavish notch
#

fucking hell

hot hull
#

It's not gonna affect performance at all

lavish notch
#

there is thunder in the uk

#

like loud ass shit

surreal quarry
#

to make it simpler just make it a method and never look at it again

hot hull
#

Or use kotlin, <insert code here @prisma wave>

prisma wave
#

kotlin?!?!!?

surreal quarry
#

kotlin good fingerguns

prisma wave
#

YES!

#

@lavish notch if you don't wanna use Kotlin use StringJoiner

empty flint
versed ridge
#

1.8 is very fun to develop on

prisma wave
#

is that sarcastic

versed ridge
#

nahhh, not at all

empty flint
#

1.8 is very fun to develop on
@versed ridge Why would you even...?

versed ridge
#

making a plugin for someone that's on 1.8

prisma wave
#

implement fuck-1.8 :)

versed ridge
#

ah yes, good idea

hot hull
#

Not gonna lie, it's almost impossible finding a commission which isn't 1.8 these days

prisma wave
#

very sad

frail glade
#

Just need to know where to look.

hot hull
#

Nah Glare, for you it might be easy since people throw them at you, and wouldn't consider having it public otherwise

empty flint
#

Ah you're doing commissions. Got it. I was just about to say I would not develop on 1.8 for free ๐Ÿ˜„

hot hull
#

Not like I'm complaining, I've had constant commissions for the past 2-3 months so fingerguns

frail glade
#

Wouldn't consider having it public otherwise
Wdym?

hot hull
#

ie. request-paid, most are 1.8 ones, I've had some people dm me asking for a non 1.8 commission, which they didn't consider putting in there, as an example

frail glade
#

Ohhh, I get what you mean.

hot hull
#

You famous fingerguns

frail glade
#

I often do try to pass on commissions to other people that I don't have time for. If I know someone is looking, I will consider them to pass it on to.

distant sun
#

js

hot hull
#

disgusting

#

no need to filter btw Gaby, it'll never be null

steel heart
#

^

empty flint
steel heart
#

or well frosty it can

distant sun
#

๐Ÿ˜‰

hot hull
#

it can, but it will never be

#

Unless you're doing some jank shit and modifying it yourself

distant sun
#

Avoid NPE, don't cause them.

prisma wave
#
Bukkit.getOfflinePlayers()
  .filterNotNull()
  .map { it.name }
  .joinToString()
``` ๐Ÿ™‚
steel heart
#

Well pretty sure getOfflinePlayers wouldn't give you any OfflinePlayer with a nullable name

distant sun
#

still better than what you had initially ๐Ÿ‘€

steel heart
#

streams is meh

empty flint
#

Yall wanna see some ugly ass piece of code?

steel heart
#

sure

distant sun
#

๐Ÿคท

steel heart
#

whats that

hot hull
#

Frcsty

distant sun
#

more than half of the code is wrong

#

at least it works ๐Ÿคฃ

prisma wave
#

:)

distant sun
#

how do people use abstract classes for their plugin api?

prisma wave
#

is that a rhetorical question?

distant sun
#

no

steel heart
#

how do u use api gaby ๐Ÿ˜ฎ

prisma wave
#

uh

empty flint
#
if(rank != null) {
  if(network != null) {
    if(worldUuid != null) {
      return ContextType.RANK_IN_NETWORK_ON_WORLD
    }
    return ContextType.RANK_IN_NETWORK
  }
  return ContextType.RANK
} else if(network != null) {
  if(worldUuid != null) {    
    return ContextType.NETWORK_ON_WORLD
  }
  return ContextType.NETWORK
}
return ContextType.GLOBAL
prisma wave
#

you make an abstract class?

#

it does something

distant sun
#

smh

steel heart
#

implicit else

#

blocky

distant sun
#

I remember seeing this api who had no return of any methods but they worked

#

abstract / interface class

empty flint
#

What is an implicit else?

#

my internet takes 3 minutes for a google search

prisma wave
#

you return upon preconditions

compact perchBOT
prisma wave
#

rather than writing else manually

#
if (!blah) {
  return;
}
//blah is true
steel heart
#

most times its by negating your condition

#

@distant sun well

empty flint
#

umm this is flattened already

steel heart
#

its good to think that you should make your api based on interfaces

#

and well interfaces is mostly aimed to determine behaviour

hot hull
#

Imagine using else, ew

steel heart
#

well I've seen worse

empty flint
#

I mean, in this case I can't avoid it I don't think

#

there is one else in there

#

everything else is a guard clause

distant sun
#

@steel heart ok but I still dont know how it works xd

empty flint
#

I would love if there was some sort of switch or when for conditions with multiple conditionals and their combinations

#

Like write down all the permutations and just list all the results

distant sun
#

do you do something like public interface API, public class APIImplementation implement API and API api = new APIImplementation();?

empty flint
#

fuck off with that if if if else else else shit already

steel heart
#

yeah

#

blocky lol

#

yeah ignore that then ig

distant sun
#

I assume this way you can have a public api for premium plugins?

#

by providing only the interfaces

empty flint
#

yeah ignore that then ig
@steel heart It's necessary sometimes...

#

actually

#

I have an idea

steel heart
#

I mean a generally case is to not expose anything in the api itself as it should only define behaviour. Gaby but I mean you don't always have to follow it just like I don't follow solid.

#

I mean there's a lot of explanation out there but its most likely because for instance the end user who uses the api shouldn't really know how things are done and they don't really have to care anyways. They only need to make things for themselves. Trying to modify it such as implementing it could break the behaviour.

distant sun
#

I assume I can make them package private

steel heart
#

which one?

distant sun
#

Trying to modify it such as implementing it could break the behaviour.
Like the API interface

#

or it doesn't work for implement but only for creating an instance?

steel heart
#

I mean implement or extend it generally. Because your application that implements them should handle that part and for instance if the end user would extend the interface Shoe, that wouldn't necessarily break anything although it can cause weird behaviour.

#

There's also a lot of apis which has some implementing classes that might be handling security and algorithms which the end user most likely shouldn't be able to access.

empty flint
#
fun main() {
    val a = 42
    val b = 69
    val c = 420
    
    val permutations = conditionPermutations((a < b), (b > c), (c == a))
    
    when(permutations) {
        "TFT" -> println("a is smaller than b, b is smaller than c and c is equal to a")
        "TTF" -> println("a is smaller than b, b is larger than c and c is not equal to a")
        "TFF" -> println("a is smaller than b, b is smaller than c and c is not equal to a")
        "else" -> println("leave me alone!")
    }
}

fun conditionPermutations(vararg conditions: Boolean): String {
    var ret = StringBuilder()
    for(condition in conditions) {
        ret.append(if(condition) "T" else "F")
    }
    return ret.toString()
}

I made a thing...

#

rofl

steel heart
#

lol

main cargo
#

what the

empty flint
#

condition permutations

#

I'm gonna use it...

#

I just wish there was a cleaner way to indicate the result of the condition instead of as a string with T and F. Maybe numbers with 1 and 0 but that's not clear enough

#

Kotlin is fun dude

#

I wish I knew about it sooner

steel heart
#

idk if Predicate<T> is useful

#

like in kotlin

#

@prisma wave

#

/summon kotlinpro

empty flint
#

idk if Predicate<T> is useful
@steel heart in this case? I don't think it makes sense in this case

#

is that a class?

#

there is a BitSet in Kotlin tho

prisma wave
#

@steel heart it's not

empty flint
#

its a thing u do with raw bytes
@silk jewel Oh no I know what a bitmask usually is, I just thought you meant more by it

#

Idk how to compare a BitSet in the when body though

#

What do I compare it to?

prisma wave
#

@empty flint any reason you can't just use a boolean?

empty flint
#

@empty flint any reason you can't just use a boolean?
@prisma wave Yes. There's 3 of them.

#

So one would be 2 too little

prisma wave
#

so 3 potential states?

empty flint
#

and all their permutations, yes

prisma wave
#

oh and you want that expressed in a single class

steel heart
#

HexaPredicate

empty flint
#

that's 2^3 potential states.

prisma wave
#

yeah bitmasking probably

#

or return a List<Boolean> and destructure it

empty flint
#

I just want

if(rank != null) {
  if(network != null) {
    if(worldUuid != null) {
      return ContextType.RANK_IN_NETWORK_ON_WORLD
    }
    return ContextType.RANK_IN_NETWORK
  }
  return ContextType.RANK
} else if(network != null) {
  if(worldUuid != null) {    
    return ContextType.NETWORK_ON_WORLD
  }
  return ContextType.NETWORK
}
return ContextType.GLOBAL

@empty flint this to be not so fugly to look at and maintain

#

I have basically 3 variables that can be null or not

#

and depending on their combination I want different things to happen

prisma wave
#

also kotlin fun conditionPermutations(vararg conditions: Boolean): String { return conditions.joinToString(separator = "") { if(it) "T" else "F" } }

#

use when perhaps?

empty flint
#

also kotlin fun conditionPermutations(vararg conditions: Boolean): String { return conditions.joinToString(separator = "") { if(it) "T" else "F" } }
@prisma wave I'd kiss you on the cheek rn if the 'Rona wasn't around

prisma wave
#

<3

empty flint
#

That is beautiful

#

I love Kotlin

#

use when perhaps?
@prisma wave Can you use a when with mutliple variables?!

prisma wave
#

declarative programming > imperative programming

#

when doesn't need a variable

#
when {
  conditionA && conditionB -> blah
}```
empty flint
#

declarative programming > imperative programming
@prisma wave I wouldn't know the difference or their signatures but sure, whatever you say chief

prisma wave
#

might be better

empty flint
#
when {
  conditionA && conditionB -> blah
}```

@prisma wave Oooooooooooh

#

That changes EVERYTHING!

onyx loom
#

๐Ÿ“

prisma wave
#

@prisma wave I wouldn't know the difference or their signatures but sure, whatever you say chief
@empty flint declarative is telling the computer what to do (eg listOf(1, 2, 3).map { it + 1 }.sum()), imperative is telling the program how to do it (eg a for loop creating a new list manually

empty flint
#

when doesn't need a variable
@prisma wave Hm does when hit on the first condition that is met?

onyx loom
#

yes

prisma wave
#
val list = listOf(1, 2, 3)
val other = ArrayList()
for (element in list) {
  other.add(element + 1)
}
var sum = 0
for (element in other) {
  sum += element
}
return sum
#

this would be declarative

#

and yes

#

the first condition, then it stops

onyx loom
#

when good

prisma wave
#

if bad

#

wait no

#

switch bad

onyx loom
#

why is it even called switch case ๐Ÿคฃ

empty flint
#

@prisma wave Is there a shorthand notation for == null and != null?

when {
                rank != null && network != null && worldUuid != null -> return ContextType.RANK_IN_NETWORK_ON_WORLD
                rank != null && network != null && worldUuid == null -> return ContextType.RANK_IN_NETWORK
                rank != null && network == null && worldUuid == null -> return ContextType.RANK_IN_NETWORK  
            }
prisma wave
#

not really

#

nothing that would work in this case anyway

empty flint
#

crap

#

Well, still prettier than those ifs

#

thank you!

prisma wave
#

np

steel heart
#

Wth when in kotlin is actually cool

prisma wave
#

you thought it wasn't?

steel heart
#

Oh well didnโ€™t really know

prisma wave
#

Wth everything in kotlin is actually cool
Fixed it

#

Fair enough lol

steel heart
#

Lmao

#

Wait does it allow -> ?

#

Idk if youโ€™d call it a lambda in that scenario but iirc java 14 or smtng has that right?

prisma wave
#

Um*

#

oh

#

Yeah I think so

#

With switch

#

yeah Java 14 switch is pretty much she.

#

when*

#

Mobile bad

steel heart
#

The actual cool thing with kotlin is that we can have java 14 features in java 8 with kotlin

prisma wave
#

well

steel heart
#

Or I mean kotlin is cool not only because of that