#dev-general

1 messages ยท Page 461 of 1

sweet cipher
jovial warren
#
fun spin(producer: (Thread) -> KryptonServer): KryptonServer {
    val reference = AtomicReference<KryptonServer>()
    val mainThread = Thread({ reference.get().start() }, "Server thread")
    mainThread.setUncaughtExceptionHandler { _, exception -> LOGGER.error(exception) }
    val server = producer(mainThread)
    reference.set(server)
    mainThread.start()
    return server
}
```this should be the way I instantiate `KryptonServer` now
onyx loom
#

as this PRINCIPLE states: a class should REPRESENT ONE thing and ONE thing only !!! in your "practical" example, this is clearly not practical at all because you are VIOLATING the principle by representing many things with one class !!!

#

nah jokes, im just chatting shit now

static zealot
#

I guess you did do this for CombatStats

#

so I'd assume you are

onyx loom
#

wha

oak raft
onyx loom
#

my classes are all separate

oak raft
#

reminds me that you're british

jovial warren
#

who thinks that spin good

onyx loom
#

well YES because i AM BRITISH !!!

#

๐Ÿ˜Š

static zealot
tropic mountain
jovial warren
#

nah using spin will get me a big fat Copyright (c) 2009 Mojang AB

onyx loom
#

what is spin

#

i is confusion

sweet cipher
#

Its the opposite of spun

onyx loom
#

oh never saw this

jovial warren
#

Kotlin translation of MinecraftServer.spin

static zealot
#

When krypton will take over the world they'll try and take you down if you use that. Don't give them the advantage

onyx loom
#

fun youSpinMeRightRound

jovial warren
#

you spin up a Minecraft server

oak raft
#

So my plugin doesn't show up in /pl

#

and it shows this same error

static zealot
#

did you relocate

#

or use PDM?

oak raft
#

wdym relocate

obtuse gale
#

did you shade the lib?

static zealot
#

shade that's what I meant

oak raft
#
shadowJar {
    relocate 'me.mattstudios.mf', 'me.remence.minecraftchallenges.mf'
}
#

I have that

obtuse gale
#

you have to run gradlew shadowJar instead of gradlew build

static zealot
#

and how did you build?

#

^^^

#

what Emily said

oak raft
#

Where do I see that? usually I build through the gradle menu

obtuse gale
#

how

#

step by step

#

exactly

onyx loom
oak raft
onyx loom
#

shadowJar button

obtuse gale
#

yeeeeeeeeeeeeeee

oak raft
#

okie thank you

obtuse gale
#

tf is "knows" lmao

onyx loom
#

who knows

static zealot
#

it always knows

onyx loom
#

ha ha

#

get it !!!

oak raft
#

Like I'm supposed to know thonking

obtuse gale
#

sorry Kaliber, I don't get it

static zealot
# onyx loom get it !!!

yeah it was funny. Took me a second to get it but damn when I got it I couldn't stop laughing

ocean quartz
static zealot
#

only smart people get it

dawn hinge
#

๐Ÿฆ

obtuse gale
#

is that the "only the shadow knows" or something like that?

sweet cipher
onyx loom
#

lol

obtuse gale
#

lmao

obtuse gale
#

that's cool

jovial warren
#

pfff

#

I've seen people make entire first person shooter games using nothing but a terminal and ASCII text

oak raft
#

So I'm using the mf-cmd obviously, and when I type my default command and gibberish I get this error

old wyvern
#

Um

oak raft
#

Is there a way to customize this?

static zealot
old wyvern
#

Discord just went down for me for like 10 mins

#

Couldnt connect

jovial warren
oak raft
static zealot
#

Remence have you tried reading the wiki? xD

oak raft
#

I haven'

jovial warren
#

the way it works

static zealot
oak raft
#

I haven't read it all ๐Ÿฅฒ

jovial warren
#

it handles circular dependencies very well

oak raft
#

What's the point of mf-msg

onyx loom
#

messages lib that supports markdown in mc

forest pecan
#

lightweight

static zealot
#

in mc

#

so __message__ would be italic etc.

#

cool project but I personally don't use it for my plugins. All I need is hex

#

also gradients

#

I think

jovial warren
#

comes from vanilla

#

it's a good way to reference something though isn't it?

static zealot
#

yo @ocean quartz when is MF-Config coming to the wiki?

oak raft
#

Can I use multiple Annotations?

ocean quartz
old wyvern
#

It doesnt look like it needs to be an atomic reference

ocean quartz
jovial warren
#

yeah could probably be a lateinit var

onyx loom
static zealot
oak raft
#

How would that look like

static zealot
#

where nwo its trying to act like a person

#

or something

onyx loom
#

well it depends what annotations ur after

static zealot
#

๐Ÿ˜ฎ

ocean quartz
#

Yeah

oak raft
onyx loom
#
@Permission("maincommand.sub")
public void subcommand(blah)```
for example
static zealot
oak raft
#

Can I not use @Permission for the default command?

static zealot
#

u can

oak raft
#

So why is it rejecting me

static zealot
#

ugh

jovial warren
#

use it on the method?

static zealot
#

you need for the @Default one

#

not for the class

#

for the method

oak raft
#

oh

static zealot
#

yeah

oak raft
#

so @Command always stays alone

#

?

old wyvern
# jovial warren yeah could probably be a lateinit var

Why not just

fun spin(producer: (Thread) -> KryptonServer): KryptonServer {
    val server = producer(mainThread)
    val mainThread = Thread({ server.start() }, "Server thread")
    mainThread.setUncaughtExceptionHandler { _, exception -> LOGGER.error(exception) }
    mainThread.start()
    return server
}
static zealot
#

not necesarely

ocean quartz
static zealot
#

you can use Alias and other stuff for it

old wyvern
#

I dont see a benefit of using atomic there

static zealot
jovial warren
onyx loom
#

annotations must be applied to the specific cases, e.g @Command annotates classes, @SubCommand annotates a method etc

old wyvern
#

Yes Im comment on vanilla's usage as well

oak raft
#

what's the website again

#

for the docs

old wyvern
#

Was this decompiled?

oak raft
#

?mf

compact perchBOT
static zealot
#

Man I forgot I even have a website... Now I want to go back at html css js ๐Ÿ˜ข

ocean quartz
#

Use react, it's pretty fun

onyx loom
jovial warren
#
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverProducer) {
    AtomicReference<S> serverReference = new AtomicReference<>();
    Thread serverThread = new Thread(() -> serverReference.get().runServer(), "Server thread");
    serverThread.setUncaughtExceptionHandler((thread, exception) -> LOGGER.error(exception));
    S server = serverProducer.apply(serverThread);
    serverReference.set(server);
    serverThread.start();
    return server;
}
```here's vanilla's btw Yugi
onyx loom
#

WHAT

#

WHY was my message deleted

old wyvern
jovial warren
#

yes, but I fixed it

old wyvern
#

Thats probably it

jovial warren
#

there is no way that a compiler would create an AtomicReference if it didn't need one

static zealot
onyx loom
static zealot
#

the logs show nothing

onyx loom
#

what in the fuck

static zealot
#

oh that one is still here

old wyvern
#

Not the compiler, but rather the decompiler may

static zealot
onyx loom
#

i am so confused rn

jovial warren
static zealot
ocean quartz
old wyvern
#

Atleast I assume its not the compiler

old wyvern
onyx loom
#

it literally just deleted on my screen, i send another message and it comes back

#

sus

old wyvern
#

let me know what you find

onyx loom
#

ok but matt answer my question ๐Ÿ™‚

#

will this happen ๐Ÿ™‚

static zealot
#

already exists

ocean quartz
jovial warren
#

bytecode from both deobfuscated and even the obfuscated one use AtomicReference

static zealot
#

man I love Glare's web page

ocean quartz
#

Same, it's really nice

jovial warren
#
new java/util/concurrent/atomic/AtomicReference
dup
invokespecial java/util/concurrent/atomic/AtomicReference.<init>()V
astorel
static zealot
#

I think I'll steal it and say I had it before him

old wyvern
#

hmm

#

weird

static zealot
#

Mine is not bad so far but I feel like its so crowded for no reason... I have no projects to actually display on there xD

#

so its just a bunch of Lorem Ipsum projects

#

xD

old wyvern
#

Make a few blitz

old wyvern
#

wow

#

uh

#

ban?

static zealot
# old wyvern Make a few blitz

well I would only display stuff that actually wold be useful there. And I've got no idea what to make that will be usefull xD

old wyvern
#

@sacred hollow <- this dude

onyx loom
#

nice ๐Ÿ‘

obtuse gale
#

lol rip

static zealot
#

@chilly zenith or @frail glade whichever of you are around

#

please ban.

#

thank you

obtuse gale
#

they gone

old wyvern
#

banned

jovial warren
old wyvern
#

lit

chilly zenith
#

what

jovial warren
#

so useful

old wyvern
#

oh wait

static zealot
#

not banned

#

tho

#

...

#

they left

old wyvern
#

kali is suppourt in training as well?

#

๐Ÿ˜ฎ

static zealot
onyx loom
#

๐Ÿ˜‚

old wyvern
#

gg

onyx loom
#

took u all day to nice lol

old wyvern
#

I didnt notice the color

jovial warren
frail glade
#

Poof.

static zealot
#

ty grand judge

old wyvern
#

Ya'll are in all shades everyday

static zealot
#

oh nvm

#

ty glare

old wyvern
#

Pink yellow green blue

#

god knows

onyx loom
#

hmmmm

old wyvern
#

xD

jovial warren
#

gets ignored again

#

xD

old wyvern
#

๐Ÿ˜”

onyx loom
#

sendMessage is the same bardy

jovial warren
#

no look at the class

#
public LightningStrike strikeLightning(@NotNull Location loc, boolean isSilent) {
    throw new UnsupportedOperationException("Not supported yet.");
}
```lol
jovial warren
onyx loom
#

yeah

hallow crane
#

That just means not implemented

#

Usually means it's overwritten

onyx loom
#

๐Ÿฅฒ

jovial warren
#

also can we just address md_5's awful fetish for just not letting anything fail silently? lol

onyx loom
#

yeah its overwritten, but still... just why lol

hallow crane
#

That's the API

#

not the actual server

#

What else are you supposed to do?

#

Leave it empty

onyx loom
#

yes

hallow crane
#

well I guess you could do that

jovial warren
#

I swear Spigot isn't overridden

hallow crane
#

Dude it is

obtuse gale
#

it is...

hallow crane
#

Anything you see on the API

obtuse gale
#

otherwise no one would ever be able to send components

#

lmao

hallow crane
#

is overwritten

onyx loom
#

bardy, everytime u send a message, do u get a UOE lol, didnt think so

jovial warren
#

why don't they make it an interface then?

hallow crane
#

They just reference what is implemented on the server side

jovial warren
onyx loom
#

smooth brains bardy, smooth brains

jovial warren
#

should be an interface if it's always overridden and requires all of the defined methods to be overridden

oak raft
#

So how can I get somebody to type a players name after the default command

hallow crane
#

that doesn't fit the structure of what is actually on the server side

forest pecan
#

md5 4head tho

oak raft
#

Would I still use a subcommand?

oak raft
#

but I'm not sure if that's what I need to be using

hallow crane
forest pecan
#

get all players on the server, and get their names

#

then override the onTabComplete method

#

and return that

jovial warren
hallow crane
#

CraftWorld isn't World though

#

World is World

jovial warren
#

it's an implementation of world

hallow crane
#

Okay, but we're not talking about implementations

jovial warren
#

yes we are

#

how are we not?

hallow crane
#

just the reference to the existing object in the api vs the server

#

implementations are children to the existing object

jovial warren
#

Spigot should be an interface in the API

#

there's no reason to not have it be an interface

hallow crane
#

Okay sure

#

that's not what im arguing

#

You may be right

#

in fact I agree

#

but md4 0head

jovial warren
#

what are you arguing then?

hallow crane
#

the reason it's not an interface on the api side

#

is because it's not on the server side

jovial warren
#

as I said earlier though, that literally makes 0 sense lol

obtuse gale
#

how is it not.. it's extended on the server impl and every method overridden lmao

jovial warren
#

^^^

onyx loom
#

hold on a second

jovial warren
#

this is just md5 being a 3head as usual

onyx loom
#

who in their right mind made it in an inner class in the first place?

jovial warren
#

m
d
5

onyx loom
#

like oh my god

#

im deeping it

jovial warren
#

oh come on

onyx loom
#

it makes 0 sense

jovial warren
#

who else would it be?

#

md5 = 3head

onyx loom
#

im losing braincells just looking at this now

forest pecan
#

md5 = a stupid hashing algorithm orange slime

hallow crane
#

md0

jovial warren
#

one thing I do love when I browse through Paper sometimes though is that all of his commits show up as just "5" in the blame lol

hallow crane
#

someone should really make a new functional mc server implementation... :p

jovial warren
forest pecan
#

sometimes, I am super lazy in my commits and literally name them "1"

#

or "2"

forest pecan
#

or "a"

forest pecan
onyx loom
#

OH NO

jovial warren
#

in Kotlin*

onyx loom
#

SOMEONE said it

hallow crane
forest pecan
#

lol

hallow crane
jovial warren
old wyvern
#

ah

hallow crane
#

does my plugins for krypton have to be kotlin or can they be java

old wyvern
#

gimma a min

jovial warren
#
val server = producer(mainThread)
val mainThread = Thread({ server.start() }, "Server thread")
old wyvern
#

Yea my bad

forest pecan
#

Server#stop

hallow crane
#

Can I use the api to do something like item.addNbt(tag);

onyx loom
#

i think bardy is trying to make it java compatible

sweet cipher
jovial warren
oak raft
#

What's up with @Command not being recognized?

ocean quartz
forest pecan
#

perhaps if you wanted to add other roles

oak raft
#

import me.mattstudios.mf.annotations.*; right?

sweet cipher
jovial warren
distant sun
#

import *;

oak raft
#

Why not use wildcard

jovial warren
#

confusion and ambiguity

ocean quartz
#

Post your entire code

compact perchBOT
#
HelpChat Paste

Please use a paste service to share configs, errors, code and long logs.
โ€ข HelpChat Paste

oak raft
ocean quartz
#

import org.bukkit.command.Command;

jovial warren
#

not sure whether NBT should be an implementation detail yet or not

oak raft
jovial warren
#

depending on the server is really easy though anyway, and even encouraged if you want implementation-specific stuff or to make your own domain-specific optimisations

pale shell
#

@onyx loom fix bug

onyx loom
#

what bug

#

eh

pale shell
#

Autosell

#

Broke

#

Reee

jovial warren
#

#bestbugreportof2021

onyx loom
#

๐Ÿคจ

#

what are u saying

pale shell
#

It's broken

onyx loom
#

ok cool

pale shell
#

If no work

onyx loom
#

ok cool

pale shell
#

It no work

onyx loom
#

ok cool

pale shell
#

You gonna help fix bug?

jovial warren
onyx loom
pale shell
#

NO

onyx loom
#

if u have a genuine issue with autosell, use #autosell

pale shell
#

I almost clicked it

#

But it's to do with the api and such

forest pecan
#

ig

pale shell
#

So it's dev stuff

onyx loom
oak raft
#
@SubCommand("test")
@Completion({"#players", "#range:1-20"})
public void tabExample(final CommandSender sender, final Player player, final Integer number) {
}

So if I use this, would Player player be the player selected in the completion?

forest pecan
#

wait

#

i meant like

#

hm

#

I am wondering tho, are you using this field a lot tho?

jovial warren
sweet cipher
forest pecan
#

yea

onyx loom
forest pecan
#

cause i feel like it doesnt need to be a singleton?

sweet cipher
#

Well not yet

#

It's always going to be the same

jovial warren
forest pecan
#

hm

onyx loom
#

yes

oak raft
#

I'd only take the player

visual hatch
#

Somebody got experience with DeluxeCombat?

jovial warren
#

yeah nvm, I got confused Remence

oak raft
#

I just wanna know if it's gonna be whoever is selected in the completion

jovial warren
compact perchBOT
#
FAQ Answer:
ยป Give the helpers some details
ยป Ask suitable questions
ยป Be polite
ยป Wait

Source

visual hatch
#

?help

compact perchBOT
#
FAQ Answer:
ยป Give the helpers some details
ยป Ask suitable questions
ยป Be polite
ยป Wait

Source

obtuse gale
#

..

jovial warren
#

read it

visual hatch
#

Details sry,

#

Yeahh i did that

jovial warren
#

also not asking to ask

visual hatch
#

1 week ago

pale shell
#

Spigot linking doesn't exist?

onyx loom
#

it does

#

iignore me, i read that as deluxechat tho

visual hatch
#

Still not accepted.

pale shell
#

Why can't I see it

onyx loom
jovial warren
#

DeluxeCombat isn't even a HelpChat thing

onyx loom
visual hatch
#

DeluxeCombat send me to here tho

#

Kaliber i did that, one week ago.

#

Cant see any services

#

To talk on for premium.

onyx loom
#

?

visual hatch
#

My bad sheesh,

pale shell
#

I wonder who's gonna make it though SIT.

ocean quartz
pale shell
#

I can name someone who I think won't.

onyx loom
#

ur right, none of us will :kekw:

pale shell
#

Bm likely will

hallow crane
#

zSkcTz3

onyx loom
#

nice one yako

hallow crane
#

thats the discord

#

for deluixecomabast

#

deluxecahtm

#

deluxecombat

onyx loom
#

stroke

hallow crane
#

eyboard

#

keybvoard

#

keyboard

onyx loom
#

second stroke

hallow crane
#

no stroke

#

just type

onyx loom
#

ok ๐Ÿฅฒ

hallow crane
#

does /dc have conflict with /dc (deluxecombat & deluxechat)?

pale shell
#

@prisma wave I'll send some ยฅ if you know a fix btw ;)

#

Kaliber could you help at all

onyx loom
onyx loom
pale shell
#

If you get denied, is there no feedback on why you got denied?

onyx loom
#

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

#

are u implying that im getting denied ๐Ÿคจ

pale shell
#

I'd like to know why I was denied so I can work on my flaws.

onyx loom
#

ask cube ig

pale shell
#

I knew it was gonna be denied tbhreversed_fingerguns

oak raft
#

Hey, so I wanna make a command where you type a command with a players name, and that player will get a message with the original command senders name. For example I type /helpchat Kaliber and kaliber gets a message saying "Remence is in HelpChat"

#

So how would I do this with mf-cmd

onyx loom
#

send the player arg a message of the CommandSender's name

distant sun
#

(Player sender, Player target)

prisma wave
pale shell
#

But for real I'm struggling on the plugin because it is so temperamental with the selling

jovial warren
#
@Default
fun default(sender: Player, target: Player) {
    target.sendMessage(Component.text("${sender.name} is in HelpChat!"))
}
```ez
onyx loom
#

Component.text ๐Ÿ˜‚

prisma wave
#

ewwwwwww

prisma wave
#

not enough monads

onyx loom
#

ikr

jovial warren
onyx loom
#

using adventure in kotlin is yuck

jovial warren
#

I agree

onyx loom
#

we need a kotlin dsl

jovial warren
#

I'm trying to make that a bit better though

#

we have one

onyx loom
#

where

jovial warren
#

adventure-extra-kotlin

onyx loom
#

o

jovial warren
#

not all that useful tbh

#

text { content("Hello World!") } vs text("Hello World!")

onyx loom
#

wait where is this

#

i can find maven repos to it but not a gh

jovial warren
#

also, the DSL won't show up nice colours because kashike refuses to use DSL marker on it because "there's no official documentation saying you should use it on functions"

jovial warren
onyx loom
#

is there no source for this?

jovial warren
#

oh you want source

#

that came from the top of my head lol

onyx loom
#

yeah unfortunate

#

404 sad_fingerguns

pale shell
#

I might put some money down for someone who knows a fix to this thing I'm having issues with.

jovial warren
#

fixed

pale shell
#

Idk what a fair amount would be, it should be a small fix tho.

onyx loom
#

or just #development and actually state what u need help with

pale shell
#

I'd pay someone to sort it

onyx loom
#

ah it was hidden in plain sight bardy

#

i went on the main repo but couldnt find the module

jovial warren
#

lol

prisma wave
onyx loom
#

lmao

old wyvern
oak raft
#

Why are my colour codes not working in my command?

#

This is my util

#
public class ChatUtil {

    public static String color(String message) {
        return ChatColor.translateAlternateColorCodes('&', message);
    }

}
pale shell
#

I put a request paid thing out, I'll see who wants the money ๐Ÿ‘

onyx loom
#

are u calling the method remence

old wyvern
#

yea no

obtuse gale
#

might help to mention what the issue actually is

onyx loom
#

lol

#

said so many times now ๐Ÿ˜ฉ

pale shell
#

It's the stupid citizens plugin

oak raft
onyx loom
#

yes very stupid plugin

pale shell
#

The thing has a mind of its own

onyx loom
#

well yea but u still have to call the method to whereever ur using the colour codes remence

old wyvern
#

amazing

pale shell
#

You tell it to register something and it does something totally different

old wyvern
#

Thats not a issue, thats an invention! we have sentience!

oak raft
#

thanks

#

this makes a bit more sense

obtuse gale
#

lol

onyx loom
#

i see nothing wrong.

oak raft
#

Since I'm op, the &4 is overriding the &e, how can this be fixed?

onyx loom
#

are u using displayname or smth?

oak raft
#

It's like you're on my computer ๐Ÿ˜ณ

onyx loom
#

lol

#

Player#getName() should just return their name unformatted, unlike getDisplayName()

oak raft
#

Makes sense

#

Thanks

onyx loom
oak raft
#

Idk you're the support guy

onyx loom
#

nah this is where the "in training" comes in

oak raft
#

๐Ÿคซ

onyx loom
#

someone needs to train me

oak raft
#

I'll train you ๐Ÿ–๏ธ

onyx loom
#

๐Ÿ˜ณ

oak raft
#

Also

#

Is there a way to have my @Completion({"#players"}) the subcommand itself?

#

or can I just leave it with @Completion and it'll be a subcommand

onyx loom
#

eh

ocean quartz
#

Huh? What does completion have anything to do with subcommand?

oak raft
#

Ok like

#

If I have /greet as my default command

#

I could use /greet <player right? because of my @Completion({"#players"})

#

So does the Completion only take effect after the default command by itself?

onyx loom
#

probably

oak raft
#

If I have a subcommand

#

so /greet other

#

Ok this is getting annoying to explain

onyx loom
#

probably

oak raft
#

Yeah but I wanna make sure you understand what I'm talking about ๐Ÿ˜…

#

Meh, if something goes wrong then I'll know

static zealot
#
@Default
public void default(CommandSender sender, @Completion("#players") Player target) {
  // Greet Target
}```
oak raft
#

Um

#

Does the order of the args in default matter?

gusty glen
#

When ur class is over 1k lines and you know you should refactor it, buuuut

ocean quartz
oak raft
#

?mf

compact perchBOT
gusty glen
#

*almost 1k

oak raft
#

Wait mf-config is actually coming out?

#

I was joking when I asked about that ๐Ÿ˜ณ

onyx loom
#

its already made for the most part apparently

oak raft
#

Nice

#

What could be after config? thonking

onyx loom
#

MF-Database ๐ŸŒš

#

ever heard of hikari? nah mf-db

sweet cipher
#

MF-Web Editor or whatever itโ€™s called

#

Copy+paste luckperms

old wyvern
#

MF-Spigot

lost forge
#

MF-Bungee

sweet cipher
#

MF-Krypton

cinder flare
#

MF-Minecraft

sweet cipher
#

MF-IP Grabber

half harness
#

intellij's duplicate checker is a bit...

oak raft
#

MF-Valorant fingerguns

gusty glen
half harness
forest pecan
#

MF-pp

obtuse gale
#

Therefore you hate it

old wyvern
#

Because Kotlin bad, haskell good

onyx loom
#

haskell has ?:

old wyvern
#

Maybe monad

onyx loom
#

infact, haskell has any symbol!

old wyvern
#

Ofc

#

๐Ÿ˜Œ

obtuse gale
#

Hold on a second ...

old wyvern
#

Yea?

onyx loom
#

๐Ÿคจ

obtuse gale
#

Okay done

old wyvern
#

Umm

onyx loom
#

troll

old wyvern
#

Lol

onyx loom
#

i was waiting for u to say smth then go to sleep

old wyvern
#

I thought there was a haskell objection coming

#

Good for you

obtuse gale
#

I wanted to check something on the internet but my ISP is betraying me today ๐Ÿฅฒ

old wyvern
onyx loom
#

now ive missed out on 7 minutes of sleep ๐Ÿ˜”

old wyvern
#

Ive missed out on 7 mins of pretending I can sleep

#

Its almost 5 am

#

Class in an hour

#

๐Ÿ˜ซ

onyx loom
#

that sounds great

oak raft
#

dude

onyx loom
#

stay up for class!

oak raft
#

you're telling me that your class starts a t 6AM?!

onyx loom
#

u make a good point

old wyvern
onyx loom
#

oh yeah

#

living in qatar lessons in india correct

old wyvern
#

Yes

#

So there its at 8:30

onyx loom
#

makes sense

oak raft
#

You live in qatar but go to school in india?

onyx loom
#

he walks from qatar to india every day, its a small journey

old wyvern
#

My uni is in India, my family is in qatar so I returned there coz we cant stay at uni coz corona

oak raft
#

Ah that makes sense

onyx loom
#

yugi ping me again with that emoji pls

obtuse gale
onyx loom
#

i didnt get a noti from ur ping emily ๐Ÿ™
my phone had the invalid emoji icon in the notification :smiling_face_with_tear:

#

terrible phone doesnt have latest Android/ emojis ๐Ÿ˜ซ

oak raft
#

How to give player an item ๐Ÿฅฒ

#

yo?

lost forge
#

get the player, get their inventory, additem

oak raft
#

you're the luckperms guy

#

you helped me transition from ultrapermissions to luckperms lol

#

anyway thanks

lost forge
#

lol

oak raft
#

What's this itemstack stuff I'm hearing about though?

lost forge
#

The ItemStack is the time you want to give to a player

oak raft
#

?materials

compact perchBOT
oak raft
#
    @Default
    @Permission("challenges.sword")
    public void defaultCommand(final Player player) {
        player.getInventory().addItem("DIAMOND_SWORD");
    }

Does this look wrong?

#

There's a red line under ("DIAMOND_SWORD")

#

Says cannot resolve method

obtuse gale
#

You need to create an ItemStack from the Material, then add the item to the player inventory

ItemStack itemStack = new ItemStack(Material.DIAMOND_SWORD);
player.getInventory().addItem(itemStack);
oak raft
#

What if I wanted to do a bunch of items?

#

Would I have to create an itemstack from each material?

#

Surely not

half harness
#

you can loop/streams

oak raft
#

hmm

#

ok

half harness
#

if you want to convert List<Material> -> List<ItemStack>

oak raft
#

Okay

#

Well how about naming the item?

#

or giving it lore

half harness
#

getItemMeta

ocean quartz
#

ItemMeta

obtuse gale
#

Oh boy ItemMeta....

ocean quartz
#

๐Ÿ˜ฌ

obtuse gale
#

What a dark zone

lost forge
#

lol

oak raft
#

What's wrong with ItemMeta

obtuse gale
#

Null checks, null checks everywhere

#

e v e r y w h e r e

ocean quartz
#

Unnecessary bullshit everywhere

oak raft
#

So what's the replacement

ocean quartz
#

None

oak raft
#

Yikes

ocean quartz
#

You suffer

#

And you like it

oak raft
#

๐Ÿฅฒ ok

obtuse gale
half harness
#

:smiling_face_with_tears:

ocean quartz
#

You can come here and bully people as a coping mechanism

oak raft
#

So basically @onyx loom

#

Oh no

#

Kaliber is gonna have anti ping soon ๐Ÿ˜”

ocean quartz
#

Anti ping only works on support channels

oak raft
#

I guess so

obtuse gale
ocean quartz
#

the neglected son

obtuse gale
#

๐Ÿ™

#

enums are so damn misused lol

#

A heap bunch of crap that would be waaaaay better replaced with generics and registries

oak raft
#

I thought I could have annotations as args ๐Ÿคจ

#

Ig not

ocean quartz
#

Annotations as args?

oak raft
#

Yeah someone told me I could

#

I forgot who

ocean quartz
#

Wdym by that?

oak raft
#
    public void swordOther(final Player player, final Player target, @Completion({"#players"})) {
        player.sendMessage("yes");
    }
#

Basically I just want a command where you type the default command, and then any online player name

#

But I think I know how to do it

ocean quartz
#

That makes no sense lol
swordOther(final Player player, @Completion("#players") final Player target)

oak raft
#

Yep I realize that now

#

But that's what I was told ๐Ÿคทโ€โ™‚๏ธ

#

Do I need a seperate method for lore or no?

#

Because I'm seeing these examples on spigot have these giant methods to add lore

ocean quartz
#

d;spigot ItemMeta#setLore

ruby craterBOT
#
void setLore(@Nullable List lore)```
Description:

Sets the lore for this item. Removes lore when given null.

Parameters:

lore - the lore that will be set

ocean quartz
#

Ayyy, working fine

lost forge
#

Looking good

#

Is it responsive ๐Ÿ˜‰ ๐Ÿ˜›

oak raft
#

What's that for?

old wyvern
#

ayy

ocean quartz
#

Not much right now, well it's kinda responsive since Material UI is responsiveish by default

old wyvern
#

looks great

ocean quartz
oak raft
#

That's awesome

old wyvern
#

You moved from kotlin react to typescript react?

oak raft
#

When I do the sword command, it gives me a diamond sword but it's not named, why is that?

    @Default
    @Permission("challenges.sword")
    public void defaultCommand(final Player player) {
        itemStack.getItemMeta().setDisplayName(ChatUtil.color("&cThis sword belongs to &4" + player.getName()));
        player.getInventory().addItem(itemStack);
        player.sendMessage(ChatUtil.color("&6There's your sword kid."));
    }
ocean quartz
#

Yeah, Kotlin react was very limiting since most things aren't compatible yet
The most important was material ui, which I can't live without anymore

half harness
#

getItemMeta returns a copy

ocean quartz
#

Typescript is odd

old wyvern
#

guess what else has material ui?

#

and is pretty much like react, but much better

ocean quartz
#

Oh?

oak raft
#

ohh thanks dkim

old wyvern
#

Elm

#

๐Ÿ˜Œ

ocean quartz
#

Ooh that's pretty cool, Vue also has it but isn't compatible with Vue 3 yet

old wyvern
#

๐Ÿ˜ฎ

ocean quartz
#

This indentation hurts me

oak raft
half harness
#

..give the item?

oak raft
#

but it doesn't let me this way

#

Like I did before

half harness
#

huh?

#

just add an extra line

old wyvern
#

Actually that convention may have derived from ML

#

Im not sure

#

But its actually quite nice to use

half harness
#
    @Default
    @Permission("challenges.sword")
    public void defaultCommand(final Player player) {
        final ItemMeta meta = itemStack.getItemMeta();
        meta.setDisplayName(ChatUtil.color("&cThis sword belongs to &4" + player.getName()));
        itemStack.setItemMeta(meta); // btw where is the "itemStack" variable?
        player.getInventory().addItem(itemStack);
        player.sendMessage(ChatUtil.color("&6There's your sword kid."));
    }
ocean quartz
#

@oak raft Imagine messing with ItemStacks like modifying someone's DNA, you extract their blood (getItemMeta), modify it (do your changes), then you need to inject the blood back in the person (setItemMeta), then they die

half harness
#

interesting example ๐Ÿ‘€

oak raft
#

Very interesting ๐Ÿ‘€

old wyvern
#

?paste

compact perchBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use one of these:
(However we do prefer if you used our paste :))
โ€ข HelpChat Paste - Usage
โ€ข Hastebin

oak raft
#

But also very helpful

ocean quartz
lost forge
ocean quartz
#

And at the end of the day, it's all suffering

old wyvern
#

It supports indentations as an alternative like haskell

oak raft
#

Thanks to you both

old wyvern
#

I've only actually tried it once

ocean quartz
#

That's actually not bad, it's kinda similar to Kotlin react

#
div {
  h1 {
    + "Title"
  }
}
old wyvern
#

yea I feel like its core concept is pretty much that of react, it just builds onto that

#

Here you dont control anything, you define the view once, and then the only thing you can do is modify the model on events

ocean quartz
#

Does it compile to wasm?

old wyvern
#

Compiles to js I think

ocean quartz
#

That's actually pretty cool

old wyvern
#

yea its really nice

#

The compiler is actually much more helpful than ghc

#

It pretty much instructs you what to do to fix something xD

ocean quartz
#

I'll tell you right now, fuck React's errors

#

They make no sense

old wyvern
#

"Seems you mispelt Lsit. Maybe you meant: List or Lisp"

#

"Cant find Model in current project scope, Maybe you want to depend on x?"

old wyvern
ocean quartz
#

React be like:

Error: Objects are not valid as a React child (found: object with keys {children}). If you meant to render a collection of children, use an array instead.

#

render a collection of children
I'm sorry but I don't collect children

obtuse gale
#

Wait for about 20~30 years and you will get started

old wyvern
#

imagine having runtime exceptions ๐Ÿ˜Œ

ocean quartz
#

Someone please shoot me

#

Just spent 15 minutes trying to find why the css wasn't working, I didn't apply the class ๐Ÿฅฒ

lost forge
#

lol

#

I don't know how many times I've done that...

oak raft
#

Hey matt, it's completely valid to only have @Cmpletion({'#players'}) as an annotation right?

ocean quartz
#

Yeah

ocean quartz
oak raft
#

interesting

#

By any chance do you know why this method isn't being recognized? When I type the default command as well as a player name I want this to run but instead I get "This command does not exist"

#
    @Completion({"#players"})
    public void swordOther(final Player player, final Player target) {
        meta.setDisplayName(ChatUtil.color("&cThis sword belongs to &4" + target.getName() + "&c."));
        lore.add(ChatUtil.color("&cGiven to &4" + target.getName() + " &cby " + player.getName()));
        itemStack.setItemMeta(meta);
        target.getInventory().addItem(itemStack);
        player.sendMessage(ChatUtil.color("&6Sword successfully sent."));
        target.sendMessage(ChatUtil.color("&6Sword received from " + player.getName()));
    }
ocean quartz
#

Oh, i mean yeah you need either @Default or @SubCommand those are required

oak raft
#

Ah okay that makes sense

#

Do I need to fill the SubCommand() value though? I don't want another word besides from the target player name

ocean quartz
#

Yeah if you do subcommand you need to fill
Can you show me an example of your command?

oak raft
#

So basically if I type /sword it'll give me a custom sword. However if you type /sword <player> it'll give them a sword

#

Or do you wanna see what I've written

ocean quartz
#

Oooh

#
@Default
public void sword(final Player player, @Optional @Completion("#players") final Player target)
oak raft
#

Oh

#

Was that stated somewhere in the wiki?

ocean quartz
#

Yeah

oak raft
#

๐Ÿฅฒ

oak raft
#

Okay so under the method, I would write as if the player is typing the command by itself right?

ocean quartz
#

If target is null it means the player did either /sword or /sword invalidPlayer

#

Visual representation of my brain when working with recursion

lost forge
#

Lol, Maybe a couple sub menus too many

oak raft
#

Still looking good ๐Ÿ‘

#

And thanks

#

I'll try this out

#
    @Default
    @Permission("challenges.sword")
    public void defaultCommand(final Player player, @Optional @Completion("#players") final Player target) {
        if (target == null) {
            meta.setDisplayName(ChatUtil.color("&cThis sword belongs to &4" + player.getName() + "&c."));
            itemStack.setItemMeta(meta);
            player.getInventory().addItem(itemStack);
            player.sendMessage(ChatUtil.color("&6There's your sword kid."));
        } else if (target != null) {
            meta.setDisplayName(ChatUtil.color("&cThis sword belongs to &4" + target.getName() + "&c."));
            lore.add(ChatUtil.color("&cGiven to &4" + target.getName() + " &cby " + player.getName()));
            itemStack.setItemMeta(meta);
            target.getInventory().addItem(itemStack);
            player.sendMessage(ChatUtil.color("&6Sword successfully sent."));
            target.sendMessage(ChatUtil.color("&6Sword received from " + player.getName()));
        }
    }

Is this what you mean matt?

ocean quartz
#

Yes, but can be done a lot better

oak raft
#

I'm still a beginner so it's the first solution that came to my head lol

#

Although, in game there is no lore that shows up.

#

List<String> lore = new ArrayList<>();
I also have this

ocean quartz
#

You never set the lore to the meta

obtuse gale
ocean quartz
#

Did they actually add an executable message to it, that's so extra, i love it

oak raft
#

Now itโ€™s setting lore when you type /sword which isnโ€™t what I want ๐Ÿฅฒ Iโ€™m done for today

old wyvern
#

"Drink Water"
"WhAT DoEs ThIs MeaN"

oak raft
#

Thank you for ur consistent help today Matt

obtuse gale
ocean quartz
#

That's actually not a bad idea tbh

gilded granite
#

aaaaaaaaaaaaaaaaa

#

my java course

#

has 19 hours left

#

aka 400 hours because debugging

#

this is gonna be fun

steel heart
onyx loom
jovial warren
jovial warren
#

up to you

#

lol

jovial warren
#

omg

#

you've never wrote a unit test before?

onyx loom
#

i mean bardy its not everyday u need to make a unit test

#

i doubt half the people have

jovial warren
onyx loom
#

no

jovial warren
#

yes

onyx loom
#

k

jovial warren
#

test-driven development lol

#

how do ya think

old wyvern
#

Ya'll just need some haskell in your life

jovial warren
#

it gets Maven artifacts from the moon efe

old wyvern
#

You have a local maven repository in your UserHome/m2 folder

jovial warren
#

.m2*

old wyvern
#

You can publish artifacts there if you want to use it

jovial warren
#

where do you think all those dependencies get downloaded to?

#

for Maven, it's .m2

#

for Gradle, it's .gradle

old wyvern
#

You ussually dont need to look into them yourself,
If you have a library you want to use that doesnt provide a hosted repository, you can publish it there to use it across projects on the same pc

prisma wave
jovial warren
#

yeah I should try it

prisma wave
old wyvern
#

๐Ÿ˜Œ

jovial warren
#
import kotlin.math.*

fun main() {
    val one = Vector(128.7584973, 128.7598947, 128.7599732)
    val two = Vector(129.7589385, 129.7503284, 129.7542847)
    
    val dot = (one.x * two.x) + (one.y * two.y) + (one.z * two.z)
    val length = sqrt((one.x * one.x) + (one.y * one.y) + (one.z * one.z))
    val otherLength = sqrt((two.x * two.x) + (two.y * two.y) + (two.z * two.z))
    println(acos(max(min(dot / (length * otherLength), -1.0), 1.0)))
}

data class Vector(val x: Double, val y: Double, val z: Double)
```someone please tell me why that last `println` always returns `0.0` no matter what I seem to change those coordinates to
prisma wave
#

acos(1.0) = 0.0

jovial warren
#

yeah ik that, but why do we always end up with 1 there

lunar cypress
#

v * w <= |v| * |w|

#

That's the inequality of cauchy schwarz

jovial warren
#

Bukkit doesn't use absolutes though (got this from Bukkit's Vector)

#

and I'm gonna guess it's doesn't always return 0

lunar cypress
#

by | I mean the euclidian norm here

jovial warren
#

ah right

#

because I know what that is

lunar cypress
#

you calculated it

jovial warren
#

oh

lunar cypress
#

What this implies is that your thing you call min/max on is always <= 1

jovial warren
lunar cypress
#

yes

#

as I said

jovial warren
#

ah, I thought that said >= lol

lunar cypress
#

Also you probably want to swap min and max there?

jovial warren
#

I struggle reading those inequality signs sometimes for whatever reason

lunar cypress
#

what is it that you're trying to calculate exactly?

jovial warren
jovial warren
lunar cypress
#

Why min max

jovial warren
#

that's just what Bukkit uses

#

Doubles.constraintToRange (from Guava)

#
public float angle(@NotNull Vector other) {
    double dot = Doubles.constrainToRange(dot(other) / (length() * other.length()), -1.0, 1.0);

    return (float) Math.acos(dot);
}
#

this is from Bukkit

lunar cypress
#

Idk what the point of this is exactly, but you don't need it for the angle

jovial warren
#

okay

#

so what should I have? just acos(dot(other) / (length * other.length))?

lunar cypress
#

looks correct (if this is the first vector)

jovial warren
#

jesus christ

#

I wonder why Bukkit forces it between that range

#

wait a minute... isn't the cosine of an angle always between -1 and 1? the same as all the other trigonometric ratios?

old wyvern
#

Thats not cosine

#

thats the inverse of a cosine

jovial warren
#

arc cosine takes a cosine as an argument

lunar cypress
#

"inverse", yeah

jovial warren
#
Special cases:
  - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
#

yeah that might explain it

lunar cypress
#

ah

#

But that never happens

#

afaik

jovial warren
#

yeah it shouldn't, but ya know, floating point rounding errors

lunar cypress
#

because of the inequality I mentioned earlier

#

fair enough

#

the same as all the other trigonometric ratios?
tan would like to have a word with you

jovial warren
#

can the tangent of an angle be above 1?

old wyvern
#

lol

lunar cypress
#

tan is literally the worst

old wyvern
lunar cypress
#

goes from -inf to inf all the time

old wyvern
#

^

jovial warren
#

seems legit

old wyvern
jovial warren
#

here's the question though: how infinite does it get?

#

xD

old wyvern
#

NaN

jovial warren
#

not that kind of infinite lol

lunar cypress
#

infinite infinite

old wyvern
#

xD

jovial warren
#

NaN isn't a mathematical concept (afaik), it's a CS concept

old wyvern
#

Ofc

#

There not much more you can say than infinite in this case I think

lunar cypress
#

there is no value y such that for all x tan(x) <= y

#

there

jovial warren
#

also, I wonder why Bukkit has an EPSILON value (0.000001) that accounts for floating point errors

#

lemme show you what I mean

lunar cypress
#

because they've decided on that delta /shrug

jovial warren
#

is that a normal thing to do?

lunar cypress
#

yes

old wyvern
#

Yes'

lunar cypress
#

it's how you compare floating point numbers

#

for equality, anyway

jovial warren
#

so I shouldn't be using == to check floating point numbers then?

lunar cypress
#

absolutely not

old wyvern
#

mhm

jovial warren
#

(I mean Kotlin's ==, which calls equals under the hood, a.k.a object equality in this case, not reference equality, just for clarification)

lunar cypress
#

doesn't matter in java either if we're talking primitives

old wyvern
#

equals doesnt do a range check either

jovial warren
#
override fun compareTo(other: Position): Int {
    if (x == other.x && y == other.y && z == other.z) return 0
    if (x > other.x && y > other.y && z > other.z) return 1
    if (x < other.x && y < other.y && z < other.z) return -1
    return 0
}
```this is `Position`'s current `compareTo` function
#

pretty terrible ik, and could definitely do with some improvements, but I guess it works

lunar cypress
#

That is a bad idea

jovial warren
#

which part?

lunar cypress
#

3 dimensional vectors do not have total order

jovial warren
#

so they shouldn't be comparable then?

lunar cypress
#

so you can't say one is bigger than the other

#

yeah

jovial warren
#

because I use that to check if the new location sent by the client has changed since the last position sent by them lol

lunar cypress
#

then you check equality

old wyvern
lunar cypress
#

with an epsilon

lunar cypress
#

and I believe it violates the contract of comparable

old wyvern
#

d; Comparable

ruby craterBOT
#
public interface Comparable```
Comparable has 38 sub interfaces, 1 methods, and  200 implementing classes.
Description:

This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering , and the class's compareTo method is referred to as its natural comparison method .

Lists (and arrays) of objects that implement this interface can be sorted automatically by Collections.sort (and Arrays.sort). Objects that implement this interface can be used as keys in a sorted map or as elements in a sorted set, without the need to specify a comparator.

The natural ordering for a class C is said to be consistent with equals if and only if e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2) for every...

This description has been shortened as it was too long.

jovial warren
#

I need to check if the X, Y and Z coordinates have changed, that's it

lunar cypress
#

It is strongly recommended (though not required) that natural orderings be consistent with equals

#

I would adhere to that

old wyvern
#

mm

lunar cypress
prisma wave
lunar cypress
#

lmao

old wyvern
#

lol

jovial warren
#

so just fun areEqual(first: Position, second: Position) = first.x == second.x && first.y == second.y && first.z == second.z should do then?

lunar cypress
#

well

#

proper float comparison ofc

jovial warren
#

I'm not bothered here about being 0.000001 out lol

#

the client will never send a position change that would cause problems with those inaccuracies

lunar cypress
#

That's not what it's for

old wyvern
#

Its not an issue with the client

lunar cypress
#

It's the opposite

jovial warren
#

ah, checking if they are equal

lunar cypress
#

0.000001 is to tolerate mistakes

#

if you don't do a comparison like this it breaks for every fp error

old wyvern
#

Floats loose precision from normal operations because of how floating point numbers are represented in memory

#

It doesnt have infinite precision

jovial warren
#

so what should it be then? abs(first.x) - abs(second.x) > 0.000001 for all 3 coordinates?

lunar cypress
#

subtract, then abs

old wyvern
#

^

jovial warren
#

ah right

jovial warren
#

actually maybe I can use == here, since equals is the one that is overridden to use the epsilon

#
override fun equals(other: Any?): Boolean {
    if (this === other) return true
    if (javaClass != other?.javaClass) return false
    other as Vector
    return abs(x - other.x) < EPSILON && abs(y - other.y) < EPSILON && abs(z - other.z) < EPSILON
}
lunar cypress
#

๐Ÿ‘

#

maybe you can make an extension function for Double

#

dunno why kotlin doesn't already have that

prisma wave
#

kotlin bad ๐Ÿ™‚

jovial warren
#

also, when you realise that you overrode equals and hashCode for Vector but you didn't for Location lol

prisma wave
#

data class

#

noob

jovial warren
#

actually I just overrode equals, not hashCode

jovial warren
# prisma wave noob

we need to check equality with a fuzzy error term to account for floating point errors

#

noob

lunar cypress
#

overriding hashCode isn't trivial, I actually don't know what's best practice there

#

since equality implies same hash code

prisma wave
#

deriving (Eq, Hashable)

jovial warren
#

I just let the data class determine the hash code

old wyvern
lunar cypress
jovial warren
#
   public int hashCode() {
      long var10000 = Double.doubleToLongBits(this.getX());
      int var1 = (int)(var10000 ^ var10000 >>> 32) * 31;
      long var10001 = Double.doubleToLongBits(this.getY());
      var1 = (var1 + (int)(var10001 ^ var10001 >>> 32)) * 31;
      var10001 = Double.doubleToLongBits(this.getZ());
      return var1 + (int)(var10001 ^ var10001 >>> 32);
   }
```this is the generated `hashCode` function
lunar cypress
#

ah

#

still breaks though

jovial warren
#
override fun equals(other: Any?): Boolean {
    if (this === other) return true
    if (javaClass != other?.javaClass) return false
    other as Location
    return world == other.world &&
            abs(x - other.x) < EPSILON &&
            abs(y - other.y) < EPSILON &&
            abs(z - other.z) < EPSILON &&
            abs(yaw - other.yaw) < EPSILON &&
            abs(pitch - other.pitch) < EPSILON
}
```I think that should do for `Location`
#

World equality is defined by two world objects having the same UUID associated with them

lunar cypress
#

the hashCode question remains

jovial warren
#

what would I even override hashCode with?

lunar cypress
#

that's the question

#

but the way data classes do it currently violates the contract

jovial warren
#

how?