#help-development

1 messages · Page 1208 of 1

upper hazel
#

Just image when you join to server and you see DOOM

#

wtf

#

Wait sec

#

This 1.18

#

Uhh?

#

This NOT FIXED?

smoky anchor
# upper hazel This NOT FIXED?

it is fixed basically for all versions
the initial hotfix was editing a config file
the true fix was later updating the log4j version I believe

quaint mantle
#

Truly "don't try this at home" moment

vagrant stratus
#

all the nms entity tutorials are outdated too (╯°□°)╯︵ ┻━┻

upper hazel
#

Then why exists plugins for fix it

quaint mantle
vagrant stratus
#

Nah. I'm trying to do NMS stuff w/ 1.20+ lol

#

I'm using mojang mapped 😎

#

Everything's 1.11 or below KEK

upper hazel
#

Start fix version is..??

smoky anchor
#

in 1.18 you could change the config file to enable the exploit
also, that tweet is years old

upper hazel
#

1.12?

vagrant stratus
#

public static final EntityTypes<EntityZombie> ZOMBIE = register("zombie", EntityTypes.Builder.of(EntityZombie::new, EnumCreatureType.MONSTER).sized(0.6F, 1.95F).eyeHeight(1.74F).passengerAttachments(2.0125F).ridingOffset(-0.7F).clientTrackingRange(8));
Mobs are registered like this nowdays, rendering everything useless.
Can't directly call register either 😐

quaint mantle
smoky anchor
#

well no

#

it's log4j config which normal user will never see

upper hazel
#

Oh cool if default this disabled

#

And fixed

smoky anchor
#

yes, that was done for all versions

vagrant stratus
#

no custom command either

#

scammed

#

@tender shard get yo ass in here.
Guide for registering custom NMS entities for 1.20+ pls

#

everything's outdated lmao

upper hazel
#

I want see nms API

smoky anchor
#

with mixins

upper hazel
#

Plugin nms API))

smoky anchor
#

I don't think that makes any sense

upper hazel
slender elbow
#

that's just the spigot-api

upper hazel
vagrant stratus
#

NMS API is literally the spigot api lol

smoky anchor
#

I think there are some projects that allow that
But don't...

vagrant stratus
#

unless you mean using NMS directly, which is also possible (but stupid usually)

upper hazel
vagrant stratus
#

In which case, you use NMS directly

#

or PR a new API method

quaint mantle
#

Ngl api covers 90% of use cases

vagrant stratus
#

Yea, but I want isSunSensitive D:

#

and the ability to spawn hostile mobs during the day D:

upper hazel
smoky anchor
vagrant stratus
#

No thanks. I try to do things w/ pure vanilla specifically so I'm not recreating stuff

upper hazel
slender elbow
#

just use a dapatack zzz

upper hazel
#

Lol

smoky anchor
#

AnimatedJava ftw!

vagrant stratus
#

datapack's not an option for what I'm wanting to do, at least not without making it more difficult for devs and server owners

upper hazel
#

I remembered doing rust in minecraft and there were so many datapacks there

#

For inventity, items

#

This crazy

slender elbow
#

"how can I do X?"
"with a datapack"
"no"
ok :D

upper hazel
vagrant stratus
#

Because I'd be mixing code and datapacks. That's too messy

slender elbow
#

I disagree

upper hazel
#

Invisible loading

#

Or just kick

#

If not want

vagrant stratus
#

I disagree with your disagreeing because it means server owners have to modify both a plugin config and datapack, or everything has to be rewritten to work within a datapack.

I'd prefer just doing everything w/ full code since that's what is already happening

#

Large enough datapacks are already a bitch and a half just to modify as well

upper hazel
#

Question. How hard is it to register a fake player to the server ?

#

Like he will real player

smoky anchor
vagrant stratus
#

The library I'm using is also code only w/ 0 datapack support too 🙂

smoky anchor
#

assuming you only need to enable mobs spawning during day
can you not use reflection to change the light level setting of a dimension definition ?

vagrant stratus
#

Depends on how it's setup 🤔

smoky anchor
#

Nvm, it's a record, not even reflection can touch that

vagrant stratus
#
public static boolean checkMonsterSpawnRules(EntityTypes<? extends EntityMonster> entitytypes, WorldAccess worldaccess, EntitySpawnReason entityspawnreason, BlockPosition blockposition, RandomSource randomsource) {
        return worldaccess.getDifficulty() != EnumDifficulty.PEACEFUL && (EntitySpawnReason.ignoresLightRequirements(entityspawnreason) || isDarkEnoughToSpawn(worldaccess, blockposition, randomsource)) && checkMobSpawnRules(entitytypes, worldaccess, entityspawnreason, blockposition, randomsource);
    }

There's ignoresLightRequirements. Can't set that though 😐

#

oh that's just a TRIAL_SPAWNER check lmfao

slender elbow
vagrant stratus
#

actually I have a dumb idea on how I can do this. Question's are

  1. How big's the compiled jar gonna be and
  2. will this even fucking work
#

?tas

undone axleBOT
vagrant stratus
#

time to do that thing

smoky anchor
#

ok now I'm really curious to see what you're cooking

vagrant stratus
#

stg if this works

#

Knowing my luck, probably not?
But if I can make it work for other things that'll be nice lol

#

Compiled. Will it run and work properly though 🤔

smoky anchor
#

Oh the suspense

vagrant stratus
#

gonna be waiting. I don't have a non-remapped 1.21.4 jar to test with lol

#

over an MB though. Gonna have to hope the libraries plugin yml option will save this lmfao

#

loaded

#

no errors

#

will it do the thing

#

(probably not, but we can hope)

smoky anchor
#

oh :O

vagrant stratus
#

answer: no
I wonder why 🤔

smoky anchor
#

Damn, sadge
And I wonder what the frick you cooked 🤔

vagrant stratus
#

okay might know why, if this doesn't work I can't do exactly what I want D:

#

No, purely because of the way mapping works KEK

#

I'd have to add the mapped server jar to maven & figure everything out that way which isn't necessarily bad just annoying

young knoll
#

What demonic code is optic writing now

#

:)

vagrant stratus
#

Trying to figure stuff out cause there's nothing in the spigot api & I can't override methods and shit D:

#

I don't think i can do what i want (yet), but I have some ideas on ways I can use this lol

young knoll
#

What do you want to do

vagrant stratus
#

Well for NMS a few things.
Allowing hostile mob spawns during the day (unless there's a way to do this with base spigot) & isSunSensitive

#

but I've moved to more cursed code

young knoll
#

Mmm yeah I can’t think of an easy way to do that

#

Other than rewriting the mob spawn system

vagrant stratus
#

isSunSensitive is a EntityMonster thing

#

it just returns true lol

#

Not sure how the first would be allowed though 🤔

#

I know there's a method to check if hostile mobs can spawn, not sure on a clean way to impl overriding

tulip pine
#

my virtual server got banned

blazing ocean
#

no he cannot

vagrant stratus
#

no

tulip pine
#

oh

vagrant stratus
#

If this new cursed code works.. then i'm gonna be during a looot of cursed shit lol

blazing ocean
#

stop breaking stuff optic

vagrant stratus
#

No

young knoll
#

ASM!

vagrant stratus
#

If I can make this work it'll both be cursed, but clean things up kinda lol

blazing ocean
#

ignite!

vagrant stratus
#

but I think the mapping system is gonna fuck it alll up lmfao

#

Might be forced to work w/ the obf'd jars rip

#

I just want to do cursed shit D:

#

I DID A THING

vagrant stratus
smoky oak
#

if i set PlayerDeathEvent message to 'null' does it print an empty line or nothing at all?

smoky anchor
#

?tas But it is @Nullable so I assume it will work like that.

undone axleBOT
smoky oak
#

kty

smoky oak
blazing ocean
#

i mean if people don't know

slender elbow
#

yeah i love getting flooded with "i don't know" answers, idk why people don't do that more often

vagrant stratus
#

why do we exist just to suffer

smoky oak
hollow vessel
#

Hi, maybe someone here has expirence with that kind of logic with InvUi library. What I am trying to do? I have a normal gui with an VirtualInventory as an ingredient, where players can put and take items, I want to "synchronize" it - I mean when two players are watching this gui and someone put items the second player will also see it. I would be really gratefull for any kind of help.
Here is my code: (I am new using this library)

#
 public void openInventory(Player player, AssortmentChest assortmentChest) {
        Gui.Builder<Gui, Gui.Builder.Normal> guiNormalBuilder = this.getGui(assortmentChest);
        Gui gui = guiNormalBuilder.build();

        int usedWeight = assortmentChest.getUsedWeight();
        int weightCapacity = assortmentChest.getWeightCapacity();

        Window window = Window.single()
                .setViewer(player)
                .setGui(gui)
                .setTitle("Skrzynia " + usedWeight + "/" + weightCapacity + "kg")
                .build();

        window.open();
    }

summer scroll
#

From what I can see that everytime that method is called you're creating a new inventory, so it's a different inventory essentially.

hollow vessel
hollow vessel
summer scroll
#

I'm not really familiar with InvUI

hollow vessel
#

they are not answering 😦

summer scroll
#

Why do you need to close the gui before opening it again?

hollow vessel
vagrant stratus
#

@young knoll Praise be libraries

remote swallow
#

why dont you use compact packages

vagrant stratus
remote swallow
vagrant stratus
#

oh. I like it this like so that empty packages aren't a bitch

vagrant stratus
#

Ah md, do we have a way to randomize mobs on spawn within spigot?
e.g. cats, sheep, etc?

sullen marlin
#

Not sure, I thought at least at one point they just did

vagrant stratus
#

hmm

#

lemme double check

#

@sullen marlin Same code as spawn eggs?

Cause for sheep I'm seeing only White, Gray, Black, and Brown

#

gonna check w/ spigot api, but I have a feeling it might be the same lol

sullen marlin
#

What other colours do sheep spawn?

#

Aside from like a 0.0001% chance for pink, if that still exists

vagrant stratus
#

In my case, it's any color (and age)

#

I've got like.. 10ish if statements lmfao

sullen marlin
#

That's something you have to do yourself, there's no natural green sheep in mc

vagrant stratus
#

Yea, doing this for Ageable, Axolotl (For the blue color), Cats (Non-vanilla spawning), Sheep (All colors), Mooshroom, and Foxes

Might have to double check those last 2 using vanilla spawning

#

Praise be randomization

#

Threw this stuff under extensions, just so I can CraftCat#randomize and somewhat clean up code lol

#

Hoping I can do the same w/ abstract classes & abstract methods, then I don't have to cast all over the damn place lmfao

quaint mantle
#

Car

vagrant stratus
#
        if (mob instanceof Ageable) {
            CraftAgeable ageable = (CraftAgeable) mob;
            ageable.randomize();
        }

        if (type == EntityType.AXOLOTL) {
            CraftAxolotl axolotl = (CraftAxolotl) mob;
            axolotl.randomize();
            return;
        }

        if (type == EntityType.CAT) {
            // FIXME: Can't use an extension for this one, otherwise compilation breaks
            Cat cat = (Cat) mob;
            randomizeCat(cat);
            return;
        }

        if (type == EntityType.MOOSHROOM) {
            MushroomCow cow = (MushroomCow) mob;
            randomizeMushroomCow(cow);
            return;
        }

        if (type == EntityType.FOX) {
            Fox fox = (Fox) mob;
            randomizeFox(fox);
            return;
        }

        if (type == EntityType.SHEEP) {
            Sheep sheep = (Sheep) mob;
            randomizeSheep(sheep);
            return;
        }

Haven't fully ported it, but this is the current mess lol

#

Did something similar w/ jockeys too, albeit not fully supported yet

blazing ocean
#

what is an extension

vagrant stratus
#

cursed code

#

Adds new methods to classes

#

e.g. this adds a CraftAxolotl#randomize method to the code

blazing ocean
#

so mixins but worse

vagrant stratus
#

Actually, I'd say better. You're not having to do super annoying annotation stuff just to add a new method or something

blazing ocean
#

how is it annoying

#

mixins are great

vagrant stratus
#

if we're going for worse though, let me present the jockey code:

        if (isJockey && entity.isValidJockeyMob()) {
            entity.convertIntoJockey();
        }
blazing ocean
#

interface injection is not annoying at all

vagrant stratus
#

2 annotation, no PITA annotations like fabric
just needs a specific dir structure

buoyant viper
#

i feel like that would also be like 2 annotations with fabric

#

possibly only 1

#

u would just need to cast, if anything

vagrant stratus
blazing ocean
#

that ain't a PITA

vagrant stratus
blazing ocean
#

sure you're gonna need to add two lines to a json file

#

which your ide has a literal button for

remote swallow
#

he doesnt use intellij like a normal person though

vagrant stratus
#

cause IJ sucks

buoyant viper
#

what do u have against intellij :(

blazing ocean
#

dude netbeans is NOT better

buoyant viper
#

i think opti is jus a Hater fr

#

hates intellij

blazing ocean
#

actual brainrot

buoyant viper
#

hates mixins/fabric

blazing ocean
#

he hates anything that isn't his 2014 spigot netbeans

vagrant stratus
buoyant viper
#

i fucking Love that design actually

#

i hated Eclipses workspaces with a passion

vagrant stratus
#

I hate it

blazing ocean
#

you are aware they have a workspaces plugin right

vagrant stratus
#

Install a plugin just for functionality in an IDE I'm already using?

#

you do realize how dumb that sounds, right?

blazing ocean
#

lmao this guy

#

you realise you can open multiple windows right

remote swallow
#

but his workflow

vagrant stratus
#

yea, annoying as hell having to alt-tab

remote swallow
blazing ocean
#

it's not that deep

vagrant stratus
#

ooor just use an IDE I've been using for 5+ years with the functionality built in?

blazing ocean
#

there are modern replacements

vagrant stratus
#

None that interest me enough to switch, install a plugin, and re-learn everything

blazing ocean
#

is installing a plugin really that hard to you

buoyant viper
#

i mean

vagrant stratus
#

Hard? No.
Pointless? Yea, pretty much

buoyant viper
#

in his defense it would also mean installing a whole different IDE

blazing ocean
#

are you saying netbeans does not have an ij plugin

vagrant stratus
buoyant viper
#

i mean eclipse to intellij wasnt a very hard move

#

idk

vagrant stratus
#

Shortcuts, UI, etc, etc

blazing ocean
#

get with the times

#

how does netbeans even look

buoyant viper
#

like eclipse, probably

#

so stuck in 2014

blazing ocean
#

ugly then

#

yep

remote swallow
#

like eclipse but shiter

vagrant stratus
#

I don't need an IDE to look nice lmfao

buoyant viper
#

u drive a hard bargain, however

#

hehe pretty UI

blazing ocean
#

you preferably want a tool you're gonna be staring at for 10 hours a day to not look like absolute dog shit

vagrant stratus
#

same reason I don't switch to linux for the customization options.
Idc about them lmfao

blazing ocean
#

but maybe that's just me

buoyant viper
#

u dont switch to linux becos ur a plain jane

vagrant stratus
#

Switched NB to a dark theme & called it a day

buoyant viper
#

i dont switch to linux because i cant play Fortnite

#

we are not the same

#

(im worse)

vagrant stratus
#

stg I could see rad switching to the newest JS library which dies a week later just because it's newer

blazing ocean
#

that would imply I use JS in the first place

buoyant viper
#

just think about the resumee tho

#

"experience in 35 different frameworks"

blazing ocean
vagrant stratus
#

And you're assuming I require or need a modern IDE. I don't lmao

blazing ocean
#

when did I say that

buoyant viper
#

alright honestly

#

this actually looks a bit better than eclipse

blazing ocean
#

still looks bad

vagrant stratus
#

Yea, exactly. It's good enough

buoyant viper
#

eclipse actually i take it back

vagrant stratus
#

Idc about looks but it's better than eclipse lmfao

blazing ocean
#

i haven't used eclipse in like 5 years

buoyant viper
#

those icons are like Massive

#

compared to IJ or Eclipse

#

im all for visibility but like

#

Fuck

blazing ocean
#

need muh 10000 icons

vagrant stratus
#

ngl didn't even notice

remote swallow
#

wait untill you find out i use the old intellij ui

blazing ocean
#

i am aware of that

buoyant viper
blazing ocean
#

kekw

#

love comparing libreoffice to an ide

remote swallow
#

mmmmmm old ui

vagrant stratus
#

If I do use IJ, it'll be because I'm paid lmfao

blazing ocean
#

not buildtools!

remote swallow
#

it was the first project i pressed radical steven

blazing ocean
#

the old UI isn't that bad tbh

buoyant viper
blazing ocean
#

i just really don't like the file location thing whatever at the top but you can remove all the

#

it's now way smaller and at the bottom

remote swallow
#

cant say i ever look at it often

#

i also like words not icons

blazing ocean
#

too much for my poor eyes to handle

remote swallow
#

the new ui is also fat i feel

#

covers too much of my code i cant process it properly

vagrant stratus
#

Also, wait until rad learns I use sublime text for literally anything that isn't java

brazen obsidian
#

hi, for some reason i cant cast a block (that i checked the material of to be an ACTIVATOR_RAIL) to a Rails class to check the isOnSlope() method... please help (version 1.12.2 plz dont bully me)

blazing ocean
vagrant stratus
#

I look at the code, duh

brazen obsidian
vagrant stratus
#

the actual important bit of an IDE

blazing ocean
#

that's still part of the ui

vagrant stratus
blazing ocean
#

yeah knew you were a fucking menace

#

even vs would've been better

vagrant stratus
#

switched from notepad++ two or so years ago lol

brazen obsidian
#

i use nano 🗿

vagrant stratus
#

needed better highlighting and NP++ didn't have a plugin kek

vagrant stratus
blazing ocean
#

do you make money

brazen obsidian
vagrant stratus
#

I have premium resources and bought my PC from it (and like <$20 in donations), so I'd hope so

vagrant stratus
#

got like... 20-ish different colors. Makes going through logs infinitely easier

buoyant viper
vagrant stratus
#

so

buoyant viper
#

or well cast the BlockData to Rail i think

vagrant stratus
#

(I'm probably not gonna update that lmfao)

brazen obsidian
buoyant viper
#

nope

brazen obsidian
#

oh thats why, thank you so much

buoyant viper
#

same goes for items

#

u check with the ItemMeta rather than the Item/ItemStack? itself

brazen obsidian
#

I cant cast this though

#

Rails rails = (Rails) railBlock.getType().getData();

#

railBlock is a Block btw

#

@buoyant viper

buoyant viper
#

i think its just railBlock.getData no?

#

getBlockData() *

brazen obsidian
#

thats the tricky thing

buoyant viper
#

try uh

#

Rails rails = (Rails) railBlock.getBlockState().getData()

#

alternatively: update ur server and plugin to latest mc

brazen obsidian
#

ok this seems to work let me try

#

Rails rails = (Rails) railBlock.getState().getData();

#

yay it worked

buoyant viper
#

oh yeah

brazen obsidian
#

thanks youre the best fr

buoyant viper
#

np

smoky oak
#

is it possible to obtain a chunksnapshot of how a chunk would have generated for any version (current or previous)

desert ingot
#

Hi, I’m looking for Minecraft developers primarily for long-term cooperation, but there’s also room for someone looking for a one-off project. I’m working on an ambitious and unique project where you can create something extraordinary and gain a valuable addition to your portfolio. I’m looking for people who can write mods for Fabric and have basic knowledge of Spigot. Would anyone be interested?

young knoll
#

?services

undone axleBOT
desert ingot
young knoll
#

Prevents spam

#

You can always contact devs that have offering threads

desert ingot
#

Yeah that's faster solution thanks for advise

wet breach
#

This is why the seed you use in a previous version can generate an entirely different world in an updated version

slender elbow
#

I bet I know what a void world looks like in all versions

#

like a psychic

wet breach
#

Lmao well i am not sure if they were referring to void worlds

slender elbow
#

me neither but it makes it easier so I'll go with that

#

very clever

wet breach
#

Well true

mortal hare
#

is there any way to make intellij stfu about missing controller value at the top level for JavaFX FXML?

#

its annoying af

#

as im loading those dynamically

#

due to how javafx is nasty and does allow you to fetch by id predictibly

#

and i need to set dependency injection via constructor

#

but controllers expect to have no arg constructor in order to construct them implicitly via reflections

#

so im left with unpredicatable lookup() method that allows you to select elements, but it depends on the css and layout results of the notation, so it may be unpredictable depending on the element you've used to fetch it, since you're relying on internal implementation output

#

or these errors which actually not errors since i do setController() at the runtime

#

or i can do setter injection, but that's even more nastier

#

for gods sake is there any good UI framework in java that doesnt suck

#

like really

halcyon hemlock
blazing ocean
ivory sleet
#

interoperability with Java 🤩

quaint mantle
#

Imagine trying to use compose functions in java 💀

ivory sleet
#

hehe

viral halo
#

does anyone know how to set custom nbt to an itemstack in new 1.21

worthy yarrow
#

why not use pdc?

#

?pdc

digital karma
#

Hey! Wanted to ask, does the spigotmc site has any API or way to update a plugin from a CI ?

#

just trying to automate the process of deploying a plugin

sullen marlin
#

no, also spigotmc is for releases not continuous builds

digital karma
#

Alright thanks! Yeah I was only thinking about releases

mortal hare
half fjord
#

Hello I uploaded my plugin on spigot but it doesnt look right, how do i update it's description?

eternal oxide
#

edit

half fjord
#

Cant find that option anywhere

eternal oxide
#

bottom of the page I believe

half fjord
#

Nope, nothing there

eternal oxide
half fjord
#

And where is that, all i see is report

eternal oxide
#

you are not logged in then

half fjord
#

I am, i literally just posted it xd

eternal oxide
#

you have to have 2fa enabled to upload/edit

half fjord
#

Just enabled it and yeah still nothing

#

T-T

#

is there a different url for that or where am i going wrong

eternal oxide
#

nope, its just on the plugin page

half fjord
#

Yeah its def not there

eternal oxide
#

has teh plugin been approved yet? Not sure if that has an effect

half fjord
#

It goes through approval? didnt know that

#

how can i check that

eternal oxide
#

I believe it does, to prevent spam/trojans

half fjord
#

Alright i guess imma wait then?

Its just the images i inserted are mis aligned. gottta fix that T-T

#

Ah yeah, it just appeared xd

#

ty

sullen marlin
#

FYI it would've told you at the top of the page this is something you needed to do

mortal hare
#

who the hell in javafx dev team decided to make XML based format for GUI's but decide not to add proper id fetching support

#

what if i want to attach controllers dynamically

#

instead of using their @FXML annotations

#

that's a bad design if you ask me

#

the fact that JavaFX doesnt have DOM api equivalent of document.getElementById() is just... what?

#

closest to this is lookup("#id"), but then you have implementation specific css selectors, like who the hell decided that this is a good idea

wooden frost
#

Is there a way to check interact event every tick (20times a second) ?

wooden frost
# mortal vortex Schedular

any other ways (if you mean calling a 4tick long schedule every 4 ticks(not actually checking if he is still interacting))

wooden frost
#

obvious mojang rule violation XD

#

want to make a pew pew

mortal vortex
#

Do you know how Spigot works?? Why do youu need to check an event?? Events fire themselves???

wooden frost
#

wellll yesss

#

i may not know.

#

let me re-phrase. How do you check if player is inputing RMB every tick?

eternal oxide
#

you can't

#

you get one event on first click, then you get a new event if they hold it down to repeat

wooden frost
#

datapacks better?

#

i remember people did that with datapacks💀

eternal oxide
#

If you can do it with datapacks then thats your only way

wooden frost
#

crazy that there s no actual way still

eternal oxide
#

API does not provide any method to check

wooden frost
#

made me in-sane

eternal oxide
#

well, there is no packet sent for a key up so the server can;t know when you release

#

it only knows on press/repeat

eternal oxide
#

blocking is not teh same as a key press

#

its a toggle

#

so a packet is sent to block and release

wooden frost
#

optimised?no

#

works

eternal oxide
#

yes

wooden frost
#

yess

pseudo hazel
#

datapacks are good to extend the way people can configure your plugins

#

like I can just say my plugin has terrain generation, butif you load your own datapack in there with custom generation then my plugin can yoink the gen settings and use that instead

#

thats free customization

grim ice
eternal oxide
#

depends what he is trying to do

#

he asked if he coudl check if a key is pressed each tick and the short answer is no

#

not unless an event is triggered by toggling the key

grim ice
eternal oxide
#

he actually asked about checking interact event each tick, so no as he's talking about mouse clicks

grim ice
#

🤷

eternal oxide
#

with mouse clicks there is no signal for stop pressing

smoky oak
#

if i generate a chunk does it get loaded? if yes does it lazy load the eight surrounding chunks and generate them?

solemn meteor
#
C:\WINDOWS\system32>"C:\Program Files\Java\jdk-23\bin\java.exe" -Xms512M -jar "C:\Program Files\NMS\1.21\BuildTools.exe" --nogui --remapped --output-dir "C:\Program Files\NMS\1.21"
[--nogui, --remapped, --output-dir, C:\Program Files\NMS\1.21]
Loading BuildTools version: git-BuildTools-f901b6f-188 (#188)
Java Version: Java 23
Current Path: C:\Windows\System32
*** Could not find PortableGit installation, downloading. ***
Starting download of https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/PortableGit-2.45.2-64-bit.7z.exe
Downloaded file: PortableGit-2.45.2-64-bit\PortableGit-2.45.2-64-bit.7z.exe with hash: 851a15074dea6b272785b2a2a4697a72970256de2afe7b8e4a9c5e168c27ccdd
Extracting downloaded git install
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, C:\WINDOWS\system32\PortableGit-2.45.2-64-bit\PortableGit-2.45.2-64-bit.7z.exe, -y, -gm2, -nr]
        at org.spigotmc.builder.Builder.runProcess0(Builder.java:1042)
        at org.spigotmc.builder.Builder.runProcess(Builder.java:967)
        at org.spigotmc.builder.Builder.startBuilder(Builder.java:212)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
#

I'm confused onto whats happening

eternal oxide
#

running a buildtools.exe through java?

solemn meteor
#

Nevermind

#

I fixed it, brain fart

solemn meteor
#

thought my uac already handled it but apparently not

merry cove
#

Hey, deployed api and depend on it in a third party plugin but somehow [16:34:55] [Server thread/ERROR]: [skytester] Plugin skytester v1.0.0 has failed to register events for class me.albusthepenguin.skytester.Sky because me/albusthepenguin/api/events/SkylineSendPlayerEvent does not exist. in the multi module project I can do it across modules but unsure why I can't use third party plugin to do so ? what am I missing. it's the correct path.

#

(yes I depend)

#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>me.albusthepenguin</groupId>
        <artifactId>Skyline</artifactId>
        <version>2.1.5</version>
        <relativePath>../pom.xml</relativePath> <!-- Adjust path if necessary -->
    </parent>

    <distributionManagement>
        <repository>
            <id>github</id>
            <name>GitHub Maven Repository</name>
            <url>https://maven.pkg.github.com/AlbusThePenguin/Skyline</url>
        </repository>
    </distributionManagement>

    <packaging>jar</packaging>

    <artifactId>skylineapi</artifactId>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <skip>false</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <skip>false</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>```
chrome beacon
merry cove
jovial mason
#

some1 in the mood th help me find my memory leak in my src lol

remote swallow
#

?ask

undone axleBOT
#

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

eternal night
#

take a heap dump and find what object is leaking?

jovial mason
#

i got told thats not possible

eternal night
jovial mason
#

its just possible by looking at the src itself

#

is what they told me

remote swallow
#

you can do it from looking at the src, having a heapdump tell you whats leaking makes it easier to figure out where its coming from

jovial mason
#

how can i make a headdump?

#

heapdump sorry

#

i got spark

blazing ocean
#

/spark heapdump

remote swallow
blazing ocean
#

if you're storing block states or similar that'd be why

remote swallow
#

im calling its a location or a player

jovial mason
#

and now?

blazing ocean
#

lol on brawls we had 200000 vec3/blockpos in a heapsummary before

remote swallow
#

oh so just a few

blazing ocean
#

like 2000 is normal for vanilla I think

remote swallow
chrome beacon
#

So not that surprising

jovial mason
remote swallow
#

wdym does that work with intellij

jovial mason
#

open heapdump sorry xD

remote swallow
#

intellij is an ide not a heap dump analysis too

jovial mason
#

oh ok my provider is down rn i install visualvm and read it then

sullen canyon
jovial mason
#

i hope it says which plugin

wet breach
#

watch it be some list holding player objects

#

and never releasing them

jovial mason
#

how exactly i read it now?

#

i cant tell what it means :((

jovial mason
remote swallow
#

try mat, and did you actually make it cause the mem leak

#

just creating a heapdump after a server is started wont help very much

jovial mason
#

How can i create that while the server crashes?

#

now i am confused XD

jovial mason
sharp bough
#

spark has a memory dump command that will crash / slow down the server but gather all data you need to identify the leak

#

even a simple heapsummary might be enough to find the leak

#

if its too bad

jovial mason
#

but i cant predict the memory leak server crash

#

idk when it crashes thats what i mean

eternal oxide
#

Why are you so certain its a memory leak? Do you actually run out of memory?

#

as nothing you have said so far actually indicates a memory leak

jovial mason
#

yes

#

console says: out of memory: true

eternal oxide
#

um

#

you get a stacktrace when it crashes? as an out of memory does generate a stack trace

jovial mason
#

how i get that?

eternal oxide
#

the jvm will throw an error

jovial mason
#

i dont have a root server

#

just a game server

#

i dont get it

eternal oxide
#

the game server console will show the jvm error

jovial mason
#

it doesnt get logged :((

#

it says error and a number

#

nothing else

#

wait

eternal oxide
#

you are on a hosted panel or something?

jovial mason
#

novacloud@ryzen01~ Server marked as offline...
[Novacloud Deamon]: ---------- Detected server process in a crashed state! ----------
[Novacloud Deamon]: Exit code: 137
[Novacloud Deamon]: Out of memory: true

#

thats what i get

wet breach
#

how much ram does this thing have?

blazing ocean
#

Deamon
kekw

jovial mason
#

14gb

wet breach
#

is the mc server allocated all 14gb?

eternal oxide
#

unlikely you are using 14gb

jovial mason
#

yes

#

i am

#

its in the startup

eternal oxide
#

how often does it crash?

jovial mason
#

every 9 hours

eternal oxide
#

damn, thats a HUGE leak. It shoudl be simple to find

wet breach
#

I think the issue is GC and because GC needs ram to do its thing it dies

jovial mason
#

a huge leak??

#

elgarL pls help me if its easy to find XD

#

i am trying to find it for 3 days

blazing ocean
wet breach
#

doubt they are using JVM arguments for allocations above 10GB

eternal oxide
#

if you have 14gb and you assigned it ALL to the jvm you will run out of memory

wet breach
#

?flags

undone axleBOT
jovial mason
#

i can show u the startup

#
java -Xms128M -Xmx14336M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -XX:+HeapDumpOnOutOfMemoryError -jar server.jar
#

and it still runs out of memory with that

eternal oxide
#

do not assign ALL memory to the jvm

jovial mason
#

i sadly cant change that

eternal oxide
#

why?

jovial mason
#

its not editable

blazing ocean
#

shitty host I assume

eternal oxide
#

yeah

blazing ocean
#

a host not allowing you to do that is bad

eternal oxide
#

very bad

jovial mason
#

i could make a ticket

#

probably

#

but there is still a memory leak tho?

eternal oxide
#

possibly not

#

IF that max memory is ALL the systems memory then GC may never trigger

jovial mason
#

GC does trigger I see memory spike from 10gb to 5gb and then back to 10gb

wet breach
eternal oxide
#

ok, then just run spark at 1 hour and again at 5 hours

wet breach
#

docker ram allocation isn't done the same way as jvm allocation

eternal oxide
#

see what has increased by a LOT

jovial mason
#

u mean a spark heapdump? or how its called idk

wet breach
jovial mason
#

yes 4 selfmade

#

i am pretty sure they are corrupted

#

i cant code i used chatgpt ... xD

wet breach
#

that....explains a lot

eternal oxide
#

is source public?

jovial mason
#

I can give the src

blazing ocean
#

how moch you wanna bet they're storing some kind of block state or player reference

jovial mason
#

i dont store that

eternal oxide
#

bound ot be be some map leak yep

wet breach
jovial mason
#

I got maps

#

i got 5 plugins tho idk which one is the corrupted one

#

prob all

wet breach
#

not sure why you call it corrupted

jovial mason
#

Cuz its fcking my memory

#

XD

wet breach
#

corrupted implies they don't work, clearly they are working

jovial mason
#

You are right..

#

its just frustrating

blazing ocean
jovial mason
#

since u guys dare to bet on my src error i just post my src XD

#

see something there?

#

its main and other class

blazing ocean
#

List<Player>
List<Entity>

#

knew it kekw

jovial mason
#

WHAT

#

???

remote swallow
#

those instances only exist when a their online or alive respectively

blazing ocean
jovial mason
#

but u said never release

remote swallow
#

once they log out or die the server doesnt need that instance and you dont remove that reference to it

eternal oxide
#

when they log out and comer back its a NEW Player. they will not match their old ones

jovial mason
#

its not loading

#

how can i fix that?

#

pls be so kind

wet breach
#

use the leave event and remove them from the list when they left

#

this ensures the list is kept cleared of old objects

#

but there is probably a lot of other stuff that is wrong too

eternal oxide
#

looks like he does remove in the quit event

jovial mason
#


        flying.remove(player);
        boosted.remove(player);
#

aint that it?

eternal oxide
#

yes, so its unlikely to be that plugin causing issues

jovial mason
#

can i send u the other plugin too?

eternal oxide
#

yes

jovial mason
#

thank you

#

i think thats okay

#

Wait

#

thats the outdated code..

#

sorry

#

if u guys could tell me what i have to look at i can look for myself :D

blazing ocean
#

Set<Player>

#

you're still storing player references

jovial mason
#

huh which plugin now

blazing ocean
#

the last one you sent

jovial mason
#

ah yeah

eternal oxide
#

You don;t listen to the quit event to remove teh Player from the Set in the bed plugin

blazing ocean
#

you shouldn't be storing players in the first place

jovial mason
#

So what does that mean? i dont know what that means i told u its ai XD

eternal oxide
#

if the player quits while they are in a bed they will forever be in the Set

jovial mason
#

Ohhh if they get knocked out of bed

eternal oxide
#

if they log out/disconnect

jovial mason
#

i need a player quit event?

eternal oxide
#

yes

jovial mason
#

and then bedenter delete player?

eternal oxide
#

no

#

Same as the onBedLeave event

jovial mason
#

BedEnter.remove(event.getPlayer())?

eternal oxide
#

yes, for teh quit event

jovial mason
#

Okay thank you, give me pls a sec

eternal oxide
#

Though to be a serious memory leak you would have to have a lot of players quit while sleeping

jovial mason
#

i have a few other plugins which have the leak i guess

#

but first i need to find out how i add it cuz bedenter is red CANNT RESOLVE SYMBOL BEDENTER

#

fixed it now mb

#

what about this one?

eternal oxide
#

No Collections so no leak, unless you are mass jailing and the config grows to a massive size

jovial mason
#

okay there are 2 plugins left

#

wanna check em?

eternal oxide
#

sure

jovial mason
#

thanks

eternal oxide
#

No leak

jovial mason
#

can i send u the last one private?

#

i know its silly

#

but

#

idk

eternal oxide
#

I don;t do dms

jovial mason
#

Aghh

#

fine

#

are u ready

#

for the worst one

blazing ocean
#

oh no

jovial mason
#

its all in 1 class

#

its the most messy one

blazing ocean
#

the english-german mix is messing with my brain

jovial mason
#

XDD

#

u guys just witnessed nightmare

wet breach
#

everyone here has produced some atrocious code at some point

jovial mason
#

it was my first pl to be fair XD

#

but i bet there must be a memory leak

wet breach
#

sure thats fine, but we are not going to sit here and just make fun of you either lol

jovial mason
#

if there aint a memory leak i am cooked

#

cuz i dont know the solution then

wet breach
#

it would have to be the other plugins you are using, but I thought we identified one already?

jovial mason
#

yes but it was a small one

#

i guess

#

there aint many pleayers who leave while sleeping

#

on my server

eternal oxide
#

Probably no leak, unless you are respawning multiple Displays in that last plugin

jovial mason
#

thats not good

#

now i am out of idea

eternal oxide
#

Do as I said, run spark profiler at 1 hour and 5 hours. Note differences in object sizes

jovial mason
#

I will

#

but for example

#

even if i find it how can i tell why and where it caused the problem?

eternal oxide
#

the profiler will tell you

jovial mason
#

okay thank you

eternal oxide
#

it will guide you to which plugin is causing it

jovial mason
#

Thanks i think its a skript of mine

#

if its not a plugin

wet breach
#

you are using skript?

jovial mason
#

y...yes?

#

pls dont punch me XD

#

skript is good for easy things

wet breach
#

quite possible javascript taking up all your resources

jovial mason
#

Skript = Javascript? huh now i am confused

wet breach
#

its based off it

jovial mason
#

is it the plugin itself? or skripts which i coded?

wet breach
#

not sure, I didn't look at anything since ElgarL was

#

he is pretty decent developer so if he doesn't notice anything glarring probably true then

jovial mason
#

i mean the skript plugin itself

spark lake
#

Good afternoon

#

Is it possible to download the Spigot plugin?

#

For VPN server

quaint mantle
#

Who can help with item display rotation?🙏

sullen marlin
#

what specifically about it

sullen marlin
#

What's your current code?

quaint mantle
jovial mason
eternal oxide
#

yes a couple of hours shoudl be fine, if you are running out of memory in 9 hours

jovial mason
#

its 2gb big how can i show it to u=

spark lake
#

Is it possible to download the Spigot plugin?

jovial mason
#

or how can i see the difference and show u

eternal oxide
#

spark sdhould give you a link

jovial mason
#

its a folder

#

heap

eternal oxide
sullen marlin
jovial mason
#

So u dont want the spark heapdump

spark lake
quaint mantle
slim elbow
#

Hello, I am trying to connect my plugin to grafana loki to publish every log from minecraft console. but Bukkit.getLogger returns the logger for my plugin and not for the whole server, what should I do in order to listen to every log?

#

Basically, I want to track every log which I see in minecraft console, not sure how to do that, log4f seems to be a little confusing

sullen marlin
sullen marlin
quaint mantle
sullen marlin
#

You can just move the entity, no need to translate

jovial mason
#

ingame with a plugin like spark

eternal oxide
#

/spark profiler open

#

if you have a profile running/ran

jovial mason
#

one says spark profiler one says spark heapdump

#

i am so confused

slim elbow
# sullen marlin Bukkit.getLogger is the server log, Plugin.getLogger is the plugin log

https://media.discordapp.net/attachments/1276611213769441405/1328824408420257853/image.png?ex=67881bab&is=6786ca2b&hm=c11ad06fcff7bf74e87d7fd4def266f377c356364d52595c9875885c53e2edb7&=&format=webp&quality=lossless

Is it the valid way to do that? Passed logger is Bukkit.getLogger(), although it doesn't seem to catch any log at all, is the level messed up? Also, if I make a handler for server's logger, should I also make one for my plugin or it's already included?

sullen marlin
#

Are you actually using spigot and not some fork

jovial mason
#

paper..

slim elbow
#

Even worse, purpur

jovial mason
#

hh

#

huh

sullen marlin
#

Thank you, next

jovial mason
#

DAMN WHAT

slim elbow
#

😭

jovial mason
#

i am sorry

eternal night
jovial mason
#

some1 mad cuz paper better 😿

blazing ocean
#

?whereami

hollow vessel
#

hi, how can I check what is the amount of item what player puts in inventory

here is my code now, but event.getCursor().getAmount() is returning the amount that player is holding on cursor. I need to check if someone take someting or put, if put how many he put.

    @EventHandler(priority = EventPriority.MONITOR)
    void onInventoryClick(InventoryClickEvent event) {
        InventoryHolder holder = event.getInventory().getHolder();

        if (!(holder instanceof AssortmentChestViewHolder chestHolder) || !(event.getWhoClicked() instanceof Player player)) {
            return;
        }

        ItemStack currentItem = event.getCurrentItem();
        int slot = event.getSlot();

        AssortmentChest assortmentChest = chestHolder.getAssortmentChest();
        Bukkit.broadcastMessage("cursror: " + event.getCursor().getType());

        if (currentItem == null) {
            ItemWeight itemWeight = this.itemWeightProvider.getItemWeight(event.getCursor());
            player.sendMessage("put");
            player.sendMessage(event.getCursor().getAmount() + " ");


            assortmentChest.addContent(slot, itemWeight);

            chestHolder.updateTitle(assortmentChest);
            chestHolder.action(event);

            return;
        }

        Material currentItemType = currentItem.getType();
        if (currentItemType != Material.AIR && event.getCursor().getType() == Material.AIR) {
            player.sendMessage("Take");
            assortmentChest.removeContent(slot);
        }

        chestHolder.updateTitle(assortmentChest);
        chestHolder.action(event);
    }

maybe my logic is wrong and there is simpler way to do that

golden turret
#

is there any gradle plugin like paper's paperweight.userdev, but for spigot?

cinder temple
#

Any good developer here? Who have free time for plugins dev?

eternal night
#

?services

undone axleBOT
golden turret
cinder temple
#

Thx bro

slender elbow
#

or you can just put all your nms in a maven repo behind credentials

sullen marlin
#

CI can do anything you can do

slender elbow
#

?nms iirc this guide says something about gradle anyway

slender elbow
#

First of all, you have to run BuildTools

#

epic

golden turret
#

it is just that i wanted something easy like a compileOnly(spigot1.20.4)

golden turret
river oracle
#

?gui

hollow vessel
tidal kettle
#

hey i tried to see if, when the player interact with an item PlayerInteractEvent, it's an eatable item so i use

player.getInventory().getItemInMainHand().getItemMeta().hasFood()

any idea why it don't work?

wet breach
#

why do you need to know how much they take or put?

hollow vessel
#

I need to detect if player is putting something to inventory or take someting. If putting I need the exact amount of the putter item

wet breach
#

yes but why?

hollow vessel
wet breach
#

that doesn't really clarify anything

#

there is a reason I am asking because it dictates how you could go about it

hollow vessel
#

to calculate "item weight" in a slot

wet breach
#

the real question is, how soon do you really need to know about it?

hollow vessel
#

I made system that some items has their weight

#

and I need to calculate the waight in a slot, so I need to know what is an amount of put item

slender elbow
hollow vessel
#

its little weird 😅

wet breach
#

ok, on inventory open of the chest get a snapshot of it

#

on close, compare it with your snapshot

hollow vessel
#

I need to get it after put

#

no on close

wet breach
#

to do what?

hollow vessel
#

to update lore with item weight

wet breach
#

idk what this item weight is for or does

hollow vessel
#

its not vital

wet breach
#

ok if its not vital why must it be done while the chest is opened?

hollow vessel
#

to update lore, and calculate this weight. Its not vital to understand what item weight is.

#

I just need to check if player put or take items and what is the amount of put item

#

with InventoryClickEvent

wet breach
#

you don't need click event for this

#

so instead of on close, when chest opens run a task that checks the inventory of the chest when it was opened to what it is now when checked

#

so get a snapshot

hollow vessel
#

can I get the effect with InventorDragEvent?

wet breach
#

yes but that isn't reliable since that is thrown when simply moving an item not necessarily placing it

#

anyways, its easy to compare snapshots of inventories for changes

#

if no change, don't do anything

#

if change detected, check the slots

#

odds are the item without lore isn't going to stack with one that has lore

#

so that means realistically would have to check only the empty slots but idk your specific setup etc

hollow vessel
#

i will try thanks

mortal hare
#

i propose new law in java clean code

#

if you cant name your variables under one single word

#

your implementation is too big

mental drum
#

Im making a AI questing plugin. Shits huge

mortal hare
#

for me personally this seems to be the case like 80% of the time

rough drift
#

it'll be so bad

rough drift
#

that's acceptable

mental drum
#

Its actually pretty decent atm. Heavy constraints and context needed though

rough drift
#

or ig playerId

mortal hare
rough drift
#

ai isn't that great at it tbf

rough drift
mortal hare
#

just name it name or id

rough drift
#

what if I have two players

urban cloak
#

as long as the name fits within the 80 character limit its fine xd

rough drift
#

do you suggest id1 or id2?? 😭

mental drum
#

Its basically open world with endless quest lines with the help of quest generation and context from ai

mortal hare
mental drum
rough drift
#

what about

victimId
killerId

mortal hare
#

could be also

rough drift
#

but still

mental drum
#

Ill pleasently surprise you when its released

mortal hare
#

but i would prefer references instead in this case

#

if you need to reference both playerNames, its usually a binary operation algorithm so it should be under separate utility method

rough drift
#

what if I just need to run a check and pass them somewhere else?

mortal hare
#

example?

rough drift
#

I can't type codeblocks rn but checking player ids and passing them to say a map

#

like checkSomethingA checkSomethingB map.put

#

I just store them in a variable because it looks nicer

mortal hare
#

putIfAbsent

#

computeIfAbsent

#

methods

#

i guess

#

i just noticed that for my cases where i have two word variables it implies that algorithm could be simplified into smaller parts

rough drift
#

they don't do the same thing though?

rough drift
#

unless you need critical performance that calling a method slows it down, you should already split stuff up

mortal hare
#

exceptions for me would be utility binary operation methods

#

like comparison methods

rough drift
#

inlining 4 method calls saved 10s off a 14s runtime

rough drift
mortal hare
#

the main rule is me is that variable name shouldnt repeat the same information that type name already does provide

#

you shouldnt name UserInformationService variable to userInformationService, imho you should name it like users or information or just service, and the type would implicitly tell you more information about details (if you name service you can lookup to to the type to see what kind of service it is for example, or if you name it information you can lookup to the type that it returns you user information)

#

if you have collisions for a name, it implies to me that either:
**a. **you name variable data wrong in that particular context where variable is being used;
**b. **your algorithm is too big and need to be splitted

golden turret
#

how can i make buildtools ignore the java version?

urban cloak
#

that seems very pointless

#

you will definitely not have only 1 service

#

userService at least

#

nobody will understand that, calling it only service

#

users is alright tho

slender elbow
#

UserInformationService userInformationService = new UserInformationService()

urban cloak
slender elbow
#

that's why you just strip all the vowels, srNfrmtnSrvc

#

peak C naming

#

or do shit like userI9nS5e

urban cloak
#

oh ye i remember ncurses, mvwaddch

#

absolute bullshit

#

why leave the a in there at that point

mortal hare
mortal hare
#

shouldnt type tell you the exact details

urban cloak
#

if you have UserController class, then calling the infoservice only service might be feasable

mortal hare
#

you should name your variables according to the context

urban cloak
slender elbow
#

i name my user information service user information service because it's a service for information about users

#

👍👍👍👍👍

mortal hare
urban cloak
#

hover over every second variable in intellij to see the type or press ctrl + B to see the declaration. seems very good!! yeye totally recommend 💯

mortal hare
#

if you want type information just use hungarian notation mess

#

LPCSTR

urban cloak
#

i dont want type information, i want function information

#

im not gonna call it ClassUserInformationService that is actually pointless

mortal hare
#

type name implies the functionality

urban cloak
#

typename is not visible always tho

mortal hare
#

java is a strictly typed language, its not as if its javascript where type information is hidden

urban cloak
#

still possibly not on your screen

mortal hare
#

intellij just tells you the type by just typing the variable

urban cloak
#

ye when typing but not when reading

mortal hare
#

it depends on the context of the class

#

its not as if the fragment is verbose enough to define its functionality

urban cloak
#

class is enum Platform

mortal hare
#

even if you name it with functional type name

urban cloak
urban cloak
mortal hare
urban cloak
#

if your context is a class named Screen then its not straightforward

mortal hare
#

again it depends on the context, if its a different context i would name it something else that suites the context, in this case there's no graphics related fields so its reasonable to call it like this

urban cloak
#

you dont call motorcycle just cycle just cause in the context of a road it might imply that it has a motor

#

or washing machine "machine"

#

pointless

mortal hare
#

thats a different thing, those are different words with different meanings

wet breach
#

your examples are equal to that if you wanted to compare to generics lol

mortal hare
urban cloak
urban cloak
wet breach
#

not in Java

urban cloak
#

why?

wet breach
#

because the type isn't going to magically change

urban cloak
#

not calling a button soething something button just because why not seems very pointless to me

urban cloak
wet breach
#

types have to be declared

urban cloak
#

ye you dont always see the declaration

wet breach
#

not sure how you wouldn't?

urban cloak
#

50 lines up on your screen???

wet breach
#

I can see like 200 on a screen

remote swallow
#

hover over it?

mortal hare
#

but you spend more time embedding the same type information over and over in variable names than just to check once when you use an IDE

urban cloak
#

i can only see 50

remote swallow
#

ctrl+click it?

wet breach
#

anyways, IDE's today do a good job telling you where the declarations are at 😛

urban cloak
#

calling an integer just "variable" because people can just click on it to see that its an integer is the most pointless thing ive ever heard

mortal hare
#

in my opinion, embedding type information is variables clutters your code for no reason, and it makes it less readable, since those variable names tend to be quite long, and usually you can know what variable actually does just by looking at the context where variable is being declared. so there's no need to embed such information and repeat yourself, instead calling it something short helps readability.

wet breach
#

if I see an equation I know the types have to be of the number family

urban cloak
# mortal hare

i dont understand why the method still has button in it tho

#

the return type already tells you what it returns 🤷‍♀️

mortal hare
#
    public static LoginScene create(final Stage stage, final UserInformationService service) {
        final InputTextField username = new InputTextField();
        final InputPasswordField password = new InputPasswordField();

        final InputButton register = LoginScene.createRegisterButton();
        final InputButton login = LoginScene.createLoginButton();

        final LoginScene scene = LoginScene.instanciateLoginScene(username, password, register, login);
        login.setOnAction(new LoginNavigationActionHandler(stage, scene, service, username, password));
        register.setOnAction(new NavigationActionHandler(stage, RegisterScene.create(stage, service, scene)));
        return scene;
    }

here's the whole method.

urban cloak
#

why is it so quiet suddenly

mortal hare
#

i dont see it how its not clear from the context what login is inside the method

wet breach
#

LoginScene is quite clear and the method name even more so

urban cloak
#

yeah the method name is alright

wet breach
#

LoginScene so we are dealing with UI elements, and its creating them

urban cloak
#

and this LoginScene.instanciateLoginScene youre not being very consequent with this idiom

mortal hare
#

type tells you what login refers to, it implies that InputButton is implicit, non-existant LogicInputButton type, but since there's no need for separate class implementation in this context it refers to as login

wet breach
#

also known as lazy loading

urban cloak
#

yeah i know that it creates a LoginScene object because its in the LoginScene class

#

just call it LoginScene.instanciate if you wanna stay true to that concept

#

and LoginScene.createLogin

mortal hare
#

i agree on this one

wet breach
#

well I don't know the class structure so its quite possible there is other objects that could be instantiated in it?

urban cloak
#

YES EXACTLY

#

AND THIS is why its pointless

urban cloak
#

and that person can look it up in intellij

#

makes it good to read 💯

mortal hare
wet breach
#

my point was instanciateLoginScene makes sense if that class had other methods for instantiating objects. Therefore we know we are instantiating the LoginScene from that class

urban cloak
#
public static LoginScene create(final Stage stage, final UserInformationService service) {
    final InputTextField username = new InputTextField();
    final InputPasswordField password = new InputPasswordField();
    final InputButton register = LoginScene.createRegister();
    final InputButton login = LoginScene.createLogin();
    final LoginScene scene = LoginScene.instanciate(username, password, register, login);
    login.setOnAction(new LoginNavigationActionHandler(stage, scene, service, username, password));
    register.setOnAction(new NavigationActionHandler(stage, RegisterScene.create(stage, service, scene)));
    return scene;
}
``` woah i love this already 🤩
mortal hare
#

in my case its the only object instanciated, so he's right, i should've named it instanciate() as method

wet breach
#

that is all I was saying

#

whether or not implementation has too much responsibility is more or less preference

#

and not something I am trying to debate

urban cloak
#
public static LoginScene create(final Stage stage, final UserInformationService service) {
    final InputTextField usernameField = new InputTextField();
    final InputPasswordField passwordField = new InputPasswordField();
    final InputButton registerButton = LoginScene.createRegisterButton();
    final InputButton loginButton = LoginScene.createLoginButton();
    final LoginScene scene = LoginScene.instanciate(usernameField passwordField, registerButton, loginButton);
    login.setOnAction(new LoginNavigationActionHandler(stage, scene, informationService, usernameField, passwordField));
    register.setOnAction(new NavigationActionHandler(stage, RegisterScene.create(stage, informationService, scene)));
    return scene;
}
``` tell me whats more readable
mortal hare
#

my idiom is that the less words i see and the more i depend on the context the easier for is to read for me, verbosity adds complexity for me. also if class name changes, i dont need to change my variable names too, since they depend on the context and not on the specifics of data

urban cloak
#
public static LoginScene create(final Stage stage, final UserInformationService service) {
    final InputTextField usernameField = new InputTextField();
    final InputPasswordField passwordField = new InputPasswordField();

    final InputButton registerButton = LoginScene.createRegisterButton();
    final InputButton loginButton = LoginScene.createLoginButton();

    final LoginScene scene = LoginScene.instanciate(usernameField passwordField, registerButton, loginButton);
    login.setOnAction(new LoginNavigationActionHandler(stage, scene, informationService, usernameField, passwordField));
    register.setOnAction(new NavigationActionHandler(stage, RegisterScene.create(stage, informationService, scene)));
    return scene;
}
#

you could even make it more readable by removing even pointlesser final keywords

public static LoginScene create(Stage stage, UserInformationService service) {
    InputTextField usernameField = new InputTextField();
    InputPasswordField passwordField = new InputPasswordField();

    InputButton registerButton = LoginScene.createRegisterButton();
    InputButton loginButton = LoginScene.createLoginButton();

    LoginScene scene = LoginScene.instanciate(usernameField passwordField, registerButton, loginButton);
    login.setOnAction(new LoginNavigationActionHandler(stage, scene, informationService, usernameField, passwordField));
    register.setOnAction(new NavigationActionHandler(stage, RegisterScene.create(stage, informationService, scene)));
    return scene;
}
mortal hare
#

i use final everywhere since then i could be guaranteed that the variable is not surprisingly being mutated somewhere else

#

prevents bugs

urban cloak
#

hmmm

#

doesnt your IDE tell you that

#

and isnt that violating a java code principle

mortal hare
#

well final imposes compile time errors

urban cloak
mortal hare
#

wdym

urban cloak
#

idk how a variable should be accidentally mutated

mortal hare
#

what i mean by mutation is that it wouldnt mutate the variable deep down in the function where i would miss that due to error

urban cloak
#

were not writing python

mortal hare
#

not that it should be mutated outside method

#

if i see a field being declared final i can be sure that at the end of the function, that variable will stay the same

#

unless it wasnt intialized in the first place (in that case it would be null)

#

meanwhile if i didnt declare it as final, i have to use my dumb monkey brain to manually check with ide that the variable is safe to reference in the way i want and that it hold what i expect to

urban cloak
#

idk how that should happen by accident but okay