#help-development

1 messages · Page 91 of 1

young knoll
#

get(0) and get(1) will both be “hi”

dry forum
#

huh

#

would it being static have anything to do with it?

sterile token
#

Lmao i dont know why im so dumb that i cannot sort a List via Priority int

valid sorrel
#

how do I know where the location returned from getLocation() is coming from

#

so I can modify it directly somehow

young knoll
#

getLocation is implemented in CraftEntity

vocal cloud
#

NMS

valid sorrel
#

oh nms

young knoll
#

And CraftEntity will pull data from EntityPlayer

floral drum
#

and CraftEntity extends Entity

#

👀

young knoll
#

CraftEntity implements entity

floral drum
#

implements?

young knoll
#

Yes

floral drum
#

cap

young knoll
#

Ah

#

I meant org.bukkit.entity

floral drum
#

ah

#

oh

#

I thought CraftEntity also extended Entity

#

MB

#

ignore me

#

😄

#

it just has a reference to the entity inside it instead

valid sorrel
#

aaaaa

#

intellij takes forever to index nms

echo basalt
#

I mean

#

It's not that bad

#

Sure it takes a while but it doesn't brick your computer

valid sorrel
#

yea

#

ah it's done

echo basalt
#

I've been doing some localhost testing directly on my ide

#

and I'm testing vector math in particular

#

async raytracing n all

#

I bricked my computer countless times already

#

so you're lucky you're not suffering

#

but we're getting somewhere

floral drum
valid sorrel
#

aka line feed

echo basalt
#

I might hit up AMD to make a custom SoC to do raytracing a lil better

#

get a 300w threadripper

floral drum
#

lmao

valid sorrel
#
public Location getLocation() {
        return new Location(this.getWorld(), this.entity.df(), this.entity.dh(), this.entity.dl(), this.entity.getBukkitYaw(), this.entity.ds());
    }
#

hmm

quasi patrol
#

Was the ability to show players the demo menu removed in the latest versions?

valid sorrel
#

no

#

org.bukkit.entity.Player

#

has showDemoScreen()

compact haven
#

why is that even a thing lmao

quasi patrol
valid sorrel
valid sorrel
quasi patrol
valid sorrel
#

I built it today with buildtools so it should be up to date

quasi patrol
#

I’m on 1.17.1. .-.

valid sorrel
#

oh that's old

#

old version doesnt have it

compact haven
#

"Was the ability to show players the demo menu removed in the latest versions"

quasi patrol
valid sorrel
compact haven
#

it's likely just some packet the server can send

#

and it was just added to the api after 1.17.1

quasi patrol
#

Ight.

#

Well I moved to 1.19.1 I’ll see if it work.

compact haven
#

in case you want to remain on the older version but still send the demo screen

valid sorrel
#

hm

#

can you help me with accessing private fields

quasi patrol
#

Since there is player#updateCommands, it there a way to get the commands a player’s client knows that exists?

valid sorrel
#

any idea why this code won't work?

CraftEntity craftEntity = ((CraftEntity) player);
Field entityField = craftEntity.getClass().getDeclaredField("entity");
entityField.setAccessible(true);
Entity entity = (Entity) entityField.get(craftEntity);
Class<?> entityClass = entityField.getType();
Field vec3dField = entityClass.getDeclaredField("aw");
vec3dField.setAccessible(true);
Vec3D vec3d = (Vec3D) vec3dField.get(entity);
Class<?> vec3dClass = vec3dField.getType();
Field xField = vec3dClass.getDeclaredField("c");
xField.setAccessible(true);
xField.set(vec3d, x);
Field yField = vec3dClass.getDeclaredField("d");
yField.setAccessible(true);
yField.set(vec3d, y);
Field zField = vec3dClass.getDeclaredField("e");
zField.setAccessible(true);
zField.set(vec3d, z);
vocal cloud
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

valid sorrel
#

I thought you could get what is wrong in my code

#

yeah it's just generally "not working"

vocal cloud
#

Well the answer is that there is no declared field entity

valid sorrel
#

huhhhh?

#

my ide says it is

vocal cloud
#

java 17?

valid sorrel
#

yep

#

could it be because it is a private field

vocal cloud
#

Java 17 has reduced a lot of what reflection can do

valid sorrel
#

aaaa

sullen marlin
#

what is that code even meant to do

valid sorrel
#

modify player's location directly

vocal cloud
sullen marlin
valid sorrel
#

want to teleport a player without sending a packet

sullen marlin
#

?

valid sorrel
#

also I can't use Player.teleport asynchronously

sullen marlin
#

they will just glitch out and/or resync with a packet immediately

valid sorrel
#

that's what I'm trying to do

sullen marlin
#

and what makes you think you can use reflection to randomly poke fields asynchronously in a safe way

vocal cloud
#

They want to have the player appear in one location to all other players while the player is actually in another

sullen marlin
#

well your code wont achieve that

valid sorrel
#

even to the server

#

anyway is there any other way to change the player's location without teleporting them

vocal cloud
#

You can always fork spigot and make your own stuff that will cause a tonne of issues shrug1

valid sorrel
#

I want it to be a plugin

#

so everyone (that has a questionable mind like me) can use it

wet breach
vocal cloud
#

It's also a lack of understanding how client->server relationships work it seems

wet breach
#

exactly what I said way in the beginning XD

valid sorrel
#

no I know how it works

#

I want it to desync purposefully

#

between client and server

wet breach
#

what you are wanting to achieve can be achieved in more simpler ways

vocal cloud
#

Yet you still haven't explained why

wet breach
#

and this ^

valid sorrel
#

modifying server side player movement logic

vocal cloud
#

For what purpose?

#

What is the end goal here?

wet breach
#

lol

valid sorrel
#

seeing if I can do it another way

wet breach
#

anyways back to some pew pew pew

valid sorrel
#

the alternate method (as expected) does not work

wet breach
#

you still haven't told us what exactly needs to be accomplished

vocal cloud
#

Day 2 of asking what this is for

wet breach
#

if you tell us we would be able to help you go about it most likely in a better more simpler way

wet breach
vocal cloud
#

Does it desync me so I can enjoy rubber banding?

valid sorrel
#

actually

wet breach
#

AI entity pets/companions. They are entities that follow you and you can teach it over time to do things

vocal cloud
#

Animal tamers

valid sorrel
#

to reduce rubber banding

#

with questionable methods

vocal cloud
#

Wait this whole fucking time

wet breach
vocal cloud
#

you wanted to fix rubber banding

valid sorrel
#

not really fix

#

questionable experiment

wet breach
#

I am not sure what makes it questionable

vocal cloud
wet breach
#

so it has to learn

#

but it only learns from the player it is assigned to

vocal cloud
#

It has a skill tree?

ashen quest
#

whats the size of a minecraft inventory (texture wise)

wet breach
#

this way, no two companions will ever be the same and if you lose that companion it is more meaningfull 😄

vocal cloud
#

Ah I see

wet breach
#

be interesting to create such a plugin

#

not sure if a server will be willing to use it though

#

will need some DB space for sure

vocal cloud
#

Storage would be thicc indeed

#

memory too

wet breach
ashen quest
#

yep

vocal cloud
#

Steal the texture from the game itself?

ashen quest
#

boinkkk ok

boreal sparrow
#

I have a player world changed event. How do I get the location of the player in the world they left?

#

player.getLocation() returns the location of the player in the world they travelled to

valid sorrel
#

ahhh got it working!

#

player.teleport then cancel packet

#

oof

#

it doesn't actually work

wet breach
#

do it from the command

#

in getting their location

boreal sparrow
wet breach
boreal sparrow
#

true, but it is not command caused

#

not entirely sure but one of the plugins keeps sending the players to world spawn

wet breach
#

or when they do /spawn?

#

or is it upon death this happens

wise mesa
#

Does anyone know if hotswapagent works with spigot

#

Hotswapagent + JetbrainsRuntime

#

I was testing it earlier and getting a bunch of issues

#

I’ll send the errors in the morning but just wanna know if it’s possible

tawny otter
#

I cant get "getCustomConfig" to work on my other Classes

    @EventHandler
    public void onInventoryJoin(PlayerJoinEvent event){
        plugin.getCustomConfig().getString("some-path");
    }

"Cannot resolve method 'getCustomConfig' in 'JavaPlugin'"

    public FileConfiguration getCustomConfig() {
        return this.customConfig;
    }
vivid cave
#

Can I have a template of a gradle file for 1.19 spigot + nms? (kotlin, not groovy)

zealous osprey
tawny otter
#
plugin = this;
getServer().getPluginManager().registerEvents(new Sneak(plugin),this);
zealous osprey
#

Ye, it needs to be your main plugin class. Cause JavaPlugin doesnt contain the "getCustomConfig" method

tawny otter
#

I think it is?

zealous osprey
#

what is the class called that extends "JavaPlugin"

tawny otter
#

(If I know what main means) its my main thats extends it

public final class OreIginPlugin extends JavaPlugin implements Listener, TabCompleter 
#

the main is also passing the plugin var to the listener class

zealous osprey
#

Instead of having private final JavaPlugin plugin; do private final OreIginPlugin plugin;

tawny otter
#

looks to work

#

thanks

zealous osprey
#

since JavaPlugin does not contain "getCustomConfig()", it has the "getConfig()" method, but it will not contain any method that you add in your main plugin class (aka the "OreIginPlugin" class)

tawny otter
#

righty, thats confusingly understandable

river oracle
#

Polymorphism moment

cobalt thorn
#
        List<String> list = plugin.getConfig().getStringList("blacklisted-world");

        for (String worldB : list) {
            if(player.getWorld().getName() == worldB) {
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Language.FeatureDisabled")));
            }
        }

Config:

blacklisted-world:
  - world

doesn't work any clue?

vivid cave
#

Can I have a template of a gradle file for 1.19 spigot + nms?

cobalt thorn
zealous osprey
#

did you save the config before trying plugin.getConfig()? As in having saveDefaultConfig(); in you onEnable method?

cobalt thorn
#

everything else work i have a config gui inside in game and work but not this section

sturdy frigate
#

How can i reload just my plugin? (i would like to render code changes without restarting the server) (/reload corrupts my worlds)

cobalt thorn
#

on reloading plugin

rough drift
#

Please do not do that

zealous osprey
rough drift
#

You might think your plugin is bugged however it is just plug man causing issues

#

no

sturdy frigate
cobalt thorn
sturdy frigate
rough drift
#

in YAML hello and "hello" are the same

rough drift
#

the only difference is that "hello" will not get parsed as syntax

#

whilst hello can

cobalt thorn
#

now works lol i just didn't remeber to do /main reload

zealous osprey
rough drift
#

yep

rough drift
cobalt thorn
#

nope doesn't work

#

even with reload what i can try?

rough drift
#

Just restart

#

it's the best way

cobalt thorn
#

i mean i did /plugin reload

wet breach
#

its not application dependent, however though that doesn't mean you won't encounter problems in an application because it matters how the application is designed

#

for instance in minecraft it isn't really built in to just arbitrarily expect the player object to just be null if the player hasn't left

#

exception being when the reload command is used

valid sorrel
#

Set location of player without sending teleport packet

sour wedge
#

Is it a good idea to store Config values in memory or just get them when you need from the file?

floral pier
lost matrix
sour wedge
lost matrix
#

No context

sour wedge
#

I have make a command thats allow ops to change config values, but one of them will not saved to the file no idea why

#

On the same command other values will successfully saved only one of them not updated when i open the file or restart server

sour wedge
# lost matrix No context
settings:
  global:
    spawner:
      spawnrate-percentage: 80
      spawnrate-delay: 5
      spawn-max-entities: 4
      stack-size: 64
      spawn-distance: 64
      distance: 64
  skyblock:
    save-interval: 300

Only settings.global.spawner.distance can't be writen

lost matrix
#

Makes no sense. Show some code pls

floral pier
sour wedge
#

Wrong past

lost matrix
#

?paste

undone axleBOT
lost matrix
#

like this one

shadow night
#

what event is ran when the player gets into a minecart?

shadow night
lost matrix
#

"Raised when an entity enters a vehicle."

floral pier
#

It shouldn't be more prone to error if you are doing it properly; i.e: clearing when you should, synced loading and safety checks for edge cases.

Loading files from the disk should not cause lag; do it in a separate thread and unless you are loading 10,000 100 linefiles it shoukdn't even noticibly impact server performance.

shadow night
#

seems fine to me

floral pier
#

Also don't use .json

lost matrix
# floral pier It shouldn't be more prone to error if you are doing it properly; i.e: clearing ...

First of all using Strings as keys is always more error prone than having concrete variable implementations.
FileConfigurations are just glorified Map<String, Object> objects. So it is quite important to not use them as
a data structure but merely as a tool for serialisation.

And my statement regarding IO was simplified because shared doesnt have much experience and coming at him
with threads would just confuse him. Also the biggest concern here is not the size of the files but the frequency
at which filehandles are opened/closed.

lost matrix
grim ice
floral pier
floral pier
#

Smaller, more robust and more compatible overall

lost matrix
floral pier
#

Yes but those would be glaring bugs that are easy to fix

#

Also String[] or LinkedList<String>

flint coyote
#

If you have a fixed size you can use an Array or an ArrayList.

floral pier
#

That's true, and you will for keys

lost matrix
#

If you think that those are glaring bugs then you havent worked on truly big projects.
You want to prevent runtime bugs at all costs as they can be very deceiving. And why
even take the risk of possibly implementing bugs into your code if they can be easily avioded
by writing a more robust application?

#

Using FileConfigurations on runtime is objectively worse.

flint coyote
#

Technically the arraylist doesn't need a fixed size but I listed it because lists are just more comfy to use than arrays imo

lost matrix
floral pier
grim ice
#

Makes sense

lost matrix
#

"performance > certainty" lol

floral pier
#

Or config.getString(17); and have getString lookup the key from a getter method

grim ice
#

i would have an enum with the paths

#

if i really wanted to do it

lost matrix
smoky oak
#

mars climate orbiter cough cough

lost matrix
#

"Write it buggy now, take the same time to fix it later."
If i would propose this to QA then they would literally laugh and think that im joking.

floral pier
#

I didn't say write it buggy, I said you should be confident enough in your abilities to do the job right.

floral pier
lost matrix
#

"performance > certainty. You can then have both when it's fixed."

floral pier
#

San Andreas Multiplayer

lost matrix
#

Nobody writes code like this

smoky oak
#

you wish

#

someone will

floral pier
#

Actually everyone in the industry I've seen does. Microsoft does.

smoky oak
#

anyways may i ask a minecraft question

floral pier
#

The Linux Kernel and C standard library are both written like that.

lost matrix
lost matrix
#

They have 99.9% test coverage and are written test-driven.

grim ice
#

i dont think that's a scalable way of writing code

floral pier
hazy parrot
#

this is cringe ngl

grim ice
#

making errors purposefully just to fix them later

floral pier
obsidian drift
#

How can I play sounds when a player respawns? Using PlayerRespawnEvent and delaying the playSound by 10 ticks still doesn't produce a sound.

floral pier
grim ice
#

it is

floral pier
#

It's not.

lost matrix
#

No they dont catch the bugs. They lay the constraints. You obviously dont work in software engineering.

grim ice
lost matrix
#

test-driven development Read that up

lost matrix
#

You dont write tests to catch bugs. You write them to enforce software constraints.

floral pier
#

The fact of the matter is noone in the industry is going to avoid using standard goid practice because they might make a spelling error in the key-string

lost matrix
#

Anyways this is taking too much of my time... Read "Clean Code" by Robert C. Martin.
Will convert you.

lost matrix
# floral pier The fact of the matter is noone in the industry is going to avoid using standard...
grim ice
#

i wanted to do that earlier but its too boring tbh

floral pier
grim ice
#

2008

lost matrix
grim ice
#

idk if 2008 == 1990 for you

#

it was p much mid 2008

floral pier
grim ice
#

mb

lost matrix
floral pier
#

Wat

lost matrix
#

If you think memoization is an argument contradicting my point then you didnt understand it.

floral pier
#

Okay but memoization is what I've been talking about this entire time. How would YOU suggest for example loading a dynamic player property from a file?

#

You need a simple x, y, z.

lost matrix
#

I would first of all avoid having one file with all player data in it.

floral pier
#

...

#

Yes good point why did I NEVER think of this???

lost matrix
#

05408439-23db-48a6-be80-34298e1f0b89.json

floral pier
#

Okay, right then you load the file

#

Okay next

lost matrix
#

Then it has a weak correlation

floral pier
#

You have to find the line containing key 'x' without a string literal to test against.

#

How are you doing it

fiery prairie
#

so it is checking if the item in someone's hand is air, if it isnt, the code works, if it is, it shows "An internal error occurred while attempting to perform this command", any idea why?

lost matrix
#

Like... did i talk spanish?

#

Anyways i got to go now

smoky oak
#

that aside no idea

#

the error should show you a lot more if you bother to look into the console

fiery prairie
#

getMaterial doesnt even exist

#

lmao

smoky oak
#

gettype then

#

still

#

look into the console

fiery prairie
#

it just says its null

#

so like the code works

#

but the else doesnt work

#

because it checks if it is air

#

but it just cant rename it

smoky oak
#

if the result it gives you is 'internal error' there IS, with guarantee, an error

fiery prairie
smoky oak
#

yea it says right there

fiery prairie
#

or maybe i should just check if its null instead of air

smoky oak
#

since the item wasnt modified

#

it doesnt have meta yet

#

you need to create a new meta and assign that to the item

fiery prairie
#

i have, basically it works if i am holding an item

#

but if i hold nothing then this appears

smoky oak
#

ah

#

i understand i think

#

because youre holding air, but comparing it to an itemstack

fiery prairie
#

ill just check if its null

smoky oak
#

you really should just check the material if its air

#

or if the hand is empty i think theres a method for that too

fiery prairie
#

okay wait

#

so im supposed to do this, right?

smoky oak
#

that should work

fiery prairie
#

well... it didnt

smoky oak
#

did you get a different error?

fiery prairie
#

same thing but im checking something that worked from the spigot forums

#

so uhh it kind of works

#

but now when im actually holding something

#

it doesnt do anything

#

nevermind

#

i did something very wrong

floral pier
grim ice
#

i think the way hes talking is really straight forward

fiery prairie
smoky oak
#

sure

#

time to ask a REALLY nice question for me now though
so im working on biome stuff
and apparantly i cant get the temperature adjustment value from a biome
does anyone know why? does it just default to zero?

grim ice
#

what i understand is that you should use the FileConfiguration only for serialization and data persistence, and use your own data classes to cache the actual data and use it

lost matrix
#

Be more concrete then i can give a straight answer

misty ingot
#

I have a command and when someone uses it, I want every argument (which is seperated by a comma ,) to be in a list
so like if I do -

/mycommand Oh hi how, are you doing, today sir?

then the args would go in an array like this
{"Oh hi how", "are you doing", "today sir?"}

#

how can I do this

smoky oak
#

you know you can split strings right?

misty ingot
#

I am using stringbuilder to put all the args into one stringbuilder

#

cant use .split() in a stringbuilder

#

and cant cast it as string

drowsy helm
#

sb.toString().split(",')

misty ingot
#

wait you can do that?

smoky oak
#

yea

drowsy helm
#

what do you think a string builder is for lol

#

you have to make it a string eventually

smoky oak
#

making string into more string

misty ingot
#

brehh

#

me dum

smoky oak
#

cant u just look up the javadoc

#

ah

#

iirc that method raytraces along the sightline for a maximum of <arg> blocks and returns null or the block it hits first

#

i remember doing some item tomfoolery with mining modifiers

fiery prairie
#

if im right, gettargetblockexact returns the block a player is looking at, and maxdistance is the maximum distance because it doesnt have to be within a player's reach or cursor

smoky oak
#

either that or air

fiery prairie
#

as far as i understand, yes

smoky oak
#

you mean in hand?

#

whats your goal exactly

#

set distance to 5

#

thats default targed distance iirc

fiery prairie
smoky oak
#

also make sure not to delete blocks at the bottom of the world

#

nether

#

you need to check dimension too

#

its overworld -64, and nether 0 and 127 iirc

#

also dont allow players to delete bedrock near end spawn or the ender dragon gets bugged

#

gateways

#

but yea

#

best dont allow block des in end

fiery prairie
#

so the if(args[1]!=null) is supposed to check if an argument with an item name was given so it doesnt return null, but it still does, any idea why?

smoky oak
#

you should really just allow them to craft end portal frames and break non naturally generated. they're finite and a griefer could just demolish all access to the end

rough drift
#

How may I check if a potion effect is positive/negative? (ex: regen = positive, poison = negative)

smoky oak
#

i think there is a method for that but it might be nms

rough drift
#

Yeah I remember using it in fabric

#

I am assuming it's there in spigot as well

smoky oak
#

to be fair thats an issue if someone gets built into bedrock and doesnt have 3 diamond blocks on hand too

shadow zinc
#

what do I do if two maven modules are dependent on each other?

#

I am

#

😢

smoky oak
#

well minecraft plugins cant have cyclic dependency

#

theyll just not load

chrome beacon
shadow zinc
chrome beacon
#

First one

shadow zinc
#

do you need the code?

#

or do you just want to call it bad design and not suggest anything?

fiery prairie
#

still, someone can change the name of his world

#

oh

#

i thoought its a public plugin

chrome beacon
fiery prairie
#

dumb me

smoky oak
#

does anyone know the maven dependency for spigot javadoc?

chrome beacon
fiery prairie
#

yea

shadow zinc
chrome beacon
#

Send the code

#

In a github repo

shadow zinc
chrome beacon
#

Check my profile 🙂

shadow zinc
#

lol thats the nerdiest shit ever

fiery prairie
#

seriously though saying the username would take less time than telling someone to check the profile

shadow zinc
#

no offence btw

#

@chrome beacon I did something, apparently it notifies you

chrome beacon
#

It saved the time searching for it

glossy basin
#

Hey is there a way to get the ID of the current item? For example, that a string with DIAMOND_AXE is output?

chrome beacon
#

Yeah I got the invite

#

Will check code later. Going for a swim now 🙂

shadow zinc
#

k

fiery prairie
#

?

#

and the args.length is 2 in the command

#

so whats the problem

#

wait actually im stupid and i still need to think how this works rn

#

okay

#

now that makes sense

#

thanks lmao

#

yea

#

shouldnt it be >=2 ?

hybrid spoke
#

zero-based indexing LUL

fiery prairie
drowsy helm
#

laughs in ACF

undone axleBOT
old cloud
#

Is it normal that you can put an item into offhand out of an inventory even if you deny the action on spigot 1.18.2?

drowsy helm
old cloud
smoky oak
#

isnt the bedrocck in the overworld at y-64

old cloud
drowsy helm
#

what method are you using

rotund pond
#

Hello !
I have a little question.
Essentials gives Invisibility 2 when vanished...
But is it a spigot system ?

I mean, do vanished players are invisible thx to spigot who hide in tab etc players with invisibility 2 ?
Or maybe essentials gives Invisibility 2 and hide himself players with this potion effect ?

old cloud
#

InventoryClickEvent

drowsy helm
#

yeah because thats not a click event

old cloud
#

but its still an inventory action isnt it

drowsy helm
#

PlayerSwapHandItemsEvent

#

what

#

not every inventory action calls InventoryClickEvent

#

you arent even clicking the inventory when you swap hands

old cloud
#

it should be in that category tho

#

cause protocol does

smoky oak
rotund pond
old cloud
drowsy helm
smoky oak
#

sides thenumber cant tell anything wrong. I'd do it a bit differently, but thats about it

old cloud
drowsy helm
#

because it's the same as dragging it, inside of your inventory

#

swapping with f isnt dragging it

old cloud
#

So the click event still cancels it

#

so its a click lol

#

even protocol treats it as a click

drowsy helm
#

interesting

#

why would creative not tho

old cloud
#

True cause you can easily clone everything

drowsy helm
#

wait

#

are you talking about pressing f in inventory

#

our outside of inv

old cloud
#

inside

drowsy helm
#

ah

shadow zinc
#

how do you get past circular dependencies?

grim ice
#

initialize objects lazily

shadow zinc
grim ice
#

what

fiery prairie
#

so umm same problem as earlier (im doing a different command now) and im proabbly stupid again but basically i have this and returns null and internal error (same as earlier) when im not holding anything even though its supposed to send a message to me

#

if im actually holding something then it works correctly

hazy parrot
#

Then your condition is not right

#

You can check what #getItemInHands equals if you are not holding anything

fiery prairie
#

the same condition works with a different command though

hybrid spoke
#

null

#

also what version are you on

fiery prairie
hazy parrot
hybrid spoke
#

the problem is the operator

#

you are using OR

#

you want to use AND

#

&&

hazy parrot
#

If first one is false, java will check second operator

fiery prairie
#

as i said, it works with a different command properly

hazy parrot
#

And if first one is false, that means it's null

hybrid spoke
#

otherwise if the first one is false, the second one is executed

hazy parrot
#

And second operator will call npe

fiery prairie
#

could i just remove the second condition?

old cloud
#

just use && lol

hybrid spoke
#

most likely

#

also enums are compared by ==

old cloud
#

shouldnt matter tho

hybrid spoke
fiery prairie
#

or maybe it doesnt

#

yea it doesnt

shadow zinc
fiery prairie
#

wdym

shadow zinc
#

the line where its null or whatever

#

it says in console

fiery prairie
#

63

shadow zinc
#

whats line 63?

fiery prairie
shadow zinc
#

paste it in chat

#

or that

hybrid spoke
#

its probably because you are checking for the itemInHand, but you never specified which one. therfor i asked on what version you are

fiery prairie
#

1.8

hybrid spoke
#

oh ew

fiery prairie
#

and as i said like 500 times, it works with a different command

#

which is weird

old cloud
#

Anybody knows why inventory close event is called after disconnect? There isn't even an inventory open...

hazy parrot
fiery prairie
#

yes

shadow zinc
#

facts

hazy parrot
#

Because in this case, only inventory can be null for it to throw npe

#

Which I doubt is the case

fiery prairie
#

it doesnt throw npe if i am right

hazy parrot
#

You said it does?

fiery prairie
#

i mean it just says null but i cant see anything about nullpointerexception

hazy parrot
#

Can you show error

fiery prairie
hazy parrot
#

Error is pretty clear

old cloud
#

it has no item meta

hazy parrot
#

Look at Caused by

hybrid spoke
hazy parrot
hybrid spoke
fiery prairie
#

yea cause i added some other things already

#

so what should i do

hazy parrot
shadow zinc
#

anyone know how to do this and avoid circular dependencies? The red are classes in my main/api module

fiery prairie
#

and the error happens if im not holding anything

hazy parrot
#

As I said check what getItemInHand is equal if you are not holding anything

old cloud
hazy parrot
#

And make condition based on that

fiery prairie
old cloud
#

you said you removed that

fiery prairie
#

i removed one condition because i had 2

hazy parrot
#

Just check what is it or use debugger...

fiery prairie
#

what is checking "what it is equal to" supposed to mean

#

i already made an if to check if its air

old cloud
hazy parrot
young knoll
#

Iirc the players inventory is always technically open

hazy parrot
#

Because its obv isn't null

young knoll
#

If nothing else is

hazy parrot
#

If code gets executed

grim ice
#

how are we supposed to help u with that pic

#

send github

shadow zinc
#

its private...

grim ice
#

then send enough pictures

fiery prairie
shadow zinc
#

I'll send you an invite

#

nvm

grim ice
#

my github's Dqmino

#

oh well okay

shadow zinc
#

im assuming you know how to fix it

#

ffs idk what to do

grim ice
#

mhm, well you can just send me pictures of the constructors

fiery prairie
shadow zinc
#

okay

#

me implementing it

hazy parrot
fiery prairie
#

yea the plugin is 1.8 and im on 1.19

hazy parrot
#

That may be the cause

fiery prairie
#

wait what about this?

grim ice
#

there isnt even a constructor here, this aint circular dependencies

hazy parrot
#

Nah, don't think it would work

onyx fjord
#

LEGACY materials are deprecated afaik

grim ice
#

this is how circular dependencies look like:

public A(B b)

public B(A a)

shadow zinc
#

version manager implementation

fiery prairie
#

so what should i do

onyx fjord
fiery prairie
#

if i still want the plugin to work 1.8-1.19

shadow zinc
#

do what I'm doing lol

grim ice
#

god

#

okay

#

whats the problem here anyways

fiery prairie
#

i have no idea what youre doing

shadow zinc
#

version support

grim ice
#

i think youre getting your terms wrong, since from these pictures i dont see any circular dependencies

shadow zinc
#

wait

#

and its correct

#

if I try to add the dependency for this interface I get this

#

because that means they rely on each other

fiery prairie
#

okay lets just say rip legacy version players ill do 1.16.5, i give up lmao

shadow zinc
#

the only dependency in that interface is <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>

floral drum
#

uwu

grim ice
#

thats circular dependencies between modules

eternal night
#

at which point, make them a single module

#

or do a proper adapter layout if you wanna stick to modules

shadow zinc
eternal night
#

no ?

shadow zinc
#

then wdym?

eternal night
#

why would your api ever depend on anything

shadow zinc
#

what?

#

it depends on many things

eternal night
#

yea but it should not depend on your implmenetation

shadow zinc
#

it does tho

eternal night
#

but it shouldn't

chrome beacon
#

^

eternal night
#

that makes no sense

floral drum
#

Well, that's not how API's should work

grim ice
#

dependency inversion principle

shadow zinc
#

remove it and I get this

eternal night
#

why the fuck is your API registering legacy wrappers

grim ice
#

you should probably check out SOLID before making APIs

shadow zinc
grim ice
#

DIP says that high level modules should not depend on low level modules, but on abstractions

eternal night
#

they abstract the concrete logic of an impl away

#

that is the point of an API

floral drum
#

API's should only really be full of abstract classes or interfaces honestly

eternal night
#

^

chrome beacon
#

Hm I have a few final event classes (in my api) that's fine right?

shadow zinc
#

not sure how that serves me any justice to anything

eternal night
#

wat

floral drum
#

Then them abstract classes should be implemented inside of the implementation module

#

if that makes sense

eternal night
#

idk how this servers me any justice, yes I have a circular because I don't know how to structure my project but I don't think properly moving logic into impl will help me

#

the API does not depend on the impl period

#

because the impl has to depend on the API

#

as it provides concrete implementations to the APIs interfaces

shadow zinc
eternal night
#

which, that would be a circular

shadow zinc
#

they seem to depend on the abstraction module

#

however its more NMS so they don't need to depend on the api module

#

its different for me

eternal night
#

they just have names mixed up

hazy parrot
#

Just curious

eternal night
#

they don't have a concrete API and implementation

flint coyote
eternal night
#

they have the "abstraction" which serves them as an intermodule API

#

and then API is more like their base plugin implementation/library implementation

floral drum
#

basically

#

And people can also implement their own versions of stuff

hazy parrot
#

Yap, that makes sense, thanks 👍

#

Both of you

floral drum
#

example:
abstract class Game {
// Logic
}

public class TestGame extends Game {

}

#

bet

shadow zinc
#

So what should I do to fix it?

floral drum
#

Make your API not have any logic inside of it

eternal night
#

do you actually want a pure API ?

#

or do you just want an implementation that loads a bunch of NMS legacy wrappers

shadow night
#

how do I check the new player location in VehicleExit event

shadow zinc
eternal night
#

I just want it to work
doesn't help

#

do you want other plugins to interface with your plugin

#

do you need a proper plugin api

shadow zinc
#

I use this API for my plugins, to run code, loggers, gui builders, nothing fancy

floral drum
# shadow zinc I use this API for my plugins, to run code, loggers, gui builders, nothing fancy

This is an example of how it should be laid out. So, for example you are depending on the class "HeartBeatWrapper". Why don't you make that a class inside of the api and for example make it an abstract class or an interface. By doing this, you shouldn't need to depend on any implementation of your api inside of the api module. You would only need to import the abstracted class in your api, and then to use that just take the HeartBeatWrapper inside of the implementation and do this:

public class HeartBeatWrapper extends/implements IHeartBeat {
    // Logic
}```
@shadow zinc
#

You understand?

topaz cape
#

how many threads do async bukkit tasks use

#

like if i run 2 tasks async would both be on the same thread

young knoll
#

It uses a pool

#

Not sure how big said pool is

shadow night
#

hey guys anybody know why this isn't working and when leaving the minecart it doesn't tp me?

@EventHandler
    public void onVehicleExit(VehicleExitEvent event) {
        if(event.getExited().getType() == EntityType.PLAYER) {
            // if((int)event.getVehicle().getLocation().getZ() != plugin.config.getInt("mainZ")) {
            Location loc = new Location(event.getExited().getWorld(), event.getExited().getLocation().getX(), event.getExited().getLocation().getY(), plugin.config.getInt("mainZ"));

            event.getExited().teleport(loc);
            // }
        }
    }```
eternal night
topaz cape
#

🤨

shadow zinc
sturdy frigate
#

Hey guys if i have a code structure like this:

    private final Gui navigatorGui = Gui.gui()
            .title(Component.text("Game Menu"))
            .type(GuiType.DISPENSER)
            .create();```
Whenever i autoformat my class, it gets collapsed down to a single line, is there a way to stop that in intellij?
chrome beacon
#

Yeah

chrome beacon
floral drum
#

It's kind-of an example of how an API and multi-modular java project should be laid out

sturdy frigate
old cloud
#

?paste

undone axleBOT
hidden kestrel
#

Any idea why this

        VoidGenerator voidGen = new VoidGenerator();
        new WorldCreator("event").generator(voidGen).createWorld().setKeepSpawnInMemory(false);
        new WorldCreator("community_event").generator(voidGen).createWorld().setKeepSpawnInMemory(false);

stalls the server on generation??

This is the VoidGenerator class

public class VoidGenerator extends ChunkGenerator {
    
    @Override
    public void generateNoise(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, ChunkData chunkData) {
        
    }
    
    @Override
    public boolean shouldGenerateNoise() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateBedrock() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateSurface() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateDecorations() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateCaves() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateMobs() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateStructures() {
        return false;
    }
}

old cloud
gritty urchin
#

how do i create a yaml file (output in jar directory) from the resources folder?
using snakeyaml (maven)

shadow night
#

how do I call something after an event ran?

old cloud
shadow night
#

not when an event ran but after

hidden kestrel
#

scheduler

young knoll
#

Use a delayed task

shadow night
#

ah okay

#

gotta remember how to do that

quaint mantle
#

can you, in case of Mojang mappings, use that naming for reflection?

young knoll
#

No

quaint mantle
#

epic >-<

cobalt thorn
#

someone knows an Api or some sort that you can Convert OBJ to Schematics

floral drum
#

Or just an API?

#

that you can implement

cobalt thorn
shadow zinc
#

is SOLID the convention that all apis follow?

flint coyote
#

Schematics?

#

You mean a serializer?

cobalt thorn
#

directly for example an OBJ file to a schematic file that i can use inside my plugin code

grim ice
#

its pretty much just principles you should follow when coding in oop languages in general

flint coyote
shadow zinc
cobalt thorn
grim ice
#

yeah

floral drum
#

What he means by OBJ is a model @flint coyote

#

This for example

flint coyote
#

ohh

floral drum
#

haha

cobalt thorn
#

but nothing like maintained or something else

grim ice
#

ones that i know of are:

KISS (Keep it simple, stupid)
DIP (Dependency Inversion Principle)
Tell me what it does (Use READMEs and make wikis)
Dont tell me how it works (Abstract implementation details)
Tell me what this thing is (documentate your code, and comment it)

#

though most of them are common sense

#

but u should focus on that when making APIs

onyx fjord
#

how do i break a block and get the item entity that spawned after the fact?

cobalt thorn
#

to do that thanks btw for the help

smoky oak
#

does anyone know how to impose a biome onto a world?

#

to be more precise

hybrid spoke
#

and its not a convention

#

its a principle

smoky oak
#

a import net.minecraft.world.level.biome.Biome; onto the server level

hybrid spoke
#

or more like a bound of principles

shadow zinc
#

5 principles right?

hybrid spoke
#

yes

#

each letter for one

sturdy frigate
#

Why does it say it's unable to resolve the gamerule in my (if i ctrl click it, it works properly)?

chrome beacon
#

Invalidate caches and restart

sturdy frigate
#

alrighty

sturdy frigate
chrome beacon
#

Hm are you depending on multiple spigot versions?

sturdy frigate
chrome beacon
#

Hm does it build when you package the jar?

sturdy frigate
#

all good

#

looks like this in hover docs

chrome beacon
#

Hm did you invalidate caches or just restart?

sturdy frigate
#

I did both

chrome beacon
#

Odd

sturdy frigate
#

It does take me there when i ctrl click soo o.O

chrome beacon
#

The entire world or just a section of it?

smoky oak
#

section

#

i tried looking at both craftworld and serverlevel but couldnt find where to do it

#

im using remapped

chrome beacon
smoky oak
#

wtf

#

i have to do it per block

#

u serious?

chrome beacon
#

Well biomes are stored that way

smoky oak
#

wait a moment

#

im using the nms biome

#

not the bukkit biome

chrome beacon
#

Ah then take a look at then implementation in CraftBlock

#

See how they do it

ashen quest
#

how i make plugin like essential? java not know, how do wth skript

#

and i also want make geyser plugin but skript

chrome beacon
#

Oh no

ashen quest
#

why

#

i only knowing skript

chrome beacon
#

Skript is slow

ashen quest
#

me caring not

#

me want plugin

chrome beacon
#

And it cannot do what geyser does

young knoll
#

Okay skript essentials is one thing

agile anvil
#

If you know it, do it

young knoll
#

But geyser

#

Lul

smoky oak
#

.......how do i get a craftblock

#

craftworld.getblock returns bukkit.block for some reason

ashen quest
smoky oak
#

is there a general rule for casting between nms and bukkit?

flint coyote
#

Doesn't Block extend CraftBlock?

young knoll
#

You can just cast to craftblock

smoky oak
#

dont think so

#

ill try

agile anvil
young knoll
#

all org.bukkit.blocks are going to be CraftBlocks

agile anvil
#

So since the server is craftbukkit, just cast your block instance to craftblock

worldly ingot
#

Why do you need it

chrome beacon
worldly ingot
#

The #1 question that should always be asked when someone's using internals

young knoll
#

They want to change biomes

#

I’m guessing they are using custom biomes

ashen quest
smoky oak
#

or modified

young knoll
#

No?

#

You can setBiome with the api

#

Just not custom biomes

smoky oak
#

well yea im doing a custom one

#

the enum aint helpful here

young knoll
#

Spigot is still stuck in 1.16.0 when it comes to biome

#

:(

chrome beacon
#

PR time

young knoll
#

Making a PR for it isn’t hard

#

Preserving backwards compat is

smoky oak
#

this is annoying

#

the craftblock takes the enum biome not the biome class as argument for setbiome

chrome beacon
#

It still calls an nms method somewhere

young knoll
#

Im curious how that works

#

Since biomes aren’t per block

chrome beacon
#

They are stored in 3d somehow

young knoll
#

Yes

#

Biomes are saved per 4x4x4 area

chrome beacon
#

I'm guessing it just takes the coords of the block

#

and uses that to set the biome

smoky oak
#

explains the bit shift tho

#

whats a holder

young knoll
#

Gonna need a bit more context

smoky oak
#

Holder<net.minecraft.world.level.biome.Biome> bb

#

okay new question

#

how do i make/use one

#

it fills my ide with override methods

young knoll
#

Ah

#

Holder is a class that holds a registry object

smoky oak
#

its a method in the class that returns an object?

#

wildcards are weird

#

wait a second

#

DAMMIT

#

i needed it as a 1X1 biome

#

urgh i hate my life

agile anvil
#

what are you trying to achieve ? x)

young knoll
#

Yeah idk how biomes go from 4x4x4 to per block

#

Probably just some interpolation

smoky oak
#

im trying to change the color of water in a cauldron

#

without rpacks

young knoll
#

Ah

#

Does that even work on java

smoky oak
#

well the color of cauldron water changes with biome color

#

water can change color in java

#

easily

#

the issue is

#

i dont want to change color in the surrounding swamp if i change the cauldron contents of say a witch hut

#

but biomes are 4³ urgh

young knoll
#

Huh

#

Didn’t know cauldron water changed on java

ancient plank
#

You can change biomes in a specific block, no?

smoky oak
#

how would i

young knoll
#

Nope

ancient plank
#

That's how I do it in my corruption plugin

young knoll
#

Well maybe

ancient plank
#

?jd-s

undone axleBOT
burnt sand
#

Hello i have a question how can i put items in a chest by code

young knoll
#

I know they are saved to the world files in a 4x4x4 area

ancient plank
young knoll
#

Guess the only thing to do is test it

#

See if it affects the blocks around it

ancient plank
#

This is how my corruption plugin changes single blocks

smoky oak
#

uh well

#

i found that too

#

but it takes the biome enum

young knoll
#

Imagine not using packets

ancient plank
#

To get the misty effect and ambience from the nether

smoky oak
#

isnt that immutable

young knoll
#

Yes

#

But you can also change a single block with NMS

chrome beacon
#

See how CraftBlock does it

smoky oak
# chrome beacon See how CraftBlock does it
public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> bb) {
        BlockPos pos = new BlockPos(x, 0, z);
        if (this.world.hasChunkAt(pos)) {
            LevelChunk chunk = this.world.getChunkAt(pos);
            if (chunk != null) {
                chunk.setBiome(x >> 2, y >> 2, z >> 2, bb);
                chunk.setUnsaved(true);
            }
        }

    }
#

the issue still is that i cannot set a CUSTOM biome to a 1³ area

quaint mantle
#

I think world guard or world edit has that feature

burnt sand
#

How to put a item in a chest by java code?

quaint mantle
#

you can change the biome of a region

#

check how they do it

smoky oak
#

im about 99% sure thats the same issue as before that its only possible with Biome Enum elements

young knoll
#

It’s not

#

Hang on gonna do some testing

grim ice
agile anvil
smoky oak
#

WELL THEN
SCREW MOJANG
Preconditions.checkArgument(biome != Biome.CUSTOM, "Cannot set the biome to %s", biome);

young knoll
#

that 's not mojang lol

outer river
#

hello, what is the "?" parameters in player.playSound(player.getLocation(), Sound, ?, ?) pls ?

young knoll
#

volume and pitch

sly venture
#
When the food level is less than 6, the sprint turns off and slows down.
Can't i cancel this?

outer river
#

what did they do ?

young knoll
#

Control the volume and pitch of the sound?

torn shuttle
#

implementing a* pathfinding to a plugin, now this is what I call game dev

outer river
#

ok thx

#

but why i see example with 0.7F ??

#

what mean "f" ?

young knoll
#

float

smoky oak
#

numbers that have numbers after the comma

minor garnet
#

where i can found the spigot 1.12.2 src?

smoky oak
#

decompile it

minor garnet
outer river
#

okok

minor garnet
#

I thought there was already some repository

young knoll
#

?stash

undone axleBOT
young knoll
#

I think that only has latest tho

#

Yeah you can't change the biome of a single block, I just checked.

#

I would spawn an armorstand with a coloured helmet inside the cauldron instead, not perfect but it's the best you got

#

If you are using a resource pack you can make it even more convincing

smoky oak
#

@ancient plank hows that repo named on ur github

ancient plank
#

Wyn

young knoll
#

I changed a single block with worldedit and it's affected at least a few blocks around it

ancient plank
#

Wym

smoky oak
#

you said something about a corruption plugin

young knoll
#

I assume the fade is based on your blend distance

agile anvil
#

I guess so

ancient plank
#

Ye

#

But the code is really ass

#

Just a random thing I wanted to make work

young knoll
#

This is one block changed, with a blend distance of 5x5

#

This is a blend distance of 0

smoky oak
#

that aint a cube

young knoll
#

It is not

smoky oak
#

worldedit?

young knoll
#

There is clearly some interpolation going on

#

yes

ancient plank
#
 block.getLocation().getWorld().setBiome(block.getX(), block.getY(), block.getZ(), Biome.CRIMSON_FOREST);
young knoll
#

Wait until she realizes you can just do block.setBiome

smoky oak
#

oh ffs
no such method: W

young knoll
#

Block has a world

ancient plank
#

Wait until you realize I wrote most of the code in the project over a year ago

young knoll
#

Nope

#

Bad code -1/7

#

Check the javadocs

#

Or with your ide

eternal night
#

player extends inventory
wat

young knoll
smoky oak
#

wait

#

that also only takes the enum as a possible argument

hoary lance
#

how do I cancel anvil enchant event

young knoll
#

InventoryHolder != inventory

young knoll
hoary lance
# young knoll PrepareAnvilEvent

@EventHandler
public void CancelAnvilEvent(PrepareAnvilEvent event) {
if (event.getItem() = ItemManager.TNTSword) {
event.setCancelled(true);
}else if (event.getItem() = ItemManager.SpeedBoots) {
event.setCancelled(true);
this doesn't work

young knoll
#

What does getItem return in that event anyway

#

I know getResult is the output

#

Also use isSimilar

#

Yes

#

In fact

#

= is assignment

smoky oak
#

equals isnt always

young knoll
#

So that won't even compile

#

=: Assignment
==: compares memory location
.equals: same as == by default, can be overriden
.isSimilar: .equals but it ignores stack size

ancient plank
#

10 reasons to compare with pdc:

young knoll
#
  1. PDC is cool
  2. Works even if the item loses durability
  3. PDC is cool
#

That's 10 right?

young knoll
#

Sure