#help-development

1 messages · Page 1864 of 1

digital rain
#

so how do i create recipes with custom items?

brave sparrow
#

If you want to have it intelligently use a specific item you’ll need to use the event

waxen plinth
#

You cry

digital rain
#

yeah ok i cry

ivory sleet
#

I believe HashMap permits null keys and null values so in that sense checking for null won’t check if there really was a previous value

brave sparrow
#

Listen to the prepare item craft event and check if it’s using the appropriate items

waxen plinth
#

But yeah using PrepareItemCraftEvent you can do it

digital rain
#

omkay thanks

tardy delta
#

no but i mean to check if the entry wasnt already there, ignoring other things

brave sparrow
#

As conclure said, hashmap allows the value to be null, so that by itself does not mean the previous value was not in the hashmap

lunar forge
#

Hi, how can I get the Material/ItemStack of an entity that is an dropped item?

brave sparrow
lunar forge
brave sparrow
#

The entity is an Item

#

Item is a type of entity

tardy delta
#

which happens in my case

#

then it would work i guess

spiral light
#

yes but why

tardy delta
#

doing stuff like this

#

i was using a set before

lunar forge
tardy delta
#

i check if the channel isnt already present before adding it

#

returns false if it failed

spiral light
#

what version do you use ?

lunar forge
brave sparrow
lunar forge
#

This should work right?
Item droppedItem = (Item) entity;

brave sparrow
#

Yup

spiral light
#

if entity is a Item yes

lunar forge
#

Alright thanks

brave sparrow
#

Make sure you check that it’s an item

lunar forge
brave sparrow
#

Alright then

dry forum
#

why am i getting these errors
Could not find artifact org.bstats:bstats-bukkit:pom:1.7 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/)

            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```
```        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
        </repository>```
mellow comet
#

What could be the reason that my spigot dependency is not found?

tender shard
#

Ugh I really need help with JDA

@Override
    public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) {
        System.out.println("GuildMemberRemoveEvent");
        System.out.println(event.getMember()); <-- returns null
        System.out.println(event.getGuild().getMemberCache().getElementById(event.getUser().getId())); <-- returns null
        saveRoles(event.getGuild(),event.getUser());
    }

Here's my construction thingy:

         jda = JDABuilder.createDefault(BOT_TOKEN)
                 .setChunkingFilter(ChunkingFilter.ALL)
                 .setMemberCachePolicy(MemberCachePolicy.ALL)
                 .enableIntents(GatewayIntent.GUILD_MEMBERS)
                 .build();

         jda.addEventListener(new RoleSaveListener());

Any idea why the member always returns null in the GuildMemverRemoveEvent?

tardy delta
#

heh jda

#

go to its dc?

dry forum
waxen plinth
tender shard
waxen plinth
#

You need to cache it yourself before they leave

#

You should be able to at least get the ID of the user

tender shard
#

MemberCachePolicy.ALL should actually cache ALL members from what I understood

waxen plinth
#

No longer accessible once they leave

#

To my knowledge

#

It's annoying I know

tender shard
waxen plinth
#

I have dealt with that before

#

Hm

tender shard
#

otherwise that method would be a bit useless 😄

quiet ice
#

The javadocs always lie

waxen plinth
#

Never messed with the built in cache

#

¯\_(ツ)_/¯

tender shard
#

😢

#

on JDA discord noone answers at all lol, everyone is just asking questions lol

quiet ice
#

this happens when you get use a protocol noone understands

dusk flicker
#

jda is a mess

#

all java discord implemtations are a mess imo

ivory sleet
tacit drift
#

No one uses that lolz

ivory sleet
#

Wut

tacit drift
#

Also it's a LOT more wierder

ivory sleet
#

Elaborate

tacit drift
#

Even the example on their github page is wierd

ivory sleet
#

But can you elaborate on what you mean by weird

tacit drift
#

like you wouldn't understand what a lot of methods do by just looking at the code

ivory sleet
#

I bet you haven’t even tried it

tacit drift
#

For example .block()

ivory sleet
#

bruh

tacit drift
#

what should that mean

ivory sleet
#

That’s a common word which means it blocks the operation on the thread its called on

#

Stop bullshitting nonsense

#

It’s same with RestAction::complete in jda

#

Also blocking

#

Thats probably not less confusing for you tho

tacit drift
#

nope

ivory sleet
#

If you don’t understand the name/intent of a method, then read the javadocs, don’t just call it weird

torn shuttle
#

tbf I've read the javadocs then said it was weird even after reading the description before

tender shard
torn shuttle
#

like how random items are damageable but have 0 durability

quaint mantle
#

it is allowed to Complete Futures with nulls?

dry forum
#

why am i getting this error when building with maven
org.bstats:bstats-bukkit:pom:1.7 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced

           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.17-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
       </dependency>```
```<repository>
           <id>spigotmc-repo</id>
           <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
       </repository>```
ivory sleet
torn shuttle
dry forum
#

thats the spigot repo link so therres nothing i can do to fix it...?

torn shuttle
#

you're looking for bstats not spigot

dry forum
#

how

dusk flicker
#

either way his maven repo is wrong

dry forum
#

all i did was add the spigot dependency and repo

dusk flicker
dry forum
#

im still getting this error Cannot resolve org.bstats:bstats-bukkit:1.7

torn shuttle
#

you have the wrong repo

dry forum
#

<repository> <id>spigot-repo</id> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> </repository>

torn shuttle
dusk flicker
#

send your full pom

dry forum
#

the repository isnt mine

dusk flicker
#

in a paste

#

?paste

undone axleBOT
torn shuttle
#

sure then whoever wrote that has the wrong repo

dry forum
#

md did

torn shuttle
#

nope

dusk flicker
#

send your full pom in a paste

torn shuttle
#

doubt that

dry forum
dusk flicker
#

md has at one point, but others have edited it more

#

but the wiki is right either way

torn shuttle
# dry forum :/

md5 wrote the repo for spigot, why the hell would he write the repo for bstats

dry forum
#

im getting the error from spigot

#

adding the spigot dependency

#

im not doing anything with bstats

torn shuttle
#

no

#

you are getting bstats not found in the spigot repo

#

unless I am going blind

#

which is possible, I did have eye surgery a couple of weeks ago

dusk flicker
#

mavens errors are hard to tell

#

could be spigots wrong, could be bstats is wrong

#

its a mess

torn shuttle
#

no

dry forum
torn shuttle
#

it is bstats is msising

#

org.bstats:bstats-bukkit:pom:1.7 was not found

dry forum
#

all i did

torn shuttle
#

it's very plain to tell

dry forum
#

was add the spigot repo and dependency

#

if spigot messes with bstats thats not my issue

#

its spigots issue

#

i havent done anything with bstats all i did was copy the maven from the spigot wiki

torn shuttle
#

no clue why you insist this is an issue with spigot when it clearly says bstats is the one MIA

#

but sure

dusk flicker
#

you're refreshing maven right?

dry forum
#

because bstats is included in spigot... whenever i add spigot as a dependency i get this error so how is it not spigots fault

dry forum
torn shuttle
#

lol

#

no

#

but I guess it's fun to make stuff up

#

personally I blame the 5g networks for your issue

dusk flicker
#

Somethings wrong on your end

#

Everything I see looks fine

dry forum
#

?? if i add the spigot dependency then i reload it and it gives me the error after adding the spigot dependency how is it my fault? its spigot giving me the error i havent added anything to do with bstats

dusk flicker
#

could also be another dep you have installed, do some testing

dry forum
#

idk what the issue could be

#

ive done nothing other then create the project

torn shuttle
#

did he post the full pom

dry forum
torn shuttle
#

didn't paper have bstats built into it or smth

#

never dealt with that api

dry forum
#

its not the offical paper

torn shuttle
#

oh that's much worse, thanks

dry forum
torn shuttle
#

gotta go to the gym gl

dry forum
#

worldedit needs it or it wont work so :/

torn shuttle
#

uh does it?

dry forum
#

mhm

torn shuttle
#

nope

dry forum
#

if i dont add it, it gives errors saying it needs paperlib

torn shuttle
#

ok i'ma be late

dry forum
#

Cannot resolve io.papermc:paperlib:1.0.2

#

Could not find artifact io.papermc:paperlib:pom:1.0.2 in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)

polar pagoda
#

Teleporting Error

spiral light
#

fastest crash in my history with a lot of dope shit right there

shadow owl
#

Is PlayerQuitEvent sent when players switch servers using bungee?

spiral light
#

the problem is that the api doesnt want me to register new entities ... so it crashes the server in like 2ms when trying to generate villages

sleek pond
#

From my testing a few months back it did

spiral light
#

thats correct since the spigot server dont rly know its a bungee - switch

quaint mantle
#

How do I get the number of blocks passed through PlayerMoveEvent?

spiral light
#

normally it shouldnt be more then 1

#

but getTo / getFrom and a little bit of calculations will help you

quaint mantle
spiral light
#

LocationA - LocationB = dif
dif.length = blocks passed

#

dif.length will be less then 1 for sure each time

arctic delta
#

getConfig in other class than Main

quaint mantle
spiral light
#

what ?

quaint mantle
#

x y z

spiral light
#

PlayerMoveEvent:
there are 2 methods: getTo and getFrom
both return Locations

sonic osprey
#

Does anyone present use caddy as web server?

quaint mantle
spiral light
#

you dont want to have blocks fallen count as walked ?

quaint mantle
#

Constantly writes a number like this: 0.324234142354335

spiral light
#

both location: setY(0)

quaint mantle
#

can I have an example, please?

spiral light
#

thats not complicated tbh

glossy scroll
#

I have a TreeSet using Bukkit's Vector impl private final TreeSet<Vector> doors = new TreeSet<>(Comparator.comparingDouble(Vector::getX));

#

however i still get a ClassCastException when trying to add to this treeset

spiral light
torn vale
#

How to create a animated tablist in the 1.18.1 api?

spiral light
#

with header and footer or more ?

torn vale
#

only header and footer

spiral light
#

player.setPlayerListHeaderFooter

torn vale
#

How to animate it?

spiral light
#

setting the header and footer multiple times

maiden thicket
#

have a bukkit runnable that changes it 🤷🏽‍♂️

spiral light
#

what

quaint mantle
#

writes to me in the chat

spiral light
#

and ?

#

the player walked 0,4 blocks

quaint mantle
#

no

spiral light
#

ok

#

then no

#

but yes

quaint mantle
#

OK, I'll check)

quaint mantle
spiral light
#

why teleported O.o

#

didnt you want to get the blocks the player walked ?

quaint mantle
#

Location from = null; // e.getFrom
Location to = null; // e.getTo

    from.setY(0);
    to.setY(0);

    double blockdistance = to.subtract(from).length();
spiral light
#

annnnd why do you teleport the player then ?

quaint mantle
maiden thicket
#

clone it instead

#

e.getFrom().clone()

#

e.getTo().clone()

spiral light
#

didnt expected that ....

quaint mantle
#

i'm

#

move

spiral light
#

and iam speed

quaint mantle
#

I have writes

quaint mantle
#

i have writes

#

1.3453053453456

#

the higher the speed, the greater the value

spiral light
#

and thats making totally sense

tender shard
#

anyone know how I can get my plugin to download JDA library at runtime? Because if I shade it, the .jar gets 7MB in size so I can't upload it to spigotmc anymore lol

quaint mantle
#

how can I output for example 10 blocks?

quaint mantle
spiral light
#

the relative calculated 10 blocks ?

quaint mantle
#

How many blocks have I overcome

spiral light
#

in total ?

quaint mantle
spiral light
#

Player player = null;
int cm = player.getStatistic(Statistic.WALK_ONE_CM);

quaint mantle
#

no

spiral light
#

player shouldnt be null

lost matrix
quaint mantle
tender shard
#

it has its own repository

spiral light
#

you can create an external download link ?

tender shard
lost matrix
quaint mantle
tender shard
#

oh wait

#

that sucks lol

#

they only have 5 alpha and 1.2 and older lol

tender shard
#

yeah but only 1.2

#

I am currently using 4.3.X

spiral light
#

then create an downloader in your plugin that downloads the jda-spigot-plugin too ^^

quaint mantle
#

How can I do it via PlayerMoveEvent?

lost matrix
spiral light
lost matrix
quaint mantle
quaint mantle
#

Overcame

lost matrix
#

Ah i see. Then you need to use the PlayerMoveEvent.
Filter out teleportations then calculate the magnitude of the vector spanning between 'from' and 'to'
in order to add them uo.

spiral light
quaint mantle
spiral light
#

?learnjava

undone axleBOT
quaint mantle
lost matrix
#
  Location from = ...;
  Location to = ...;
  double distance = from.distance(to);
spiral light
#

seems like you dont understand anything

quaint mantle
quaint mantle
lost matrix
#

assuming d is the distance

quaint mantle
terse ore
#

How can I get player's yaw and pitch

lost matrix
#

Location#distance(Location) is a better approach when calculating the distance between 2 locations.
But this will only display the distance you have travelled in this exact one tick

lost matrix
lost matrix
terse ore
quaint mantle
lost matrix
#

btw you will need a hashmap somewhere to store player move distances

lost matrix
quaint mantle
terse ore
#

you are just clarifying my doubt

#

not answering it

#

how do i get yaw and pitch

lost matrix
terse ore
#

thx

spiral light
#

😮‍💨 if ppl would just try to read provided methods before asking or at least javadocs

lost matrix
#

index iteration bounds: [0, 18[
Then call Inventory#getItem(int)
*If you are speaking of Chest type inventories.
For other inventories such as dropper you would
need to differentiate.

hasty prawn
spiral light
#

instead of saying that it does not work you could show the error or even describe the problem you have 🙂

quaint mantle
#
@EventHandler
    public void onPlayerMove(PlayerMoveEvent e) {
        Location from = e.getFrom().clone();
        Location to = e.getTo().clone();
        from.setY(0);
        to.setY(0);
        double d = to.subtract(from).length();
        int ds;
        ds = (int) d + ds;
        e.getPlayer().sendMessage(String.valueOf(ds));
    }```
lost matrix
# quaint mantle does not work
  1. Create a Map<UUID, Double> to associate a players ID with a double value, representing the distance
  2. Listen to PlayerMoveEvent and filter out teleportations
  3. Get the distance in this event
  4. Add this distance to the maps value associated with the players id
  5. on disconnect: save the value from the map into the players PDC
  6. on connect: load the value from the players PDC into the map or add 0 to it if the value is not present in the PDC
spiral light
#

dont cast 0,4 or all those values to an int ^^

quaint mantle
quaint mantle
round finch
#

is baby zombie with player skin possible?

spiral light
#

resourcepacks probably

round finch
#

my idea was small players

#

idk if you can set a player skin on a baby zombie?

brave sparrow
#

No

#

You cannot

spiral light
#

hmm since player is a adult-object i dont think you can create an baby npc

brave sparrow
#

The player model is not ageable and a zombie can’t be given a player skin without disguising it as a player

#

Which would then be full size

#

Best you can do is colored armor and a player head for helmet

round finch
#

could i do it with Lib's Disguises?

patent horizon
#

im getting this error

[19:18:26 WARN]:     at Guilds-1-all.jar//me.wally.Guilds.Functional.createGuild(Functional.java:263)
[19:18:26 WARN]:     at Guilds-1-all.jar//me.wally.Guilds.Command.createGuildCommand(Command.java:30)
[19:18:26 WARN]:     ... 29 more```
opal juniper
#

"this.economy" is null

#

its that simple

patent horizon
#

thats what the github says too

opal juniper
#

you have to initialise it properly

quiet ice
#

Why do people use Logger.getLogger("Minecraft")

#

I should honestly PR a patch that nags when this is used

opal juniper
# patent horizon
    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false;
        }
        econ = rsp.getProvider();
        return econ != null;
    }
patent horizon
#

yeah thats what i have

spiral light
#

PlayerTeams are not UUID - based right ?

patent horizon
#

and the getEconomy() method too

quiet ice
#

Always get your eco lazily

#

And make sure there is even an eco

#

Your economy plugin might start after your plugin after all

#

And not every plugin uses #onLoad

ember karma
#

paper error (helpppp)

patent horizon
#

ive never had to do any of the things you describe and it's worked before

ember karma
#

please help me

spiral light
#

inventoryclickevent? you can also cancel inventorydragevent and if a player has an item on cursor while closing inventory you could give him this item in the inventory ^^

quiet ice
livid void
#

When selling plugins do yall use a regular paypal account or a paypal business account?

modest shard
#

am i supposed to use the craft bukkit file as a reference library?

eternal oxide
#

no

modest shard
#

what am i suppsed to use then

quiet ice
#

how the hell did you get the cb jar for 1.18

modest shard
#

am i not supposed to have it

quiet ice
#

To some degree, yes because it is more or less deprecated for removal

#

It is a far better idea to use spigot instead even though the difference is not too large

modest shard
#

do i replace it with spigot 1.18?

#

this file?

quiet ice
#

Also you should be better using 1.18.1, 1.18 could have a severe exploit if it is too outdated

modest shard
#

*plugins

quiet ice
#

Anyways, to answer your question, it is recommended to use maven instead, linking directly to the cb/spigot jar is a bit complicated

modest shard
#

do u think u could help me 😦

quiet ice
modest shard
#

i use eclipse too

#

thanks tho

quiet ice
round finch
#

i forgot how do i download the spigot Doc to my ecplise

#

Attachment

eternal oxide
#
        <!-- Spigot Javadocs -->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>${project.spigotVersion}</version>
            <type>javadoc</type>
            <scope>provided</scope>
        </dependency>```
round finch
#

oh Maven

#

i just thought to do manual add file

#

or something

quaint mantle
#

Hey, what is player.isAllowingServerListings() for anyway?

round finch
#

but i forgot where i faund the file

glossy marsh
#

I have a quick question: If I use .getItemInMainHand(), which has @NotNull, does that mean that I don't have to check for .getItemInMainHand() != null before I start using ItemStack commands?

ivory sleet
#

In principle

#

Provided that some jerk didn’t put that annotation there to lie

quiet ice
#

which sometimes happens

ivory sleet
#

Unfortunately yeah

quiet ice
#

At which point you have to use Objects.isNull to not trip the static analyzer

glossy marsh
#

Like can I just use

ItemStack m = p.getInventory().getItemInMainHand();
if (m.getType() == Material.COMPASS && m.hasItemMeta()) { ... }
glossy marsh
ivory sleet
#

Just get the meta and set it back

glossy marsh
ivory sleet
#

An ItemStack with material as compass will always have a meta to return when you invoke getItemMeta

#

ItemStack::setItemMeta

glossy marsh
#

Ah okay! When will an ItemStack not have a meta?

quiet ice
#

if it is air I suppose

ivory sleet
#

Material::isAir yeah

glossy marsh
#

Ah okay! So that means my m.hasItemMeta() is redundant, right?

round finch
#

wait air is material

#

so air is matterbrainpower

quiet ice
#

there is also cave air now

ivory sleet
quiet ice
#

And I think void air?

ivory sleet
#

Yeah and cave air

glossy marsh
#

Okay, thanks!

#

Great help ^-^

quaint mantle
ivory sleet
#

That’s just for javadocs

#

To create these anchor elements

hasty prawn
#

@ivory sleet Do you know what would cause Gradle to say this

#

It seems just randomly it decides to say it

quiet ice
#

Do you use custom tasks?

ivory sleet
#

or 3rd party plugins?

quiet ice
#

If so you are missing some anntoation

hasty prawn
#

No 3rd party plugins I don't think

#

What annotations would I need Thonk

quiet ice
#

Or actually, I think you are providing the annot, but not the files which it needs to track. Regardless I know as little as you

hasty prawn
#

It happens just randomly it seems like, it'll build a few times, say that, and then sometimes it'll work the next build else I have to clean/restart my IDE

quiet ice
#

I myself never bothered doing things incrementally because when I looked into it I thought that it would be quite the pain to get working

wet breach
#

I mean you don't really need incremental builds

golden turret
#

is it possible to have a rgb boss bar?

#

instead of using the BarColor

hasty prawn
#

I don't clean before every build no

#

I guess if it's going to prevent this I'll start LOL

wet breach
#

well sometimes I know in maven, by deleting the extra files from previous building can cause it to lose track

#

not entirely sure with Gradle

jade perch
#

Cleaning before each build sucks

quaint mantle
jade perch
#

The whole point of incremental building is to stop that

round finch
#

ok i attach source

#

spigot-api-1.18-R0.1-20211206.042128-24-sources.jar

#

that work fine

glossy marsh
quiet ice
ivory sleet
#
isLodestoneTracked()
Gets if this compass is tracking a specific lodestone. If true the compass will only work if there is a lodestone at the tracked location.
north trench
#

how to make lightnig when right click air spigot coding?

ivory sleet
#
hasLodestone()
Checks if this compass has been paired to a lodestone.

@glossy marsh

round finch
quiet ice
#

expand the maven dependencies -> right click on an artifact -> maven -> download sources

#

works only half the time, but relatively easy

round finch
#

i got a pom.xml

#

but meh kinda noob at maven

#

?paste

undone axleBOT
round finch
quiet ice
#

Technically you shouldn't need to manually do that in the first place, though I know that eclipse sometimes does that

hasty prawn
#

Boy Gradle really is a pain in the ass....

quiet ice
#

that is quite the pom

late sonnet
#

OneDrive?

round finch
#

idk i just copy pasted things

#

no clue thb

grand umbra
hasty prawn
#

Let me go yell at OneDrive to work faster

quiet ice
#

It probably has something to do with your spigot only being defined via the towny dependency

vale ember
#

how to check if NBTBase is of specific type (e.g. NBTTagInt, NBTTagDouble)?

quiet ice
#

If you were to manually define the spigot dependency and exclude towny's dependencies then it should work better in theory

golden turret
#

how could i do a system that knows the x and z values to be added for the vector goes into the given direction?

chrome beacon
#

Defining version info for xml and pom

round finch
#

Sorry

#

discord lag spikes

quiet ice
round finch
#

meh brain i dont know enough to understand it all

quiet ice
#

Also you forgot to include the repository which is used by towny, I doubt that it is on maven central

north trench
#

how to make lightnig when right click air spigot coding?

spiral light
#

PlayerInteractEvent -> get target Block -> spawnLightning

quaint mantle
wide coyote
#

np

fleet atlas
#

can i use github actions with the mavenLocal repo for the spigot server?

alpine urchin
#

yes

#

if i understand you correctly

#

yes

fleet atlas
#

how?

vale ember
#

please, can anyone say, how can i convert NBTBase to specific type, like NBTTagDouble, if i am sure that it is of that type?

crystal magnet
#

Cast

vale ember
#

will that really work?

crystal magnet
#

Nbt base is a superclass off nbt tag double, right?

vale ember
#

yep

crystal magnet
#

It should work then

vale ember
#

ok ill try

craggy steeple
#

Hi guys from spigot help devolopment! I wonder if it is possible to enable the player-head image in front of the player name in tab list? My server is in offline-mode. Thank you guys!

toxic mesa
#

I've been looking over and over at this, maybe im stupid?
Why is this returning 0.0 and not 0.33 ect. 😂

        Bukkit.broadcastMessage("NewVL: " + String.valueOf(newVL));
        Bukkit.broadcastMessage("VL limit: " + String.valueOf(VL_limit));
        double progressDouble = newVL / VL_limit;
        Bukkit.broadcastMessage(String.valueOf(progressDouble));
echo basalt
#

you're doing integer division

toxic mesa
#

omfg kill me

quiet ice
#

intelliJ should really start to warn about that one

toxic mesa
#

(eclipse, but yes)

#

I can probs just make a plugin for that lmfao

#

will save me a lot of time

vale ember
#

is nbt tag type ids different in every version 1.13+?

glossy marsh
proud basin
#

so I have process.env.DISCORD_CLIENT_ID and then in the .env I have DISCORD_CLIENT_ID=2738131388wa8d829 but for some reason it can't get the value

vale ember
#

did it send any errors?

grand umbra
proud basin
#

?buildtools

#

?buildtool

chrome beacon
#

?bt For future reference 🙂

undone axleBOT
chrome beacon
#

Another NPC plugin?

sage patio
#

How I can create this? ( under pointer )
This happen when you join a 1.9+ server with 1.8 ( viaversion, backwards and rewind )

chrome beacon
#

I've only seen that with Protocolsupport

#

Did they add it to the Via series too?

sage patio
#

y

#

So, how I can create it?

quaint mantle
#

Sending a subtitle

sage patio
chrome beacon
#

I believe so

quaint mantle
sage patio
#

thanks

lethal coral
#

Is there any way to serialize an itemstack?

quaint mantle
quaint mantle
lavish hemlock
#

manually serialize 😎

left swift
#

is there any way to disable pickaxe repair?

lethal coral
quaint mantle
lavish hemlock
#

I mean if you wanna know what I'd do

#

I'd basically just create a "handle" class that contains a small bit of information on an itemstack

#

that I'd deserialize/serialize manually

quaint mantle
#

ok

lavish hemlock
#

but swap the o and the k

quaint mantle
#

🤯

onyx fjord
#

KO

quaint mantle
#

🤯

lavish hemlock
#

K.O. yourself

#

🪦

onyx fjord
#

Who tf puts heart on grave

#

It's supposed to be image of the person

lavish hemlock
#

yeah the heart is supposed to be put in the grave

#

not outside of it

quaint mantle
#

😵

lavish hemlock
#

if you don't get that joke you should take a biology class

lunar forge
#

Hi, I'm currently having a NPC class that spawns a NPC/EntityPlayer, but I want it so it can walk to a specific Location. I've heard of using PathFinderGoals, but I don't know how I need to use that in my code, can anyone help me with that?

ivory sleet
#

?services

undone axleBOT
left swift
#

is there any way to disable tool repair?

sage patio
#

I have this check, but while player click on a block my codes ran twice

quaint mantle
sage patio
quaint mantle
#

return if off hand

sage patio
#

ty

quaint mantle
round finch
#

PrepareAnvilEvent

set result Air

sage patio
quaint mantle
sage patio
quaint mantle
#

Why would you want to return String

sage patio
dusk flicker
#

thats not how a util works

sage patio
#

sending action bar to player with Utils.sendActionBar(player, "text");

dusk flicker
#

you want it to return void

#

and just dont return anything, only perform the code

sage patio
#

like this ?

#

thanks

dusk flicker
#

ye

quaint mantle
#

"" + bad
String.valueOf()
Better

round finch
onyx fjord
#

@vagrant stratus warn him

#

He sent that everywhere

round finch
#

oh

Using String.valueOf(int), or better, Integer.toString(int) is relatively more efficient for the machine

quaint mantle
#

well, "" + just looks ugly at first. At second, it unecessarily creates a new string while combining it with empty one

round finch
upper niche
#

is there a way to drop an itemstack so that only a single player can see it?

round finch
#

maybe packets?

onyx fjord
#

Packets prob

echo basalt
#

yeah packets

upper niche
#

lovely
where might a good resource be for learning to work with packets

echo basalt
#

You can't pick the items up unless you implement the logic yourself

echo basalt
quaint mantle
#

No need for packets

echo basalt
echo basalt
upper niche
#

I'lll try the hideEntity method first

echo basalt
#

wasn't in 1.16

quaint mantle
#

im so happy that i dont bother myself supporting older versions

echo basalt
#

yeahh

#

It's more about api methods that didn't exist like 5 years ago

#

and I didn't know they exist

quaint mantle
#

ah

upper niche
#

hm
hideEntity is deprecated but it doesnt say what to use instead

arctic moth
#

how do you force someone into a crawling/swimming position

paper viper
# sage patio

technically you dont want to return void on an util function

#

but i may be a bit picky lol

#

(impure functions)

sage patio
#

yea fixed, any way thanks

arctic moth
onyx fjord
#

You'll have to force it every tick

#

Or place block above player

arctic moth
#

how do you force it

onyx fjord
#

You shouldn't do it

#

It's laggy

#

And glitchy

arctic moth
#

also what is the method for it

onyx fjord
#

I mean

#

The block should be fake

#

So protocols

#

We don't want others to see the block do we

arctic moth
onyx fjord
#

It shouldn't exist on the server

#

Just on the player who is being positioned

arctic moth
#

i dont understand

#

gimme docs lol

arctic moth
#

u mean sendBlockChange?

proud basin
#

so im using typescript rn and im wanting to use bigint with mysql but it says bigint is not support with mysql so what should I use instead of Number?

#

I can't use number due to it making it a int in mysql and the index cannot be 18

eternal oxide
#

player.spigot().

sullen marlin
#

yes it is

ivory sleet
#

Pretty sure it is

eternal oxide
#

yes it is

sullen marlin
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar (download), or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

#

?cc create bootstrap Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

#

?jd

sullen marlin
#

?cc help

#

what guide

#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

sullen marlin
#

its a wiki

#

anyone can edit it, including you

#

' Click on the + button and select JARs and directories..., locate your Spigot-API-shaded jar and click Apply.'

#

there, edited

#

use maven or gradle and you dont have to worry about this

visual tide
#

^^

#

not really

hasty prawn
#

It's worth it

visual tide
#

you can set it up very easily with intellij

#

with mcdev plugin

sullen marlin
#

luckily there's a wiki 😉

visual tide
#

?maven

undone axleBOT
hasty prawn
polar pagoda
#

i got it to work with vs code 😏

hasty prawn
#

Why isn't what included

sullen marlin
#

it is, you're just using the api improperly

hasty prawn
#

^

#

Depend on the shaded jar and it'll be there peepoHappy

sullen marlin
#

try and call ItemMeta#getAttributeModifiers and you will run into similar issues

#

because titles are not chat messages, but we have sendMessage(ChatMessageType

fierce salmon
#

I am trying to make a plugin that will help me type a command much easier but i don't know why it is not working

fierce salmon
# hasty prawn What isn't working

It will not dispatch the command that I want it to do and it wont show the information that I want it to show when i type /plugin. I tried doing /EpitaphPlugin:plugin in case it interferes but still no luck.

#

I have no console errors which is strange

upper niche
#

in your main did you register "plugin" as a command?

fierce salmon
#

yessir

hasty prawn
#

And it doesn't print anything in your chat?

fierce salmon
#

no

upper niche
#

do you have the op permission

hasty prawn
#

Are you opped and is it in the plugin.yml?

#

Oh, yeah you need the "op" permission

upper niche
#

if it isnt in the yml it would throw an error at load

buoyant viper
fierce salmon
#

I am opped

#

lemme check the console at load

sullen marlin
#

opped != "op" permission

#

perhaps you want isOp

fierce salmon
#

oh okay

#

ty

#

prob the reason i didn't get any message is because i didn't have it send a message if you don't have permission

upper niche
#

that would do it

shy forge
#

Anyone know if TabCompleter forces alphabetical order? Mine is but I don't like that

sullen marlin
#

I think in 1.13 it does force

shy forge
#

Trying on a 1.18.1 server

sullen marlin
#

(1.13+)

shy forge
#

Ah, bother

#

Thanks

fierce salmon
upper niche
#

java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "knownCommands" is null

#

knownCommands isnt registered in the yml im guessing

fierce salmon
#

i thought it did

#

lemme check

#

omg i forgot to make the description a string

#

😵

upper niche
#

making a little plugin loader for myself
enabling a plugin works fine, but disabling the plugin seems to do nothing
all the commands and events related to the plugin are still handled by it even after i tell the PluginManager to disable the plugin
and each time i tell it to disable it just seems to add a new instance of the plugin to the enabled plugins instead
does disablePlugin not behave how i expected it to?

if (args[0].equals("disable")) {
    Plugin plugin = Main.getPlugin().getServer().getPluginManager().getPlugin(args[1]);
    if (plugin == null) {
        sender.sendMessage(ChatColor.RED+"Plugin not recognized or not loaded.");
        return false;
    }
    Main.getPlugin().getServer().getPluginManager().disablePlugin(plugin);
    sender.sendMessage("Successfully disabled plugin.");
#

actually
enabling plugins seems to have an issue too
the events work fine but none of the commands are registered

fierce salmon
upper niche
#

which one?

next plume
#

I wish it would just leave the items alone. I'll put them in the order I want them to be in.

arctic moth
#

anyone know what this means i dont normally get these in runnables

sullen marlin
#

missing public

arctic moth
#

wdym

#

oh

#

public void run

#

thx

#

intellij autogenerated it without public

#

strange

fathom cobalt
#

does Spigot not load all classes in a plugin jar file?

#

it seems it only loads classes that are referenced

eternal night
#

That is how java class loaders work usually

true vault
#

I have been trying to implement more and more changeable Settings into my plugin, but i think i went a bit too far. What do you think?

paper viper
#

Use variables, and also capitalize your static constants

#

And also don’t use getTitle

#

To compare inventories

true vault
paper viper
#

Always use primitives instead of wrapper types if possible

#

Also don’t name your plugin class Main

#

Just name it directly your plugin

true vault
paper viper
#

Stop following the YT tutorial

fathom cobalt
eternal night
#

there are a few libraries out there that can explore it all for you iirc

true vault
eternal night
#

reflections does it ?

paper viper
#

You should have never wasted your time the first place

#

Have you learned any Java so far tho?

fathom cobalt
#

yeah, perhaps reflections is a better option to go with

paper viper
#

Do you know what primitive types are?

#

This should not be a hard question

#

It’s one of the first things you learn — defining a primitive variable like int, long, etc

true vault
fathom cobalt
#

and i know that constants should be capitalized
this is really just a naming convention, varies with languages/habits/preferences

#

primitive types varies a little too, but generally very similar

paper viper
#

Well, you should always use an int over Integer of course

#

Always primitive over wrapper cause it’s faster and unnecessary memory

ivory sleet
eternal night
#

vahalla when

ivory sleet
#

think its like 4 or 5 years since it was touched sad_fingerguns

eternal night
#

huh ?

unreal quartz
#

We do a little touching

eternal night
#

no didn't they release a new update this christmas

#

on their work

ivory sleet
#

Wait fr

eternal night
#

yea

#

we got language specs

#

it looks sooooo good

#

The cpu cache is going to love this

ivory sleet
#

Ah nice

hasty prawn
#

Does anyone know what the hell this means? LOL

#

It says that when I try to build my project, and then when it goes to build the modules

ivory sleet
#

Well that file seems to not be existent

true vault
hasty prawn
#

All I'm doing is clean and then build on the main project and it says that

true vault
#

Is the file inside a zipfolder?

hasty prawn
#

No

true vault
#

then nvm

ivory sleet
#

Dessie mind sending your build.gradle

hasty prawn
#

And if I build them individually it works confusedCat

#

Sure

#

?paste

undone axleBOT
hasty prawn
ivory sleet
#

May I ask why go through the trouble to do all this

#

When paperclip exists

#

Or if it was paperweight

hasty prawn
#

Idk what that is

ivory sleet
#

Also java-library adds java

hasty prawn
#

o

ivory sleet
#

So no need to add java then

#

paper userdev is probably what you want

hasty prawn
#

But my obfuscation works 🤷‍♂️

#

or mapping, I mean

ivory sleet
#

Uuhhh I guess but what was causing the issue then?

hasty prawn
#

I have no idea what's causing it. PepeHands

ivory sleet
#

If you run with -stacktrace

hasty prawn
#

Yeah I can send the stacktrace if you think that'll help

ivory sleet
#

Any info helps xD

hasty prawn
ivory sleet
#

What if you wrap the logic of jar inside a doLast

hasty prawn
#

Well it builds, but it doesn't include the submodules into the main JAR

waxen plinth
#

@ivory sleet help pls

#

how do i the and when

#

pls pls

ivory sleet
#

Hmm?

ivory sleet
hasty prawn
ivory sleet
#

Since you’re not building an application, implementation and runtimeOnly won’t shade 🌚

hasty prawn
ivory sleet
#

Yeah I know, it’s a bit baboony

hasty prawn
#

Still weird that this is all of a sudden a problem

ivory sleet
#

Yeah

hasty prawn
#

Could using api cause this you think?

ivory sleet
#

that’s basically implementation + transitive

waxen plinth
#

api should shade

ivory sleet
#

try it yah, tho I don’t recall it shading with simply the jar task

hasty prawn
#

yeah I did try it

#

It doesn't

#

But I recently added it for other purposes and this seemingly started when I did that

ivory sleet
#

Yeah stuff is strange sometimes

#

But might wanna fallback on shadowJar

#

It’s not a big change

hasty prawn
#

Curse you Gradle.............

ivory sleet
#

Just change all your jar stuff to shadowJar

hasty prawn
#

I've noticed that it is very finiky

#

You can touch 1 thing and it all goes down hill from there noo

ivory sleet
#

Yeah well gradle has great potential but you’re right

waxen plinth
#

Well

#

You can easily make build run shadowJar

hasty prawn
#

Oh yeah, Gradle is great when it does what I want it to do KEKW

ivory sleet
#

It’s minute and getting things to just work is just so hard, effort taking and cumbrous

waxen plinth
#
build.configure {
    dependsOn shadowJar
}```
ivory sleet
#

I believe he uses a custom build task sequence but yeah that’d what you’d use

#

Sure maven actually wins here when you just want to get things to work

hasty prawn
#

Maven is also an eyesore lol

waxen plinth
#

Maven is way too verbose

ivory sleet
#

But gradle has the potential and the configurability

#

Yeah using xml is something I detest wholeheartedly

waxen plinth
#

Gradle often doesn't tell you what went wrong which is what bothers me the most

#

But yeah anything beats xml

paper viper
#

Woah there

#

ant

hasty prawn
#

I think they just made Gradle a little too... I dunno, rich? Doing simple things with it is just such a pain because of it.

paper viper
#

🐜

#

Superior

ivory sleet
#

🌝

paper viper
#

Ant > Gradle

waxen plinth
#

I find very little difficulty with gradle at this point

paper viper
#

i cant believe intellij uses ant for its default build tool tho

#

XD

waxen plinth
#

But I don't try to do anything especially advanced with it

#

So I guess, meh

ivory sleet
#

I believe the tool is extremely powerful once you master it, however mastering it is quite the challenge already which may discourage the usage of the tool

paper viper
#

gradle is pretty easy if u know a little bit of kotlin

#

for kts dsl

hasty prawn
#

Gradle is quite literally the definition of "OH MY GOD IT WORKS IM NEVER TOUCHING IT AGAIN"

paper viper
#

then u are writing methods and stuff

#

super easy

#

tbh id want to say gradle is easier at this point, but id see why it has a steeper learning curve

#

and harder for beginners

ivory sleet
#

Yeah well understanding the implementation of gradle is something inevitable you in principle have to go through before being able to master it I think

paper viper
#

i def did not master gradle lol

#

remember conclure

#

i used to ask u

ivory sleet
#

Which takes some time lol

paper viper
#

to help me

#

XD

#

for gradle projects

#

and converting

ivory sleet
#

Yes well I haven’t even mastered

#

Pulse yeah well you got it well working now ingot_diamond

paper viper
#

i realized i had a lot of weird shit in the past in gradle i forgot to delete

ivory sleet
#

🥲

paper viper
#

and when i started using it more like a build script rather than a configuration

#

i realized how powerful it is

ivory sleet
#

Yeah

fathom cobalt
#
    private inline fun <reified T> findSubTypes(reflections: Reflections): MutableSet<Class<out T>> {
        return reflections.getSubTypesOf(T::class.java)
    }

    private fun registerCommands(reflections: Reflections) = findSubTypes<PluginCommand>(reflections).forEach {
        commandsHandler().registerCommand(this, it.getConstructor().newInstance())
    }```
this shit works in one of my plugins, but not the other... in the other plugin, it's as if there are no other classes than the main class, even though within the jar file, I have multiple classes
#

anyone have any ideas why this could be?

ivory sleet
#

In the light of configurability as opposed to maven its endlessly better

fathom cobalt
#

sure enough, manually registering the commands from my onEnable() would work just fine btw

paper viper
#

Just wondering, can you import a module dependency but on the final shadowJar artifact

#

rather than the actual module

ivory sleet
#

Hmm possibly

paper viper
ivory sleet
#

Extract an inline function and invoke that which just registers every command

#

It makes your application less coupled for free

fathom cobalt
fathom cobalt
ivory sleet
#

😐

paper viper
#

you could use annotations

#

or smthing

ivory sleet
#

It’s not inconvenient, just a part of every fundamental loosely coupled design (:

fathom cobalt
#

it's inconvenient to write 100 lines of registerCommand(...)

paper viper
#

abstractions

ivory sleet
#

Well it’s explicit, in no time will you be able to tell which commands are registered and which aren’t

waxen plinth
#

I have a------

#

,,,,,,,

ivory sleet
#

You don’t want your code to hide things from you, especially not when you bind dependencies imo

waxen plinth
#

🧿

ivory sleet
#

Lol

#

Anyways nozemi I assume you don’t run unit tests

#

So have you debugged with your logger?

#

Like which classes are even found

fathom cobalt
#

well, it'll be fine imo, because it'll automatically register anything deriving my abstract command class

waxen plinth
#

Ok few things

fathom cobalt
#

no unit tests (yet at least)

waxen plinth
#

I have done that exact thing before lol

#

But also using PluginCommand is cringe

ivory sleet
#

Bukkit command api is kinda stale and cringe

fathom cobalt
waxen plinth
#

It is but it's good for building abstractions on top of at least

waxen plinth
#

I'll describe a command and we'll see who can implement it more cleanly

#

Hint: PluginCommand/CommandExecutor never wins this game

fathom cobalt
#

PluginCommand is my class btw, not the one in Spigot

ivory sleet
#

It’d be cool if we’d deprecate the command api and replace it with a brigadier supporting one

waxen plinth
#

Still

#

Would you like to try

fathom cobalt
#

well, your library is way more mature than whatever I'm working on

#

so there is no way I can win

waxen plinth
#

Sure but that's kinda the point lol

ivory sleet
#

You don’t need a library to make a command clean

waxen plinth
#

Ehhh

fathom cobalt
#
abstract class PluginCommand(
    val subCommands: MutableMap<String, PluginCommand> = mutableMapOf()
) : CommandExecutor {
    abstract val name: String
    abstract val description: String

    open val playerOnly: Boolean = true
    open val aliases = listOf<String>()
    open val permission: String? = null
    open val permissionMessage = "You don't have permission to use this command."

    open fun tabComplete(sender: CommandSender, alias: String, arguments: Array<String>) = emptyList<String>()

    fun registerSubCommand(command: PluginCommand) {
        subCommands[command.name] = command
    }
}```
#

this is all it does

ivory sleet
#

Just make sure to extract methods which expresses your intent in code and write explanatory variables etc

#

Surely a framework helps significantly with the productivity part

waxen plinth
#

The point is to illustrate how cleanly I can implement commands with my command library and help you understand it to see if you're interested

ivory sleet
#

and efficiency

waxen plinth
#

Do you want to give it a go or no?

fathom cobalt
#

sure

waxen plinth
#

Alright

ivory sleet
#

Can we set a deadline?

waxen plinth
#

Write a command /strike with alias /smite

ivory sleet
#

20 min should be enough init?

waxen plinth
#

It takes a player optionally and strikes them with lightning

#

If no player is provided it strikes the sender

ivory sleet
#

30 min maybe

waxen plinth
#

But only if they are a player

hasty prawn
#

I got it working with Shadow Jar, appreciate the help NODDERS

waxen plinth
#

Should be pretty easy, 30 mins is too much

ivory sleet
#

15 min

waxen plinth
#

I could do it in <5 on mobile

#

Granted I will be using a very very high level of abstraction lol

ivory sleet
#

Idk your opponents productivity but giving them a decent amount of time might make the duel more interesting

waxen plinth
#

Fair I guess

#

Go ahead noz

#

I'll wait until you finish yours to write mine

ivory sleet
#

Yeah alright in 15 min

#

I’ll take the time now

waxen plinth
#

Anyone else can feel free to participate using their command library of choice

waxen plinth
#

Yeah write that command

dense heath
#

A smite command? lmao

waxen plinth
#

Yeah let's see it

ivory sleet
#

It’s about the cleanliness (:

waxen plinth
#

It's not difficult but it illustrates the difference a good library makes nonetheless

dense heath
#

Alright lmao

waxen plinth
#

We can do something a bit tricker after

ivory sleet
#

If the participants are fine with it, I’ll judge, promise to be impartial

waxen plinth
#

Ok lol

ivory sleet
waxen plinth
#

I guess I should start writing

fathom cobalt
ivory sleet
#

?jd-s (:

undone axleBOT
waxen plinth
#

World#strikeLightning(Location)

ivory sleet
#

@paper viper do you want to judge also? I believe you’re quite experienced in regards to clean code

dense heath
#

Does the version matter?

ivory sleet
#

In principle not

ivory sleet
#

Yes Redempt vs bk vs nozemi

paper viper
#

Ok

#

I will judge too

ivory sleet
#

Ko

#

Noice

paper viper
#

Ko

#

writing commands still isnt fun tho ngl even with clean code

ivory sleet
#

Yeah indeed

paper viper
#

still very time consuming

#

like gui's

ivory sleet
#

I hate writing any low level stuff

dense heath
#

I'll go dig up some old code, I'll be back in a bit lmao

ivory sleet
#

👍

paper viper
#

i personally use brig

#
  • commodore
ivory sleet
#

Ya

paper viper
#

just the basic

waxen plinth
#

Command file:

smite,strike player:target?(context self) {
    permission smite.use
    help Smites the given player, or you
    hook smite
}

Method hook:

@CommandHook("smite")
public void smite(CommandSender sender, Player target) {
    target.getWorld().strikeLightning(target.getLocation());
    target.sendMessage("Thou hast been smitten");
}```
fathom cobalt
#
class StrikeCommand(
    override val name: String = "strike",
    override val description: String = "Strikes a player",
    override val aliases: List<String> = listOf("smite"),
    override val playerOnly: Boolean = true
) : PluginCommand() {

    override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
        val player = sender as Player
        // If no player is provided or found, will strike sender.
        val target = if (args.isEmpty()) player else Bukkit.getPlayer(args[0]) ?: player

        target.world.strikeLightning(target.location)
        return true
    }
}```
#

so like this

paper viper
#

i cant really judge kotlin lol

ivory sleet
#

It’s same as java pulse

paper viper
#

Yeah true

waxen plinth
#

What if the sender is not a player and no argument is given

fathom cobalt
#

that's checked in my command handler

waxen plinth
#

So console can't run /smite <target>?

#

🤔

paper viper
#

probably

fathom cobalt
paper viper
#

needs to hook on the correct method name

fathom cobalt
#

like I said, my shit is not mature at all

waxen plinth
#

Will hook into the method annotated with @CommandHook("smite")

paper viper
#

Yeah

hasty prawn
#

Would you ever use more than 1 command hook for a command?

waxen plinth
#

No

#

Each runnable command/subcommand gets a hook

ivory sleet
#

redempt yours is looking good however there’s minimal code to judge

Nozemi yours isn’t bad but the comment is redundant, it could be just extracted to its own method where the name of the method is explanatory such that it can express your intent of the code

fathom cobalt