#development

1 messages ยท Page 18 of 1

shell moon
#

you mean loop player to get the closest checkpoint

#

but what about the fact that a checkpoint is a location

#

even tho they are at the same line (road width)

#

| A - - C - - - | //Checkpoint
| - - - B - - - |

#

if C is a checkpoint, the player A should be in 1st place

#

but since when looping the B is closest to the last checkpoint

#

it would be 1st and A the 2nd place

#

same with finish line, how would i handle correctly that

forest jay
#

how can I allow the player to switch between proxies? I couldn't find anything useful on Google

marble nimbus
#

Hey, whats the best way to find all classes inside a package using Kotlin? (at runtime)

sterile hinge
#

that's generally something that should be avoided, and while there are tools to find all classes in a package, that doesn't necessarily match the source code representation (especially with kotlin)

marble nimbus
#

is there a particular reason why that should be avoided?

icy shadow
#

yes

marble nimbus
#

oh facepalm sorry, I meant to ask what the particular reason is xD

icy shadow
#

sorry lmao i couldnt resist

marble nimbus
icy shadow
#

the main issue is that it's kinda fragile, as ywell said it's usually relying on classes matching the source which isnt always true, there could be lots of other generated classes that will break things

#

it also usually involves a big (many MB) library and some performance cost

#

if you need it then something is probably badly designed

lyric gyro
#

cough serviceloader cough

marble nimbus
#

that does make sense thinkies
Well I am not quite sure how to achieve it other wise. Basically I am creating alot of recipes, and the Recipe class itself has just one job, make the shapedRecipe, I have a class that does the registering itself.
So I don't have alot of references in my "RecipeRegisterClass" I thought it would be the best to "auto discover" all the recipes

#

but I guess I will just have to reference all the recipes in some way

icy shadow
#

yeah i wont lie, that would be a nice idea

#

but it's generally not a good one

marble nimbus
#

you think the auto discovery is a nice idea?

marble nimbus
#

Ohhh I know what that is now

#

@icy shadow is serviceloader a good idea? never worked with it

icy shadow
#

dunno

#

me neither

#

im not sure thats really what it's made for though

marble nimbus
icy shadow
#

afaik it's more for having different possible implementations of 1 thing, but only selecting 1

marble nimbus
#

ohh nvm

#

its for that

#

but its weird

#

I need to declare the implementations inside the meta-inf

icy shadow
#

seems like overkill ngl

#

but go for it

marble nimbus
#

Actually it is very overkill, but I do want to learn something new, so ima try it anyway thinkies thanks alot Mr. Mitten

icy shadow
#

np

lyric gyro
#

i would argue classpath scanning is more overkill

icy shadow
#

both are

#

however

#

i would argue otherwise because i enjoy arguing with you

lyric gyro
#

Does anyone know why this doesn't work?

#

(I can't upload images here for some reason)

neat pierBOT
tight junco
#

The [0] feature is limited to arrays

#

to get the first value from a list you need to use uh

#

List#get

lyric gyro
#

Oh I see, that's weird I could've sworn I've used [0] on a List before, but thanks it seems to work now!

dusky harness
#

kotlin ๐Ÿ˜Œ

#

but besides that it's array only

upper matrix
#

im attempting to replicate all the chest interactions onto a specific block and this is what i got, it works but sneaking and interacting does not allow me to place blocks as a chest would:

if (item != null) {
                    //  player can right click with any item in hand
                    //  if player has item in their hand and sneak, they can use that item
                    if (!item.getType().equals(Material.AIR) || (!item.getType().equals(Material.AIR) && !player.isSneaking())) {
                        event.setCancelled(true);
                    }
                }
upper matrix
#

this works:

if (player.isSneaking() && (!item.getType().isAir() || item.getType().isEdible())) return;
                    if (!player.isSneaking() && !item.getType().isAir()) event.setCancelled(true);
merry knoll
hoary scarab
robust flower
dusky harness
#

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

#

a lot of that stuff isn't needed but I'm just showing my usecase

stuck hearth
#

I find the autoservice with the ServiceLoader api to be quite nice

thin storm
#

Hello, I'm having an issue with formatting of placeholders, I've attempted to format strings that are meant to go on a scoreboard using the String.format(), for example:
https://cdn.discordapp.com/attachments/968239967836987414/1023085687198711808/unknown.png?size=4096
But on the actual scoreboard, they end up formatting like this:
https://cdn.discordapp.com/attachments/968239967836987414/1023085799287312426/unknown.png?size=4096
Any insight into what the problem may be would be greatly appreciated.

stuck hearth
#

What are you trying to do

thin storm
#

Format the strings so that the left part is left justified while the number is right justified

stuck hearth
#

I'm not a genius or anything, but just as a test, try removing the %5 in the second return, what does it look like without that

thin storm
#

without the %5 the second piece gets cut off entirely

stuck hearth
#

Oh, well. Good luck ๐Ÿ’€

thin storm
#

I'm thinking it might have something to do with the font not being equally spaced

marble nimbus
stuck hearth
#

Actually I'm on mobile I'm just going to link you a build file

tall field
#

JAVA 8

CODE

System.out.println(false ? Double.parseDouble("2") : Integer.parseInt("2"));
if (false) {
  System.out.println(Double.parseDouble("2"));
} else {
  System.out.println(Integer.parseInt("2"));
}```
**OUTPUT**

2.0
2```
For whatever reason, the first value is a double. Do you guys know why?

stuck hearth
#

You parsed it as a double

#

Wym

tall field
#

umm, no?

#

System.out.println(false ? Double.parseDouble("2") : Integer.parseInt("2"));

stuck hearth
#

Do you not see the words parseDouble

#

Wait are you asking why it's printing double?

tall field
#

yes?

stuck hearth
#

That is a better question

marble nimbus
stuck hearth
marble nimbus
#

hmm let me try

stuck hearth
tall field
#

same thing

stuck hearth
#

Double as well?
Try using an expression that evaluates false instead
Like 1==2

tall field
#

still a double

stuck hearth
#

Wild

#

Wait

#

@tall field
Try printing two different numbers

merry knoll
#

does slimeworldmanager unload the world from their end if bukkit.unloadworld is called?

#

i know they do some caching by default with the serialized slimeworlds

#

but does that ever get unloaded

tall field
#

OUTPUT
4.0

stuck hearth
#

Yeah that makes sense now

#

The compiler is autoboxing the value so they're both double instead of one or the other.

upper matrix
icy shadow
formal crane
#

How would i create a websocket client in java 18 without any libraries?
i have tried multiple google searches for it but many of them require libraries or are on a different java version

icy shadow
#

java version shouldnt matter

formal crane
stuck hearth
#

Then you're not using j18

formal crane
#

oh

stuck hearth
#

That message is saying your language is too old to use the new feature

formal crane
#

but it is java 18 tho or i am stupid (high chance)

stuck hearth
#

Click that thing that says to set the language level

formal crane
#

oh i see

#

it says 11

stuck hearth
#

Probably just got set to that after clicking it.

formal crane
#

prob

#

its at this point rn

stuck hearth
#

Should work theoretically now

formal crane
#

same error

stuck hearth
#

What build system are you using? Gradle?

formal crane
#

oh it turns out the language level got set back to java 8 again

#

its working now

#

ty

stuck hearth
#

Woot

formal crane
#

So i have these listeners:

                @Override
                public void onOpen(WebSocket webSocket) {
                    getLogger().severe("WEBSOCKET CONNECTED");
                }

                @Override
                public CompletionStage<?> onText(WebSocket webSocket, CharSequence data, boolean last) {
                    System.out.print("Text received");
                    getLogger().severe("WEBSOCKET TEXT RECEIVED");
                    Bukkit.broadcastMessage("WEBSOCKET SHIT RECEIVED");
                    return null;
                }
            };````
But the onText doesnt get called at all, the on open does get called, anyone that knows what could have gone wrong?
vestal talon
#

I have a weird issue, when I'm trying to loop through all entities in the world while the server have 1+ players it's finding them all,
but once the server empty from players it's not finding them all and gives less results, why is it?
The current code:

        if (entity.getType() == EntityType.ARMOR_STAND) {
            entity.remove();
        }
}```
#

Someone told me here about on chunk loaded but I have no clue how to do it that way, someone can help me with that please? (:

merry knoll
#

are you just trying to clean up armor stands on a world?

#

if yes, listen to chunk unload, then loop through entities in that chunk

#

world.getEntities only lists the entities that are loaded

#

aka if the chunk is unloaded, it wont show up on that list

#

@vestal talon

vestal talon
#

How can I use the event that way?

merry knoll
#

listen to ChunkUnloadEvent

#

then event.getChunk.getEntities to get entities in that chunk

vestal talon
merry knoll
#

you dont

#

you need to register a listener

vestal talon
#

Alright thanks (:

coral fable
#

~~Hey, does anyone know how I can get my script working. It doesn't work and I'm not sure what to add/change:

 if region is "AFK" 
  set metadata tag "entered-region-at" of player to now
  every 1 minute:
   loop all players:
    if difference between now and metadata tag "entered-region-at" of player is 1 minutes:
     execute console command "cr give to %player% AFK 1"
     set metadata tag "entered-region-at" of player to now```~~ moved to [#general-plugins](/guild/164280494874165248/channel/164280494874165248/)
merry knoll
coral fable
#

Oh

#

Will do, thanks ๐Ÿ™‚

merry knoll
#

Why is this throwing null pointer

// null pointer on this line
player.sendMessage(messages.getColorized(Messages.EDITOR_WORLD_EXISTS))

//Messages enum
enum class Messages  {
    EDITOR_WORLD_NOT_SCHEMATIC,
    EDITOR_WRONG_USAGE,
    EDITOR_WORLD_EXISTS,
    EDITOR_WORLD_CREATE_START,
    EDITOR_WORLD_CREATE_FINISH,
    EDITOR_WORLD_COMPLETE_START,
    EDITOR_WORLD_COMPLETE_FINISH,
    NO_PERMISSION
}

class MessageConfig(plugin: Plugin, fileName: String) : YamlConfig(plugin, fileName) { // just a YamlConfiguration extension
    operator fun get(message: Messages) = this.getString(message.name.lowercase())
    fun getMessage(message: Messages) = this.getString(message.name.lowercase())
    fun getColorized(message: Messages) = this.getString(message.name.lowercase())!!.colorize() // this is somehow null
}

// this is in the message config file
editor_wrong_usage: "Wrong Usage!\n Usage: /wwe <create|edit|delete|complete|cancel> [worldName]"
editor_world_not_schematic: "The world you are in is not a schematic!"
editor_world_create_start: "Creating an editor world. This may take a while!"
editor_world_create_finish: "World created! Teleporting..."
editor_world_complete_start: "Closing template editor. This will save the template as a serialized file!"
editor_world_complete_finish: "Serialization complete. Template saved in WandererWorlds\serialized_worlds"
no_permission: "You dont have permission to use this command."
editor_world_exists: "World already exists!"
#

am i tired or what, it was working last compile now broke somehow without any changes

lyric gyro
#

no friendly NPE message?

merry knoll
#

its somehow not reading config

#

but the file is created properly if deleted so its not the file name being wrong

#
Caused by: java.lang.NullPointerException
    at dev.peopo.wandererworlds.config.messages.MessageConfig.getColorized(MessageConfig.kt:11) ~[wanderer-worlds-1.1.0.jar:?]
    at dev.peopo.wandererworlds.commands.editor.EditorCreate.onCommand(EditorCreate.kt:25) ~[wanderer-worlds-1.1.0.jar:?]
    at dev.peopo.wandererworlds.commands.EditorCommand.onCommand(EditorCommand.kt:37) ~[wanderer-worlds-1.1.0.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
    ... 21 more
rain wasp
#

i havent coded in kotlin yet (should definitely learn) but probably the problem is in YamlConfig ig

merry knoll
#
open class YamlConfig(private val plugin: Plugin, fileName: String) : YamlConfiguration() {
    private val file: File
    private val fileName: String

    init {

        if (fileName.endsWith(".yml")) this.fileName = fileName
        else this.fileName = "$fileName.yml"
        logger.info("Loading $fileName...")
        file = File(plugin.dataFolder, this.fileName)

        if (!file.exists()) {
            file.parentFile.mkdirs()
            this.saveDefault()
        }
        this.load()
        logger.info("$fileName loaded.")
    }

    fun saveDefault() {
        plugin.saveResource(fileName, false)
    }

    fun load() {
        try {
            super.load(file)
        } catch (e: Exception) {
            logger.severe("An error has occurred while loading the config file!")
        }
    }

    fun save() {
        try {
            super.save(file)
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }
}
#

highly doubt it

#

its so weird, rolled back my commit to when it used to work and it still throws null pointer

rain wasp
#

that colorize extension is also null safe right?

merry knoll
#

yeah

#

kotlin does not have null pointers unless you specifically allow it

#

fun getColorized(message: Messages) = this.getString(message.name.lowercase())!!.colorize() // this is somehow null

#

^ is where the null is 100%

#

this.getString on YamlConfig is returning null

#

which is just YamlConfiguration

lyric gyro
#

try iterating the config key set and see what keys the actual map has?

#

idk just debug the shit out of everything

merry knoll
#

^ good idea thanks

#

its empty

lyric gyro
#
editor_world_complete_finish: "Serialization complete. Template saved in WandererWorlds\serialized_worlds"

๐Ÿง I don't like that \s

merry knoll
#

oh shit

#

thats probably it

#

its probably escaping

#

yeah that was it

#

@lyric gyro thank you!

icy shadow
#

you're welcome ๐Ÿ˜Š

merry knoll
icy shadow
#

so called "null safe" language

merry knoll
#

i mean i asked for it

#

!!

icy shadow
#

so called "null safe" language

merry knoll
#

null safe!!

icy shadow
#

"null safe"
has NPEs

#

hi dkim19375

dusky harness
#

Hello

#

!! Should not be in kotlin

icy shadow
#

true

#

kotlin should not be in kotlin

lyric gyro
#

so true

dusky harness
#

What is backslash s

#

Emily

lyric gyro
#

but also

icy shadow
#

Emilu

lyric gyro
#

Emilu

icy shadow
#

they should make kotlin but instead of fun main you write public static void main that would be funny i think

lyric gyro
#

composition > inheritance

dusky harness
icy shadow
#

then you have even less excuse

lyric gyro
#

public static void main string args

icy shadow
#

where is the function inheritance huh!!

dusky harness
#

Public class Main

#

{}

lyric gyro
#

in scala you can extend function types lmao

icy shadow
#

what!

dusky harness
#

Wdym

lyric gyro
#

Whatevs[I, O] extends (I => O)

dusky harness
#

What is that

icy shadow
#

what is there to override

lyric gyro
#

.apply

icy shadow
#

evil

#

actually

#

i guess you could do like AOP with that

lyric gyro
#

lmao

icy shadow
#

seems kinda useful

lyric gyro
#

I did L extends (L => L) the other day and started to build lambda calculus functions with it

#

cuz you know

icy shadow
#

do those names not clash

#

or is it recursive

lyric gyro
#

well it's not exactly "recursive"

#

it's like in Java Enum<E extends Enum>

icy shadow
#

oh

#

ok

lyric gyro
#

or BaseStream<T, S extends BaseStream<T, S>>

icy shadow
#

so it's like UnaryOperator<L>

lyric gyro
#

yeah

#

But L in itself is a UnaryOperator

#

so UnaryOperator<UnaryOperator<UnaryOperator<UnaryOperator<UnaryOperator<...

icy shadow
#

spiral eyes

lyric gyro
#

you could do L extends UnaryOperator<L>

#

but that's not really a proper function type

#

cuz java

icy shadow
#

true

#

hang on

#

is there even a valid value for that type

#

except the identity function

#

L => L

lyric gyro
#

well no

#

you can return another function that isn't the input

#

e.g. TRUE: L = a => b => a

#

that is a function that takes a, but it returns a function that ignores its input and returns the captured a

icy shadow
#

oh i get it now

#

ok

#

ez

lyric gyro
#

"currying" if you will

#

(because that's what it is anyway)

icy shadow
#

yeah i was just confused about the type

#

but i forgot u dont have anything that's not a function in the LC

#

i was thinking like Int => Int

lyric gyro
#

yeah lol that's where it gets complicated

#

"how do i actually do anything"

#

IO :')

icy shadow
#

well i suppose you dont do anything

#

just like a "pure" turing machine doesnt really do anything

lyric gyro
#

i find it intriguing how a Turing machine describes a physical machine but LC is more abstract and it's just .. whatever it is, but they define the same thing

#

how do you "build" a LC machine?

icy shadow
#

im not sure you could

#

but i cant elaborate

#

that is an interesting thought experiment though

sterile hinge
#

You just have a lambda basically

shell moon
#

PaperMC updated snakeyml in 1.19.2 which limits yaml file size. Someone knows if they will revert that change?

merry knoll
#

doubt it

dusky harness
#

whats the file size? ๐Ÿ‘€

shell moon
#

New limit is 3mb

dusky harness
#

I mean that's a lot to be fair

shell moon
merry knoll
dense drift
#

even big dm menus are a few kbs or 1mb at max

merry knoll
#

chances are they are using yml as a database

merry knoll
#

does java sets compare through hash?

dusky harness
#

java sets are hashmap keys

#

iirc

#

hashsets*

merry knoll
#

or is it just hashsets?

#

that do so

dusky harness
#

well i mean you could make your own set impl

#

which doesn't use hashmaps

merry knoll
#

nah hashing is fine

#

just need to know if they compare reference or hash

#

so i can implement hash method to the stuff i store

dusky harness
#

hashCode() is only for "sorting"

#

but it ends up comparing by equals() I think

merry knoll
dusky harness
merry knoll
#

overriding both of them to be safe i guess

dusky harness
#

IntelliJ

#

use IntelliJ's overrides

merry knoll
#

or

#

just use data class from kotlin

dusky harness
#

๐Ÿ˜Œ

merry knoll
#

it covers both cases no?

dusky harness
#

yes

#

and toString

merry knoll
#

welp sorted then

shell moon
#

I guess i have only 2 options, sqlite or json

merry knoll
#

you could also use separate yml files

#

if you want them to be accessible to users manually

lyric gyro
# shell moon New limit is 3mb
  • Snake now limits the length of a document to 3MB by default, Paper increases this to 64MB by default, due to plugins (mis)using YAML files as databases
merry knoll
#

you would probably want users to edit the settings of the heads

lyric gyro
#

yeah but paper doesn't put the 3 mb limit like he said, it increases it lol

dense drift
#

(mis)using
gold

merry knoll
#

if they are hitting 64mb though thats kinda

dusky harness
#

Even for a data file

#

That's still a lot for one fole

#

File

#

Imo

shell moon
sterile hinge
#

it never was 3mb for Paper

shell moon
#

Somehow larger thab 3mb files caused issues, until the file was recuded to 3mb

sterile hinge
#

well if you use snakeyaml directly, you need to configure it yourself

#

or it was spigot instead of paper

shell moon
lyric gyro
sterile hinge
#

idk, people are weird sometimes

stuck hearth
#

Configurate uses snakeyaml, dunno that they adjust that size

marble nimbus
#

Hey I have a quick question, is it smart to prepare statements like this?

    private void checkTables(){
        try (Connection connection = connectionKeeper.connection();
             PreparedStatement statement = connection.prepareStatement("""
                        CREATE TABLE IF NOT EXISTS Coins (
                            player_uuid varchar(36) primary key,
                            coins BIGINT
                        ); 
                    """)
        ) {
            statement.executeUpdate();
        } catch (SQLException e) {
            throw new CoinsDBException("An error occurred while checking tables.", e);
        }
    }

Incase its unclear, inside the () of the try, this will get a connection and also prepare the statment, and in the actual try block it will execute it.

#

Wouldn't it be better to just put in the connection inside the () of the try? Since I think once the connection gets auto-closed the preparedstatement will be picked up by GC

sterile hinge
#

I'd leave it that way. While correctly implemented drivers should be able to deal with the latter, it's definitely not worse to have both as resources

#

(and the GC only comes afterwards, the resources should be closed properly at that point already)

lyric gyro
#

better be safe than sorry

marble nimbus
lyric gyro
#

hikaricp will actually go nuts if you don't close shit

sterile hinge
dusky harness
lyric gyro
#

(that's what he's doing)

#

((and asking about))

dusky harness
#

(((oh)))

#

no but he said he will leave it

dusky harness
#

well

merry knoll
dusky harness
#

yes

merry knoll
#

closes them if they are autocloseable

#

i think both are autocloseable no?

sterile hinge
#

otherwise it wouldn't compile

merry knoll
#

although not sure which order they get closed

sterile hinge
#

as defined in the JLS :p

merry knoll
#

afaik you gotta close statement first

dusky harness
#

don't you have to put the statement in try with resources too

#

oh you mean which one to close first

merry knoll
#

yeah

dusky harness
#

wait if you close the connection

#

isn't that the database connection?

#

so you're reconnecting each time?

merry knoll
#

if its from a connection pool

#

aka hikari etc

dusky harness
#

oh

merry knoll
#

it returns to pool

dusky harness
#

idk what connection pools are

#

so

merry knoll
#

on close

dusky harness
#

I'll assume this is all correct

#

so I think its statement -> connection

merry knoll
#

if they get the connection from a pool

#

then its correct

sterile hinge
lyric gyro
#

but i declared it in top to bottom GH_Nerd

dusky harness
#

also in the code above, he didn't close statement at all

lyric gyro
#

dkim

dusky harness
#

oh

#

sorry Emily

lyric gyro
#

that is exactly what the twr is for

merry knoll
#

its in the try block

dusky harness
#

so it closes automatically?

lyric gyro
#

aaaaaaaaaa

#

yes

merry knoll
#

yes

dusky harness
#

wow

#

thats cool

merry knoll
#

try(closeable) {}

dusky harness
#

but what if you don't want it to close but you want it to be in try with resources

#

no

#

in {}

#

statement is in {}

merry knoll
#

is basically same as try - catch - finally close here

lyric gyro
#

meanwhile kotlin
a.use {
b.use {
c.use {
}
}
}

dusky harness
#

so

#

it still closes?

#

Wow

#

thats cool

sterile hinge
#

the statement is declared in the resources block too

dusky harness
#

then whats the point of ()

#

in try with resources

lyric gyro
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

merry knoll
#

aaa

#

why the fuck does it detects

#

emotes as caps

dusky harness
#

Ha

merry knoll
#

here no cap version

#

lmao

lyric gyro
#

dkim both the connection and the statement are inside the parenthesis

dusky harness
#

OHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH_ _ _ _ _ _ _ _ _ _

#

OHHHHHH

lyric gyro
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

dusky harness
#

OHHHHHHHHHHHHHHH_ _ _ _ _ _

stuck hearth
#

Get fucked

lyric gyro
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

dusky harness
#

Ty emily

#

I didn't know that

merry knoll
#

do we get to shout if we boost

pulsar ferry
#

Good ol bass

dusky harness
merry knoll
#

damn

dusky harness
#

im just abusing a bypass

merry knoll
#

how does one get a bypass lmao

dusky harness
#

and none of the admins are online ๐Ÿ˜

stuck hearth
#

boost1inb

merry knoll
stuck hearth
#

Does BAAS even exist anymore

lyric gyro
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

stuck hearth
#

oh

#

I hadn't seen it in so long

merry knoll
dusky harness
#

do you use firefox or edge

#

or chrome

stuck hearth
#

I'm on discord

dusky harness
#
#

click that ^

#

and then are you on firefox or chrome or edge

stuck hearth
#

Opera

dusky harness
#

oh

merry knoll
lyric gyro
#

mask

stuck hearth
#

fem

dusky harness
#

I have a question

neat pierBOT
#

There is no time to wait! Ask your question @dusky harness!

dusky harness
#

if some data is lost throughout the internet

#

like if you were calling a REST API

#

how would the api function

#

or is it just so reliable

#

that it never loses any bytes

merry knoll
stuck hearth
#

If I had to guess it probably verifies the integrity of the packet sent

dusky harness
#

but I never do that with mine

stuck hearth
#

something like TCP

merry knoll
#

internet protocol is smarter than that though

dusky harness
#

what happens now?

icy shadow
#

There is no time to wait! Ask your question @kotlin =!

stuck hearth
#

I think it signals that packet is malformed and send a new packet?

lyric gyro
#

with checksums and shit, a single byte is probably recoverable

stuck hearth
#

It's been a long time since I've studied TCP

icy shadow
#

TCP is very back and forth

dusky harness
hushed badge
#

where is nialls meme about tcp

stuck hearth
#

Bad library

hushed badge
#

that perfectly sums up tcp

icy shadow
#

if your client library doesnt support the TCP protocol then it cant even use the internet

dusky harness
#

oh

#

what if I make one from scratch

#

so I don't follow the entire TCP protocol

lyric gyro
#

then you can't connect to the internet

stuck hearth
#

UDP only

#

for everything

dusky harness
#

how's it know that I'm following the protocol 100% tho

merry knoll
lyric gyro
#

a protocol is a protocol, if you don't follow a protocol then you can't use the protocol

icy shadow
# icy shadow TCP is very back and forth

it's like
hello i'm going to send you this
ok i'm ready to receive this
ok i'm sending this
ok i'm receiving this
ok i'm still sending this
ok i'm still receiving this
ok i finished sending this
ok i finished receiving
have a nice day
you too

if any of those messages don't come through then the protocol says to try again / send an error

lyric gyro
#

there's a Tom Scott video to link here somewhere

dark garnet
#

how can i get a yamlconfiguration as a file?

icy shadow
#

classic

#

it's always tom scott or xkcd

dusky harness
stuck hearth
dark garnet
dusky harness
#

ask nicely

lyric gyro
icy shadow
dusky harness
#

oh

icy shadow
#

it's not built into the hardware

dusky harness
#

so like ktor doesn't do it

icy shadow
#

no

dusky harness
#

but Windows does

icy shadow
#

i think

dusky harness
#

thanks Brister Mitten

lyric gyro
#

you tell windows "hey send this to this address using this protocol, take care of the rest"

icy shadow
lyric gyro
#

exclusively windows

#

linux doesn't exist yet

icy shadow
#

yeah

#

linux still doesnt support TCP

lyric gyro
#

๐Ÿคฃ

stuck hearth
lyric gyro
dusky harness
icy shadow
dusky harness
#

I don't use linux so its just Windows for now :(

lyric gyro
dusky harness
#

I am 1 minute and 9 seconds

#

into that video

lyric gyro
#

good

icy shadow
#

extremely common tom scott W

dusky harness
#

anyone have any profile picture recommendations

stuck hearth
#

yes

dark garnet
#

does anyone know how how to "convert" a YamlConfiguration into a File?

dusky harness
#

does it even store the file?

dusky harness
#

I don't see why it would store the file

dark garnet
icy shadow
uneven lanternBOT
icy shadow
#

or even

#

d;FileConfiguration#save

uneven lanternBOT
#
public void save(@NotNull File file)
throws IllegalArgumentException, IOException```
Description:

Saves this FileConfiguration to the specified location.

If the file does not exist, it will be created. If already exists, it will be overwritten. If it cannot be overwritten or created, an exception will be thrown.

This method will save using the system default encoding, or possibly using UTF8.

Parameters:

file - File to save to.

Throws:

IllegalArgumentException - Thrown when file is null.
IOException - Thrown when the given file cannot be written to for any reason.

dusky harness
dark garnet
icy shadow
#

what

stuck hearth
#

huh

lyric gyro
#

that does not make sense

icy shadow
#

they dont hold any hard reference to files

lyric gyro
#

a YamlConfiguration is not attached to any file in particular

icy shadow
#

^

lyric gyro
#

you can save one to any file you want

#

it's literally just a Map<String, ?>

icy shadow
#

if you want to keep track of a config and file then you'l have to encapsulate that into a separate class

dusky harness
#

YamlConfigurationButWithFile

dark garnet
#

so i have to save the yaml to a temporary file and then use new File(path) to get it as a File?

icy shadow
#

?

merry knoll
#

what

dusky harness
#

Map<File, YamlConfiguration>

#

bam

#

๐Ÿ‘

lyric gyro
#

why do you need "it as a file" to begin with?

dark garnet
icy shadow
#

...?

#

then what you mean to say is you want to read from a file?

dusky harness
#

Huh

lyric gyro
#

Well, again, a YamlConfiguration is not attached to any File in particular, you load any file you want into a YC and use it, but it could be any file into any yc

dark garnet
#

i know

#

i need it as a File cause i cant do:

objectMapper.readTree(YamlConfiguration));```it has to be
```java
objectMapper.readTree(File));```
dusky harness
#

wat

#

does YamlConfiguration override equals

lyric gyro
#

you can't get a file from a yamlconfig

dark garnet
lyric gyro
#

that is not a thing that exists

dusky harness
#

run saveToString()

#

read the file

#

String#equals

#

ez

icy shadow
#

if you want to check if 2 configs are equal then just compare getValues()

dusky harness
#

oh

icy shadow
dusky harness
#

i didn't know there was getValues()

#

sorry bm

icy shadow
#

delete your messages please.

#

now

dusky harness
#

Never

#

sorry

icy shadow
#

wtf

icy shadow
#

thanks

dusky harness
#

np

robust flower
#

Is possible via JS to trigger normal input form events when setting the value of an Input arbitrarily? I am having issues because the validations on the fields are not triggered when I use input.value = "blah" on my JS code (an userscript).

dark garnet
icy shadow
#

np

#

in future please just say what your end goal is because that was classic xy problem

dark garnet
# icy shadow np

wait if i have this:

key1: value1
key2:
  key3: value3
  key2: value2```what would that look like when i use `getValues()`?
#

more precisely, what would be the map's value for key2?

icy shadow
#

another map

dark garnet
#

ah ok

#

should i have deep set to true?

icy shadow
#

yes

dark garnet
#

alr, ty

dark garnet
icy shadow
#

that's probably intentional

#

it loads stuff as memory sections

#

i wont lie im not sure what the end goal here is but

#

try saving to a string and then loading it back to trigger YamlConfiguration#convertMapsToSections

#

kinda cursed but

dusky harness
#

but

icy shadow
lyric gyro
#

at that point i'd rather load the file into YamlConfig and compare both's saveToString

icy shadow
#

at that point i'd rather kick the shit out of you

#

in a nice way

lyric gyro
#

do it

icy shadow
#

alright

lyric gyro
#

when are you coming over?

icy shadow
#

soon

#

get ready

lyric gyro
#

i need to adjust my schedule tho so please let me know

icy shadow
#

what time works best for you?

dusky harness
#

wait but you guys are in different timezones

icy shadow
#

really?

dusky harness
#

I don't know

#

are you

#

its a guess

icy shadow
#

you do know

lyric gyro
#

yeah you do know

dusky harness
#

oh

#

thanks

icy shadow
#

you're not welcome

lyric gyro
#

np

icy shadow
#

it was not serious

#

sorry

dusky harness
#

am I welcome

icy shadow
#

no

#

i mean yes

dusky harness
#

thanks bm

icy shadow
#

you're not welcome

dusky harness
#

oh

lyric gyro
#

you're not aiden

icy shadow
#

plot twist

icy shadow
lyric gyro
#

๐Ÿคฏ

icy shadow
#

we are so funny

#

i agree

dusky harness
#

Hahaha

icy shadow
#

thanks

dusky harness
#

no problem

lyric gyro
#

problem

icy shadow
#

there's no time to wait! ask your question @lyric gyro

lyric gyro
#

no need to shout

icy shadow
#

i wasnt shouting

#

you're souting

#

system.out.println

#

this is your coding skill

dusky harness
#

pwd

icy shadow
#

epic

dusky harness
#

whats the first thing you think of

icy shadow
#

the linux command?

dusky harness
#

epic

icy shadow
#

actually that was a lie

dusky harness
#

oh

icy shadow
#

the first thing i thought was pwn

lyric gyro
#

@icy shadow hello i need some help with this plugin private mines how can i integrate it with essentials

icy shadow
#

because it's funny

icy shadow
lyric gyro
#

hm

#

u sure?

icy shadow
#

do not ever ask me such a stupid question ever again

#

of course im sure

lyric gyro
#

because im not

icy shadow
#

i am an expert in private mines plugins

lyric gyro
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

icy shadow
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

dusky harness
#

GUESS WHAT BM_ _ _ _

#

We are contributers

#

to the famous privatemines

icy shadow
#

thats old news dkim

lyric gyro
#

contributers thonk

dusky harness
#

a server owner told me a few days ago

#

lol

icy shadow
#

lol

#

tell them to get out while they still can

lyric gyro
#

or don't

icy shadow
#

wdym

dusky harness
icy shadow
#

why would they dont

icy shadow
dusky harness
icy shadow
#

private mines

#

it will haunt them for the rest of their life

dusky harness
#

is it bad

icy shadow
#

not necessarily

#

idk tbh

#

but

dusky harness
#

they are making a prison server

icy shadow
#

this god damn plugin has been haunting me since 2019

#

and i cant escape it

dusky harness
#

huh

lyric gyro
#

@UntouchedOdin0 thoughts?

icy shadow
#

who?

lyric gyro
#

Kyle

icy shadow
#

asked

lyric gyro
#

Mister Controversy

icy shadow
lyric gyro
#

no

icy shadow
#

what do u mean no

dusky harness
#

ha

#

ha

#

hahaha

icy shadow
#

thanks dkim

#

see dkim is a real fan

lyric gyro
#

he's laughing at you

#

lmao

icy shadow
#

dont be silly

lyric gyro
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7 @kotlin = You're sending messages too quickly.

icy shadow
#

oh dear

#

he may have been muted

lyric gyro
#

Global Mute

#

lol

icy shadow
#

poor bloke

#

sent to the backrooms

#

it's not a pleasant experience

lyric gyro
#

I was there once

#

@dkim

#

:(

icy shadow
#

@dusky harness

#

ez

lyric gyro
#

Hello there

:)

๐Ÿค”

icy shadow
#

every lang with semicolons = bad

lyric gyro
#

hgdfjgldfkgfdpj
fniosfidf
emiofksgd {}

ebon whale
#

Excuse me?

icy shadow
#

hey whats up

lyric gyro
#

those are your coding skills

icy shadow
#

how dare you

lyric gyro
#

it's quite easy frankly

#

you just dare

ebon whale
#

I see youre idling.
Procrastinating eh? ;)

icy shadow
#

oh yes

lyric gyro
#

we are having a very imporrtant comversaiotyng

#

Not configuration help

icy shadow
#

a very important what?

lyric gyro
#

No favourite IDE arguments.

icy shadow
#

vim is the best

icy shadow
#

it's just not a thing anymore

#

now it's kotlin vs java

ebon whale
#

Its ij vs vscode now

lyric gyro
#

vim
vi
v
_ _

icy shadow
ebon whale
#

I got suckerpunched for vscode in spigot dc

#

And discordsrv lol

icy shadow
#

in my 27 years of coding spigot plugins ive seen about 2 people say they use vscode

icy shadow
lyric gyro
#

i mean sure you can use a wrench as a hammer

#

but it's not meant to be

icy shadow
#

so true

ebon whale
#

Wow emily

lyric gyro
#

or as they say

#

uh

ebon whale
#

Kickin my ass i see

leaden sinew
#

They do say โ€œuhโ€

lyric gyro
#

there's something to be said about a guy with a hammer seeing everything as a nail

icy shadow
#

you're kicking your own ass by using vscode

#

which is quite anatomically impressive but not very useful otherwise

lyric gyro
#

yea

leaden sinew
#

Some people like that type of thing

lyric gyro
#

actually

ebon whale
#

As long as ij lags out, ill use vscode so its its own fault

icy shadow
#

it's*

ebon whale
#

Im lazy

icy shadow
#

likewise

#

i just thought it was funny

#

its its

#

but which its is wrong?

lyric gyro
#

skill issue

leaden sinew
#

First one

icy shadow
#

well done

leaden sinew
#

Thanks

ebon whale
#

I see how it is. Well. Bye i guess

lyric gyro
icy shadow
#

goodbye

lyric gyro
#

ah fuck i have a lot of work to do ugh

icy shadow
#

same

#

also

#

this is very unrelated but

#

the launderette double charged me and the dryer didnt fully dry the clothes so i needed to use it twice

#

so i have spent a whole ยฃ10 on a single load of washing

lyric gyro
#

hold on

#

oh wow that's quite a bit of money

icy shadow
#

yes

#

it shouldve been half as much

#

which is still quite a lot

#

i am not happy

lyric gyro
#

how many clothes are we talking about?

icy shadow
#

like a weeks worth

#

not much

lyric gyro
#

just one outfit?

icy shadow
#

no

lyric gyro
#

๐Ÿคจ

icy shadow
#

uh

#

whats the unit of measurement for clothes

lyric gyro
#

clothe

icy shadow
#

ok

#

approximately 25 clothe

#

maybe

#

not loads anyway

reef delta
#

https://github.com/apocas/node-whmcs

For those familiar with the node package, whmcs. I'm having an issue using a API key/secret- I get an error message stating that username property is required. What could I be doing wrong?

dark garnet
icy shadow
#

that'll be the exact same as equals lol

#

unless you fuzzy compare MemorySection and Map

#

which is even more effort

stuck hearth
#

Write a wrapper that converts a memory section to a map then compare

dark garnet
#

@icy shadow this ended up working:

yaml1.saveToString().equals(yaml2.saveToString());```
icy shadow
#

i suspect that will not always work

#

but

#

ok

stuck hearth
#

Did we ever find out why they were doing this

dark garnet
icy shadow
#

...

#

if the files are the same then there's nothing to overwrite

#

it's an idempotent operation ๐Ÿค“

olive fulcrum
#

free my boy @dusky harness

icy shadow
#

so true

olive fulcrum
#

i mean I could

dark garnet
#

well it said on my scp that the file was changed

icy shadow
#

is that really such a big problem

olive fulcrum
#

yall want dkim back

#

i'll free him rn

icy shadow
#

of course

#

thanks

#

i love dkim

neat pierBOT
#
Successful!

You've unmuted dkim19375#6351!

olive fulcrum
#

๐Ÿ˜ญ

icy shadow
#

hey dkim

#

whats up

#

how was the backrooms

dusky harness
#

TYYYYYYY

dusky harness
#

๐Ÿ˜ญ

icy shadow
#

it really is

placid lintel
#

When I'm op the ui opens but when I'm not op it gives me error

stuck hearth
#

That's nuts

dusky harness
#

๐Ÿ˜ฑ

merry knoll
#

is there a cleaner way to have a world without file?

#

I currently override serverlevel but trying to see if there is a non nms method

high edge
#

doubt

merry knoll
#

then does anyone know if I need to register the custom worlds anywhere other than nms server. levels?

#

I went through nms source but thats the only place I could find that needs to be registered

whole yacht
merry knoll
whole yacht
#

Ok sorry

dense drift
#

Don't upload configurations on spigot

#

especially masked as jars lol

proud pebble
#

thats just sad

ebon whale
#

Anyone good with image work in java?
My goal is to take java assets and punch them together for images being sent by my bot to discord. Example: Player dies with a diamond pickaxe in their hand. So I have to create the inventory image with the player puppet, their skin applied within the inventory as well as the item held just like the ingame inventory. I know this is... not the easiest task.
I'm currently looking at libraries and I'm rather unsure. I know that I want generation to be as fast as possible, but I'd also like the option for additional effects. Any ideas, suggestions, pointers? If it was your task, what would you use and why?

lyric gyro
#

Haven't done anything like that before but have you tried looking into making some sort of web api that you can request generated pics from?

#

I have no idea what the actual generation method would be though lol

merry knoll
merry knoll
#

i have not used it myself though

hoary scarab
#

Was just about to say that someone posted in showcase exactly what you want but the post was made by you xD
#showcase message

ebon whale
#

Yea, exactly that. Currently, I rely on interactive chat discordsrv addon providing the image methods and my plan is to get away from that dependency. Sometimes, with that, images (especially ones that have many layers such as inv + puppet + items held + full inventory + armor) take up to 7 seconds to come back - something I'd like to fix in my version.

queen plank
#

I'm trying to make a projectile invisible. I know I need to use packets for this, but I don't know how to get the packet I require. I found that I need the PacketPlayOutEntityDestroy, but I don't know how to get it. I can't find the class path for it anywhere, anyone who knows?

proud pebble
#

for mojang, its ClientboundRemoveEntitiesPacket

lyric gyro
#

how to code command to check player inventory and take item in this?

proud pebble
lyric gyro
#

give me

#

:((

#

the code

proud pebble
#

im not spoonfeeding you the code

#

ive told you what to do

lyric gyro
#

the event player invent?

proud pebble
#

you can get the player's inventory from the player object

lyric gyro
#

listen daddy cool

#

when you code:)

primal otter
lyric gyro
proud pebble
#

clearly not taking this seriously so you wont get any serious help from me

#

i would spoonfeed, if i and only i want to, not because someone else told me to

queen plank
# proud pebble you using remapped?

That was actually very useful, I managed to get and instantiate the Packet. However, I can't send it lol :> I get this: java.lang.NoSuchFieldException: playerConnection Here is my code```java
try {
Object packet = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy")
.getConstructor(int[].class).newInstance(new int[] { p.getEntityId() });

for (Player player : p.getWorld().getPlayers()) {
Object handle = player.getClass().getMethod("getHandle").invoke(player);
Object playerConnection = player.getClass().getField("playerConnection").get(handle);
playerConnection.getClass().getMethod("sendPacket", getNMSClass("Packet"))
.invoke(playerConnection, packet);
}
} catch (Exception e) {
e.printStackTrace();
}

proud pebble
#

oh, reflection. how fun

queen plank
#

Do you know what is causing it?

#

Indeed

proud pebble
#

has Player been cast to CraftPlayer?

queen plank
#

It has not no

proud pebble
#

you need to do that, not sure how that works with reflection

queen plank
#

I'm supporting 1.14-1.19 so I didn't think that worked

#

Casting to craftplayer I mean

hoary scarab
# lyric gyro how to code command to check player inventory and take item in this?
public class YourCommand implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(!(sender instanceof Player player))
            return true;

        PlayerInventory playerInv = player.getInventory();
        ItemStack diamond = new ItemStack(Material.DIAMOND);
        playerInv.removeItem(diamond);

        return true;
    }
}
proud pebble
#

actually, if it didnt work it would fail at getHandle

#

hmm

#

maybe its renamed something else

queen plank
#

yay...

lyric gyro
#

how to create new pack have command

primal otter
#

pack?

lyric gyro
#

package

proud pebble
#

its not playerConnection, its b

queen plank
#

java.lang.NoSuchFieldException: b

#

:>

proud pebble
#

oh

queen plank
#

I just saw that as well lol

proud pebble
#

what version are you using rn to test with?

primal otter
queen plank
#

rn it is 1.19

proud pebble
#

1.19.0?

queen plank
#

Yus

lyric gyro
wicked sonnet
#

Not login my account

proud pebble
#

what about connection?

primal otter
wicked sonnet
#

Its fast when I login my account by number it says unable to login in discord

lyric gyro
#

this is not discord support

primal otter
#

lmao

proud pebble
queen plank
#

Hmm?

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

proud pebble
#

instead of b try connection

queen plank
#

Ahh, I see. Lemme try

proud pebble
#

last thing i could think of

lyric gyro
#

cant upload image

neat pierBOT
proud pebble
#

o wait

lyric gyro
#

@primal otter

queen plank
#

Ugh java.lang.NoSuchFieldException: connection

lyric gyro
#

not have commands package

primal otter
#

its undefined

primal otter
proud pebble
#

getHandle gets the EntityPlayer, so you would have to get it from the object handle

lyric gyro
#

my english bad

primal otter
#

yeah i see

lyric gyro
#

VietNamese

#

ok?

proud pebble
lyric gyro
proud pebble
#

not from the player object

lyric gyro
#

how to add command

primal otter
#

idu what you want

#

how to make minecraft command?

lyric gyro
#

add command

lyric gyro
queen plank
primal otter
proud pebble
queen plank
#

Lets see then :>

lyric gyro
#

i dont understand

proud pebble
#

something like that

primal otter
lyric gyro
#

Because they already made the command, I don't understand what they do

primal otter
#

how old are you

lyric gyro
#

:)))

#

you will be very surprised

#

:)))

#

how old are you

#

@primal otter

primal otter
#

let's stay on channel topic

queen plank
# proud pebble something like that

That did work, but of course there is another problem lol, though I'm sure it is the last one at least heh. So, I can't send the packet to the player since java.lang.ClassNotFoundException: net.minecraft.network.protocol.game.Packet, it is this row playerConnection.getClass().getMethod("a",getNMSClass("Packet")).invoke(playerConnection, packet).

#

I'll just have to find the class path of the Packet class though

primal otter
hoary scarab
queen plank
#

@proud pebble, I've managed to get it to work now. Thank you so much for the help! Now 1.14-1.19 support awaits me lol. Thank you so much though!

proud pebble
lyric gyro
#

and the next tip?

queen plank
proud pebble
#

or if its not obfuscated name then to its current stated name

#

sounds like fun /s

lyric gyro
#

@hoary scarab help

tight junco
# primal otter please learn java before coding spigot plugins

i kinda hate this sentiment because you can very easily learn java using spigot and it seems like it's completely a slap in the face and disregards whatever the user is asking how to do, it seems so much more helpful to say to focus on learning java conventions.

Saying to learn java before spigot plugins is essentially saying "lol quit plugins, its too hard for you" zzz_shrug

lyric gyro
#

:))

#

yesss

tight junco
#

instead of saying, I recommend looking into how _x_ language is used to help with the plugin, you're just saying to just stop entirely

icy shadow
#

you might be able to make something work but it'll be a gigantic mess that barely works

hoary scarab
#

I never actually learned java. All my knowledge/experience was started from spigot.

lyric gyro
#

no wonder

tight junco
#

i agree with that much, but saying to just completely disregard using spigot api entirely is plain stupid to me

#

it's completely unhelpful

icy shadow
#

trying to code plugins with 0 java knowledge is equally unhelpful

tight junco
#

-> user asks for help on how to do something
-> developer tells them to learn how to do it and nothing else
-> user got nowhere

icy shadow
#

oh sure i wouldnt use it as an excuse to not help someone

tight junco
#

people so often just tell people to learn the language without pointing them any direction on how

icy shadow
#

but 9/10 times if someone doesnt have java knowledge they wont even understand any helpful explanation

lyric gyro
#

giv cod

tight junco
#

but in 9/10 cases people just say "learn java" and give no directions from that point on

icy shadow
#

citation needed

lyric gyro
#

learn-java moment

icy shadow
#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

icy shadow
#

ez

#

so called "unhelpful"

lyric gyro
#

thanks <@&333634764085133313>

icy shadow
#

what

#

did u just ping me

tight junco
#

even then that's still limited imo

lyric gyro
#

limited how lmao

merry knoll
lyric gyro
#

those are literally the starting points

merry knoll
#

they come back with the same type questions constantly

tight junco
#

yeah they're the starting points but even then it can take a really extended amount of time to get to the point

merry knoll
#

and thats normal, you kinda have to deal with the pain

icy shadow
#

well yes, thats the point

#

^

#

learning programming takes time