#development

1 messages · Page 91 of 1

proud pebble
#

are you surr your imports are correct and are using just bukkit, not craftbukkit classes?

lyric gyro
#

Anyone understand the heap and have good experience with eclipse memory analyzer? I'm trying to trackdown why with 61 players online (61 PlayerConnection objects) ive somehow managed to use over 10gb of memory, for some reason, seems to be related to the PacketPlayOutMapChunkBulk packet but.

sterile hinge
#

Sounds like you‘re on a completely wrong path

#

What are you actually trying to figure out

lyric gyro
#

Why I'm using 10gbs of memory with 60 players on.

#

I was told there was a memory leak, but I've seen nothing obvious, although I am wondering why that packet specifically is seemingly accompanying 90% of the size of each PlayerConnection object.

brisk pilot
#

hi

lyric gyro
sterile hinge
lyric gyro
brisk pilot
#

how could I create like a ghost block only for 1 player (protocolLib ig) that would be invicible and would stay in place (so setGravity to false and it wouldn't drop etc.) i was trying to make it but im starting over

#

if anyone could help I'd be really grateful

brisk pilot
#

im kinda beginner in writing plugins so i can say b^llsh1t

sterile hinge
lyric gyro
#

well i thought like

lyric gyro
#

someone made a shitty NPC plugin

#

cause i tracked that down below

#

cause he didnt flush packets

#

had like 1923192312 QueuedPackets

brisk pilot
pulsar ferry
#

No, it'll be a ghost block which is what you asked, not a block entity

brisk pilot
lyric gyro
#

607mB of packetplayoutmapchunkbulk objects in one playerconnection 😠

brisk pilot
#

and could I do a highlight on it?

pulsar ferry
#

No

brisk pilot
#

:/

pulsar ferry
#

If you want an entity that only one player can see look at Player#showEntity

brisk pilot
#

im trying to create like a preview before placing structure @pulsar ferry

#

like you know, in rust

pulsar ferry
brisk pilot
pulsar ferry
#

Probably better as block display entities

#

@lyric gyro why you do keep sending me friend request?

lyric gyro
#

wym keep sending

#

did i send another

pulsar ferry
#

Yes, you sent me twice already

lyric gyro
#

oh

#

mb

lyric gyro
#

gonna crashout @sterile hinge

#

u wont believe what the issue was

lyric gyro
#

I never even used the memory analyser wrong, I just had blind faith for the developer of the jar. Of course there was no upstream inbound references, becaues the issue was on packet received with server-debug mode on he just adds infinitely to a map with no capacity and it is only cleared manually via command 📈

icy shadow
#

lmao

rich charm
#

Hello, i would like to know how i can replace all placeholders inside a String, so like i have a config String like "%player_name% has a ping of %player_ping%"
and i would like to replace everything at once

lyric gyro
#

u want to replace

#

in a placeholder replacement?

#

theres an expansion for that I think with PlaceholderAPI.

rich charm
#

normally i have done that with PlaceholderAPI.setPlaceholder()

#

but i want so not to replace a specific one.

lyric gyro
#

wait im confused what you're trying to do lemme read again

lyric gyro
rich charm
#

yes

lyric gyro
#

setPlaceholders should do that as you said though

#

diff sigs but the javadocs says its translates ALL placeholders into their corresponding placeholders, theres' just overloads for like offline players, arrays, etc. all do the same thing tho

river solstice
#

yes, PlaceholderAPI.setPlaceholders does parse all the available placeholders, no need to specify what you "want" to parse manually

rich charm
#

p.sendMessage(PlaceholderAPI.setPlaceholders(p, "%player_name%"));

icy shadow
#

noo

#

the second parameter is the entire message

#

not the placeholder

rich charm
#

Ahhhh

icy shadow
#

so you would do p.sendMessage(PlaceholderAPI.setPlaceholders(p, "%player_name% has a ping of %player_ping%"));

rich charm
#

Now i check

#

Thanks!

brisk pilot
#

hello, could someone help me make a ghost block visible to only 1 player using protocollib, it'd be falling block, i just dont know how to strat, and then if someone could tell me how to teleport it to coordinates

i'd be really grateful
i just tried and i have no idea

pulsar ferry
#

i told you before, you don't need protocol lib, you can use the api for that, and use display block entities instead of falling blocks

worn jasper
#

Besides, why use protocollib when packetevents exists

#

😭

icy vigil
#

nms exists

torn heart
torn heart
lyric gyro
#

use ignite instead of any of it ong

lime frost
#

I want to fork deluxetags to allow for different guis for different tag groups, anyone know where I can get the repo?

river solstice
neat pierBOT
fluid shore
#

plese help

dusky harness
#

maybe it doesn't support 1.21 yet? 🤷‍♂️

shell moon
minor summit
#

what does a hub plugin need to not support, like, any version lol

hazy nimbus
#

from the spigot page, probably:

  • tablist
  • holograms
  • anti world downloader (I wonder how that works)
icy shadow
#

are you neanderthal

hazy nimbus
#

I guess so :<

upper jasper
hazy nimbus
#

lol

#

why did I expect something more sophisticated

upper jasper
#

it might also do something chunk loading related but i dont expect that

#

it indeed does not after seeing the code lmao

spiral prairie
#

What the fuck is a server going to do in order to prevent that bruv

torn heart
#

but that wouldn't really matter for hubs

#

since not much to hide below the surface

neon pewter
#

in a data model class i have a method called getTable that return an enum of type Table. It is overriding an abstract class.

    @Override
    public Table getTable() {
        return Table.ITRequest;
    }

why when i try to obtain this method from another method using :

        Table table;

        try {
            table = (Table) modelClass.getMethod("getTable").invoke(null);
        } catch (Exception e) {
            throw new IllegalAccessException("Model is missing a valid getTable() method that return a Table enum.");
        }

it throw the error saying the model class i'm passing in is missing its getTable method?

lyric gyro
#

wait

#

hold up

#

may of misread my ui is miniaturized rn

#

wait not yea

#

The error occurs because you're invoking the getTable method as a static method using invoke(null), but it's an instance method.

#

since getTable() is an instance method (overrides an abstract method) it requires an object instance to be called, and using invoke(null) attempts to call it statically

neon pewter
#

ohhh i see now, the method was previously static but then i implement a new abstract class for required method. Thank you for pointing that out!

lyric gyro
hoary scarab
#

Any reason maven would stop shading jars into my plugin?
Haven't changed anything, ran package and the output jar doesn't contain any of the files its suppose to shade.

sterile hinge
#

sounds like you misconfigured something

hoary scarab
#

Haven't changed anything since I used it last so misconfigured wouldn't sound right.

sterile hinge
#

the alternative is that a cosmic bit flip modified maven code in a way that it suddenly behaves fundamentally different

hoary scarab
#
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.6.0</version>
    <configuration>
        <filters>
            <filter>
                <artifact>*:*</artifact>
                <excludes>
                    <exclude>META-INF/**</exclude>
                </excludes>
            </filter>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
</plugin>
```This seem right?
sterile hinge
#

that part yes I guess

hoary scarab
#

Yeah then no clue why its not shading.

sterile hinge
#

Well that’s not the only relevant part

hoary scarab
#

Made a new project, copied over the code, converted it to maven, generated a fresh pom, added the shade plugin and dependency, ran with package.
Still doesn't contain the dependency.

sterile hinge
#

Then you‘re still doing something wrong

hoary scarab
#

Got any ideas?

#

This worked fine less than 6 months ago lol

sterile hinge
#

I can’t magically see the rest of the pom, so no

hoary scarab
#

I'm not on PC anymore. Fresh pom generated with the maven compiler plugin written and I just added the shade plugin and dependency.

sterile hinge
#

That doesn’t help at all

neon pewter
#

is it possible to to check for Number Format exception like this ?

minor summit
#

yeah

lyric gyro
#

^

river solstice
high needle
#

How do I get my plugin to show stats on Bstats?

high needle
#

Thanks!

half sinew
#

Bonjour, je souhaiterai savoir comment modifier le nombre de chunck claim ( les passer de 4 à 1 seul)

Merci d'avance.

icy shadow
#

I don’t think this is the right place

#

And you probably need to ask in English

half sinew
#

Okay, thanks

eager cobalt
#

heko

#

help

broken elbow
# eager cobalt https://mclo.gs/K44CfHI

io.netty.handler.codec.EncoderException: com.viaversion.viaversion.exception.InformativeException: Please report this on the Via support Discord or open an issue on the relevant GitHub repository

neon pewter
#

is it possible to exclude these 3 class from my module or i have to move out into another package ?

sterile hinge
#

What do you want to achieve? What type of module are you talking about?

neon pewter
#

if i do dbConnect.mapper it will expose all class within this package

sterile hinge
#

As you‘re having a module-info.java already, just put them in their own package and don’t export it

neon pewter
#

so there is no other option then, ty

sterile hinge
#

I mean you can make them package private, but that probably doesn't help you

finite terrace
#

Creating my own placeholder for my plugin, how can I return my string with color?

if(params.equalsIgnoreCase("clan_role")) {
            String clan = plugin.getClanManager().getClanByOfflinePlayer(player);
            if (clan == null) return "";
            else if (plugin.getClanManager().isOfflinePlayerOfficer(player)) return "O ";
            else if (plugin.getClanManager().isOfflinePlayerLeader(player)) return "L ";
            else return " ";
        }

I tried just adding $#xxxxxx infront of O and L but it output that exact text, no color parsing.

lyric gyro
finite terrace
#

PAPI supports Minimessage coloring?

lyric gyro
#

when you're making your own placeholder, and assuming your jar is added as a dependency in this plugin you're making a PlaceholderExpansion hook just translate it directly

#

e.g. MiniMessage.miniMessage().deserialize(message, Player)

#

i mean u can also write a method to use legacy class to translate hexadecimal colors

finite terrace
#

Right I see what youre saying now. Issue is, the plugin parsing my placeholder is not made by me.
Trying to get color from a placeholder to parse in EssentialsX Chat

#

my plugin provides the placeholder.
EssentialsX Chat and also TAB will need to parse it.

lyric gyro
#

So are you making an expansion or a plugin that has an expansion in it where is the code you sent from

finite terrace
#

I'm making a plugin which has an expansion in it.

#

A clans plugin which provides clan related placeholders.

lyric gyro
#

So just pass the string you're returning into one of them methods

#

TAB plugin already hooks placeholderapi

finite terrace
#

the string is but I'd like it to be colored based on their clan role.

lyric gyro
#

Yes so in your plugin right, which as a java plugin I assume has a dependency for your server jar

#

so you'd have access to the MiniMessage class

#

so when you return the placeholder string

#

e.g. "L "

#

pass it through the deserialize method

#

If you want to get a String and not a component back though since im pretty sure the placeholderapi method wants a string returned not a component

#

You can use the LegacyComponentSerializer to achieve that too, I think itll still parse hexadecimal colors fine.

finite terrace
#

I cant pass it through the Minimessage deserialize method if I'm trying to use it in EssentialsX chat right?

lyric gyro
#

i dont think essentials by default passes its messages through the needed placeholderapi method no

#

I dont think essentials ever has hooked placeholderapi by default

#

at-least it didnt in 1.8

#

TAB does tho

finite terrace
#

I use chatInjector plugin which does translate papiplaceholders for essentialsX

#

but it doesnt seem to pass them through mimimessage

#

Right yeah, tab is working fine, it seems to be able to parse it. Its my papi -> ChatInjector -> essentialsX chat flow thats really causing problems.

lyric gyro
#

im unsure what you're directly trying to do, yes the chat injector plugin will parse ur placeholders, and if ur placeholder is passing the string through a minimessage method most likely the LegacyComponentSerializer if you want a String not a Component, it should still work all the same. So if you in your placeholder were to return eg..

return LegacyComponentSerializer.legacySection().serialize("<#f04747>L ");

than you use the placeholder in your chat injector plugin id imagine it would work out just fine

#

" Essentials chat does not support PAPI directly. You need to use the plugin chat injector to use placeholders in your Essentials formats. "

if you use your placeholder you just created there, that doesn't work?

finite terrace
#

I'll give that a shot. I was attempting the essentials format of color codes &#f04747 rather than Component format <#f04747>

lyric gyro
#

i think newer essentials locales support minimessage by default im honestly not sure with alot of this newer stuff as i havent really even fucked around with newer mc - pretty much always been 1.8

#

But I know in 1.8 and im pretty sure its the same now

#

EssentialsChat

#

its self

#

does not pass its strings

#

into placeholderapi

#

You could always fork EssentialsChat or just use your chat injector approach for placeholders

#

Then when you make your placeholders whenever u use them in your chat injector plugin it should still be displayed normally, because im pretty sure it all translates the same nevertheless

finite terrace
#

yea, I would hate to have to maintain a fork of EssChat tbh.

lyric gyro
#

i never thought esschat was that big tbf

#

ik essentials is big

#

never thought essentials chat was

#

and considering all youd be adding is what?

#

PlaceholderAPI.setPlaceholders

#

or whatever the methods called

#

not a insanely strenuous task

finite terrace
#

yea even with component format, doesn't parse the color code in essentials [#808080](/guild/164280494874165248/channel/808080/)O Zerek: .

lyric gyro
#

so ur what, now trying to just edit ur essentials config?

#

to change chat formats

#

did &#f04747 or just #f04747 work

finite terrace
#

&# no, I'll try #

lyric gyro
#

ess might be using their own custom method such as the one I showed u when linking you that thread

#

rather than minimessage

#

to maintain

#

backwards compatibility

#

or something

#

I think i have a problem that might solve your placeholder problems too

#

although i dont know if itll work for your version as I made it in 1.8 or a friend did I think

#

let me check

finite terrace
#

no luck with #xxxxxx format

lyric gyro
# finite terrace no luck with `#xxxxxx` format

according to the essentials config you should be able to do this though;

# A color code between 0-9 or a-f. Set to 'none' to disable.
# In 1.16+ you can use hex color codes here as well. (For example, #613e1d is brown).
finite terrace
#

I think the trouble is, with the placeholder being parsed with chatinjector, that happens after essentials has done its parsing.

#

So essentials does color correctly if I put those formats directly in the essentials chat format section but when passed via chat injector, no luck.

#

So really I need a chatinjector that can parse some hex code formats.

lyric gyro
#

idk the plugin ijust sent you will purely set ur chat format with the papi parsed result, so if ur using or wanting ot use ess chat primarily for your chat formatting - the plugin I sent you alongside essentials & essentials chat are the only ones you should require~

finite terrace
#

Seems like thats basically a chatInjector. I'll try it out.

lyric gyro
#

for anyone reading the conversation we sorted it out in dms panda_hype

atomic trail
#

Is there a way of sorting a json object so I would have score shown on the top line?

                    JSONObject bestItem = new JSONObject();
                    bestItem.put("score", score);
                    bestItem.put("supplyFactor", supplyFactor);
                    bestItem.put("liquidityFactor", liquidityFactor);
                    bestItem.put("profitPerItem", profitPerItem);
                    bestItem.put("marginPercentage", marginPercentage);

Output:

    "FLYCATCHER_UPGRADE": {
        "supplyFactor": 0.8737040984105191,
        "liquidityFactor": 20.71231517720798,
        "score": 19020.651041060628,
        "marginPercentage": 4.36,
        "profitPerItem": 1104751.8000000007
    }
sterile hinge
#

use a json library that preserves order

atomic trail
#

Which one would you recommend?

#

GSON right?

dusky harness
#

Maybe

#

Oh wait nvm that's yaml

#

Or I guess it'd work in json as well, just not as pretty

atomic trail
#

Looking into that rn actually

#

I think it'll work

#

Just regular JsonArray

dusky harness
#

Oh wait is this a config

#

Or data

#

If it's not config then yeah I think array is the way to go

atomic trail
#

It's data

#

Working on a system for getting the best flipping items for hypixel skyblock lol. Just for fun

#

Then when it's done, I'll implement AI to try and predict future best options

#

I think it could be good

dusky harness
#

<scope>provided</scope> means that that dependency will be provided at runtime
meaning that maven won't shade it because it assumes that it'll be provided

#

remove that line and maven should shade that dependency

#

(by default, it's <scope>compile</scope> which tells maven to compile that dependency into the shaded jar)

hoary scarab
#

I thought "provided" means I provide it so it doesn't need to be downloaded.

#

SOAB!

wary dust
#

how do i use paperweight for a specific version of minecraft?

#

or like im trying to use the mojang remapped and I havent done it before and I keep running into issues

river solstice
#

wdym? specify the version in the build.gradle

minor summit
#

impressive

lyric gyro
#

anyone got an idea on why Oraxen/ItemsAdder in 1.21.4 just doesn't seem to overwrite textures on inventory items, weapons or armor. It does however, when placing textured blocks seem to texture the physical block, and inventory textures work fine, so im confused. could it perhaps be something to do with paper? I mean it has a NMS impl for this version so I wouldn't understand why

neon pewter
#
loom {
    splitEnvironmentSourceSets()

    mods {
        "mod_id" {
            sourceSet sourceSets.main
            sourceSet sourceSets.client
        }
    }
}

I'm reading on the loom section in the fabric doc for the spilt source of mod, do I have to create module-info for it to work ?

minor summit
#

i don't think fabric modding has any support for java modules

neon pewter
#

does any1 know where the javadoc for the minecraft package is ? i tried downloading the javadoc but it seem like there is none

hazy nimbus
#

Wdym javadoc

#

Mojang provides no javadoc lol

#

There's some community one, literally google it

river solstice
#

I don't think you can publically post that

neon pewter
#

so there is no documentation for what their method do? got it

river solstice
#

which method?

neon pewter
#

method under the net.minecraft package

hazy nimbus
river solstice
#

that's.. not exactly it

#

that's for forge

hazy nimbus
#

for fabric too, it's mojmap compatible, so you could probably make it work with paper NMS

hazy nimbus
river solstice
#

well, seeing what code actually does, not what some text says it does, imo is more valuable

hazy nimbus
#

ofc, but that's not what they asked for

neon pewter
#

im just trying to figure out what some of the method under the net.minecraft package do, for example i know getUUID() probably return the entity's uuid, but what type of uuid they return is not availiable, does it compatile with the java.util.UUID class or not (which it might since mc use uuid version 4)

river solstice
#

sure you can use some sort of library that will provide you some sort of "docs", but I'd value seeing the implementation more

#

they are free to ignore my suggestion if that's not what they are looking for

neon pewter
#

i mean if i really want to see the source code i could decompile view it in intelij but i will check out paper nms

#

not sure if it is compatible with fabric...

river solstice
#

oh, you need fabric, I totally missed that one

hazy nimbus
#

If you're using fabric you can just use what I sent :/

neon pewter
#

i will add a todo to add it once it is supported for my version

#

ty both

neon pewter
#

yeah it use java.util

proud pebble
ionic vale
#

Helo i need person for create big project in Minecraft , if you whant please dm me or tag me

signal moat
teal vale
#

Can someone compile a Minecraft Mod for me? It's my first time coding one and I'm getting a few issues while compiling.

#

It stucks on this

heavy wadi
#

What do y'all use for web scraping these days? I used to be a heavy selenium enjoyer back in the days, is there something better/easier out there in 2025?

river solstice
#

the tool that you are familiar with is probably gonna be easier than learning an entirely different one

#

but yeah, most likely there are plenty of alternatives

torpid raft
#

and if i have to deal with captchas i'll pay some online service something like $0.0002 per captcha i need to solve

hard oar
#

Hello, if I receive more arguments with my placeholders, does it have the underscores?

For example I have placeholder with the identifier test.
When I do %test_doSomething%, the @NotNull String params will be doSomething.
But when I want to do %test_doSomething_doThis%, will the params be doSomething_doThis or doSomething doThis?

minor summit
#

with underscores

hushed mantle
#

does deluxetags have an API?

lyric gyro
#

My custom placeholders break when I do /papi reload, is that normal?

#

Restarting server fixes it tho

proud pebble
#

also did you overide persist()?

lyric gyro
lyric gyro
#

let me try

proud pebble
#

override it as true

sweet rose
#

Has anyone made a free VPS with Oracle? I have one, but it won't let me make internal connections. How do I connect from outside to the VPS database? I'm supposed to have everything configured correctly. But it doesn't work for

river solstice
#

allow 3306 via network security config

sweet rose
river solstice
#

yes

sweet rose
#

I'll try, thanks

spiral prairie
#

Please don't open port 3306 to every person on the internet..

hazy nimbus
#

what can go wrong?

river solstice
#

well, lots of things can go wrong

#

brute-force attacks
ddos attacks
vulnerability exploitation

hazy nimbus
#

I should really start using /s

sweet rose
#

There really won't be anything important there

bitter ledge
bitter ledge
sweet rose
#

But as I said there wouldn't be anything important anyway

sterile hinge
#

Use an ssh tunnel

flint pine
river solstice
#

it is the wrong channel

dusky harness
# sweet rose Why?

For this I wouldn't worry about it
If you're a larger server with a reason for someone to

  1. Figure out your database vps IP (which is a separate issue)
  2. Want to attack not just your main server but also your database vps
    Then sure
    And plus you mentioned that there isn't anything important
dusky harness
#

At least, in my opinion

river solstice
#

but should be on this page

sweet rose
#

I can't use it for that anyway because I can't connect from outside. :(

spiral prairie
#

I've had an empty database hacked because Docker was exposing it with the default username/password for the service it was hosting. The IP was published exactly nowhere but they still found it

river solstice
#

no need to publish the IP

#

the bots automatically scan every possible IP in the world

spiral prairie
#

Exactly, that's why it's important to keep best security practices no matter how popular

river solstice
#

everyday I get hundreds of pings from various locations for my webserver lol

spiral prairie
#

Same

river solstice
#

lol

jade wave
river solstice
jade wave
#

Ahhh damn it

#

I wanna self host.

#

I bought another server this week and wanted to attempt to set it up as a honeypot- but I couldn't connect via IPv6 since my damn ISP doesn't support it fingerguns

#

It was so fun figuring that out after 4 hours of troubleshooting haha

river solstice
jade wave
#

Oe lemme have a look, thanks man

spiral prairie
#

Umami is very lightweight

waxen violet
#

hi

#

i need someone to help me make a bot

#

i already has evrything evrey cod

#

but i need someone to help

#

pls dm to help

rugged bane
worn jasper
#

^ hangar/paper uses umami

pure crater
#

Should I create my event implementations using ByteBuddy? I plan to have a shitload of events and I don't feel like manually implementing them because they will all follow the same format

#

I currently have a system where I use ByteBuddy to generate event impls at runtime

sterile hinge
#

What exactly are you generating there?

dusty frost
#

i've been forced to use Lombok for my work (stinky Java no Kotlin :/) and there have been quite a few issues with it, but it is kinda nice. but for something like that, you probably just want the actual real implementations for editing or whatevs

graceful hedge
#

lombok professional :o

minor summit
#

I'd probably just use Immutables tbh

river solstice
sterile hinge
#

not sure why anyone would touch lombok

swift portal
#

I’m looking for an experienced developer to create a custom plugin for my Minecraft server. If you’re available, I’d love to discuss the details — of course, I’m happy to pay for your time and work.

river solstice
# sterile hinge not sure why anyone would touch lombok

eh, well, it gets repetetive pretty quick when you are writing same thing over and over and over again (getters, setters, constructors, builders, toString, hashCode)
It's not that bad as people usually portray it to be

river solstice
sterile hinge
#

guice is still java, lombok is not

river solstice
#

eh, well, compile-time magic vs runtime-magic
wouldnt said lombok is "not" java, the produced bycode itself is still "100%" java
techically not that different how javac turns .java to .class, just that lombok adds stuff before that

#

I understand that lomboks compile-time transformations are "not" really a part of java lang spec

#

saying lombok is not java is kind of philosofical jab, not a "technical truth"
kind of like saying JSX isn't Javascript, depends on how purist you are

sterile hinge
#

bytecode is not java, it's bytecode

#

JSX also isn't JS

#

there's a reason why we have language specifications

#

lombok also encourages terrible design choices, because everything you do with it is basically an anti-pattern

sterile hinge
#

getter, setter, equals and hashcode depending on mutable values, etc

hazy nimbus
#

Uhh and how are getters and setters anti-pattern?

river solstice
# sterile hinge lombok also encourages terrible design choices, because everything you do with i...

well that's opinion, not a fact
just because you can write anti-patterns, does not mean you should
you can misuse any tool, you can abuse Spring too (@Autowired, using Field injection, using everything as @Component, abusing AOP/Proxies/Reflection, misusing @Transactional), so does that make Spring "bad"?
also lombok supports immutability and encapsulation. you can write clean, encapsulated and testable code.

#

4+ years that I have been working with lombok I have not encountered a single issue with it, personally

graceful hedge
# hazy nimbus Uhh and how are getters and setters anti-pattern?

My two cents to the discussion is that lombok complicates codebases but makes code less verbose

For example, as long as you run lombok with standard data objects, normal beans etc, you’ll find it rather fine and consistent to use. The problem I have whenever I see lombok used in a project is that you always end up deviating in design, because put simply; not all classes are gonna look like normal beans- and so you eventually get to this inconsistency issue where some constructors are lombok-generated, some are written out, some getters are generated, some are written out (in the same classes even). This is complicates your codebase due to its inconsistency and ambiguity in how things should be written - the java way or lombok way.

river solstice
#

also, there are worse things than lombok such as AOP

river solstice
sterile hinge
graceful hedge
hazy nimbus
hazy nimbus
sterile hinge
#

The point is that if you use Lombok because you want to create getters without noise, you‘re hiding your bad decisions

river solstice
graceful hedge
#

I’m not sure how much you actually consider boilerplate, in my eyes that can be a bit subjective

sterile hinge
#

Also if you just need data objects, then generating them from some spec would still be less verbose than Lombok and compatible with Java

river solstice
sterile hinge
#

Someone should really make sure that Lombok breaks with every javac update

river solstice
#

TLDR, pick your poison

public class User {
    private String username;
    private int age;

    public User(String username, int age) {
        this.username = username;
        this.age = age;
    }

    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }

    public int getAge() { return age; }
    public void setAge(int age) { this.age = age; }

    @Override
    public String toString() {
        return "User{username=" + username + ", age=" + age + "}";
    }

    @Override
    public boolean equals(Object o) { ... }
    @Override
    public int hashCode() { ... }
}
@Data
@AllArgsConstructor
public class User {
    private String username;
    private int age;
}
sterile hinge
#

See, you could generate the first from a specification that is shorter than the second

#

Pick the sane solution or the poison

river solstice
#

isn't that literally what lombok does?

graceful hedge
#

in the real world it doesn’t always look like that, (in my opinion and experience just)

sterile hinge
#

Works great and doesn’t meet any hacks

#

And it‘s also less noise than having multiple declarations of the same thing in multiple places

river solstice
#

well, that's a tool, yeah, but kind of a totally different thing

dusky harness
#

🙃

#

But yeah i know that's not the point

hazy nimbus
sterile hinge
river solstice
#

ok, so, what is the purpose of protobuf?

#

oh no emily gonna be spitting some fax

minor summit
#

I can't remember when I last wrote code in a way that required getters and setters tbh

#

fax of the day is that fax is not dated

minor summit
#

especially for the builder part

swift portal
#

Can anyone give me good videos on how to learn plugin developing?

#

I want to start learning

minor summit
#

there was some guy, uh, CodeRed or something, as far as videos go it seems to have good reputation but I cannot personally vouch for them

minor summit
#

idk I just did things

swift portal
#

lmao ok

minor summit
#

learned C at school years ago, wrote C# in vacations

#

JetBrains has a pretty good java course

sterile hinge
river solstice
#

well, no, protobuf isnt really about interacting with the "outside world" like data objects or APIs
its main purpose is data serialization
its about doing that efficiently and with minimal overhead by serialiazing request/response into a small binary format

generating source java code via protobuf is all good on its own, but generally serves a different purpose than lombok

lombok is used for less boilerplate, if you are writing .proto schemas, you are still writing way more than if you would be by using lombok
and I dont see a reason to use protobuf if I am not planning to optimize sending data between different applications/microservices or just in general "cleaner" (subjective) code

pulsar ferry
river solstice
#

for me its easier to read a smaller class, than having 50 lines of getters and setters

minor summit
#

or just don't design code in a way that requires you to have getters and setters fingergun

river solstice
#

doesnt work everywhere

hazy nimbus
#

??? How do you design java code with no getters and setters

minor summit
#

you uh you just do

hazy nimbus
#

Like ofc beans/guice are a thing, but let's talk vanilla java

hoary scarab
#

Public variables 😉

minor summit
#

no lol

hazy nimbus
#

Oh no

minor summit
#

things properly encapsulated n all

river solstice
minor summit
#

god forbid one encapsulates data

river solstice
#

in ideal world, sure, you wouldnt use getters/setters
but in enterprise solutions, frameworks, apis, serialiazation and often pretty huge codebases, thats just not really possible (imo)

minor summit
#

granted that i haven't written a 400k loc code base so maybe I am missing something, but in the past.. N years, the only times i've written getters/setters is to interact with the JavaFX properties system

river solstice
#

yeah I mean I dont see how would you not use g/s in a REST Api

minor summit
#

you uh..

#

okay

#

lol

river solstice
#

(maybe records)

minor summit
#

i use records to model data, yes, if you consider those getters I have failed you I suppose, but setters are pretty much out the window for me

#

idk i just don't design my code in a way where they show up

#

i don't have a magic powder that helps me at night.. or, not for this anyway

#

so idk

river solstice
#

well, you could say they "kind of" have getters if you wouldnt consider them "accessor methods", but yeah, no setters

sterile hinge
minor summit
#

i've never used lombok but i don't appreciate the fact it hijacks the compilation process :(

#

Immutables 🥺

river solstice
minor summit
#

i'm talking about the AP

#

v good 👍

dense drift
#

Does that generate the class in your project as you code or it happens at build time?

minor summit
#

it happens at compile time, it can generate either class files directly or java source files so it's easier to debug and navigate in your ide

#

APs run at compile time

hoary scarab
#

Wouldn't a record technically be an initalized variable? 😉

minor summit
#

what the heck kinda goofy ahh backwards question is that?

#

that doesn't even make sense

hoary scarab
#

You initialize it, then you get its contents.

minor summit
#

uh

#

sure..?

kind granite
#

last time i checked classes aren’t variables

hoary scarab
#

I'm joking... 😉

shell moon
thin tendon
#

how do I use PlaceholderAPI with Component's from Adventure?

broken elbow
#

PlaceholderAPI doesn't support components

#

just Strings

thin tendon
#

for guis and items it's deprecated

dusty frost
#

yeah so parse the strings that PAPI returns to you as Components, plus your own formatting or whatever

torn heart
#

the markdown formatting really convinced me to help you

icy sonnet
waxen violet
brittle arrow
#

Heyo! I'm working on a plugin that(among other things), increases the knockback effect of TNT onto other TNT. However, the issue I'm having is that the event I called isn't detecting TNT entities being knocked back, but it does for player entities. I'm not sure how else to do this. Here is the code I've made so far:

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
    public void TNTKnockbackEvent (@NotNull EntityKnockbackEvent e) {

        if (!(e.getCause() == EXPLOSION))
            return;
        System.out.println("We have an explosion: " + e.getKnockback().toString());
        // Increase knockback by factor provide from config
        e.setKnockback(e.getKnockback().multiply(TNTKnockbackFactor));
    }
#

the system.out.println was to check if it was actually getting triggered

river solstice
#

best bet is to listen to EntityExplodeEvent , check if it's TNT, get nearby entities, check if they are TNT

hoary scarab
#

Should also debug if the event was even ran.

brittle arrow
brittle arrow
brittle arrow
torn heart
brittle arrow
torn heart
brittle arrow
orchid otter
#

Is there a way to zoom in the players view? The only thing i have been able to find is some couple year old posts that suggest using a packet manually to i think simulate the spyglass.

Wondering if nowadays theres a better way?

hoary scarab
#

Nope. Bow was the old way, spyglass is the new one.

#

That or add the slowness/speed potion.

minor summit
#

there isn't really a way to force the client to use the spyglass tho

pulsar ferry
#

Wouldn't applying slow zoom in a bit? Ofc not as much as a spyglass

minor summit
#

ok, mattypattie

hoary scarab
neon pewter
#

beside pressure plates, buttons, tnt and target block, bell is there other blocks that can be activate by a projectile ?

pulsar ferry
#

Trip wire, and not sure if this would count or not but the big dripleaf can also be "activated" by projectile

neon pewter
#

ah ok ty

torpid raft
#

do sculk sensors count

atomic trail
#

How come the two jars in the run directory are not excluded from commit?

icy shadow
#

if theyre already staged you need to remove them from git tracking

#

do git rm -rf --cached run/

atomic trail
#

Not sure what you mean by staged?

#

If they were added with git add . before added to gitignore?

#

But yeah that works, thanks!

icy shadow
river solstice
# atomic trail Not sure what you mean by staged?

in IntelliJ, if it shows as green, it is tracked by git.
if it's red - it's not (untracked).

you can also see it by using $ git status: Changes to be comitted, Changes not staged for commit and Untracked files.

atomic trail
opaque dune
#

Hello! I just want to ask, in DeluxeMenus, is there any way of using item model instead of model data?

pulsar ferry
opaque dune
#

Oh

#

Thanks!

alpine jackal
#

I am back 😀

slow plinth
#

Is there an easy way to parse a text component into placeholderapi so that it keeps its formatting?

neon pewter
#

does any1 familiar with method name init turn yellow even tho it have no usage? , just wonder about the behavior of the editor

minor summit
#

i doubt it's specific to the name

#

it's probably because it's public

#

if you turn it private/package private it should turn grey

torn heart
neon pewter
#

wdym it doesnt exist 😭

river solstice
#

you are looking at java.nio.Buffer and the error says java.nio.ByteBuffer

neon pewter
#

it is the same line tho

dusky harness
minor summit
#

tldr build targeting the java version you are going to run on

neon pewter
#

strange, this guy specify that the source is written on 1.8 , but bumping it to 11 fixed it

minor summit
#

--release flag 💪

neon pewter
#

did i done something wrong for it to say module not found ?

river solstice
#

idk ur project is cursed

#

re-do from scratch

neon pewter
#

i read that this could cause by scope for the dependencies in the build script

#

it is recognized when running dependencies however

minor summit
#

does the mongodb driver even have a module descriptor?

neon pewter
#

it probably doesnt have it, where can i check it ?

neon pewter
#

so it mean it support java module ?

dire dust
#

Anybody else have trouble with placeholders not being parsed?

#

It registers successfully, but yet even when i do ```java
@Override
public String onRequest(OfflinePlayer player, String identifier) {
Bukkit.getLogger().info("Placeholder requested: " + identifier);

that doesn't show up
#

I also double checked /papi list and the expansion is there

#

i think it just doesn't accept _ in the identifier name

#

works now

broken elbow
narrow copper
#

Why doesn't the deluxemenus plugin show the number when I type placeholder-%bolt_queue_PROFILE_UNRANKED_fireballfight_playing% in the value?

pulsar ferry
hoary scarab
#

So for web development (front-end) I know its HTML, CSS and JavaScript. Is there anything else aside from javascript libraries (React, Vue)?

pulsar ferry
#

Wdym?

hoary scarab
#

Like... Any specific libs for webdevelopment like Apache or the other one starts with an N

pulsar ferry
#

If you want purely client sided rendering ther are a lot of js frameworks, some languages that do js compiling like Kotlin and Elm, WASM based languages (not very used right now)
If you want server side rendering there are again js stuff like NextJs, but you can also do it with other languages like Java, PHP, Rust, pretty much any other language
If you want a mix you can throw HTMX into it and use any language you want

hoary scarab
#

Yeah was thinking just java, HTML & CSS but was wondering if their was a lib to make HTML/CSS easier.

pulsar ferry
#

With Java there is stuff you can do with Springboot, templating libraries like ThymeLeaf or Freemarker as for CSS there isn't really much, you're very much stuck using vanilla CSS
If you want to dive into Kotlin you can use kotlinx.html which gives you some DSL for CSS as well

hoary scarab
#

I still have to figure out SSL and get HTTPS working lol

pulsar ferry
#

What's complicated about it? Just set it up on nginx or caddy and call it a day

hoary scarab
#

I'm using pure java currently

torpid raft
#

nginx is goated

pulsar ferry
#

Huh? Java is just what you're using for the application, reverse proxy would be how you "expose" it on the web, you don't need to set anything up in Java

torpid raft
pulsar ferry
#

Shadcn on Java? :')

torpid raft
#

im sure its doable with enough effort

hoary scarab
pulsar ferry
orchid otter
#

When you use Laravel with Blade (templating engine) and tailwind, they use vite to dynamically generate css for dev and it lets u build the project too, so definitely can figure something better out than just cdn

#

Eh actually idk, cause if youre directly writing the html in java that then gets compiled

#

Either way learning web dev thru doing everything from scratch on java is a wild way to start :D

graceful hedge
true ember
#

Maybe not necessarily a specific question but more of a general outlet that I need to bring out. One thing that makes me hate coding is that when learning basics and all that you usually never really get anywhere specific. Most guides or tutorials that I followed for Java specially never really go much further than basic knowledge, so when I want to create something new, I always get hard stuck because I just don’t know how to do it, and asking for help or googling things sometimes helps but I don’t want to look things up every minute because I’m just so new. Are there any people here that feel the same or were like this and somehow got past it? Genuine question uwu

pulsar ferry
# true ember Maybe not necessarily a specific question but more of a general outlet that I ne...

One thing that makes me hate coding is that when learning basics and all that you usually never really get anywhere specific.
That is because so many people skip the basics and then get stuck on something thinking it's too complex when it wouldn't have been if they stuck around just a bit more to learn the basics

Most guides or tutorials that I followed for Java specially never really go much further than basic knowledge
A lot of times it's just better to try out on your own, decide what you want to do and go for it, go back and revisit the tutorials when you have an issue, search when you have others, etc

googling things sometimes helps but I don’t want to look things up every minute because I’m just so new
This one never really goes away, googling is a very fundamental part of programming, every time you are using a new api or a different platform you'll likely be googling
Just because you understand the language doesn't mean you understand what you are just starting to work with
Sometimes you even forget something very basic that you definitely knew and have to search just to remember how it was

TLDR: It is totally normal what you're feeling, but keep it up, google as much as you want and ask as many questions as you want, don't be scared to sound stupid for asking basic questions
I know devs are very arrogant and very often rude so it can be scary to ask but as long as you're willing to listen you'll be fine

true ember
pulsar ferry
#

Good luck! Feel free to ask around here if you have any issue
Definitely get out of static abuse yeah, static is great when used correctly

true ember
#

Well okay then I’m curious to know when it’s okay to use static

#

I really don’t understand what it does besides being able to use a function from a different class without having to get it first

pulsar ferry
#

Static means that what ever you are making static be it field or method you are making it belong to the class instead of the instance of the class
Let's say you have a field called name, each instance can have their own value of name so "john", "adam", etc
When you make it static is like you are saying that no matter what instance you have or even if you don't have any instance at all, name will always be "john" (not exactly since you can change it but good enough to explain for now)
The most common uses of static are for constants, values that are never going to change and you can access it everywhere, for example

public static final int SIDES_OF_SQUARE = 4;

Another very common use are util methods, stateless methods that can be called from anywhere for example:

public static String getFirstFourCharacters(final String string) {
  return string.substring(0, 4);
}

The method itself isn't related to anything in the class and can be standalone no matter where it is so it makes sense to just be a static utility method

true ember
#

Okay so for example if I have a class that holds integers to track the state of an object that returns a string instead of an integer, I can use a static so I dont have to create an instance of the class to use it?

#

Is static also okay with singleton classes?

pulsar ferry
#

If a class holds any state what so ever it should probably not have static members and should be instance instead
It depends on how you make your singleton, also people will argue whether singletons are good or bad in general so it's up to you tbh, but as long as you don't think of everything as singletons you should be fine using them

true ember
#

I am bad at explaining but I’ll give an example of what I have

#

I have a class called GameState. This class has static integers going from 0 to 5. Inside of my “server” class, it holds an integer between 0 to 5 that tells me in what state that server is in (lobby voting, game started). Is it okay to make these static so I don’t have to create a GameState class to use a number. These numbers have a function to return a string that just tells you what that number should mean

#

I don’t understand what is bad about singleton since I often work with “manager” classes that only get made once on plugin start. It wouldn’t make sense to not make it have a static method of grabbing it since there is only one at any given time

#

It would just require me to write way more code to have the same purpose

pulsar ferry
#

If a field in a class is changing like that I personally would not make it static, static is global therefore can be changed from anywhere a lot of times you want to expose as little as possible and mutable global state just sounds dangerous to maintain, at first it may sound easy but once you have a lot of classes going where a lot are changing the state of it then you'll get lost very easy, and if only one class is accessing it then there is no point in making it a global state

Singletons aren't bad per say, but they can be for example a manager like you mentioned, if I pass the manager down to the class I know for a fact that the class uses that manager, if it is just used on a method of the class somewhere it's a lot harder to know that so for maintainability of your code it is much harder to deal with singletons

I'll give some examples for the first paragraph

public class Server {
  private final ServerState serverState = new ServerState();

  public void something() {
    // imagine a lot of code is happening here
    serverState.setState(1);
  }
}

public class ServerState {
  private int state = 0;

  public void setState(final int state) {
    this.state = state;
  }
}

And then

public class Server {
  public void something() {
    // imagine a lot of code is happening here
    ServerState.setState(1);
  }
}

public class ServerState {
  private static int state = 0;
 
  public static void setState(final int state) {
    this.state = state;
  }
}

These two are basically identical functionality wise, but on the first one the server is the only class in your entire code base that has control over the state meaning it's safer and easier to maintain and also easier to understand

true ember
#

Ah I think I get it

#

It’s hard to give an example

#

I don’t really know how to explain it without sending code

pulsar ferry
#

I mean it is totally fine if you send code ;p
Use https://pastes.dev/ if it's too big so we don't clutter the chat

true ember
#

Give me a moment I’m almost home and then I’ll show an example of using a static

#

It might sound easier to also tell you what my project even is about

#

I am working on a racing minigame basically with an intuitive track editor and using mobs as “karts”

#

I am using a static method to apply a “kart” to a player and put them inside a list

#

I mostly only use static methods for grabbing information from a specific player, for example what kart they’re currently using and in what server instance they are in

pulsar ferry
#

I'll be able to get a better idea of it when you send code but I do think that those aren't very good places to use static

true ember
#

Well if possible I would love to hear a better alternative so I can start applying it

#

One moment

wheat carbon
#

you've got a gamestate class

#

what if one day you decide you want to run multiple kart races at once

#

best practices ensure code is reusable, expandable, and maintainable

true ember
#

Oh no that wouldnt be a problem since the game state class is just a constant

#

The actual state a game is in is managed from within the server class

#

I’ll show you

pulsar ferry
#

Oh that is not what I had understood from your message, if that's the case then it still shouldn't be a class with static constants but instead an enum

true ember
#

Actually it might be an enum

#

Let me check

#

oh no it really is a class

#

public class GameState {

    public static final short LOBBY_WAITING = 0;
    public static final short LOBBY_VOTING = 1;
    public static final short LOBBY_STARTING = 2;
    public static final short GAME_STARTING = 3;
    public static final short GAME_PLAYING = 4;
    public static final short GAME_ENDING = 5;

    public static String toString(short state) {
        switch (state) {
            case LOBBY_WAITING -> {
                return "Lobby Waiting";
            }
            case LOBBY_VOTING -> {
                return "Lobby Voting";
            }
            case LOBBY_STARTING -> {
                return "Lobby Starting";
            }
            case GAME_STARTING -> {
                return "Game Starting";
            }
            case GAME_PLAYING -> {
                return "Game Playing";
            }
            case GAME_ENDING -> {
                return "Game Ending";
            }
        }
        return "";
    }

    public static boolean isStarting(short given_state) {
        return (given_state == GameState.GAME_STARTING);
    }

    public static boolean isPlaying(short given_state) {
        return (given_state == GameState.GAME_PLAYING);
    }

}
wheat carbon
#

oh yeah that can definitely be an enum

true ember
#

Enums are a very unknown area for me

pulsar ferry
#

Enums are basically what you have but they make it easier to work with and understand, let me show you how that would look like as an enum

true ember
#

Are enums similar to a switch case

#

Where something that be one of the things you provided

#

I also have another question

#

Its more java related but sometimes i get confused on what final means

wheat carbon
#

switches can be looked at like alternate syntax for if else chains

pulsar ferry
# true ember ```java public class GameState { public static final short LOBBY_WAITING =...
public enum GameState {
    LOBBY_WAITING("Lobby Waiting"),
    LOBBY_VOTING("Lobby Voting"),
    LOBBY_STARTING("Lobby Starting"),
    GAME_STARTING("Game Starting"),
    GAME_PLAYING("Game Playing"),
    GAME_ENDING("Game Ending");

    private final String message;

    GameState(final String message) {
        this.message = message;
    }

    public static boolean isStarting(final GameState givenState) {
        return givenState == GAME_STARTING;
    }

    public static boolean isPlaying(final GameState givenState) {
        return givenState == GameState.GAME_PLAYING;
    }

    public String getMessage() {
        return message;
    }
}
wheat carbon
#

it's a little more complicated than that but that's an easy way to see it imo

true ember
#

I understand it means a value cannot be changed after it's created, but for some things it isnt

pulsar ferry
#

final means the variable/field can't be reassigned, that is all

#

Basicall means you can't do myFinalVariable = "something new"

true ember
#

okay but for lists and hashmaps you can still add values to it

#

So that technically makes it not final right

#

Okay so wait you changed the class to an enum

#

So the enum is now a String?

pulsar ferry
#

It is still final, the list and the variable holding the list are different
You can't reassign the variable but you can still add to the list
For example

List<String> stringList = new ArrayList();
stringList.add("aaaah"); // adds to the list
stringList = new ArrayList(); // changes the list, final prevents this one only
pulsar ferry
#

The string I added there is just so you don't need to do the switch on the to string

true ember
#

Okay I understand

#

However I am running into something now that I didnt think about

#

Basically my old class had a number attached

#

However its an enum now, so I can't check if its above a specific number

#

For example, I dont want people to open the voting gui after the game goes to game starting or above

#

so what i did before, was to just check if the state was > 2

pulsar ferry
#

You'd normally check the state value directly, for example instead of state == 0 you'd do state == LOBBY_WAITING
But if you do need to show a number you can do state.ordinal() it'll give you the number of the enum value

true ember
#

Okay so

#

If i understand you correctly

#

    LOBBY_WAITING("Lobby Waiting"), // Would return 0 if using state.ordinal
    LOBBY_VOTING("Lobby Voting"), // Would return 1 if using state.ordinal
    LOBBY_STARTING("Lobby Starting"), // Would return 2 if using state.ordinal
    GAME_STARTING("Game Starting"), // Would return 3 if using state.ordinal
    GAME_PLAYING("Game Playing"), // Would return 4 if using state.ordinal
    GAME_ENDING("Game Ending"); // Would return 5 if using state.ordinal
pulsar ferry
#

Yes that is correct

true ember
#

so this would work


                    if (server.getState().ordinal() <= GameState.LOBBY_VOTING.ordinal()) {
                        server.pre_selected_mobs.put(clicked, finalMob);
                    } else {
                        MobManager.equipPlayer(clicked, finalMob);
                    }
pulsar ferry
#

Yeah

true ember
#

okay got it

#

then my next question (sorry), is it okay to use static for lists

#

Some context, I have a static hashmap that holds a Mob / Kart value for a player

#

Every player can only have one kart equipped at any given time and also cant be in multiple games at once, so it would be okay to use static then right?

pulsar ferry
#

It all depends on the use case, in all my projects I have at max had maybe 2 static lists
But no on your context it does not sound like a good idea to be static

true ember
#

This is inside of a class that is singleton btw

#

What do you recommend I should do instead?

#

public class MobManager implements Listener {

    private static MobManager ourInstance;
    private static final HashMap<Player, Mob> playerMob = new HashMap<>();
    private JavaPlugin plugin = MobRacers.getPlugin();

    public MobManager() {
        Bukkit.getPluginManager().registerEvents(this, plugin);
        ourInstance = this;
    }
}
#

Small part of the code for context

pulsar ferry
#

If it is a singletone then it still depends on how you are making the singleton, there is generally 2 ways of doing it, one where everything is static which in this case sure the map being static is fine, or a static instance of the class as a singleton where then the map shouldn't be
In your case it is fine, but keep in mind what Piggy mentioned about singletons and how they aren't very good in general

true ember
#

I understand it's not perfect, I genuinely just don't know how to else do it..

#

Thats more my issue

#

How I created most of my plugins is to create multiple singleton classes that each have their own purpose to make everything work

#

So one is responsible for the track and knowing what everything does, one is responsible for managing servers, one is responsible for karts, another one for guis etc

#

        TrackManager trackManager = new TrackManager();
        trackManager.loadTracks();
        new GameManager();
        new MenuManager();
        new MobManager();
``` in my onEnable
#

One thing I am worried about, is that if I create an instance of a class to use something once every time I wanna do it, it sounds like that will memory leak at some point

#

Or am I wrong

#

Like for example I see no other way to handle the MobManager class

#

How would that even work without singleton

#

The list would be lost

pulsar ferry
#

Normally you'd use something called dependency injection, where you'd pass an instance of the manager instead of making it a singleton
For example:

public class MyPlugin extends JavaPlugin {
  private final MobManager mobManager = new MobManager();

  public void onEnable() {
    Bukkit.getPluginManager().registerEvents(mobManagerf, this);
    // Assuming you need it on menu manager for example:
    new MenuManager(mobManager);
  }
}

public class MenuManager {
  private final MobManager mobManager;

  public MenuManager(final MobManager mobManager) {
    this.mobManager = mobManager;
  }

  public something() { 
    mobManager // you can use MobManager here using this instance instead of MobMager. etc being static
  }
}
true ember
#

That sounds unnatural to me

#

Although I do see what you mean

#

This sounds more reasonable in mobile development

#

Where you pass information from one view to another

#

But then I wanna ask

pulsar ferry
#

It is just reasonable in any development since you know what each class needs and what it'll use, managing dependencies and the code in general better

true ember
#

Using singleton for these classes, will this give me problems in the future for this project

#

Like

#

Generally

#

I don't want to pass 10 managers to a manager in order to use everything

#

That just sounds super inefficient

#

If its just one I can see why

pulsar ferry
#

The answer is maybe development is very complex and you could very well be totally fine with those as singletons but also you could run into issues, it all depends on how you move your code going forward

true ember
#

But in the end Ill end up with 10+ managers and needing all of those to communicate sounds like a pain to do with your example

pulsar ferry
#

You don't have to pass each manager directly either btw, let me change the example I sent and you'll see what I mean

true ember
#

is it how i do plugin?

#

Would this work?

private JavaPlugin plugin = MobRacers.getPlugin();
#

Is this what you mean?

pulsar ferry
#
public class MyPlugin extends JavaPlugin {
  private final MobManager mobManager = new MobManager();

  public void onEnable() {
    Bukkit.getPluginManager().registerEvents(mobManagerf, this);
    // Assuming you need it on menu manager for example:
    new MenuManager(this);
  }

  public MobManager getMobManager() {
    return mobManager;
  }
}

public class MenuManager {
  private final MyPlugin plugin;

  public MenuManager(final MyPlugin plugin) {
    this.plugin = plugin;
  }

  public something() { 
    plugin.getMobManager() // you can use MobManager here using this instance instead of MobMager. etc being static
  }
}

You can add getters in the plugin's body and pass the plugin's instance instead, so you just get the manager from the plugin

true ember
#

that sounds like a better idea

#

I am guessing its fine to use statics for JavaPlugin haha

#

Since there is no excuse not to

#

There is not even a way to have more than one

pulsar ferry
#

it's fine, I don't do it a lot of people don't, but a lot of people do and at this point it's up to you honestly

true ember
#

Obviously I dont want to just make things work

#

Thats how I worked when I first started

#

But realistically the bigger the project becomes, the more annoying it becomes

pulsar ferry
#

I personally don't like it, since like I said I like to have all my dependencies declared but if you prefer it that way it's fine

true ember
#

I might just completely begin from scratch and implement these methods from the start

#

I also have heard some negative things about using abstract

#

Is it really that bad to use or is this more a coping thing

pulsar ferry
#

Huh I have never heard anything bad about abstract, it has it's uses and the uses are good, i don't know what would be bad about it

true ember
#

Well I think the person I was talking to at the time was a C++ coder

#

And he was really against inheritance

#

Which I still don't understand at this point

#

For a racing minigame it makes complete sense to have an abstract kart class that holds information that every child will need

#

And then adding additional functions inside each kart

pulsar ferry
#

Inheritance has it's limits but it's totally fine people are just annoying about things from other languages

true ember
#

I love calling an abstract class more a template than anything

#

I am not going to copy paste the same stuff for every kart

#

hell no

#

If theres one thing I learned about developers is that they are lazy

#

If there is a way for me to write less code I will

#

This is why you write functions if you use something more than once

#

Its the same thing

#

I see an abstract class as the same thing

#

You write something in there that every individual kart will need

#

I am very proud of my track editor though

pulsar ferry
#

Yeah sharing common code using abstract classes is totally normal

true ember
#

Imagine a fighting game where every fighter has its own stat codes

#

instead of an abstract one and then changing values

#

gives me chills

#

Basically the track editor I made without any google or whatever

#

the thing I struggle with most is logic

#

or things like serializing

#

I hate being full of ideas but no idea how to execute them

minor summit
#

yeah people struggle more or less with different things

#

logic is become the computer, beep boop

true ember
#

Its hard to think about that the only things computers understand is bits

pulsar ferry
true ember
#

And that humans had to find a way to communicate

minor summit
#

so true

true ember
#

is python its just print hello

#

but i donte ven wanna know what a computer has to go through to show it on the screen

#

i really dont

minor summit
#

uhhhh

#

a lot

#

like, a lot

#

but that's why println exists 😁

true ember
#

and the funny part is that it happens in a few millseconds

#

As a solo developer I don't think that much about maintainability

#

But working on a team changes things

#

I dont want my co workers to see me as a psycho

minor summit
#

i write code thinking how upset my future self will be

true ember
#

my first project has multiple instances of 30 ifs and elses below each other

minor summit
#

(that's why i write bad code on purpose)

true ember
#

but realistically switches can also get large

#

And I also should write functions more often than I do now

minor summit
true ember
#

Is it okay to like

#

First code

#

And then beautify later

minor summit
#

i'd say that's what most do

true ember
#

Sometimes I'm just so in the flow that I just dont wanna do that right away

minor summit
#

first and foremost, get something working

#

then fix it later pepelaugh

true ember
#

Or or or

#

This is most often the case when you have things together that should be seperate

#

but its easier to code when you have it there at that specific moment

#

so you dont have to tab as much

minor summit
#

omg i love your banner

true ember
#

Yours is very good too nya

minor summit
#

nyam

river solstice
true ember
#

I think I made the right choice to start with minecraft java

#

Since its not just java but also uses lots of minecraft knowledge

minor summit
#

it's a fun way to start too

true ember
#

I like game development

minor summit
#

mfw "make a calculator console app" 👵

true ember
#

When I dont have to make assets

river solstice
#

I started with minecraft java now I work (around 3 years) full-time at a sizeable company with a pretty good salary lol

true ember
#

i see it as just manipulating

#

instead of creating

pulsar ferry
#

I started with Minecraft now I work full-time on Minecraft :))

true ember
#

I find java very similar to swift

minor summit
#

I started with Android & Minecraft, now I work when I feel like it (self employment is hard)

true ember
#

but purely when it comes to classes

minor summit
#

idk what swift looks like lemme see

pulsar ferry
#

Swift looks like Kotlin or well the other way around pepeLaugh

minor summit
#

all i know is the logo

true ember
#

i understood java more easily with prior swift knowledge

minor summit
#

is pretty swift

true ember
#

although they call it a struct

#

Its just a way to organize information under one name

#

Which is basically what a class is

minor summit
#

it looks interesting

true ember
#

I see it as a house

#

aka a structure lol

#

its building blocks

#

lego bricks

#

everything in life is made out of multiple things

#

a computer would be a class

#

i think officially its just called a data structure

#

like a database of some kind

#

even people are a class

#

every person has a name, an age

#

whenever i need to explain coding to someone that doesnt know it i try to use real life examples

#

it often helps a ton

river solstice
#

obviously

minor summit
true ember
#

this is how iphone design started with that rl morphism stuff

river solstice
true ember
#

nobody knew how to use phones

#

so they made apps look like real life things

#

like an actual notebook or a tv for youtube

#

I really loved this idea

true ember
#

Maybe just a hotel

minor summit
#

i mean, pretty much anything is a data structure apart from primitive types

true ember
#

where guests have a room number that has their stuff in it

#

Is it a good idea to use open source projects as a way to learn

minor summit
#

i think it's a good idea to use OSS as reference, while trimmed down examples found in tutorials are helpful as an isolated snippet of what you're learning about, having real production code is pretty valuable imo

#

although, depending on the project, it can get very complex very fast

true ember
#

I feel like maybe rewriting a project from scratch might be good

pulsar ferry
#

and make sure you choose a good project to learn from, there are some terribly coded open source projects out there

true ember
#

But just really thinking about stuff from the start

#

trust me when i say that this singleton stuff and that static bs is not from me

#

i used a project for reference

#

I used it because i didnt know any better

minor summit
#

(but also yes)

true ember
#

Well I know more than a year ago

#

I am struggling really hard on game logic

#

Like realistically speaking, it shouldn't be super hard to get checkpoint logic to work

#

Maybe if someone gave me a general direction in how to do this

#

Can I explain what I want?

minor summit
#

sure

true ember
#

Okay so basically the project I am working on now is a racing minigame but instead of players you get disguised as mobs

#

The track editor functionality is completely finished, and can be saved and loaded between server restarts which is great

#

Basically every "track" has the following properties:

"Finish Lines"
"Checkpoints"
"Player Spawns"
"Item Boxes"
"Speed Boosts"
"Jump Boosts"
"Teleports"
"Elytra Pads"

#

    protected List<FinishLine> finishLines = new ArrayList<>();
    protected List<PlayerSpawn> playerSpawns = new ArrayList<>();
    protected List<Checkpoint> checkpoints = new ArrayList<>();
    protected List<ItemBox> itemBoxes = new ArrayList<>();
    protected List<SpeedBoost> speedBoosts = new ArrayList<>();
    protected List<JumpBoost> jumpBoosts = new ArrayList<>();
    protected List<Teleport> teleports = new ArrayList<>();
    protected List<ElytraPad> elytraPads = new ArrayList<>();
#

All of these classes extend a general abstract class called Node

#

They have a basic Location variable that tells you where they are on the map

#

Some if not most nodes have customization

#

For example, you can change how fast a speed boost might make you

#

And for checkpoints and player spawns you can change the respawn direction, their index (number) and the radius

#

Basically all of this stuff is completed, and the only thing left is to well... make it work

#

And with work I just mean logic only while the game is active

#

I want to start with the most basic thing for like finish line and checkpoints

#

In a racing minigame you want people to go through checkpoints in index order and then cross the finish line to count as a lap

#

I think it's best to start with this

#

So I am figuring out the stuff that I need to make this work

#

In the gamemode class I probably need two hashmap that hold a player's current lap number and their checkpoints

#

Is there a way to have multiple values for 1 player?

#

I think that might be easier and more efficient than multiple hashmaps

#

Is that basically just a class

minor summit
#

you could have a PlayerData class that holds all the info for one specific player, and then have a HashMap mapping player -> player data

true ember
#

Ill do that yes

#

can i make a class inside a class

minor summit
#

uh sure

true ember
#

I love autocomplete

#

holy damn

minor summit
#

:)

true ember
#

It instantly filled in everything i need

#

    public class PlayerData {
        public Player player;
        public int lapCount;
        public Checkpoint currentCheckpoint;
    }
#

Like come on now AI is awesome

#

I didn't type this

minor summit
#

:(

true ember
#

Obviously ill make it private

#

And just use getters and setters

tight junco
#

the fact its wrong is why ai is bad

true ember
#

Sorry?

#

Is there like a similar thing to class but more for just information

tight junco
#

you just burned 50000 trees for some incorrect code :(

true ember
#

Well if you told me what is wrong about it I might be able to burn less trees in the future..

tight junco
#

if you ask how to do it first you dont have to burn the trees

true ember
#

I learned to first try things on my own before asking

#

Trying is the best teacher

true ember
#

But it sounds overkill to make a class for just that

#

So I'm asking if there's something similar to it that requires less code and has a purpose

#

I want a hashmap with more than one value

tight junco
#

you spent 2 minutes max trying and then asked ai but i digress, aside from the the fact the variables are public, the main problem is the fact the object is storing Player instead of UUID (player uuid), that variable changes like 5000 times a second and is prone to memory leaks iirc

true ember
#

So instead of a player having just an integer for lap count, i want a player to have 2 values, a checkpoint and an integer

minor summit
#

classes are basically the way to do anything, java has record types but their members are unmodifiable, if you want mutable, a normal class it is

true ember
#

I have never used a player uuid in my life.. is that important?

tight junco
#

i remember something something memory leak but it was on spigot forums like 6 years ago so could be wrong

minor summit
#

storing Player is fine as long as you get rid of it when a player quits

true ember
#

Everything gets removed on quits or leaves

#

or when a lobby is reset

#

I think it might be better to just use two hashmaps instead of a class for 2 properties

#

Do you agree with me

minor summit
#

eh

tight junco
#

having a class for it is fine

minor summit
#

having a class is pretty much what everyone would do tbh

#

the issue with that approach is that if you want to add more data in the future you need to add another map and you need to remember to update all the thingies around it, forgot to add the player to the map? boom you'll get a NullPointerException down the line

tight junco
true ember
#

I understand its not future proof

#

Ill make a class my mistake

minor summit
#

whereas if all the data of a single player is in its own type, you make sure that it's all tied together

#

something something, invariants, funny words blah blah

#

encapsulation

pulsar ferry
#

As long as you remember that player instance becomes invalid as soon as the player leaves you can do anything with it

minor summit
#

whatever

true ember
#

Can someone also please explain me when to use private, protected or public

#

It drives me nuts

minor summit
#

for fields just use private

#

unless you expect subclasses to access the field, then use protected

true ember
#

Okay so I want the gamemode class to be able to change playerdata class

#

but I can also just

#

use public voids to change it

#

i think thats better

#

so private it is

tight junco
#

its usually private fields and then public getters/setters

minor summit
#

private fields accompanied with public methods is the pinnacle of encapsulation

#

like

true ember
#

is that a positive word haha

minor summit
#

yeah

true ember
#

public class PlayerData {

    private final Player player;
    private int lapCount;
    private @Nullable Checkpoint currentCheckpoint;

    public PlayerData(Player player) {
        this.player = player;
        this.lapCount = 1;
        this.currentCheckpoint = null;
    }

    public Player getPlayer() {
        return player;
    }

    public int getLapCount() {
        return lapCount;
    }

    public void setLapCount(int lapCount) {
        this.lapCount = lapCount;
    }

    @Nullable
    public Checkpoint getCurrentCheckpoint() {
        return currentCheckpoint;
    }

    public void setCurrentCheckpoint(@Nullable Checkpoint currentCheckpoint) {
        this.currentCheckpoint = currentCheckpoint;
    }
}
#

So this is all I need then

minor summit
#

hm why would the checkpoint be null

true ember
#

Well when the race starts there has not bee a checkpoint passed yet

pulsar ferry
#

The start flag should be the first checkpoint

true ember
#

As a reminder, the checkpoint is purely there to respawn you there in case of death or error

minor summit
#

looks okay, maybe I would have, for example, instead of having a setLapCount, I'd have a incrementLap() method that simply adds one to the lap count

true ember
#

If there is no checkpoint, it would respawn you at the finish line

pulsar ferry
#

Yeah but if you die before the next "first" check point then you should respawn at the finish line making the finish line a checkpoint itself

true ember
#

The finish line is as basically a checkpoint, but its its own thing in my nodes

#

incrementLap is a good idea though

minor summit
#

i would consider the initial spawn point the first checkpoint tbh

true ember
#

Laps never go down

minor summit
#

but that's me

pulsar ferry
#

It is basically a checkpoint, it works like a checkpoint, then I feel maybe it should be a checkpoint :')

true ember
#

It would require me to add an option to each checkpoint to set it to either a finish line or not

tight junco
#

if it walks like a duck, quacks like a duck and swims like a duck, its a chicken

minor summit
#

oooor just make a new checkpoint at the starting point when you "build" the track, as in, in code, not the user/player

true ember
#

you should see finish line more as an inheritance to checkpoint

#

its not the same

#

For my game I feel like it makes more sense to make it it's own thing

pulsar ferry
#
public interface Checkpoint {}
public class RaceCheckpoint implements Checkpoint {}
public class FinishLine implements LapPoint, Checkpoint {}
true ember
#

The finish line node's only purpose is to check if a player has gone through all checkpoint needed for the lap to count, and if so, increment lap

#

I don't know what an interface does

minor summit
#

it's kind of like a class template, it defines what methods a class must have, but not what the code in the methods look like

true ember
#

I dont get it xD

minor summit
#

classic example is some kind of Animal interface, that has a makeSound method

interface Animal {
  void makeSound();
}

class Cat implements Animal {
  @Override
  public void makeSound() {
    println("meow");
  }
}

class Dog implements Animal {
  @Override
  public void makeSound() {
    if (Math.random() < 0.5) {
      println("woof");
    } else {
      println("bark");
    }
  }
}
#

(imagine there are more animals, i cba to do this repeatedly)

true ember
#

Oh its like a way to add functionality to a class without putting it in the parent got it

#

something like giving a car class a rocket boost

#

but the rocket boost is an interface

#

so you can add it to a class

minor summit
#

the car class would need to implement the "boost" functionality, yeah

#

the important part is that, any method can take an Animal without knowing exactly what kind of animal it is

pulsar ferry
# pulsar ferry ```java public interface Checkpoint {} public class RaceCheckpoint implements Ch...

Adding up to this

public interface Checkpoint {
  public Location getLocation();
}
public interface LapPoint {
  public void incrementLap();
}

public class RaceCheckpoint implements Checkpoint {
  private final Location location ... // example
  @Override
  public Location getLocation() {
     return location;
  }
}

public class FinishLine implements LapPoint, Checkpoint {
  private final Location location ... // example
  private int laps = 0;
      
  @Override
  public Location getLocation() {
     return location;
  }
  
  @Override
  public void incrementLap() {
     this.laps++;
  }
}

public class PlayerData {
  private Checkpoint currentCheckpoint;
  public PlayerData(final FinishLine finishLine) {
    this.currentCheckpoint = finishLine; // First checkpoint is the finish line
  }

  public void setCurrentCheckpoint(final Checkpoint currentCheckpoint) {
      this.currentCheckpoint = currentCheckpoint;
    }
}
true ember
#

Sorry to interrupt but how can I check if an integer is one above another integer

#

Just checking if its above doesnt work, it needs to be exactly 1

#

Is it as simple as just oldIndex + 1 == newIndex

pulsar ferry
#

Yeah

true ember
#

wait really haha

#

            int currentCheckpointIndex = currentCheckpoint.getIndex();
            int hitCheckpointIndex = hitCheckpoint.getIndex();
            if (currentCheckpointIndex + 1 != hitCheckpointIndex) {
                return;
            }
#

so this would be enough to return if the checkpoint you are checking isnt one index above

torn heart
#

unless you're foreseeing using them more

torn heart
true ember
#

Oh the extra variables is honestly just for myself so I don’t forget

#

I know it’s overkill I just prefer it

#

The code might get longer at some point so idk

river solstice
#

yeah thats kind of pointless

#

because if you ever check the usage of getIndex(), you will get those two variables, then you also need to check where they are used, so kind of two steps instead of one

minor summit
#

just do whatever floats your boat tbh

#

if you find abc easier to read than def, go for it

#

if you regret it tomorrow, then you'll learn

#

you don't learn if you don't try shit out and get hurt

fiery pollen
#

Would anyone have any idea how I would I can get like a distance (manhatten distance) function to get the function between two tiles in a grid like this?

I've tried to do this, but theres always a problem because when I try to get all the tiles with a distance 1 from a center tile. It's always wrong.

sterile hinge
#

not sure if that's possible for you, but doing a different number alignment might help, e.g. making these all 0 in the first axis

#

if that's not possible, you could try to figure out a transformation into that representation and use it indirectly

#

but even with your current layout, the direct neighbors should be easy to calculate

fiery pollen
#

Yeah I don't I'll be able to transform it. But the thing is, the direct neighbors do work. But it's when I have a range of 5 when It starts messing up

#

But so If I rotate I have to change my array too or how would you do it?

sterile hinge
#

I don't know how your array works, is it just 2-dimensional?

sterile hinge
#

and is the rotation even important?

fiery pollen
#

Uhm not sure what you mean, you told me it would be easier with a rotation right?

sterile hinge
#

yeah I want to know if you need the layout you showed or if you can just use the other one directly

fiery pollen
#

Ow yeah, it's for a game. That layout is for the tiles

#

This is how it is suposed to look like

#

And the green tiles are like the thing with the manhatten distance from the archer

sterile hinge
#

sounds like you could just fully switch to the other representation, but otherwise I'd assume it's just an offset you need to add/subtract

fiery pollen
#

But I tried that with the actual x and y values of the grid. And the things was, the value weren't lining up. Because sometimes it was 130 pixels between the one and the neighbour cell, and the other times it was 90 pixels.

#

Or do I have to use offsets when I use the actual x and y values of the grid?

sterile hinge
#

uh oh using two different grids mixed sounds like a good way to encounter a lot of pain

fiery pollen
#

Well the thing is the 2D array is just for the objects of the tiles. And the actual x and y values are there to set the tiles in place on the grid

sterile hinge
#

I think you lost me there

#

my brain is in standby today

fiery pollen
#

Hahah it's probably my explaining that's the problem (sorry)

#

But yeah so I'm doing this project using JavaFX. And when I put the objects inside of the Grid I have to specify an amount of pixels on the x axis and y axis so they land in the right spot.

But then I also store the tile objects in my program ofcourse when I need to update something, like an image on a tile, or when I have to get the minion on that tile, ... . And they are stored in that 2D array.

I hope that makes more sense

#

I'll show my Tile.java class

#
    private int x, y;
    private double mapX, mapY;
    private TileType type;
    private Minion occupant;
    private int homebase;

    public Tile(int x, int y, TileType type, int homebase) {
        this.x = x;
        this.y = y;
        this.type = type;
        this.homebase = homebase;
    }

    public boolean isWalkable() {
        return type == TileType.DIRT || type == TileType.FOREST || type == TileType.MOUNTAINS || type == TileType.STARTBASE;
    }

    public boolean isOccupied() {
        return occupant != null;
    }

    public void setOccupant(Minion m) {
        occupant = m;
    }

    public TileType getType() {
        return type;
    }

    public Minion getOccupant() {
        return occupant;
    }

    public boolean isHomebaseFor(Player player) {
        return homebase == player.getHomebase();
    }

    public int getHomebase() {
        return homebase;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void setMapX(double mapX) {
        this.mapX = mapX;
    }

    public void setMapY(double mapY) {
        this.mapY = mapY;
    }

    public double getMapX() {
        return mapX;
    }

    public double getMapY() {
        return mapY;
    }
}
sterile hinge
#

I'd say the pixel stuff should be completely separate

fiery pollen
#

How do you mean?

#

Like another object for the map coordinates?

torpid raft
#

your x,y indexes into the table could be the offset the second tile is from the first, and the value is the distance

#

there is also probably room to remove duplicate orientations (negatives?) if you really cared, but that is probably not necessary on a small scale

#

since the dawn of time, lookup tables are the final form for solutions to difficult game dev problems

sterile hinge
lyric gyro
#

[21:26:43 INFO]: Tokiomara issued server command: /pmine give Tokiomara
[21:26:47 ERROR]: [PrivateMines] [ACF] Exception in command: privatemines give Tokiomara
[21:26:47 ERROR]: [PrivateMines] [ACF] java.lang.NullPointerException: Cannot invoke "me.untouchedodin0.privatemines.NmsHandler.checkBlocks(me.untouchedodin0.privatemines.CuboidRegion)" because "<local10>" is null
[21:26:47 ERROR]: [PrivateMines] [ACF] at me.untouchedodin0.privatemines.factory.MineFactory.createDefault(MineFactory.java:54)
[21:26:47 ERROR]: [PrivateMines] [ACF] at me.untouchedodin0.privatemines.commands.PrivateMinesCommand.give(PrivateMinesCommand.java:38)
[21:26:47 ERROR]: [PrivateMines] [ACF] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[21:26:47 ERROR]: [PrivateMines] [ACF] at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[21:26:47 ERROR]: [PrivateMines] [ACF] at me.untouchedodin0.privatemines.acf.RegisteredCommand.invoke(RegisteredCommand.java:152)
[21:26:47 ERROR]: [PrivateMines] [ACF] at me.untouchedodin0.privatemines.acf.BaseCommand.executeCommand(BaseCommand.java:578)
[21:26:47 ERROR]: [PrivateMines] [ACF] at me.untouchedodin0.privatemines.acf.BaseCommand.execute(BaseCommand.java:513)
[21:26:47 ERROR]: [PrivateMines] [ACF] at me.untouchedodin0.privatemines.acf.RootCommand.execute(RootCommand.java:99)
[21:26:47 ERROR]: [PrivateMines] [ACF] at me.untouchedodin0.privatemines.acf.BukkitRootCommand.execute(BukkitRootCommand.java:84)
[21:26:47 ERROR]: [PrivateMines] [ACF] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:152)
[21:26:47 ERROR]: [PrivateMines] [ACF] at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:686)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1495)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1300)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:5)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14)
[21:26:47 ERROR]: [PrivateMines] [ACF] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[21:26:47 ERROR]: [PrivateMines] [ACF] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:869)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:427)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:793)
[21:26:47 ERROR]: [PrivateMines] [ACF] at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:683)
[21:26:47 ERROR]: [PrivateMines] [ACF] at java.base/java.lang.Thread.run(Thread.java:1583)

anyone who can help me with this?

minor summit
#

@icy shadow thoughts?

torn heart
#

w/ these test cases

#

maybe there's a slightly better way but 4 hours of sleep is not really helping with these types of things lmao. lmk if you're interested in an explanation, it's actually a pretty elegant problem to solve

#

a[1] and a[2] and such correspond to a.x and a.y

minor summit
#

lookup tables go hard

#

but you'd still need to calculate and bake the thing lol

torn heart
minor summit
#

💀 bruh no

torn heart
#

well he seemed against calculating it so I assumed that's what he meant

#

you could also build a tree structure and then run BFS to find the minimum distance