#help-development

1 messages · Page 475 of 1

tender shard
#

we've all been there

#

dont worry

eternal oxide
#

Yay, you're one of us now 🙂

earnest lark
#

idk why i blanked so hard on it

tender shard
#

relatable lol

#

what was the issue though

#

did you forgot to set back the itemmeta?

earnest lark
#

like i was using setItemMeta

eternal oxide
#

The lifesaver is search on the javadocs

tender shard
#

yeah tbh the javadocs are to blame sometimes - getItemMeta() doesnt tell you that you need to set it back, iirc

eternal oxide
#

true, but you can often fine everything you need just by using a partial match

tender shard
#

sure

#

still, annoying

young knoll
#

Sounds like a free PR to me :p

tender shard
#

go for it, then I dont have to do it

eternal oxide
#

I'd only typo it 😛

tender shard
#

btw can we all appreciate that I added the comments to the particle class?

#

I want hugs now

young knoll
#

I added comments to some of the potion effects that just had shitposts

#

:p

tawny remnant
#

thank you all for the help

tender shard
#

oh yeah there's also the ItemFlags class that bugs me so much

tawny remnant
#

i might never be able to repay you in any way

tender shard
tawny remnant
tender shard
#

That's me!

young knoll
#

His name Jeff

tawny remnant
#

yes

worldly ingot
tender shard
#

CHoco ban that dude, he used my name

chrome beacon
earnest lark
#

im using the InventoryPickupItemEvent how do i get the person who picked up the item

tender shard
#

get the InventoryView, then get the first viewer

#

getView(),getViewers(0)

#

sth like that

young knoll
#

InventoryPickupItem event

#

Pretty sure that’s for hoppers

worldly ingot
#

Yep

chrome beacon
#

^^

earnest lark
#

oh

tender shard
#

the "normal" event for picking up items is EntityPickupItemEvet

#

the player evet is dep

young knoll
#

Tbf it probably still works but yeah

tender shard
#

yes, I used a setting for it in my Drop2Inv plugin

#

"im-using-outdated-plugins"

young knoll
#

I wonder if MD will ever implement a policy to remove deprecated stuff after X minecraft versions

tender shard
#

I hope he won't, we're not paper

tawny remnant
#

i have a question how can i upgrade my nms project to 1.19.4

worldly ingot
tender shard
#

spigot is there to be version indepedent

earnest lark
#

ok

#

what event should i use then

tender shard
#

?xy

undone axleBOT
tender shard
#

what are you trying to do @earnest lark

earnest lark
#

im trying to see if someone is taking a specified item out of a gui i made

tender shard
#

InventoryClickEvent & InventoryDragEvent

#

then check whether the clicked item is yours

earnest lark
#

yea

young knoll
#

Yeah that’s fair

#

Granted if a plugin is that old maybe it deserves to die :p

tender shard
#

funny thing

#

PlayerPickupArrowEvent is not dep, but it extends PlayerPickupItemEvent

#

which is deprecated

worldly ingot
#

It's deprecated by inheritance. There is an EntityPickupArrowEvent

tender shard
#

but the javadocs don't tell that it's deprecated

young knoll
#

Another free PR :p

tender shard
#

someone should PR the Dep annotatio to that too. I would so, but setting up the repo for PR is annoying

#

let's just hope that @worldly ingot does it

worldly ingot
tender shard
#

ugh ok I'll do it

young knoll
#

I feel bad having so many PRs open

tender shard
#

sometimes I understand paper lol

#

BUT ONLY SOMETIMES

young knoll
#

Oh?

#

In reference to what

tender shard
#

well there's two things I dislike about paper.
1st thing is, they deprecated every string method i spigot. e.g. setDisplyName(String) - they want it to be a component. It kinda makes sense that they want this. But granted that it's a fork of spigot, which they claimed to be compatible with, they cannot remove this method. and if they don't actually wanna remove it, they shouldn't deprecate it imho. a normal @see annotation in the javadocs would be enough
2. sometimes, the add things, which are then later added by spigot, too. For example the AdvancementDisplay class, which they used an enum for (iirc, might be mistaken), then later spigot added it. or the Translatable interface, which I added

icy beacon
#

you're at a high risk of getting a whereami from a random member of the server

tender shard
#

and then they complain about spigot adding it too

#

like as if they had any right to decide "oooh we added it 2 weeks ago, now upstream adds it too? Ugh" lol

young knoll
#

One of my PRs is something I think paper already has

tender shard
#

imho paper adds many great things, but they should just fucking contribute upstream. ffs

tender shard
young knoll
#

Nope

#

But they’ll have to deal with the conflict

icy beacon
young knoll
#

True

tender shard
#

what did you add @young knoll ?

young knoll
#

But still

young knoll
tender shard
#

and they already have that?

young knoll
#

I believe so

tender shard
#

IIRC paper uses their own package for events

young knoll
#

Yeah but they’ll have to make sure both events fire

tender shard
#

they will probably make one event extend the other

young knoll
#

True

#

Forgot about that

tender shard
#

probably their event extends the spigot one

young knoll
#

Someone made a spigot PR for the event way back in 2016

#

But it kinda died so… rip

tender shard
#

if a pull request dies with no obvious reason, I#d just ping md_5 every day

#

he also pings me like every third day sooooo I guess he wouldn't worry about a ping lol

young knoll
#

Lol

#

Someone requested changes in 2021 but the author is probably long gone by now

tender shard
#

oh this reminds me, fuck

#

I had to reply

young knoll
#

So I just remade it, it was for legacy versions anyway

wise mesa
#

is there a way for a plugin to immediately stop server start up

#

like if something's wrong

#

like during load say

#

prevent all plugins after from loading

eternal oxide
#

system.exit but it's dangerous

young knoll
#

Can it not just Bukkit.shutdown

#

Or does that not work during startup

wise mesa
#

it does but I think it lets other plugins load first

young knoll
#

Hmm

buoyant viper
#

reminds me that i had a PR from a while ago that i never submitted, but id probably get shunned by paper shills bc they already had it since like 1.16 api apparently

wise mesa
#

and I don't want to use system.exit because its dangerous

young knoll
#

Not sure you can do much else

wise mesa
#

alright

buoyant viper
#

why should your plugin stop the server?

wise mesa
#

unfortunate

tender shard
#

I'm good at being honest, at least

young knoll
#

What’s the use case that if your plugin has an error all plugins must die?

wise mesa
#

so I kind of want to stop immediately if a plugin needs an update

#

its for auto downloading development builds from jenkins

tender shard
eternal oxide
#

don;t stop the server, download the update into teh update folder. It will be applied at teh next server start

tender shard
#

you could e.g. get the Unsafe object, then putAddress(0,0)

wise mesa
#

but my plugin does that and then stops the server

tender shard
#

or you just use Bukkit.shutdown() or however it's called

wise mesa
#

so that the new dev build will be applied immediately

tender shard
#

anyway, admins will fucking hate you if you do that

buoyant viper
#

^

wise mesa
#

its for development servers only

tender shard
#

you should NEVER shutdown the server just because your plugin sucks

wise mesa
#

its not for production servers

buoyant viper
#

until it accidentally gets pushed to prod AbsoluteHalal

wise mesa
#

its for developers to auto download the latest dev version of their plugin from jenkins

tender shard
wise mesa
#

its not for my plugins

young knoll
#

Make the plugin shutdown the OS

wise mesa
#

its for their plugins

#

i mean i use it on my plugins

buoyant viper
tender shard
#

"Download latest version, otherwise, maybe, in a future, this plugin will kill your server"

wise mesa
#

no

tender shard
#

I definitely wouldnt update

wise mesa
#

you misunderstand alex

tender shard
#

maybe I did haha

wise mesa
#

lol

#

here's the point

tender shard
#

anyway, you can use Bukkit.shutdown() or sth like that

wise mesa
#

yea that's what im using

#

just annoying i have to wait for plugins to initialize that are about to immediately shut down

tender shard
#

Bukkit.getServer().shutdown()

#

that inits a "nice" shutdown - so it saves the worlds properly, etc

#

if you just wanna kill the JVM asap, you can do Unsafe#putAddress(int, int)

orchid gazelle
#

System.exit(0);

#

Lmao

tender shard
#

my putAddress method is even worse

wise mesa
icy beacon
#

unplug the system

wise mesa
#

my plugin will download the latest jenkins build whenever there's a new one of whatever plugin

#

so its meant for your own plugin that you're developing

#

for easier testing

tender shard
#

yeah just print a message "Please, dear sys admin, press Ctrl+C" lol

wise mesa
#

not even

#

you are the sys admin

#

its your dev server

#

its really for my own purposes

#

because I test my plugins with other people

#

and I'm literally too lazy to upload it each time

tender shard
wise mesa
#

aight

buoyant viper
#

if i am the dev i have the plugin jar on hand and i will sftp it over

sterile token
# wise mesa aight

Whats your point ? i have seen you sending messages the whole day - hahaha

icy beacon
tender shard
#

do you people remember "EasyNicks" plugin?

buoyant viper
#

vaguely

tender shard
#

which basically added some crypto miner lol

wise mesa
sterile token
wise mesa
#

reduce my two seconds to zero

buoyant viper
#

#XMR 🚀

tender shard
wise mesa
buoyant viper
#

yes

wise mesa
#

my bad

icy beacon
orchid gazelle
#

Imagine WorldEdit quietly always using 1% of our GPUs and CPUs

#

They would be rich rn

tender shard
wise mesa
#

i've already made it

#

and have been using it

icy beacon
#

unmake it

tender shard
#

lmao

wise mesa
#

but trying to reduce my seconds even more 😎 😎 😎 😎

icy beacon
#

negative time wasted

#

bro is GAINING time when committing

tender shard
#

"yo, boss, I introduced a major flaw in Log4j back in ..." ~ "JUST UNMAKE IT"

orchid gazelle
#

time unwaste

tender shard
#

that's how log4j happenede

wise mesa
#

that's how they fixed it

tender shard
#

kinda lol

#

I'm still angry at md5 about it

icy beacon
#

you know what? fuck you

unmakes your plugin

orchid gazelle
#

What did md do

tender shard
#

he added fixes to spigot, way back to 1.7

#

he could have said "no, we only fix latest"

orchid gazelle
#

Good

#

Thanks for that md

tender shard
#

he could have basically give the death sentence to old versions

icy beacon
#

you are transforming into verano and there's no need to

wise mesa
#

it does this and then stops the server if enabled in the config

wise mesa
#

and I have pufferpanel set to auto restart the server on stop

tender shard
#

which I expected, because he's also the first one here to complain about "why don#t you just use latest"

orchid gazelle
#

1.12.2 modded gameplay still 10000% the best

wise mesa
#

so i just git commit and then /stop and wait

icy beacon
#

1.8 pvp still on top

wise mesa
icy beacon
#

I love me some new features and better API don't get me wrong

orchid gazelle
#

It has, since less spigot 1.12.2 users -> less 1.12.2 modded users

hazy parrot
icy beacon
#

but it's like trying to get rid of windows xp

#

you won't

orchid gazelle
#

-> less content for me

tender shard
#

I usually answer to people who at least use 1.16+. but I guess md did it to stop people using even more obscure forks who claim to be "spigot 1.8.8 but with log4j fixed"

wise mesa
sterile token
hazy parrot
wise mesa
#

ah

#

no

#

i murdered it

#

brutally

hazy parrot
#

?

wise mesa
#

um no they have a discord

#

and they'll reply

#

but they don't really update it

#

it works well enough for me though

tender shard
#

does puffer use docker too btw? and is it "mc only", or other games too?

wise mesa
#

docker optional

hazy parrot
#

I trough that project evolved into pterodactyl lol

wise mesa
#

other games too

tender shard
#

thx

wise mesa
icy beacon
#

good night everyone it's 3:30 am for me

#

❤️

wise mesa
#

pterodactyl was meant for big production stuff

sterile token
orchid gazelle
#

So if u guys someday make a mc mod, make it 1.12.2. It is forever going to be the best modded version

tender shard
#

good night @icy beacon

wise mesa
#

pufferpanel meant for small servers and stuff you just use for yourself

tender shard
#

I hope you dream about horses

wise mesa
#

like not hosting

icy beacon
#

I will

tender shard
#

cute horses

#

and ducks

wise mesa
#

create is on latest

#

therefore latest is best

#

😎 😎 😎 😎

orchid gazelle
#

No

wise mesa
#

im too cool to listen to reason

orchid gazelle
#
  1. I don't like Create 2. Don't take the only "good" new version content mod instead of 99% of all mods 10x better or more existing on 1.12.2
tender shard
#

1.12 is outdated since like, idk. 2018

orchid gazelle
#

And its still best for modding

tender shard
#

how so? beause you don't understrand the new API?

orchid gazelle
#

All those garbage updates all the different mods did...

tender shard
#

"best for modding" is always "Latest"

ancient plank
#

Create is pog mod

orchid gazelle
orchid gazelle
tender shard
#

1.12 sucks ass, and not in the good way that I can talk about as a gay person

orchid gazelle
#

And all those good mods not existing on latest

tender shard
#

1.12 is so outdated, it doesnt even have turtles

orchid gazelle
tender shard
#

who tf wants to play MC without turtles

orchid gazelle
#

It has turtles with mods

tender shard
#

everyone wants to have turtles

weak meteor
#

Can someone help me with smth? lol

orchid gazelle
#

Yes just use a turtle mod then

tender shard
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

round finch
#

Turtle helmet op

tender shard
flint coyote
#

why use a turtle mod when you can get the same by installing the latest version? + you get updates

tender shard
#

exactly ^

orchid gazelle
#

And no im not drunk last time I drank something was saturday :)

orchid gazelle
young knoll
#

Latest has plenty of good mods

tender shard
weak meteor
#

Ye, so i wanna make a world edit selection like, something like that, so im creating the hoe for that but idk how to listen when the player is clicking the blocks and stuff, so someone can help me w/that?

young knoll
#

Sure some good mods died on old versions

weak meteor
young knoll
#

But there are new good mods that don’t exist on those old versions

flint coyote
#

You need the player interact event

orchid gazelle
tender shard
weak meteor
#

i tried look

#

i know the code isnt equal but in the moment i made it it was supposed to work.

round finch
#

Drunk coding is the best jking

orchid gazelle
#

And also, imo all the mod-updates and new mod-textures suck on latest

tender shard
orchid gazelle
#

Wait really? Lol

weak meteor
#

ok

tender shard
#
  1. Do not compare strings using == (use equals() instead)
  2. Do not check your items using lore, name, etc, but use PDC tags instead
orchid gazelle
#

== is completely fine for enums

tender shard
#

it is, but they use it for the name

orchid gazelle
#

Yeah but there are also some for enums, those gotta stay

flint coyote
young knoll
#

Don’t check for custom items by name

#

Cough cough SLIMEFUN

tender shard
young knoll
#

Simple rule to keeps things easy

tender shard
#

general rule: ALWAYS use equals() or Objects.equals(...) unless you know that you don't need it

young knoll
#

== for primitives and enums

#

Otherwise, .equals

round finch
#

Strings . equals

orchid gazelle
#

Maybe I should start writing my PDC api to finally use pdcs

#

And still have the vanilla feeling of nbttags

tender shard
earnest lark
#

dont make fun of me for this one

#

?paste

undone axleBOT
earnest lark
tender shard
earnest lark
#

why do i get like 20 outputs when i get the item

tender shard
#

because you loop over the inv, and "like 20" items match that crit

earnest lark
#

no but i only have one of the items in my inventory

flint coyote
#

Why is your event handler a static void?

tender shard
#

because it doesn't need any instance vars - that's fine

earnest lark
#

i never understood static and stuff

#

i need to learn it

#

i understand how it works

#

just not when to use it

tender shard
#

your current usage of static is "okay"

#

however you are comparing itemstacks using ==

#

you should NEVER do that for itemstacks

young knoll
#

Apparently paper is able to better optimize non static event handlers

#

Idk if that’s true

tender shard
#

use equals() instead

tender shard
#

does it complain about that too?

young knoll
#

No idea

#

Something about ASM maybe

tender shard
#

having a static event method is totaly fine

flint coyote
tender shard
#

I should redo my blog's design lol

tender shard
flint coyote
#

Or the current item is AIR and the inventory is empty

tender shard
#

or the GC is very quickly in getting rid of new objects lmao

flint coyote
#

Could be that they have a single AIR itemstack and reuse it

earnest lark
tender shard
#

imagine this:

#

You got two people. both are called "mfnalex" and both are 28 years old

flint coyote
#

.equals() is compare by value
== is compare by reference

tender shard
#

You should ALWAYS use equals(), unless you know why you don't wanna use it

ivory sleet
tender shard
#

yeah

flint coyote
#

the memory address kinda is the reference

tender shard
#

also, yeah

flint coyote
#

But strictly speaking you are right, yes

tender shard
#

let's just stick to saying "use equals()"

#

and do idetify itemstacks, you should use PDC tags

flint coyote
#

unless you work with primitives, equals() is right 95% of the time

flint coyote
#

Depending on the order of comparison you can also call equals with null

tender shard
#

tbh, when talking like this, I do understad those kotlin simps

tender shard
flint coyote
#

The best part about kotlin is their streams imo.

tender shard
#

i dont know anything about that

ivory sleet
#

function types, null safety, coroutines and first ordered higher ordered function

flint coyote
#

They just added a lot of qol for streams

ivory sleet
#

very nice stuff

tender shard
#

all I know about kotlin is how much worse the code looks, how much more "mismaintable" it becomes by adding methods to classes that you didnt declare, and how unpredictable it is by using their fake getter/setter shit

ivory sleet
#

their java interoperability is dog water yes lol

tender shard
ivory sleet
#

but its a decent lang otherwise

young knoll
#

Why can’t java adopt some of that good stuff

#

Smh

tender shard
#

yeah idk, to me kotlin is like "wannabe java" that gets rid of all the advantages java has, while adding shitty things from other langs that nobody ever asked for

ivory sleet
#

u have Object::filter Object::let Object::any Object::map etc

#

or well

#

Any

tender shard
#

like, not knowing what type a var has? java unfortunately adopted that 🥲

#

or allowing code outside of any class

ivory sleet
#

i think null optional operator would be good

tender shard
#

I strongly disagree on that

ivory sleet
#

because?

tender shard
#

I am based. I know that objects can be null in java, and primitves can't. this is truly one of those things where I don't have a strong "pro-java" argument about.

However, kotlin also fucked up,. I dont wanna use ?????? everywhere, just because it MIGHT be null

flint coyote
# tender shard for example?
        // java
        List<String> playerNames = players.stream().map(Player::getName).toList();
        // kotlin
        val playerNames = players.map{ it.getName() }
ivory sleet
#

i am strongly for that null type semantics in terms of statement and expression operator is better than null semantics in terms of statement and expression

#

u wouldn't use ? everywhere tho lol

tender shard
#

the idea of null safety is "okay" / mediocre at best. it's either a stupid idea, nor was it ever needed imho

ivory sleet
#

u only use it on incoming return values and variables where null may be a possibility

tender shard
#

it's one of those things that kotlin "fixed" although it was never broken

ivory sleet
#

null is good

#

if used correctly

#

because at some point

#

a program has to represent absence more or less

#

99% of programs have to atleast

tender shard
ivory sleet
#

kotlin doesnt fix stuff because stuff is broken

eternal oxide
#

the only real alternative to null would be throwing an exception]

ivory sleet
#

that's not really their aim altho its not an irrelevant factor

ivory sleet
tender shard
# ivory sleet kotlin doesnt fix stuff because stuff is broken

exactly, kotlin causes more problems than it solves imho, If the kotlin devs would actually care about improving things, they wouldn't have invented their own weird lang, that doesn't care about types, but rather would just submit their rhoughts (as weird as they may be) to the actual java specs

ivory sleet
#

what problems does it cause?

#

their aim is to make a language more semantically justifiable for devs

tender shard
# ivory sleet that's completely besides the point

it is not, imho. Java, and kotlin, are both tools that people use to "get the job done". and if "getting the job done" requires using a java lib in kotlin, it's not "completely besides the point" to be afraid about how shitty kotlin is

ivory sleet
#

and java has also denied enhanced null control repeatedly

#

many java devs years after years have been complaining

tender shard
ivory sleet
#

especially in enterprise

ivory sleet
#

java usage is decreasing by time

ivory sleet
#

you'd use other semantics that kotlin provide also

flint coyote
#

Another good thing about kotlin is the visibility modifier "internal".
No longer forces you to do a tradeoff between visibility and package-structure. Especially useful for libs/apis

ivory sleet
#

im not saying kotlin is the ingenious solution alex

hazy parrot
#

I hate that thing in kotlin for some reason, no package-private

ivory sleet
#

but u cant deny that null is a problem in java, that kotlin has addressed better

tender shard
# ivory sleet java usage is decreasing by time

that doesn't mean it's good though.
VHS also defeated Video2000, and trump also defeated the other... okay, let's not go into that.
My Point is, just because it "won" in some election doesn't mean it's actually better.

I also don't have any strong reasons to hate on kotlin. it's probably 200581% nicer than PHP. But I grew up with java so I defend java. idk why, but I just dislike kotlin and every "feature" it introduces, I always think "well java can do it too, just in a better way"

#

so yeah I am biased

ivory sleet
#

but it decreased because kotlin addressed many of java's weaknesses

hazy parrot
#

Isn't internal module-private?

ivory sleet
#

the industry in programming rarely adopt something because its worse

tender shard
#

conclure are you drunk or sth?

ivory sleet
flint coyote
ivory sleet
tender shard
#

"the industry" led us to windows / win 32 api and directX

#

when much better alternatives were available

ivory sleet
#

the industry? that was rather the consumers

#

consumers liked windows

flint coyote
#

As someone who uses both java and kotlin on a daily basis (java for personal projects, kotlin at work) I can say that I would swap to kotlin if I was as fluent in kotlin as I am in Java. Sadly 1.5years of kotlin != 8 years of java

tender shard
#

fair enough, but still - just because "sth exists" and "has a greater market share", doesn't mean it's any better. I wanna remind that basically 100% of iOS apps are written in C# instead of kotlin (nor java)

ivory sleet
#

mfnalex I just think your argument for "i dont like ? everywhere" is flawed in many aspects
additionally the fact that kotlin fails to enhance or substitute important weaknesses of Java I totally disagree with

tender shard
#

vbut yeah I am based against kotlin and their shitty attitude towards java, which is probably why I dislike it so much

flint coyote
#

Aren't IOS apps swift?

tender shard
#

Depeds

ivory sleet
#

well I hate jetbrains marketing

#

i hate java interop kotlin provides

#

i hate the fun keyword

#

its not fun

#

never was

#

will never be

tender shard
#

XCode supports both C# and Swift, yes

ivory sleet
#

but the lang is decent

tender shard
#

And in the last years, it definitely moved to Swift, but you can still write iOS apps ini C# just fine

ivory sleet
#

oh ye swift is <3

tender shard
#

I also don't like swift, but that's a personal thing this time

#

I don't have any reasons to dislike it

#

for kotlin, I at least can bring up some things about why I dislike it lol

ivory sleet
#

ye well I like swift more than the other alternatives

#

yea

#

i like to make the argument, that kotlin is harder than java, since java has fewer ways of addressing a problem in terms of design, as opposed to kotlin where u have extension functions, first ordered functions, infix, operator overloading etc. all these things can make a code base extremely cluttered if used unrestrained and wrongly, whereas java just has the very necessary semantics and also waits an enormous time before even considering to add new features as by a means of avoiding redundancy and bloating the language

#

idk @flint coyote if u may have anything to add here since u use kotlin

torn oyster
#

how does one make the default world "world" use a void generator (through code or configurations)

ivory sleet
#

this makes java a more viable option conclusively (for large projects), inconclusively tho java is always the solution

tender shard
#

yeah anyway, the worst thing I hate about kotlin is how they managed to make such a nice, descriptive language, into something so unpredictable. e.g. imagine this, I got the following thing in java:

String surname;

Okay, I got a String, and it's a surname - that makes sense. a surname is usually a string, it would never be an integer, right?

And then there's kotlin:

surname: String

Hm. I got a surname. This time, it happens to be a string. that it's a string seems kinda unimportant, it only comes in at the second place. Is it ia number in the next udpate? I don't hope so

#

Ik it's petty

#

and now imagine you just do val Sth = sthElse

#

is this a string?

#

is it a CharSequence?

#

who tf knows?

ivory sleet
#

I think the benefit is that all the variables get aligned vertically

tender shard
#

but the type is much more important than the name

ivory sleet
#

idk, never thought about it that way actually

hazy parrot
tender shard
#

you can easily rename a var and everything still works

#

you change type? everything breaks

#

nobody cares about the name

flint coyote
#

While I do agree that you can do things a lot worse in kotlin by misusing or mixing to many features I wouldn't say that this is what makes it generally harder.
You can still not use a lot of those features and code "the java way" and you are good.
However it is true, that it's harder to "perfect" your code since there's a lot more ways to do it. Which is also why I still prefer java - java is where I know how to write clean code. I don't know all best practices in kotlin (yet)

tender shard
#

the opposite should be true

hazy parrot
#

You can return smth down the inheretance chain same as in java

tender shard
#

let's just imagine that I create a method that takes in a CharSequence, and returns the "inversed" version of that CharSequence. Ofc everyone would in java just do isth like this

public static CharSequcnce reverse(CharSequence origial) {
  // now return the reversed "string"
}

Pls tell me how this would look like in kotlin

#

oh I forgot, kotlin doesn't even have static methods lol

#

you'd need a companion object, whatver that's meant to be

#

basically it's a useless object that's only there because kotlin devs forgot to menton that not "everything" needs an instance

hazy parrot
flint coyote
#

Functions in a companion object do behave like normal static functions tho. Unless you wanna use them from java, then it gets weird if they aren't annotated

tender shard
#

Kotlin could have been so nice, but they took everything that's nice in java, and did it wrong

#

also what's the "fun" for?

hazy parrot
#

Function

tender shard
#

isn't it already obvious that it's a function?

#

what else would it be

#

oh and how do static init blocks look like in kotlin

hazy parrot
tender shard
#

I do

hazy parrot
#

It's same in typescript, no one is complaining

ivory sleet
#
inline fun CharSequence.reverse(): CharSequence {
    //
}

//then
val x: CharSequence = ...
x.reverse()
#

this is how kt devs would do it

#

probably

tender shard
#

how does a static init block look like in kotlin?

hazy parrot
#

Why would you need static init block if there is no static var

tender shard
#
class MyClass {
  static {    DoSometing(); }} ```
hazy parrot
#

You define it in companion object

tender shard
#

how?

tender shard
#

e.g. for fake enums, like the ENchantment class

#

in bukkit

ivory sleet
#
class A {
  companion object {
    //here
  }
}```
#

its not the same

tender shard
#

if it's not the same, I guess it's not the same

ivory sleet
#

thats right

hazy parrot
ivory sleet
#

it isnt meant to be also

#

but ye

tender shard
#

this for example. how would this look like in kotlin? because I truly don't understand itr

hazy parrot
#

That would just be object

tender shard
#

EnchantmentWrapper ofc has a normal constructor, it looks like this:

tender shard
hazy parrot
#
object Enchantment {
   val THORNS = Wrapper(...) 
}
ivory sleet
#

might wna annotate with @JvmStatic idr

#

but yea

tender shard
#

what's that annotation for?

hazy parrot
#

That java can see it as static

#

If you are accessing that api from java

tender shard
#

and why is that needed?

hazy parrot
#

Java static and kotlin object is not compiled to same code I would assume

#

Object acts as singleton

hazy parrot
tender shard
#

it's quite funny, evertime I discuss with someone about how shitty I find kotlin, the kotlin defenders come up with arguemtns that just make me belive that kotlin is even more shitty than I thought lol

hazy parrot
#

?

ivory sleet
#

well alex as said

tender shard
#

"oh sure, you just did sth totally normal in java? well in kotlin you gotta declare that it's a JVM static something/whatever, idk"

ivory sleet
#

the interop is shit

#

but like, kotlins way of dealing with global-"ity" encourages devs to avoid too much global state

hazy parrot
tender shard
#

there is not a single thing that kotlin ever added that java devs would find useful

ivory sleet
#

kotlin null optional operator

#

coroutines

hazy parrot
#

Coroutines

tender shard
#

I love having to add ???? question amrks? everyhwre

ivory sleet
#

u dont "have to"

tender shard
#

I have? to ? otherwise it doesn?t compile

ivory sleet
#

its an optional feature that many java devs like

tender shard
#

what's a coroutine?

#

honest questino

ivory sleet
tender shard
#

I don't know what coroutines are

hazy parrot
#

Similar to loom

#

Virtual threads

tender shard
#

loom?

ivory sleet
#

project loom

tender shard
#

erm whut 😄

#

sorry no clue

ivory sleet
#

structured concurrency api + virtual threads

tender shard
#

erm can you people pls gimme a tiny example

ivory sleet
#

threads that are not bound to os threads

#

which java threads are

#

as of now

hazy parrot
#

Basically can run millions of "threads" and also use them to suspend async call and return result without blocking main thread

tender shard
ivory sleet
#

it only uses an os thread during execution

hazy parrot
#

Coroutines are computer program components that allow execution to be suspended and resumed, generalizing subroutines for cooperative multitasking. Coroutines are well-suited for implementing familiar program components such as cooperative tasks, exceptions, event loops, iterators, infinite lists and pipes.
They have been described as "functions...

ivory sleet
#

and then the os thread can be reused for another virtual thread

hazy parrot
#

It's not specific to kotlin

#

But implemented in it

ivory sleet
#

this makes libs like netty less "interesting" also

tender shard
hazy parrot
#

Basically run smth async, wait for it to complete, when it complete resume

tender shard
#

a future

#

?

ivory sleet
#

yes, but it isnt bound to a java thread pool

#

which is bound to a pool of os threads

#

which is expensive

#

and less scalable

#

especially if u just use small tasks with short lifetime

#

like an io request

hazy parrot
tender shard
#

but you gotta wait for it anyway, I dont really understand how it's any better than a nornal thread

hazy parrot
#

You can't really suspend normal thread, as its expensive

#

You can run million of coroutines

#

As its cheap as fuck

#

Idk how, don't ask me 😄

ivory sleet
#

mfnalex read that

#

but in short its not the coroutines themselves

#

its how its implemented

#

vs how java has its current concurrency api implemented rn

tender shard
#

hm maybe i just don't need to do enough of millions of "read files" to understand the advantages that kotlin offers

ivory sleet
#

that makes kt coroutines better

ivory sleet
#

because in that regard scalability horizontally becomes urgently crucial to consider

tender shard
#

yeah I did not study CS or anything similar, maybe kotlin indeed offers great advantages over java that I just don't understand

ivory sleet
#

well, I find some stuff kotlin offers better and some worse

#

after using it judgement freely

tender shard
#

all I can tell is that I never experience ANY situation where I'd be like "oh this'd be much easier in kotlin" - for me, the opposite is true, but as said - I didnt study this, so no clue lol

ivory sleet
#

mye well

#

its not like java cant the job done by any means

#

so in essence I think ur opinion is somewhat factually valid

tender shard
#

conclure you do study CS stuff right?

ivory sleet
#

on free time yes

#

and math

tender shard
#

oh no well I meant, do you study CS stuff at an actual university or sth?

ivory sleet
#

na about to start that after summer

#

im just 18 :,)

tender shard
#

aaah nice

ivory sleet
#

yeaa

tender shard
#

damn you're so young

#

why is everyone so young here lol

ivory sleet
#

you're just old runs

tender shard
#

D:

#

inserts I AM OLD gif

flint coyote
#

I'm 24 aswell 🤷‍♂️

ivory sleet
#

oo

tender shard
#

maybe I should really look into kotlin stuff more often

ivory sleet
#

i think u should give the language a genuine try

flint coyote
#

one more year until getting older will actually feel bad

tender shard
#

but it's so annoying when you come from java

ivory sleet
#

after that, u dont have to like it

tender shard
#

everything claims to be the same but it's still so different lol

flint coyote
tender shard
#

IIRC there's a "pull request" about kotlin to add "actual" static methods - if they'd actually add those, maybe my hate for kotlin would go down by one level

buoyant viper
#

just replaced the headlight on my car

#

feeling like a mechanic girl 😼🫡💪

tender shard
#

and I'm a big maven fanboiii

ivory sleet
#

groaaadle

tender shard
tender shard
ivory sleet
flint coyote
#

And while I know how to code in kotlin I definitly got a lot more to learn there.
Jumping from Spring Boot projects to spigot plugins with Kotlin might not be that easy.
Since spring boot has done the abstraction already and in spigot you still have to create a lot of utils yourself

remote swallow
#

we have 8 versions

#

get fricked

tender shard
#

and the impact of performance between maven 3 and 4 is huuuuuuuuuuge

buoyant viper
buoyant viper
#

my passenger side light died :P

buoyant viper
tender shard
#

nice. I just got my headline replaced in my Opel (I think it's Vauxhall in USA) and it costed like 50€ lol

#

just to replace the light

remote swallow
#

bet you drive a vauxhall corsa

buoyant viper
#

damn

#

i paid like $18 for the bulb n did it in my driveway

tender shard
tender shard
buoyant viper
buoyant viper
remote swallow
#

who let 16 year olds drive

tender shard
#

yeah cars are hela expensive. my bf looked up how much it is to just do the driver's license exam, or however it's called in germany

#

3400€!!!

remote swallow
#

16 is when you start to drink

tender shard
#

wtf

flint coyote
#

the practical exam is like 100€. If you fail it you will have to take like 5 additional driving lessons which basically brings the price to 300-400€

#

I paid like 1400€ for my complete drivers license 5 years ago.
And I can believe that it can cost up to 3000€ these days. But that's not just the exam

tender shard
#

it's really gotten very expensive

#

I also paid only like 1500€ but that was like 12 years ago

#

then I did my bike license (A class) and it also was 2000€

#

my flying license (PPLA) was surpsingly cheap at 15k€

flint coyote
#

alex the license collector

tender shard
#

I wanted to become a flight instrucor, actually

#

instructor*

flint coyote
#

Why did it not work out?

young knoll
#

Afraid of heights

tender shard
#

oh many issues. first one was corona. You have to have at least XYZ hours of "flying yourself" during the last, I think, 3 years

#

I then lost my actual normal license, because I didn'f fullfil that

flint coyote
#

meanwhile you can not drive a car for 20 years and still have your license lol

sterile token
#

`

flint coyote
sterile token
#

sorry

#

shity discord get bugged

buoyant viper
tender shard
#

then later on, the authority was like "yeah okay but covid19 and stuff, bla bla" and they losened trhose restrictions a bit. So I got my "normal" license back. then I started to go get the insctructor's license done. I'm still on it, but it's also extremely expensive. you can expect to pay at least 50k€ from you rown pocket

flint coyote
tender shard
#

and then there's also my fucking alcohol addiction. I went to rehab justr a few weeks ago. the flying school doesn't know about it, all they know is that I "didnt have time" for a few weeks

flint coyote
tender shard
#

if not, it's much more expensive

flint coyote
tender shard
#

I don't know much about that

flint coyote
#

He was a lufthansa student

tender shard
#

I am not, nor will I ever allowed to be, to fly "normal" planes. I will, if at all, only be allowed to teach general aviation - that's already quite hard

#

I am only allowed t ofly those small planes, e.g. cessna 172

flint coyote
#

Luckily my passion (coding) is a lot cheaper and easier to get started with

tender shard
#

haha same

#

but flying is just awesome

flint coyote
#

I already dislike driving. Idk whether I'd like flying

tender shard
#

I'm a member in my local fly club - you pay "only" a few hunred € per months, and then you can just call them and say "Yo I#d like to get the 172 on the 17th of may for a day" or sth like that

flint coyote
#

The good thing about flying is that nobody is driving 2 meters behind me while I'm already over the speed limit lol

tender shard
#

that is true, however it's still exhausting

#

it's a bit like driving a car but there's an additrional dimension

flint coyote
#

Checking your rear mirror while driving perfectly normal and seeing another car pretty much sitting inside your trunk is just a weird feeling

#

Atleast there's no obstacles in the sky

tender shard
#

and you gotta be prepared for all kinds of failures

#

in a car, if sth goes wrong, you can just stop -

eternal oxide
#

You can in a plane too, but the end result differs 🙂

flint coyote
tender shard
#

even the situations in the simulator are fucking exhausting

#

and there you even know "nothing can go wrong"

#

on the other hand, you also know "okay but it's very unlikely this will happen in real life"

eternal oxide
#

It can't be that bad just step on the brakes before you hit the ground!

tender shard
#

yeah anyway, we e.g. tried the hudson landing (there's a movie about it), I tried it 3 times, and ofc everyone always died lol

drifting anvil
eternal oxide
#

has to work I've seen it in cartoons

flint coyote
tender shard
eternal oxide
#

I played MSFS back in 1990 something. I think I only ever managed to land a cesna once.

#

nope was in teh 80's

tender shard
#

yeah the funny thing is, you can definitely don't do it wihout instructions, but even with with simple instructions, almost everyone could do it. But the real challange is to land safely even with failures

#

I have plaid like thousands of hours in simulators before my first actual landing and I was still scared as fuck

flint coyote
#

All I know is that you want the rear wheels to touch the ground first (so you basically have to pull up a little right before the landing)

eternal oxide
#

early 1987 to be precise. I could take off ok, but landing was a no no

tender shard
#

https://www.youtube.com/watch?v=2NQGuJvSaxU here's my first ILS landing at my howm town

ILS (engl. instrument landing system)
Unter Instrumentenflug (umgangssprachlich auch Blindflug) bezeichnet man das Steuern von Luftfahrzeugen, bei dem die Fluglage ohne Bezug auf äußere Anhaltspunkte mit Hilfe von Instrumenten an Bord gehalten wird (Ausnahme - der circling approach ist ein Instrumentenanflug, der unter Sichtbedingungen durchgefü...

▶ Play video
#

(when I was still in flying scool)

#

ILS 25 haha

#

I remember the outrage when the airport wanted to extend the runway but some people complained because it'd have killed some specifies of ducks that were living there or sth

eternal oxide
#

looks like you had a lot of cross wind in that vid

torn oyster
#

how come this is just not sending to bungeecord?

tender shard
eternal oxide
#

ah

torn oyster
#
                ByteArrayDataOutput out = ByteStreams.newDataOutput();
                switch (args[0]) {
                    case "classic" -> out.writeUTF("hexhunt");
                    default -> {
                        p.sendMessage(ChatColor.RED + "Invalid game mode!");
                        return false;
                    }
                }
                out.writeUTF(p.getUniqueId().toString());
                p.sendPluginMessage(HexHuntExpansion.getPlugin(HexHuntExpansion.class), "bungee:queue", out.toByteArray());
                p.sendMessage(ChatColor.GRAY + "Finding you a game of HexHunt...");```
#

it says "Finding you a game of HexHunt..."

#

but on Bungee nothing comes through

#

bungee

    @EventHandler
    public void onPluginMessage(PluginMessageEvent e) {
        System.out.println(e.getTag());
        if (!e.getTag().equals("bungee:queue")) return;

        DataInputStream in = new DataInputStream(new ByteArrayInputStream(e.getData()));
        try {
            String channel = in.readUTF();
            UUID uuid = UUID.fromString(in.readUTF());
            ProxiedPlayer target = ProxyServer.getInstance().getPlayer(uuid);
            switch (channel) {
                case "hexhunt":
                    HexHuntServerManager hm = HexHuntServerManager.get();
                    if (hm.getServers().stream().anyMatch(s -> s.getInfo() == target.getServer().getInfo()
                            && s.getState() == MinigameState.IN_GAME)) {
                        return;
                    }
                    hm.matchmake(target);
                    break;
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }```
#

it prints random things but never "bungee:queue"

tender shard
#

isn't the actual name "BungeeCord" instead of just "buncee"?

torn oyster
#

wait hold on

#

would I need to register something on bungee's end too?

eternal oxide
#

you can register any channel you like, so long as it has a : in it

torn oyster
#

i have registered it on the spigot side

eternal oxide
#

?pmc

tender shard
#

from what I know, bungee willl forward anything you like - might be mistraken, though

torn oyster
eternal oxide
#

rem,ove if (!e.getTag().equals("bungee:queue")) return; see if you get any messages

torn oyster
#

oh yeah

#

you need to register it

#

on bungee end

eternal oxide
#

yes

torn oyster
#

welp that would be it

spare marsh
#

Does anybody know how the spigot AsyncStructureSpawnEvent was done in spigot 1.19.3? Or how I can find out how it was done.

undone axleBOT
river oracle
#

Still a wip I think right?

#

I checked a few days ago and there was still a pr related to it

#

Oh nvm must be dif event in the pr

spare marsh
earnest lark
#

would i have to make a new Event for finding if someone placeda item into an inventory or is there a way to find that out with InventoryClickEvent

kind hatch
earnest lark
#

ok i was looking at that but i didnt understand that one

stable dawn
#

does anyone know if theres a way to add additional arrow models in the resourcepack and display them? or any ideas how to implement it

earnest lark
#
            target.getInventory().setItem(event.getRawSlot(),event.getCurrentItem());
        }```
#

this is just not working

remote swallow
#

== for enums

torn oyster
#

how would i check what server a pluginmessage came from
on bungee's end

sterile token
#

Because plugin message are not sent from the server itself

#

Its a player packet, which means that the plugin messaging is sent thru the player connection

torn oyster
#
            if (e.getSender() instanceof ProxiedPlayer p) {
                ServerInfo serverInfo = p.getServer().getInfo();

                if (serverInfo == null) return;

                System.out.println("test");
            }```
#

it never prints "test"

sterile token
#

Well you can parse the player which sent it

#

And then get his server info

torn oyster
#

the thing i just sent

sterile token
#

try adding a debug to serverInfo and see if there is any output

#

Can you share your full sender and receiver code where having the issue

#

Because i cant help you much with little of it

torn oyster
#
@EventHandler
    public void onPluginMessage(PluginMessageEvent e) {
        if (!e.getTag().equals("bungee:minigame")) return;

        DataInputStream in = new DataInputStream(new ByteArrayInputStream(e.getData()));
        try {
            String channel = in.readUTF();
            if (!channel.equals("state")) return;
            System.out.println("new state received");

            String state = in.readUTF();

            if (e.getSender() instanceof ProxiedPlayer p) {
                ServerInfo serverInfo = p.getServer().getInfo();
                System.out.println(serverInfo);
                HexHuntServer server = HexHuntServerManager.get().getServer(serverInfo);

                if (server == null) return;

                server.setState(MinigameState.valueOf(state));

                System.out.println("test");

                switch (server.getState()) {
                    case IN_GAME:
                        HexHuntServerManager.get().newServer(); // create new server when game starts to maintain server level
                        break;
                }
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }```
#

so that basically is for the minigame servers to update the server manager when they have started

#

etc.

#

test never gets printed

#

but "new state received" does

sterile token
#

sout(event.getSender() instanceof ProxiedPlayer)

#

Before the second if check

#

Also why are you using plugin messaging channel?

torn oyster
#

its for my server deployment system

#

minigame

sterile token
#

If you are planning making a plugin which work with multiple servers and also need really fast server communication you can make use of redis pub-sub

#

But depends on what you are doing or will specially

torn oyster
#

eh it doesn't need to be too fast

#

it only communicates when the minigame state changes or someone wants to join

sterile token
#

Right i mention because there are some things you cant do with PMC

rough ibex
#

let's focus on what he's asking for

#

instead of immediately trying to shift him to an entirely different tech

sterile token
#

Yeah just mention it as an approach on future

#

So far have you try what i said?

.

#

sout(event.getSender() instanceof ProxiedPlayer)
Before the second if check

torn oyster
#

well i can't really test it

#

since someone is playtesting the game atm

sterile token
#

oh ok

#

So just ping me when you try it

torn oyster
#

yep

summer scroll
remote swallow
#

which is MainCommand.java:130

whole stirrup
#

How does cancelling a BukkitRunnable work exactly? Does whatever it's doing immediately get interrupted or does it have to check if it's cancelled during the task?

torn oyster
summer scroll
remote swallow
#

something on that is throwing an exception

#

Caused by: java.lang.NoSuchMethodException: java.lang.invoke.MethodHandles$Lookup.<init>(java.lang.Class,int) so im guessing its something in buy craft api

summer scroll
#

Yeah I think I need to contact them to be honest.

#

thank you

slow arrow
#

does player.setAllowFlight(false); also disable flight (if the player happens to be flying)?

undone axleBOT
humble tulip
#

Maybe not?

slow arrow
#

its like

#

such a simple question
I just don't wanna build and find out
cuz it'd be simpler just for someone to say yes/no

rigid sage
#

I'm bs at coding, how would I make a console command apply only to a certain world

humble tulip
#

Just apply it to that world?

rigid sage
#

Like /give @a but like only for 1 world and does this work for multiverse

rigid sage
humble tulip
#

You'd have the specify the world

rigid sage
#

Yea I'm dumb

humble tulip
#

Since the console isn't in a world

rigid sage
#

My brain ain't braining lol

humble tulip
#

I dont think there's a simple way to do it

rigid sage
#

Yea then I dknt think I can make the plugin

#

I wanna make an afk area, ppl in the afk area are given a gold ingot every 10 mins which is traded in for smtg

#

Smth

#

Obv with certain meta and stuff

slow arrow
#

Determine the BoundingBox of the AFK area
Every 10 minutes, iterate through all online players
if the player is in the correct world, and the BoundingBox contains the location of the player, give them the item

rigid sage
#

I really need to learn more coding before I do this, but thanks

gaunt hatch
#

Does anyone know the event for when the composter changes to bone mail when its full?

torn oyster
#

how do i change the minimum height of a world

#

i want it to go back to minimum y 0

gaunt hatch
#

That is getting the item, i mean when its full and it changes to full and complete and has the white stuff on top

slow arrow
#

Yeah

#

PlayerInteractEvent

#

get the block they clicked

gaunt hatch
#

put you dont click it when it changes

slow arrow
#

if it's composter, and it's full, then your good

#

oh I suppose hoppers exist

kind hatch
#

There's a stage where it will change the texture and play a sound. He wants that stage.

gaunt hatch
#

^ that

rigid sage
#

I'm sorry if my questions are dumb as hell, what's a bounding box and how do I check if the player Is in the correct world

slow arrow
# gaunt hatch ^ that

Yes, ik
you have to check the block itself for that. There won't be an event fired when it reaches that stage
You'll have to check the block based on InventoryMoveItemEvent and PlayerInteractEvent

gaunt hatch
#

That doesnt explain how using the debug stick or w/e can active it and make it change to full and complete

#

When it changes to stage 7 it always changes something in the backend does it with no player interaction

slow arrow
#

It isn't a separate event though

gaunt hatch
#

That doesn't fire for it

slow arrow
#

Stage 7 is a block state

#

There is no event for a change in block state

gaunt hatch
#

I can stop everythign else with a block state like crops growing

final monolith
#

Guys i was thinking here. Using reflections to access NMS codes is legal?

rotund ravine
#

Yes

kind hatch
#

Yes

remote swallow
#

yeah

final monolith
#

What i cannot do with NMS exactly?

kind hatch
rotund ravine
#

What do you want to do.

final monolith
#

A guy a time ago told me some things at using NMS isn't legal

slow arrow
final monolith
#

and i'm just trying to figure what i can/cannot do with

rotund ravine
#

Well there is really no list

#

You can do a lot

final monolith
#

Can i sell plugins/codes that uses reflections at the NMS?

kind hatch
rotund ravine
#

But yeah

#

Sure spigot will sell it for you etc.

rigid sage
#

I'm sorry if my questions are dumb as hell, what's a bounding box and how do I check if the player Is in the correct world

brave sparrow
#

Blocks, entities, etc all have bounding boxes

slow arrow
rigid sage
#

Do I need to make a config to enter coordinates on where it needs to be or can I use it straight from a java command class

brave sparrow
#

You can just compare the world directly, you don’t need to compare the name

brave sparrow
#

Can you explain more clearly what it is you’re actually trying to do

slow arrow
brave sparrow
#

?xy

undone axleBOT
rigid sage
brave sparrow
#

What are you trying to accomplish

slow arrow
brave sparrow
#

At a high level, don’t worry about implementation details right now

brave sparrow
#

What are you actually trying to do

#

Ok

#

So it depends on how you want that area to be defined

#

Is it intended to be configurable by the server owner?

#

Is it intended to be saved on server restarts?

slow arrow
#

you seem to have this lol

brave sparrow
#

Do you even want the area to be rectangular

#

Or do you want to support more complex areas

rigid sage
#

I am the owner, I'm always ready to go in and change it but i would like configuration

brave sparrow
brave sparrow
rigid sage
#

Thanks alot for helping me now btw

slow arrow
brave sparrow
slow arrow
#

"Why did you decide to become a programmer?"
"Why would you ever want the pain of debugging over your head?"

rigid sage
kind hatch
brave sparrow
#

Debugging is only a pain if you don’t know how to do it

rigid sage
#

Forget the rectangular area I'll make a world with multiverse and use that

brave sparrow
slow arrow
brave sparrow
#

If they are, give them the item

brave sparrow
# slow arrow but its still a pain

I remember in one of my college classes we had a debugging exam. Only me and one other guy finished, he’s now one of my closest friends. We always argue over who did the exam better, he finished before me but I got over a 100% because I found and fixed a bug the professor didn’t mean to include 😂

slow arrow
#

LMAO

brave sparrow
#

Wrong message lol

rigid sage
#

Laggy as hell

#

Yea

#

I cancelled if but it still did that

rigid sage
#

Also an on and off command will be executed by admins

#

If on, well yea every 20 mins it happens

brave sparrow
remote swallow
#

if you want it to be fully accurate for every 10 min that player is in the world track uuid + instant in a map and then a runnable starts for each player or run a runnable every minute to check if its been 10 minutes since saved instant then update the map and off it goes

rigid sage
#

Thanks

brave sparrow
rigid sage
#

Alr

hushed pawn
#

Does multiple worlds use multiple threads?

remote swallow
#

sadly not

rigid sage
#

Can I add the dependency of multiworldqnd add the name of the world?

remote swallow
#

mc is single threaded

brave sparrow
remote swallow
rigid sage
#

player.getWorld().getName().equals("world")I would replace world with world name right?

brave sparrow
remote swallow
#
for (Player player : Bukkit.getWorld("worldname").getPlayers()) {
    //do something
}
rigid sage
#

Ale

brave sparrow
#

Also, if you’re looping through the players in the world you don’t need to check that they’re in the world lol

rigid sage
#

Alr

rigid sage
#

And how to make it an on and off switch? I've seen this somewhere and I know it's really basic but it's been some time

remote swallow
#

create a toggle command and save if its on or off in that + having a boolean somewhere you can check, and have a runnable/scheduler that runs every X min, checks the boolean if its on runs the for loop

#

?scheduling

undone axleBOT
rigid sage
#

Alr, thanks

rare rover
#

how would i copy text in a resource and put it into my FileConfirguration?

#

never used bukkit's system before

#

kinda sucks ngl

#

i got

#
@Override
    public @Nullable FileConfiguration loadFile(@NotNull String path) {
        File file = new File(plugin.getDataFolder(), path);
        if (!file.exists()) {
            file.mkdir();
            try (InputStream in = plugin.getResource(path)) {
                Files.copy(in, file.toPath());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return YamlConfiguration.loadConfiguration(file);
    }
``` which ain't workin;
#

[22:31:39 WARN]: java.nio.file.InvalidPathException: Illegal char <:> at index 17: plugins\MobCore\D:\Testing Server\plugins\MobCore\generators.yml

kind hatch
#

What's your input file look like?

rare rover
#
    ew:
        test: "string"```
kind hatch
#

And you're trying to copy all of that into another yaml file?

rare rover
#

Yeah

kind hatch
#

Well one way I do this is with 2 instance of FileConfiguration. I just iterate over every key and set it in the first config file.

File file1 = new File("File you want");
File file2 = new File("File you want");
FileConfiguration config1 = YamlConfiguration.loadConfiguration(file1);
FileConfiguration config2 = YamlConfiguration.loadConfiguration(file2);

for (String key : config2.getKeys(true)) {
  config1.set(key, config2.get(key));
}
rare rover
#

But one is a resource?

#

Sorry should've clarified that

remote swallow
#

if you just want to save the resource in src/main/resources just use JavaPlugin#saveResource

rare rover
#

Alr, bukkit's system for this is so goofy

#

But probably will get better since I don't know it

kind hatch
#

IIRC, there is a way to convert a #getResource call to an actual file. I just can't remember what it is.

remote swallow
#

you have to convert it from input stream to an input stream reader then you can load it iirc

rare rover
#

so like?

@Override
    public @Nullable FileConfiguration loadFile(@NotNull String path) {
        File file = new File(plugin.getDataFolder(), path);
        if (!file.exists()) {
            file.mkdir();
            plugin.saveResource("generator.yml", false);
        }
        return YamlConfiguration.loadConfiguration(file);
    }```
remote swallow
#

yeah

kind hatch
rare rover
#

doesn't create it?

#

hmm

remote swallow
#

do you just want it in datafolder

rare rover
#

ye

remote swallow
#

if yeah, dont take a path and just set the child as "generator.yml"

rare rover
#

my bad

#

okay now

#

it create's file but nothing's in it

#
@Override
    public @Nullable FileConfiguration loadFile(@NotNull String path) {
        File file = new File(plugin.getDataFolder(), "generator.yml");
        if (!file.exists()) {
            try {
                file.createNewFile();
                plugin.saveResource("generator.yml", false);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return YamlConfiguration.loadConfiguration(file);
    }```
#

wait

#

would i have to save it?

kind hatch
#

#saveResource() takes the file you provide in the jar and copies it to disk. It will overwrite any modifications made if you make the boolean true.

remote swallow
#

is the generator.yml actually in your jar

rigid sage
#

I know what scheduler is, don't understand runnables tho? Is runnables a way to loop? And the delay for looping is in ticks right?