#development

1 messages · Page 60 of 1

dusky harness
#

so in general I just resulted in confusion

#

which led to my not-very-useful replies

icy shadow
#

🙃

dusky harness
#

there's the actual correct answer

light pendant
#

yikes that looks nasty

dusky harness
#

ya
it should be default imo

#

since it's using maven publication

river solstice
#

tf is this

icy shadow
#

update gradle

river solstice
#

bruv

#

that aint enuf?

icy shadow
#

huh

#

should be

#

idk then lol

dusky harness
#

try 8.3 gradle ig

river solstice
#

added a dependency

#

that uses records

dusky harness
#

oh

#

hm

#

do u have like some asm plugin?

river solstice
#

I do not believe so

dusky harness
#

can u show ur build script(s)

#

¯_(ツ)_/¯

#

or even better

#

a github :))

river solstice
#

private repo

dusky harness
#

ah ok

#

can u show build script(s)?

#

star to the rescue

icy shadow
#

ha

#

small world

dusky harness
#

pr was merged tho

#

make sure ur shadow plugin is up to date

icy shadow
#

make sure ur on latest version of the dependency too

river solstice
dusky harness
#

whats ur shadow plugin version

river solstice
#

bich old af

#

7.0.0

#

time to hop on 8.0.0 train

#

well

#

what do you know

#

it works

dusky harness
#

renovatebot ftw

light pendant
dusky harness
#

aka the compile scope ones

#

i think those are the transitive ones?

#

idk

#

but

#

it handles the compile scope ones

#

and i think the implementation() one too

river solstice
light pendant
# dusky harness gradle handles transitive dependencies

the problem is that I need a working pom.xml though for maven users. I also noticed that gradle doesn't include the repositories I use into the generated pom. That means that e.g. when I use PlaceholderAPI as implementation dependency (which results in a runtime dependency in the generated pom), that maven then complains it can't find PlaceholderAPI when using my project as dependency, because the extendedclip repository isn't declared in the pom

dusky harness
#

but I feel like that might be a different issue

#

kinda like the typo issue from before 🥲 🥲
might be some other unrelated issue because I've never had this issue

jovial kettle
#

Quick question. I am trying to add unicodes and hex support to my plugin. I found this methode to replace the unicodes and the hex:

public static String colorize(String message) {
        Pattern unicode = Pattern.compile("\\\\u\\+[a-fA-F0-9]{4}");
        Matcher match = unicode.matcher(message);
        while (match.find()) {
            String code = message.substring(match.start(), match.end());
            message = message.replace(code, Character.toString((char) Integer.parseInt(code.replace("\\u+",""),16)));
            match = unicode.matcher(message);
        }
        Pattern pattern = Pattern.compile("&#[a-fA-F0-9]{6}");
        match = pattern.matcher(message);
        while (match.find()) {
            String color = message.substring(match.start(), match.end());
            message = message.replace(color, ChatColor.of(color.replace("&", "")) + "");
            match = pattern.matcher(message);
        }
        return ChatColor.translateAlternateColorCodes('&',message);
    }

If I try to use this with this string &f\u+4E86&r&#FB2407, I get this output §f了§r§x§F§B§2§4§0§7

So the unicode works but the hex dissapears and the color is gray (from the §7)

Can anyone help me and explain what my problem is?

atomic trail
#

When using TriumphGui I have a kit selection gui, where the lore of the items, depend on if the player has access to the kit. Should every player have their own gui or can I have one global that gets updated whenever it's opened? What would you guys recommend? Hope it makes sense

pulsar ferry
#

Every player have their own gui

atomic trail
#

Alright, thanks, btw great api

#

It's really nice

atomic trail
dusky harness
#

the way you're doing it should be fine tho

pulsar ferry
#

That is fine

dusky harness
#

and the update() isn't needed since you haven't shown it to a player yet

atomic trail
#

Ah alright, so basically only update when a gui item has been changed after creation?

#

Also does gui.disableItemTake(); prevent people taking items out of the gui or how does it work? Like event.setCancelled(true) on left click for example

#

And would that mean disableAllInteractions() also makes handling the interact event impossible? To change what happens when the player clicks an item in the gui

#

Sorry for all the questions lol

lyric gyro
#

Has anybody here used the velocity fork of ACF? I can't seem to able to import it into my project

#

Oh for gods sake I've gone and commented out the repository

#

ignore me

rare sorrel
#

what would i set as the ip and database? these are the default values for the plugin config btw

ip: 127.0.0.1:3306
username: username
password: password
database: mc```
tight junco
#

why does block changing have to be on main thread :(

tight junco
minor summit
#

"why", complicated answer, read read the jls and jvms koriHug

tight junco
#

i want little lag mines plugin without having to rely on fawe

pulsar ferry
#

Do unsafe operations, ignore the rules, go wild koriLaugh

tight junco
#

be gay do crime

minor summit
#

"do like fawe and synchronize on random objects" - @sterile hinge probably

#

but yeah the game doesn't expect shit to be modified from an async context and it'll totally shit the bed if the wrong thing happens

tight junco
#

fair

#

i just hate relying on 3rd party plugins for stuff

minor summit
#

I generally tend to split block modifications across ticks in the 16x16x16 sections

#

but also the bukkit API is slow as fuck by itself for world operations

#

I do not hold back when I need to use worldedit lol

tight junco
#

im mentally not there enough to even attempt to comprehend how that's done

#

so i think

#

im gonna have a branch for it

#

rotting away on the project and touch it in approximetly a month, 3 weeks and 2 days

minor summit
#

lol

tight junco
minor summit
#

the issue is of skill

tight junco
#

always

dusky harness
leaden sinew
dusky harness
#

or only enable it on the edge of the region since there isn't any reason to have physics updates inside

leaden sinew
#

It’s from over 2 years ago lol

dusky harness
#

it makes a huge difference

#

tru

leaden sinew
#

Also I’m pretty sure it doesn’t do physics updates

dusky harness
#

oh ok

leaden sinew
dusky harness
#

🥲
such a great contributor

dense drift
light pendant
light pendant
#

Does anyone know how I can add javadoc links to my javadoc task? Online I've seen stuff like this

javadoc {
    options {
        links 'https://docs.oracle.com/javase/8/docs/api/'
    }
}

but I'm using kotlin and there is no "links" option there

sterile hinge
#

it's probably links.add() or links.get().add() or something like that

light pendant
#

the issue is that options is a MinimalJavadocOptions and not StandardJavadocDocletOptions - if I cast it, I can add the links just fine

tasks.javadoc {
    if (options is StandardJavadocDocletOptions) {
        (options as StandardJavadocDocletOptions).links("https://hub.spigotmc.org/javadocs/bukkit/")
    }
}

but this doesn't seem to be the correct solution

sterile hinge
#

I'd guess that's the correct solution

light pendant
#

hmmm so they cast it too

#

alright, thanks

#

there should be a buildtool that combines the advantages of gradle and maven lol

#

gradle is such a pain for some easy things

sterile hinge
#

ant trollface

light pendant
#

🥲

#

coding challenge: Everyone codes a <something> plugin, but gradle users have to use maven, maven users have to use gradle, and people who like both gradle/maven have to use ant

icy shadow
#

trivial for a guy like me

light pendant
#

then you have to write a python program that generates makefiles for javac

#

and the python program has to be a quine

icy shadow
#

Doing it with python sounds harder than just writing the makefile by hand lmao

light pendant
#

yeah the idea is to make everyone uncomfortable lol

icy shadow
#

python is defo uncomfortable

light pendant
#

btw does anyone know a fix for the "double" type annotations using jetbrains:annotations?

This doesn't happen using annotations-java5 but I want to be able to also annotate type params

minor summit
#

that's a "bug" with type_use annotations

light pendant
#

I know, but spigot somehow fixed it

#

or did choco lie to me and they did switch back to java5 annotations

#

how can this still not be fixed after like 5 years D:

minor summit
#

man tf is "8-pool" java

light pendant
#

related issue is open for 6.5 years now 🥲

#

I don't want to decide between having proper type annotations, and having readable javadocs, this sucks

sterile hinge
#

let a tool create a copy of your source code and strip the annotations, then run javadoc on that

minor summit
light pendant
minor summit
#

or create a custom doclet plugin trollface

light pendant
#

very funny lol

sterile hinge
light pendant
#

then it won't properly work in IJ etc

#

yeah anyway, that's not very important. I got almost everything working now for my basic setup, except "aggregating" javadocs. Let me explain quickly, one sec pls

#

I have this project ( https://github.com/mfnalex/cesspool ) that consists of (currently 2) subprojects.

My goal is to provide one dependency per subproject, so they can be used individually, but also one "all-in-one" dependency that includes all submodules.
I got this working fine by simply applying shadow on the parent build.gradke.kts.

Now the issue is that the javadocs are only created "per module", but I'd ofc also like to have one "aggregated javadocs" - basically like I got a shadow .jar for the parent project, I'd like to also have a "shadow javadoc". Does anyone know how this is possible?

#

in maven there's the aggregate-javadoc plugin for that

minor summit
#

generally you don't publish fat jars for libraries (or if you do, what you're shading isn't exposed as API)

light pendant
#

I don't actually need a fat .jar, I only need a proper pom for the "fat version"

#

however what I do need is a fat/aggragated javadoc thingy

#

maybe I'll explain again what my goal is - I want to rewrite my JeffLib library, which is a huge mess. You can find it here https://github.com/mfnalex/JeffLib

It consists of thousands of things which I'd like to refactor into smaller modules, e.g. yaml-commands, papi-replacer, etc etc etc

However I don't want people to have to add 17 dependencies to their pom, that's why I thought I'll just make my parent build.gradle.kts depend on all the submodules, so the resulting pom has them all as <scope>compile</scope> - this should work fine.

The only issue I'm left with is that I'd end up with 17 different javadoc htmls, which would be very annoying for people to look at ain a browser, hence I'd like to get a combined version

#

but what's the problem with combining all the modules into a "fat library"?

#

I mean - why not?

#

the idea is that someone who only wants to use one module only adds that one module, while a plugin that uses like 10 modules can intead just add the "complete version" (and let minimizeJar / shadow's minimize() get rid of the unused things)

minor summit
#

the user should be the one to decide how to consume the library(ies) rather than imposing the solution on them, you could just as easily have an "mything-all" artifact with no content that depends on all the other modules instead so they're exposed in the pom, that is for example what Netty does
as for your main problem, maybe this? https://stackoverflow.com/a/47480432 note the source/classpath config in the "alljavadoc" task (then pack into a jar), I never fiddled with javadoc really other than for crossdoc iirc

tidal mauve
#

Hello for Holographics displays, hum did someone know why I have this:
Cannot resolve method 'createHologram(NeptaliaCore, Location)'

    public CombatListener(NeptaliaCore plugin) {
        this.plugin = plugin;
    }


HolographicDisplaysAPI api = HolographicDisplaysAPI.get(plugin);
Hologram hologram = api.createHologram(plugin, kills);

in my main class I put this

    public void onEnable() {
        useHolographicDisplays = Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays");

    private void initializeListeners() {
        getServer().getPluginManager().registerEvents(new PlayerManager(), this);
        getServer().getPluginManager().registerEvents(new CombatListener(this), this);
light pendant
#

I assume instead of task alljavadoc(type: Javadoc) { I'd so sth like tasks.create<Javadoc>("alljavadoc") { right?

minor summit
#

I think so yeah

#

er, register instead of create, idk if create adds it to the task list or rather simply creates it

light pendant
light pendant
#

I also still cannot figure out how I can add something with <scope>provided to the generated pom D:

If I add jetbrains annotations with compileOnly, it doesn't show up in the pom at all, which leads to users of my dependency not being to resolve them

#

if I add it as compileOnlyApi, it ends up as <scope>compile which means end-users would end up shading jetbrains annotations

#

closest I can get is using implementation, then it ends up as <scope>runtime

light pendant
tidal mauve
#
public final class NeptaliaCore extends JavaPlugin {
tidal mauve
#

Yup It's works fine know thanks

light pendant
#

Their docs claim you also need to pass the plugin into createHologram

dense drift
#

It is probably outdated

tidal mauve
#

It is

light pendant
#

ok everyone, just for the record. I again tried to aggregate my javadocs when github copilot randomly came up with a working solution lmao

light pendant
#

since I'm new to gradle: is it true that build files easily break on every new gradle version? or do only build files break that already used deprecated features for years?

dusky harness
#

I'd just stick to latest

light pendant
#

ok, that's good to know lol. thanks

#

yeah I'm currently on 8.3 so I guess I should be fine for at least a year or so

dusky harness
#

well when something deprecates, there's prob gonna be an alternative

#

ex compile got removed a while ago in favor of implementation

light pendant
#

let's imagine I have a buildSrc script, e.g. java-conventions, and another buildSrc script that uses java-conventions as plugin, let's call it "spigot-module".

Now if a subproject declares both "java-conventions" and "spigot-module" as plugins, will the java-conventions script be called twice, or only once?

dusky harness
#

I haven't used buildSrc stuff before tho so idk

young lance
#

Hi, how are you? Where can i see detailed documentations about the placeholder expansion objects? Where mainly can read about configurable, chacheable, etc. All those objects related to help while coding custom expansions

light pendant
#

most, if not all, expansions found in the ecloud have a "source code link", although granted some of them are pretty badly coded, if that's what you mean?

#

is that you, VERANO?!

formal crane
#

So i am trying to calculate the tps of the server like this, the problem is that it logs weird and not in a 20.00 displayed way, here is where i got the original code: https://bukkit.org/threads/get-server-tps.143410/

This is my code now:

private String getTPS() {
        int ticks = 100;
        if (TICK_COUNT < ticks) {
            return "20.00";
        }

        int target = (TICK_COUNT - 1 - ticks) % TICKS.length;
        long elapsed = System.currentTimeMillis() - TICKS[target];

        double tps = (ticks * 1000.0) / (elapsed * 0.001);


        return String.format("%.2f", tps);
    }

                ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

                Runnable tpsCalculator = new Runnable() {
                    @Override
                    public void run() {
                        TICKS[(TICK_COUNT% TICKS.length)] = System.currentTimeMillis();
                        TICK_COUNT+= 1;
                    }
                };
executor.scheduleAtFixedRate(tpsCalculator, 0, 1L, TimeUnit.MILLISECONDS);
int TICK_COUNT = 0;
long[] TICKS = new long[600];
formal crane
#

lmao

#
990099.01
990099.01
990099.01
990099.01
990099.01
990099.01
1000000.00
990099.01``` here are some logs
dusky harness
#

¯_(ツ)_/¯

formal crane
#

you mean this part right? int ticks = 20;

#
1000000.00
952380.95
952380.95
1000000.00
1000000.00
1000000.00``` so i changed that and now its this
dusky harness
#

lol ok nvm

#

but theres no reference to like "20" in there

#

wait

#

why are you using a java executorservice

#

that's gonna run every millisecond

#

or 1000 times per second

#

try just doing a ctrl c ctrl v from the bukkit post

#

and modifying/testing from there

formal crane
#

you mean using a bukkit runnable?

dusky harness
dusky harness
formal crane
#

So now i changed it to this:

Bukkit.getScheduler().scheduleSyncRepeatingTask(Taakstraf.getInstance(), new Runnable() {
                    @Override
                    public void run() {
                        TICKS[(TICK_COUNT% TICKS.length)] = System.currentTimeMillis();
                        TICK_COUNT+= 1;
                    }
                }, 100, 1L);
private double getTPS(int ticks) {
        if (TICK_COUNT< ticks) {
            return 20.0D;
        }
        int target = (TICK_COUNT- 1 - ticks) % TICKS.length;
        long elapsed = System.currentTimeMillis() - TICKS[target];

        return ticks / (elapsed / 1000.0D);
    }
#

oh seems to be working when i exactly copied it:

atomic trail
#

Will this change the item inside the gui? Or do I need to call gui.update() before it updates? It just says for all inventory views, but I just need it to be updated next time inventory is opened. Using TriumphGui

        for (GuiItem iconGuiItem : selectionGui.getGuiItems().values()) {
            ItemStack icon = iconGuiItem.getItemStack();
            
            // Code that changes the icon (lore etc.)

            iconGuiItem.setItemStack(icon);
        }
tight junco
#

you'll prorbably need to update gui

dusky harness
#

theres also updateItem

#

if that doesn't work

marble heart
tight junco
#

who

marble heart
#

deez

atomic trail
#

Anyone know how to change the args in /help for acf?

sharp hemlock
#

i have something really really weird. String#startsWith is not working properly on the server, but it is working just fine on my computer. As you can see this returns false for the id "b:3:1"

#

but when testing it locally on just a basic project on my computer, intellij says it returns true and indeed it does!

dusky harness
dusky harness
#

so you can't say that it's the same

sharp hemlock
dusky harness
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

sharp hemlock
#

(its auto tab complete)

dusky harness
#

can u show the code

sharp hemlock
#

but then when i print id

dusky harness
sharp hemlock
#

?

#

not using a library

dusky harness
#

oh wait

#

nvm

#

I'm just used to seeing onCommand

sharp hemlock
#

ahh oh

#

yeah thats my own command library

dusky harness
#

do you do some interesting color stuff in ur command library 🥲

sharp hemlock
#

no

dusky harness
#

whats the box?

sharp hemlock
#

i have no god damn idea

#

i've been using my library for years

#

it literally just grabs the args from plain bukkit and puts it in the object, dont touch anything

dusky harness
#

I thought it'd just be the color code symbol thing

sharp hemlock
#

well its grabbing all the business' names, from tab complete

#

so i'll check the business database and see

#

huh, its the same in the database

#

3:1

#

okay, there is a plugin on the server that is modifying the arguments on the command. just not quite sure what

dusky harness
#

like if its not between 33 and 126 ignore

#

(google ascii chart for reference)

sharp hemlock
#

yeah if i do like /broadcast b:3:1

#

it prints out weird shit

#

its def a plugin

#

oh

#

its itemsadder....???

#

font images on itemsadder

#

is this the one

#

aye it works

minor summit
#

xd

lusty pawn
#

can u tell me why it doesnt work with ,,extends JavaPlugin'' but when i delete it everything is ok

neat pierBOT
#
📋 Your paste: anetgus11
https://paste.helpch.at/aqaqunuhih

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

light pendant
#

does kotlin have any equivalent of java's records?

hushed badge
#

i believe u can use data class and annotate with @JvmRecord to make it fully equivalent

light pendant
#

hmmm ok well so I wanna use kotlin for a tiny fun project to get used to it. I thought about a chess engine. I'm thinking of e.g. a class to describe a "location" on the field, it'll basically only have an x and z coordinate

#

in java I'd use a record for that

public record Position(int x, int z) { }
#

from what I figured, this would roughly be quivalent to using the following in kotlin:

hushed badge
#

yeah it would pretty much be the same in kotlin

light pendant
#
@DataClass
data calss Positio(val x: Int, val z: Int)

right?

#

well except for the typo ofc lol

hushed badge
#

not that annotation

light pendant
#

eeerrmmm

#

yeah

hushed badge
#

u wont even need an annotation tbh

light pendant
#

my bad, I meant to use JvmRecord

#

not @DataClass but @JvmRecord

#

shit

#

sorry for ping bro

pulsar ferry
#

You don't need the annotation either

hushed badge
#

data class Positio(val x: Int, val z: Int)
would also be perfectly acceptable

pulsar ferry
#

There is no point in making it a jvm record for that

hushed badge
#

yeah

light pendant
#

what is the purpose of that annotation?

#

I have googled and it told me "Instructs compiler to mark the class as a record and generate relevant toString/equals/hashCode methods"

#

that's exactly what I want?

hushed badge
#

it would just make it exactly the same as a java record
But a data class on its own will automatically generate the toString/equals methods for u already

#

just slight differences when using the annotations thats all, but no need to overcomplicate it

light pendant
#

I want my class to have 2 fields, int x and z coordinates, should be final ofc, and provide getters()

#

and yes, it should automatically create equals and hashcode

hushed badge
#

a data class will already do that for u

light pendant
#

same x,z = same "Position" object

light pendant
#

I have to add: I know absolutely nothing about kotlin, I have (so far) only used it for gradle build files

hushed badge
#

ah

light pendant
#

I thought coding a simple chess engine would be a nice way to learn kotlin, because I'd 100% know how I'd do it in java

minor summit
#

usually the @JvmSomething annotations are for extra java compat, e.g. it'll make it extend java.lang.Record and such

pulsar ferry
#

You'd only use jvm record if you need Java interop

light pendant
#

yeah that's what I figured too, howeeeever

#

why is a data class not a record by default?

minor summit
#

or for companion objects you can annotate functions and properties with @JvmStatic and they will be ACC_STATIC rather than an instance field/method in the companion object's class which is a singleton

#

well data classes in kt have existed for many more years than java records

royal hedge
minor summit
#

and they also compile down to like jvm 6 or whatever

light pendant
pulsar ferry
light pendant
#

Oh yeah sorry

royal hedge
#

the compiler would error

light pendant
#

I just came back from a birthday and I'm a little bit drunk, my bad. I meant JvmRecord when I said JvmStatic

minor summit
#

you don't need an excuse for being drunk, you're german

light pendant
#

So imagine I wanna have a class that represents the position on the chess field. In java I'd have 2 options:

  1. A normal class with final int x, final int z fields
  2. A record, ofc also with int x and int z fields

Which wuold be the best kotlin equivalent for this?

minor summit
#

well ackshually technically in java, a record doesn't ahve fields but record components

light pendant
#

oh and that class would have a method like getColor() for each field, which would return like an enum WHITE or BLACK for each field

pulsar ferry
#

A data class

light pendant
#

aight, let's try

light pendant
pulsar ferry
light pendant
#
data class Position(val horizontal: Int, val vertical: Int) { }

class TestPosition {

    fun testEquals() {
        val first_1_2 = Position(1, 2)
        val second_1_2 = Position(1, 2)
        val first_2_1 = Position(2, 1)
        assert(first_1_2 == second_1_2)
        assert(first_1_2 != first_2_1)
    }

}```
this runs fine, so I guess that's what I was looking for
minor summit
#

Both are great for reducing the code bloat.
bleh, that is not something exclusive of data classes in kotlin, but that is also not the reason why records exist in java either to begin with

pulsar ferry
#

I mean that's why it says both, both of them are good for that

light pendant
#

what's your people opinions's a bout lombok? I don't wanna start a war but I'd love to have a normal discussion about pros/cons of using lombok

dusky harness
#

WOO KT

#

welcome to kotlin

dusky harness
light pendant
#

imho, lombok's Data, Getter and Setter are both great and cursed:

  1. big plus: It allows me use pseudo-records in java versions that don't support them yet
  2. It's shit. I cannot even write javadocs for the generated methods, and I got no control about how exactly equals(), hashCode() and toString() are implemeneted
dusky harness
#

Theres Alt insert

#

In intellij

#

Apparently it also makes intellij show a red banner when viewing the source since it won't match byte code but idk if that was fixed yet

light pendant
#

to auto generate those methods? Sure, that exists, But what if I now add a third field (e.g. in my chess example, isWhiteField or isBlackField or FieldType (enum) which is either WHITE or BLACK

dusky harness
#

In Lombok?

light pendant
#

in lombok, that wouldn't be an issue

#

without lombok, I'd have to tell IJ again to create an equals/hashcode/toString method

dusky harness
#

Why would u have is Whitefield tho

light pendant
#

yeah that was just a bad example. every "Position" would have a "getColor()" method thatÄd return "Black" or "White"

dusky harness
#

Also

light pendant
#

yes but I might forget to run it again, you know

dusky harness
#

Pretty sure this is outdated

#

But

#

?plsnolombok

neat pierBOT
#
FAQ Answer:

Why is Lombok bad?

  • It's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse
  • It requires an IDE plugin, so unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
  • Lombok'd code won't show in Javadocs
  • The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
  • Java is supposed to be explicit, Lombok hides a lot of key functionality into a subtle annotation which can be easy to miss
  • While IDEs support it with a plugin, it's usually more difficult to find specific things, like usages of a getter because they don't exist in the source code
  • Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
dusky harness
#

Haven't used lombok myself so I can't comment much

dusky harness
#

What's in 17?

#

Oh boy mfnalex writing an essay

royal hedge
#

Records smh

dusky harness
#

Oh

icy shadow
royal hedge
#

Well technically like 14 i think

dusky harness
#

Also @light pendant when u finish the project, feel free to ping me so I can take a look at ur code :))

royal hedge
#

But thats not an lts

dusky harness
#

And idk if some have been fixed by now

#

Since it's been a long time

light pendant
#

It's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse
hm not sure about that. it's a normal plugin to the compiler. It was made for allowing plugins to be used .That's a bit like saying "LuckPerms is a hack. Bukkit API wasn't designed to modify code, ...."

It requires an IDE plugin, so unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
that is 100% false. Lombok does work fine without having to use ANY ide. Both maven and gradle have their respective integrations for lombok, the IDE doesn't care about it (well except to be abe to show the generated methods or sth)

Lombok'd code won't show in Javadocs
Yeah, that's indeed a problem. That does suck.

The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
idk, it's not less predicitable than what IJ's "generate hashcode" thingy would do.

While IDEs support it with a plugin, it's usually more difficult to find specific things, like usages of a getter because they don't exist in the source code
See nr. 2 above ^

Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
That is true, but the bytecode will also not match the source code if e.g. you're using paperweight or any other thingy that changes the bytecode

dusky harness
#

Ohhhh my

#

Btw for the predictability thing, it means that u can't see what lombok is really doing

#

I think

#

But IJ u can

light pendant
dusky harness
#

And paperweight also produces a dev jar

#

But yeah

#

I stated the disclaimer for this purpose :))

dusky harness
dusky harness
#

I'd be happy to review :))))))

light pendant
#

are fields in a data class generated by kotlin automatically immutable? and does it automatically add getters/setters for those fields?

dusky harness
royal hedge
dusky harness
#

It doesn't automatically add getters and setters but u can make it into a property

pulsar ferry
#

I just hope you are talking about using lombok in Java and not Kotlin lol

dusky harness
#

It doesn't need them by default since the code is the same

royal hedge
#

But in kotlin u just access then howcu do a normal field like in jqva

dusky harness
#

Whereas with Java u have to call a desperate message

#

Seperate

#

I'm trying to type fast before sparky answers it all 😭 (on mobile)

light pendant
dusky harness
#

So I wanna let u know abt them

#

There's still a LOT that I myself don't know

#

Both about Java and kotlin

#

OK my thumb needs a break for a min

light pendant
#

I probably have to add the following displaimer:

mfnalex sometimes is a bit upset about things that are unknown to him. He's looking at things he already knows, and if suddently he switches to a new language (/ or whatver), then sometimes things don't work as mfnalex expected them to be. That is not the fault of the targeted language, but the fault of mfnalex thinking that e.g."kotlin is like java + additions" while obv it's not as easy as that

#

and that's the reason why I ask like 10 annyoing questions here every day - not t hate on gradle or kotlin, but to be able to understand how to do it correctly in "their language"

leaden sinew
#

Just switch to Skript

light pendant
#

pleaes always keep in mind that I didn't study CS or anything close to that, I'm a self-taught developer, my actual job is being a lawyer so please go slow on me when I got questions haha

dusky harness
#

I'm in HS 🥲
Most of us are prob self taught as well

royal hedge
dusky harness
#

Oh I missed that part but plugins are an api in Java (class loader things?)

#

Not specifically plugins

#

But loading new classes

light pendant
dusky harness
#

Isn't it a gradle/maven plugin?

#

Not javac

#

Unless Javac does

#

I never used Javac by itself 💀

light pendant
#

lombok has a special plugin that hooks into javac's API, if I'm not mistaken

dusky harness
#

Interesting

light pendant
#

I am not 100% sure though, maybe I'm talking bullshit

royal hedge
light pendant
#

sure, but argueing like "well it's 100% supported right now, who knows what happens tuesday" is a very weird argument imho

royal hedge
#

i dont think its too big of an issue

#

but it is actually becoming more likely

#

java is making it harder to access internal apis

light pendant
#

yeah and I also don't even "fanboy" on lombok. I just think its useful (sometimes), but some people hate against it for no obvious reason at all.

Lombok does have many issues, I never deny that

royal hedge
#

the only "real" issues on the list imo are

  • Lombok'd code won't show in Javadocs
  • The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
  • Java is supposed to be explicit, Lombok hides a lot of key functionality into a subtle annotation which can be easy to miss
#

It requires an IDE plugin, so unless you've properly configured [your IDE]

  • configuration ur ide isnt an issue, nor is it hard. the lombok plugin is installed by default in ij and i cant imagine its too hard in eclipse

unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy

  • configuration lombok with gradle or maven is very simple

Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ

  • red bar in ij when viewing external code? oh no!
light pendant
#
  1. Yes, the javadoc thing is a big issue, I agree
  2. THe generated is imho not unpredictable at all, imho the opposite is true
  3. That's an argumentum ad absurdum - neither does lombok "hide" any key functionaly, but it's more like the other way around - if I have 3 fiels and I annotate the class with @ToString, then I exactly know what it's going to generate outta that
#

ides arent an issue, the lombok plugin is installed by default in ij and no one uses eclipse but i cant imagine its too hard
well yeah but that's an issue caused by the IDE and not lombok itself. The same argument could be used for ANY code generating annotation thingy

royal hedge
#

im saying its fine

light pendant
#

gradle and maven configurations are very simple
Oh well that's a highly debatable topic. Imho maven build files are 100 % straightforward, while gradle fies are not and never were supposed to be - the big difference between mavne and gradle is

  1. maven claims to be "explicit"
  2. gradle claims to be the opposite (both have absolutely valid use cases, ofc)
#

red bar in ij when viewing external code? oh no!
?

#

oh you're talking about gradle not being able to use <scope>provided I guess

#

yeah that indeed makes me very angry sometimes

pulsar ferry
#

Lombok is widely used, I personally don't like it, but it's fine if you do
I have seen some issues with it, compile/runtime issues due to it's funky generated code
And I have seen issue with stacktraces showing widely different lines, that's about it

light pendant
#

I wanna add: I don't "like" lombok. It does very weird things sometimes. Howver, some parts of lombok are totally fine, e.g @Getter on a field generates a getter - that's handy and has no issues (except the missing javadocs)

#

And I have seen issue with stacktraces showing widely different lines, that's about it
Yep that's also a huge issue but IIRC that was fixed like 5 major versiosn before the current version? Maybe I'm confusing it with something else though, so yeah maybe I#m wrong on that

royal hedge
#

lemme edit my message cuz i kinda rushed it so its not rly clear

#

there

light pendant
#

just for the record, I'm not a lombok fanboy, and many things they do are very weird, but some things are also just straightforward and working fine - e.g. (All/No/Required)ArgsConsturcor, EqualsAndHashCode, ToString, etc

royal hedge
#

"just for the record" more like just use a record

#

im so funny right

light pendant
#

if kotlin would have records, yeah I would do that lol

pulsar ferry
#

Why? Just use a data class lol

royal hedge
light pendant
pulsar ferry
#

I hope your answer is no

royal hedge
#

so why does it matter if kotlin does or doesnt have records

light pendant
#

it does not matter. I was never trying to start a discussion about lombok vs kotlin. I only asked "how can I mimic a java lombok'd Data class in kotlin"

minor summit
# royal hedge java is making it harder to access internal apis

eh this is not exactly relevant to the topic, I don't know all the things lombok does (it might be replacing internal fields in the compiler and such) but that is exposed as supported API, jdk.compiler module, and plugins are loaded via service discovery in the classpath, but it isn't part of Java SE, compiler plugins are much more powerful than annotation processors, see manifold project for example

light pendant
#

manifold should really fix their docs

#

I opened an issue about an, I guess, not very-uncommon problem and they basically ignored it completely

#

anyway maybe I gotta clarify again - neither was my previous messages' intent to be to hate on kotlin nor was I going to glorify lombok. I know very little about kotlin and hence all the questions I asked were not to be understood as "lol but in lombok I can just do it like this", but rather an honest question about "in lombok I do it like this, what's the kotlin equivalent for that?"

#

I'm here to learn stuff, not to fanboy about anything or sth lol. Mb if it came over differently

light pendant
#

am I stupid or why does none of this work lol

royal hedge
#

need var or val infront

#

private val figure: ChessFigure

light pendant
#

I thought that val is the default?

royal hedge
#

theres no default

pulsar ferry
#

data class Position(private val x: Int, private val z: Int, private val figure: ChessFigure)

royal hedge
#

was bouta say that

#

thats just special syntax for declaring a constructor and properties together

light pendant
#

ok I made the x and z "val" (which should mean final, right?) but it still complains

pulsar ferry
#

Kotlin's constructors aren't the same as Java

royal hedge
#

constructors are declared with constructor but use what matt sent

light pendant
#

I hate kotlin haha

#

intelliJ generated that constructor automatically

pulsar ferry
#
class Position(private val x: Int, private val z: Int) {

}
#

This is the equivalent

light pendant
#

huh? why is the constructor's name prefixed with "class"?

minor summit
#

that's the entire source file

dusty frost
#

yeah you have inline constructors

minor summit
#

kotlin is to java what Portuguese is to Spanish

#

"not java"

pulsar ferry
#

The primary constructor is declared in the class declaration

dusty frost
#

similar to Java Records

pulsar ferry
#

If you go into it with the mentality of "why isn't this like Java" then you won't like it, it's a different language

light pendant
#

ths does not make sense whatsoever

royal hedge
pulsar ferry
#

Remove the properties lol

dusty frost
#

yeah you don't do both lol

royal hedge
#

and turn the parameters into properties

light pendant
dusty frost
#

you need val in the parameters to make them into properties

dusty frost
#

as Matt showed above

light pendant
#

oh I didnt see that, sorry mb

#

ugh kotlin is so messy

dusty frost
#

you're just not used to it

#

too Java-brained

light pendant
#

so a parameter for a construcotr randomly becomes a field in the whole class by adding a keyword to the constructor's parameter?

what if my class has more than one constructor?

light pendant
minor summit
#

you can have multiple ctors yes

#

with the magic keyword

#

constructor kekw

dusty frost
#

yeah it's just a sum of all the constructors lol

minor summit
#

that just so happens to be the primary ctor and you can put fields so it auto-assigns them n shit

#

erm, "properties" 🤓 not fields

#

i am sorry MATT

#

i know i'm not the daughter you ever wanted me to be

light pendant
#

ok maybe this will help me understading kotlin: How would the following java class look like in kotlin?

public class Position {
  private final int x, z;
  @Nullable private Figure figure;

  public Position(int x, int z) {
    this.x = x;
    this.z = z;
  }

  public Position(int x, int z, Figure figure) {
    this.x = x;
    this.z = z;
    this.figure = figure;
  }
}
minor summit
#

intellij has a "convert to kotlin" action rierunrunrun

pulsar ferry
#
class Position(x: Int, z: Int)

Equivalent to

public class Postion {

  public Position(final int x, final int z) {
  }
}
class Position(private val x: Int, private val z: Int)

Equivalent to

public class Postion {
  private final int x;
  private final int z;

  public Position(final int x, final int z) {
      this.x = x;
      this.z = z;
  }
}
royal hedge
dusty frost
#

^

minor summit
#

honestly not even

#

figure: Figure? = null

royal hedge
#

yea good point

dusty frost
#

oh true true

light pendant
#

wtf

#

so the "all args constructor" is worth more than the one that only requires int x, int z?

dusty frost
#
class Position(private val x: Int, private val z: Int, private val figure: Figure? = null) {}
light pendant
dusty frost
#

google primary constructors

royal hedge
dusty frost
#

and read like, a few articles

#

oh do you not need the squiggly brackets lol

pulsar ferry
#

No

dusty frost
#

classic, love kotlin

pulsar ferry
#

That's like the thing I hate the most about records tbh

#

It's so ugly

light pendant
#

my whole chess engine would have been finished by now if I didn't click "kotlin" in the project wizard I guess

minor summit
#

i'm sure they think the same about you too matt

dusty frost
#

"i have to learn a new language, why is this so difficult and weird"

#

like come on man

pulsar ferry
#

Very true 😔

royal hedge
#

cuz we have something called no null safety

pulsar ferry
#

Which is ugly :)

minor summit
#

valhalla looking good

royal hedge
#

yea i saw valhalla

light pendant
#

anyway, thank you all you all for your pacient attempts to help me, but for me, kotlin is still just java with extra-added useless caveats that makes things more complicated iwthout adding any benefits.

Maybe I'll change my mind about this someday, but definitely not today

dusty frost
#

oh man I love kotlin data classes, I wish Java had a library that could deserialize config files like Kotlin does

minor summit
#

yeah uh, jackson, gson,

dusty frost
#

can you just do nested records?

minor summit
#

yes

dusty frost
#

i thought gson couldn't do records since it needed a no-args constructor

pulsar ferry
#

but for me, kotlin is still just java with extra-added
That's where you're wrong, and going about it wrong, it's a completely different language

light pendant
#

aren't records final?

minor summit
#

it has support for records

dusty frost
#

huh

#

cool

royal hedge
dusty frost
#

maybe i should try it out

pulsar ferry
#

You don't even have to use JVM, you can do JS, WASM, Objective C, etc

royal hedge
#

cuz parameters in record constructors have names by default

minor summit
#

objective c suffoDespair

royal hedge
light pendant
dusty frost
#

yikes

minor summit
#

why do i know so much about kotlin

#

i don't even use it

#

it's like a curse

light pendant
#

idk maybe you hate yourself

pulsar ferry
minor summit
#

oh yeah defo

dusty frost
#

i hope you're joking

pulsar ferry
#

My guy tries to write a single class in a new language and decides it sucks omega_lul

light pendant
#

I hope so too. But i am serious. I have tried to get into kotlin like, many times before. Sure, I can do easy things like, declare a useless method that I'd never actually reaylly use. However once I actually need to get stuff done, all those kotlin syntax is in my way

dusty frost
#

you need to think about it like learning a new language, since it is

#

the mindset of "it's java but a little spicier" is doing nothing but hurting your ability to learn and experience new things

#

i sincerely hope you never try to learn another language and approach it like that

light pendant
#

yes, that's probably my issue. I don't want to use a totally new language

pulsar ferry
#

Then why are you trying to? lol

dusty frost
#

yeah then just stick with Java

minor summit
#

well you're out of luck cuz it is

dusty frost
#

if you're not prepared to learn something new, you definitely shouldn't try doing that

light pendant
dusty frost
#

Looks like you just went back to step in the glue of where you already are

pulsar ferry
dusty frost
#

And immediately reverted at the most minimal sign of change

light pendant
#

I'm constantly trying to learn new things, hence I force myself to use gradle for all new projects, even though gradle is a fucking pain compared to maven for most things. But kotlin, that's next level

Gradle offers many new possibilities compared to maven, so it's worth learning it imho.

Kotlin however is just "different" but doesn't really add any useful new things.

dusty frost
#

It adds a lot of useful things, you're just never going to experience them because you couldn't get past the first 5 minutes without gawking, acting completely horrified, and going back to Java

pulsar ferry
light pendant
dusty frost
royal hedge
#

well non null types

dusty frost
pulsar ferry
#

Kotlin however is just "different" but doesn't really add any useful new things.
Extension functions
Coroutines
Destructuring
A giant library of useful utils
Boilerplate reduction
Null safety
.. etc .. etc

So unfortuante that it adds nothing useful

dusty frost
#

It's a different language with many different benefits!

light pendant
dusty frost
#

💀

spiral prairie
#

I like Kotlin xD, mostly because of the libs that make using it so much easier like Kord, KSpigot (SilkMC), Ktor and serialization

royal hedge
#

how is that a disadvantage

dusty frost
#

bro loves NullPointerExceptions

light pendant
#

Something something is obviously not per se a something. It's just an address to something that might either be there, or not.

spiral prairie
#

which uh isnt great

dusty frost
#

bro just invented the java.lang.Optional but implicitly in everything

light pendant
pulsar ferry
#

I am so happy I use Kotlin at work, using a language that I love to work with and getting paid

light pendant
#

"When was the date you filed your latest tax returns"?

dusty frost
light pendant
#

Never?

light pendant
dusty frost
#

yeah then make your date nullable

light pendant
dusty frost
#

but then you are forced to check for that/deal with it in some way

#

there is no issue with that

#

I think you have a fundamental misunderstanding of Kotlin's null safety

spiral prairie
#

Also very nice for APIs since you defo know they are non nullable without it having to be in the docs

royal hedge
light pendant
royal hedge
#

its more likely theyll restrict null

#

not that i think thats better

dusty frost
#

It makes your program immune to NPEs (pretty much)

#

which is a whole class of errors just gone, out the window

#

with minimal effort and lots of niceties and syntax sugar to make it easy to deal with

spiral prairie
#

except if you overuse ! and ?

minor summit
#

the point of null safety embedded in the type system is to leverage the task of dealing with null checking to the language level rather than you going "oh, but i need to remember it can be null" and you might forget one or another time

dusty frost
#

yeah but you shouldn't really be using ! basically at all

spiral prairie
#

^

#

thats the point

minor summit
#

sure you can be a really good programmer and "i never forget to null-check", but erring is human and you are bound to

royal hedge
minor summit
#

leveraging that to the language and you forget about it is a good thing

dusty frost
#

wait a fucking second

light pendant
#
TexReturn lastTaxReturns;
if(taxee != null) {
  // taxee is null, they cannot have tax returns
  lastTaxReturns = taxee.getTaxReturns(0); // their last tax returns

If however I'd now do whatever: TaxReturn = taxee?lastTaxReturns?get(0) then I wouldn't even know which of those were null?

dusty frost
#

why would you do that then

#

if you cared which one was null, just do it the old fashioned way

#

or use an elvis operator

#

the whole point is that it's in the type system

light pendant
#

don't you care whether taxee is nul, or taxee.getTaxReturns(0) or TaxReturns.get(0)?

dusty frost
#

depends on the scenario

#

there's nothing stopping you from doing a manual null check

pulsar ferry
#

whatever: TaxReturn = taxee?lastTaxReturns?get(0)
This would be a IDE and compile error becasue you're trying to assign a nullable value to a non null type

dusty frost
#

also, you are quite literally the person who made a PAPI PR to add @NotNull annotations to some API methods

#

guess what Kotlin's type system does

#

EXACTLY THAT

light pendant
spiral prairie
dusty frost
#

so you obviously understand the benefits of having this kind of null safety, enough that you use a tacked-on method to handle that in Java

#

so why are you so against having it as part of the language natively?

light pendant
#

this aholw a?b?c thing completely ignores the fail-fast principle

dusty frost
#

you don't have to do that

spiral prairie
#

a?b?c isnt correct syntax still and that ^^

minor summit
#

where would something fail exactly?

light pendant
#

you can keep blaming my syntax as often as you want, I am still pretty sure that you all know what I'm trying to say

minor summit
#

because kotlin adds null-throws in a function if a parameter is not-nullable

pulsar ferry
dusty frost
#

I don't understand your fixation on the ?. operator

#

There's nothing forcing you to use it

light pendant
dusty frost
#

Worst case scenario, you can do exactly as you do in Java, it will just not compile if you forget to deal with a null somewhere

#

jfc

pulsar ferry
#

It's "safe" you can say

light pendant
#

I never said that, no

spiral prairie
#

if taxee is null

light pendant
minor summit
#

well if getTaxReturns does not return a nullable type then you do

spiral prairie
#

^

minor summit
#

and given the example, it wouldn't

spiral prairie
#

or you do kt taxee?.let { lastTaxReturn = it.getLastTaxReturn(0) ?: return // lastTaxReturn is non nullable }

light pendant
#

what if it was actually null though, because whatever you called it on is from a normal java lib?

minor summit
#

the language inserts null-check-throw

#

but if it's from a regular lib it would just return nullable

#

unless annotated with NotNull

pulsar ferry
light pendant
#

huh no, it wouldn't? It would just see "first element? is null, so everything else is null too"

minor summit
#

???

#

go to sleep

royal hedge
light pendant
spiral prairie
#

idk i never understood the difference

light pendant
#

I am totally aware about my lack of knowledge about kotlin

spiral prairie
#

Hyperskill is free for a few problems a day ^^

dusky harness
#

Kotlin Basics

pulsar ferry
# spiral prairie You then use .apply?

Apply modifies the it, let gives the it and anticipates a new value
The correct syntax there would be

lastTaxReturn = taxee?.let {
  it.getLastTaxReturn(0)
} ?: return
minor summit
#

it isn't specific to kotlin, it's about leveraging null-safety into the type system itself

royal hedge
minor summit
#

when you want to run

#

duh

dusky harness
#

Also mfnalex idk if u changed ur mind (from the beginning of when I left) but plz make at least some kind of project in kt so I can help u see what u can change :))

icy shadow
#

imagine if we had a language where null literally did not exist

#

Has anyone thought of that before

dusky harness
#

Rust

icy shadow
#

No

dusty frost
#

lmao

minor summit
#

sucks

dusky harness
#

👍

icy shadow
#

Not that

pulsar ferry
icy shadow
#

It must have no nulls AND higher kinded polymorphism

#

rust only has one of the two sadly

#

Ergo fail

light pendant
dusty frost
dusky harness
spiral prairie
icy shadow
dusky harness
dusty frost
#

awww, maybe I will get back into F# lmao

dusky harness
#

Or anytime

pulsar ferry
icy shadow
#

Once again my ludicrous propaganda proves successful

dusky harness
light pendant
#

I've snacked too much diazepam and other benzos to be able to give proper arguments today. I am pretty sure that kotlin is a fine language and they got their reason for many things that are however pretty weird to jave users

dusty frost
icy shadow
#

they are comparable in that both SUCK 😂😂

dusty frost
#

Type-level null safety is not a Kotlin-only thing

pulsar ferry
dusky harness
#

I can do Cocs fine with rust now tho

#

With Google sometimes

#

And a lot of compile errors with its borrow checker thingy

icy shadow
#

One day you will be able to do Coc with Coq

dusty frost
#

CoC with Ada when?!?!?!?

icy shadow
#

Well

spiral prairie
#

Rust is fine, its easy to loose yourself in the process if you dont know it perfectly sadly

dusky harness
#

Oh also code wars is an awesome clash of code but single player kind of thing

light pendant
# dusty frost You just need to open your mind my friend

Im really working on that. I used to hate gradle (and I still think it's a very annoying buildtool compared to maven) but I've been using it for like 2 weeks now and I learn new things every day. On the other hand, gradle is sometimes a huge fucking jerk because it rquires so much configuration for things where you'd only add one line to your pom in maven and it'd just work

#

Same is probably true for kotlin vs java

spiral prairie
#

Lmao i think the same every time i use Maven

dusky harness
dusty frost
#

Yeah that's just more of a "i have more experience with X tool, why is Y so difficult and weird?" moment

spiral prairie
#

exactly

dusky harness
#

I'm on 24% gotta save battery tho so cya

Don't give up on kotlin 👍

light pendant
pulsar ferry
dusty frost
#

don't open that can of worms lmao

pulsar ferry
#

Laptop is at 32% I can go for a while longer

dusty frost
#

we all know XML as a configuration language was a mistake lmao

#

Spring is still learning that the hard way 😔

light pendant
#

ive a piano player some sheets and he'll play the notes. give the same sheets to a guitar player and he'll be like "lol wtf I only have 6 strings, how am I supposed to play 8 tones at the same time".
piano players be like "only 8 notes? Sure, no problem".
But then tell them to play the 7/th overtone of the A2 key and they'll be like "duude, impossible"

#

different tools = different approaches to do stuff

#

I don't give up on kotlin per se, but I give up on kotlin for today

pulsar ferry
dusty frost
#

oh just all the legacy Spring stuff uses XML configuration

pulsar ferry
dusty frost
#

obviously you can use like annotations and everything, just like half the docs and examples I find are like "now open your application.xml and add this database resolver or whatever with <DatabaseResolver>blah</DatabaseResolver"

light pendant
#

anyway, thank you all for your time in trying to explain kotlin to me, but I still think will learn NOTHING in this way. I should rather just buy a prope book about kotlin

pulsar ferry
#

Huh yeah we have application.yml instead

minor summit
#

what is wrong with you

dusty frost
#

even then, not a big fan of configuration formats used for that kind of stuff

#

configuration-as-code is so nice

light pendant
#

if anybody knows a good book about kotlin, please let me know - preferrably a book that eplains the differenes between java and kotlin, instead of a generic "lets learn kotlin today" book

minor summit
#

eh, problem with books is that they get outdated fast

minor summit
#

oh you have that one, don't ya

pulsar ferry
#

But yeah the docs are very good

minor summit
#

i rember

pulsar ferry
#

I do :D

light pendant
#

I fond these books, the third one is from jan 2022

#

can't be "that much outdated" I guess?

minor summit
#

sure but languages evolve

#

and i hear kotlin has some nice changes coming along with k2 👀

#

or at least planned

pulsar ferry
#

Heavily cropped for reasons, but :D

dusty frost
#

mmm k2

#

can't wait for java 21 too, would be so cool to use some of the new stuff in kotlin JVM

minor summit
#

hot

dusty frost
#

did you guys see they are working on Wayland support for IJ-based IDEs

spiral prairie
#

so idk

light pendant
#

I wanto to add one thing: I have really hated gradle to the core, only like 4 weeks ago. Meanwhile all my new projects are using gradle, even though I still have severe issues with gradle for doing simplet things sometimes. However I'm trying to learn why/how these issues can be fixed.

So yeah, I tend to claim "XYZ is shit" because I haven'T fully understood it yet. Sorry about that. Sometimes I'm just angry. In any case though, I would really like to learn "proper kotlin" and I think buying a book would be a good step into the rigth direction.

So if anyone knows a proper book about kotlin, please let me know, thanks ❤️

spiral prairie
#

Again, I can recommend the Hyperskill course

dusty frost
#

which means they'll actually like work well on WSL and Linux distros that use Wayland!

minor summit
#

naisu

light pendant
#

also, fuck youtube tutorials lol

pulsar ferry
#

Bro ignored my suggestion 😔

light pendant
#

my kotlin journy will start with a proper book, or it won't start at all

light pendant
minor summit
#

Atomic Kotlin

pulsar ferry
#

Or just look at the Kotlin docs they are very good

light pendant
#

I thinky my best choice to learn kotiln properly is to make someone turn one of my existing prokects into 100% kotin #1135819519303098429 message

pulsar ferry
#

€100 for that? If I remember it when I wake up then count me in lol

royal hedge
#

how would that help you learn if someone else is doing it all for you

pulsar ferry
#

Shhh don't make me lose 100 bucks

spiral prairie
#

why

royal hedge
#

because its calling itself when the event is called

spiral prairie
#

i think its meant to call another event

#

not the same one

#

at least thats the only thing that would make sense

#

welp imported wrong event

minor summit
#

yes

spiral prairie
#

blud never tried his lib on paper

dusky harness
#

¯_(ツ)_/¯

#

Woah

leaden sinew
#

@light pendant there's a converter in IntelliJ

#

Also why do you want to convert it to Kotlin?

spiral prairie
#

Wants to learn kotlin

leaden sinew
#

Oh

spiral prairie
#

i think their mind is a lil borked rn so i wouldnt apply for it

leaden sinew
#

Still why not use the converter

spiral prairie
#

oh it pretty much sucks if you use it for a whole project

dusky harness
spiral prairie
#

yeah

dusky harness
#

With code that's not exactly good

leaden sinew
#

Errors are good though

spiral prairie
#

yeah

#

no

leaden sinew
#

It helps the code build

dusky harness
#

Iirc if you don't use nonnull it marks everything as nullable

#

I think I even did like a replace all question mark thing before lol

royal hedge
#

bro the converter is shit

dusky harness
#

And so u can ask, get multiple ppls opinions, and decide what's brst

minor summit
#

my converter:
compile java
decompile kotlin
?? profit

dusky harness
#

Specifically I'm thinking of extension and top level functions but there's others

#

@light pendant I'd consider... Rethinking your latest request
Why not use that to learn kotlin?
Plus, you want to get ppls opinions as you ask questions and convert the project
It can be a nice learning method... For 100 pounds less :))

#

¯_(ツ)_/¯

#

My lib is a lot smaller but I also converted it to kotlin

#

🙃

#

Just my thought tho

spiral prairie
#

I also made a lib but literally never used it lmao

#

its so hard to keep it updated

dusky harness
#

Meanwhile me with DkimCore, DkimBukkitCore, DkimJDAUtils, and DkimGradle

#

🥲

#

I just take code that I notice is in a lot of my projects

spiral prairie
#

Do you guys have motivation tips xD????

dusky harness
#

Have you tried making gui desktop applications

spiral prairie
#

I know what I want to make etc but i just cant get myself to open the idea and have at it and learn

#

im also excited about that project but

#

i have another project i have to finish but i dont want to before i can start working on that

#

iygwim

dusky harness
#

It should help if there's a specific reason you need the project
Ex if there's something you or a family/friend needs (not for money) then that could help

That's why Im also trying to learn android dev

#

I gotta focus on one thing lol

#

Learning android, rust, and cpp

#

All for different reasons

minor summit
spiral prairie
#

i do many things i want

minor summit
#

that might or might not be a lie

spiral prairie
#

I have an update I have to finish before I can start working on the stuff I want to work on, but the update is very painful to do so i dont want to xD

dusky harness
#

Just don't do public plugins ez

spiral prairie
#

i wish

#

created one and its becoming a pain

dusky harness
#

Ooo it's a paid plugin too

#

Open source and paid

spiral prairie
#

Yeah I can abandon free plugins, but not paid ones pepela

royal hedge
inland walrus
#

How to load another world if there is no player in it to spawn mobs? 1.12.2 paper.

river solstice
#

what

inland walrus
#

If I am in a different world than the one where the boss should spawn, then the boss entity will not spawn.

#

Since the world where the entity should spawn is not loaded.

#

Heh

#

Loading chunks where the boss should spawn does not help.

light pendant
#

I'll think about it 😄

trail kite
#

how can i open a page to a player when they click on a button in the gui?

dawn viper
trail kite
#

@dawn viper after creating the book , how can i open it to a player?

trail kite
#

i think i can use
openBook(ItemStack book)

#

ill try

dawn viper
#

yeah that's what I just sent

trail kite
dawn viper
#

yeah, the link directed to that method

trail kite
#

anyways i made teh book but

#

when i open it it says * Invalid book tag *

dawn viper
#

send your code

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

trail kite
blazing pewter
#

this is my build.gradle.kts ```
plugins {
java-library
id("io.papermc.paperweight.userdev") version "1.5.5"
id("xyz.jpenilla.run-paper") version "2.1.0" // Adds runServer and runMojangMappedServer tasks for testing
}

group = "com.hockey.proxyplaceholder"
version = "1.0.0"
description = ""

java {
// Configure the java toolchain. This allows gradle to auto-provision JDK 17 on systems that only have JDK 8 installed for example.
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

dependencies {
paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT")
implementation ("redis.clients:jedis:4.3.1")
implementation("me.clip:placeholderapi:2.10.10")
}

repositories {
maven {
url = "https://repo.extendedclip.com/content/repositories/placeholderapi/"
}
}

tasks {
// Configure reobfJar to run when invoking the build task
assemble {
dependsOn(reobfJar)
}

compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything

// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)

}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"name" to project.name,
"version" to project.version,
"description" to project.description,
"apiVersion" to "1.20"
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}

/*
reobfJar {
// This is an example of how you might change the output location for reobfJar. It's recommended not to do this
// for a variety of reasons, however it's asked frequently enough that an example of how to do it is included here.
outputJar.set(layout.buildDirectory.file("libs/PaperweightTestPlugin-${project.version}.jar"))
}
*/
}```

#

at line 24 url= ... it says type mismatch required uri found string

#

any ideas?

trail kite
#

i made this code here
https://paste.learnspigot.com/ikobedusah.java
but im wondering , how can i make it so the next pages after page 1 only show if a player has a certain level? i assume i need to make a level system which i haven't done before so if anyone has a good guide please send it over 🙏

leaden sinew
#
chunk?::class.java

How do I make this work? I'm trying Kotlin

proud pebble
trail kite
proud pebble
trail kite
#

how do i open each book depending on what level the player has?

proud pebble
trail kite
#

i dunno how to make a level detection system or a level system on its own

torpid raft
#

can the spigot api open book guis for a player?

proud pebble
#

well then thats up to you to figure it out

torpid raft
#

or do you need nms

trail kite
#

im very new to coding

trail kite
torpid raft
#

oh then that's super ez

proud pebble
#

Player#openBook(Itemstack)

proud pebble
#

since a level system isnt a specific concept that only applies to minecraft

torpid raft
#

and intercepting it

proud pebble
#

you could google xp level system rpg programming and find something related

trail kite
proud pebble
trail kite
#

i would send a picture but i dont have embed perms

proud pebble
#

you can just force them to open it

torpid raft
trail kite
#

i basically made a menu with a 3 buttons

#

one of them is the lore book

torpid raft
#

for the realism

trail kite
#

i have tried googling a level system but all i find is super complicated plugins that have over 30 classes

#

which i dont even understand

proud pebble
trail kite
#

yeah yeah

#

very easy for someone with 2 weeks of experience

torpid raft
proud pebble
proud pebble
#

or have already done

torpid raft
#

their code generates a book item and they want it to change based on 'level'

trail kite
#

yes but the player doesnt receive the book

#

it just creates the book to open it for the player

torpid raft
#

oh

proud pebble
#

they have a chest gui, click a button in that gui and its supposed to open up a book gui that had pages for each level

torpid raft
#

i see

proud pebble
#

for a simple level system, two variables for each player, one an xp value, one a level value, then create a formula for the increase of xp per level and a loop that generates a list of values, each representing a level and their value to aquire said level, then a method that checks the player's current xp and if on gain if they are ready to level up and then if they are increase their level counter

proud pebble
#

yeah then i have no idea what you are even wanting

trail kite
#

let me explaij

#

im working on an adventure map and i want to make a lore system for it. basically you explore the map and there are gonna be waypoints. when you stand on a waypoint it will add it to the waypoint menu and it will also give you an extra page in the lore book

blazing pewter
#

trying to add papi to my bukkit project

#

build.gradle (kts) ```
plugins {
java-library
id("io.papermc.paperweight.userdev") version "1.5.5"
id("xyz.jpenilla.run-paper") version "2.1.0" // Adds runServer and runMojangMappedServer tasks for testing
}

group = "com.hockey.proxyplaceholder"
version = "1.0.0"
description = ""

java {
// Configure the java toolchain. This allows gradle to auto-provision JDK 17 on systems that only have JDK 8 installed for example.
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

dependencies {
paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT")
implementation ("redis.clients:jedis:4.3.1")
implementation("me.clip:placeholderapi:2.10.10")
compileOnly ("net.md-5:bungeecord-api:1.20-R0.2-SNAPSHOT")
}

repositories {
mavenCentral()
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven ("https://oss.sonatype.org/content/repositories/snapshots")
}

tasks {
// Configure reobfJar to run when invoking the build task
assemble {
dependsOn(reobfJar)
}

compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything

// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)

}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"name" to project.name,
"version" to project.version,
"description" to project.description,
"apiVersion" to "1.20"
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}

/*
reobfJar {
// This is an example of how you might change the output location for reobfJar. It's recommended not to do this
// for a variety of reasons, however it's asked frequently enough that an example of how to do it is included here.
outputJar.set(layout.buildDirectory.file("libs/PaperweightTestPlugin-${project.version}.jar"))
}
*/
}

#
#

any ideas?

proud pebble
trail kite
#

but i thought of a better system

#

that i can actually code

blazing pewter
#

does papi need net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT??

trail kite
#

i'll try to make it

blazing pewter
trail kite
blazing pewter
#

i added the dependency following the docs and its not working lmao

proud pebble
blazing pewter
torpid raft
#

/s

dusky harness
#

From papi

proud pebble
# blazing pewter do you have anything to contribute
repositories {
  mavenCentral()
  maven {
      url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
  }
  maven {
      url = uri("https://oss.sonatype.org/content/repositories/snapshots"")
  }
}

also your using quite an old version of paper, since 2.10.10 is from july 10 2021

#

try using a more recent one

blazing pewter
#

lemme try

proud pebble
#

since ive been using 2.11.1 and not had it complain of that for myself

proud pebble
#

tho i should probs update it to use 2.11.3 but im lazy

blazing pewter
#

where would i change?

dusky harness
#

They meant papi

#

I think

#

U change it in dependencies

blazing pewter
#

im trying rn

proud pebble
#

also shouldnt it be compileOnly and not implementation

blazing pewter
#

yea that works thanks

blazing pewter
#

1 more issue

#
  public String getProxyName(ProxiedPlayer player) {
    JedisPool jedisPool = proxyServer.getPluginManager().getPlugin("RedisBungee").getJedisPool();
    String serverName = jedisPool.getResource().get("uuid:" + player.getUniqueId().toString());
    return PlaceholderAPI.setPlaceholders(player, "%proxy_name%", serverName);
#

for return PlaceholderAPI.setPlaceholders(player, "%proxy_name%", serverName);

dusky harness
blazing pewter
#

it says cannot resolve method ProxiedPlayer string string

#

any ideas?

dusky harness
#

Papi doesn't support bungee

#

Or proxies

blazing pewter
#

yea but im making this a bukkit plugin

dusky harness
#

You can't use ProxiedPlayer

blazing pewter
#

BRUH

#

so what tf do i do then

dusky harness
#

Isn't that a bungee class?

blazing pewter
#

yea

proud pebble
#

looks like it tbh

dusky harness
#

Why is that in a bukkit plugin

#

Then

blazing pewter
#

you can add bungee api to a bukkit plugin no?

dusky harness
#

Uh

proud pebble
#

probs something to do with redisbungee

blazing pewter
#

yea

proud pebble
dusky harness
#

Uhhh ig u can use Bukkit.getOfflinePlayer(UUID)

#

To convert

blazing pewter
#

would that not work?

proud pebble
#

sorry, bungeecord-chat is included in spigot afaik

blazing pewter
#

what?

blazing pewter
#

im using redisbungee tho

proud pebble
#

the full bungeecord api isnt included in spigot or paper or any other forks

blazing pewter
#

like