#help-development

1 messages · Page 784 of 1

river oracle
#

you must apply patches to rid yourself of nasty errors

eternal night
#

oh I bet its because I need to install bukkit first

river oracle
#

I'm learning MIPS assembly language! I can't wait to never use this and use C instead Party

river oracle
#

don't forget that

eternal night
#

Missing package-info.java file.

#

okay there

#

damn

river oracle
#

get fucked

young knoll
#

omg new package

river oracle
#

new package guys

eternal night
#

get ready for package org.bukkit.persistence.list;

young knoll
#

I agree but MD doesn't pay :p

river oracle
young knoll
dry hazel
#

you get paid in exposure :p

river oracle
river oracle
young knoll
#

Yeah idk if that stuff really belongs in spigot

#

Maybe some of it

eternal night
#

meh

blazing stream
#

im legit crying

#

i need a rest api for papi

dry hazel
#

sounds horrible

young knoll
#

I find I use my UUID and NamespacedKey adapter a lot

blazing stream
#

ill give u 2 exposures, me and my alt

young knoll
#

So maybe they would fit

eternal night
#

Well

#

NamespacedKey maybe

#

UUID, well

#

you can store that as an int[], a long[], a String

river oracle
#

I'm so confused hte past two weeks in my assembly class the lectures have had nothing to do with the assignments, for example this week he talked about Finite State machines, but the assignment is how to add in assembly?

young knoll
#

2 longs probably makes the most sense

#

Idk why mojang does 4 ints

eternal night
#

but less readable with e.g. /data commands than a string

young knoll
#

True

river oracle
#

huh

young knoll
#

Yeah

river oracle
#

weird, why not just 2 longs :3

#

mojank

eternal night
young knoll
#

Yeah idk

#

I'm sure they have a reason

#

maybe

river oracle
#

anyone wanna do this challenge activity for me

#

pls and thx

young knoll
#

I mean they changed it a few versions ago to 4 ints

#

Don't remember what it was before, but they must have changed it for a reason

#

Not just for funz

blazing stream
#

ig its about time i make my own REST api for PAPI and learn java while at it

river oracle
young knoll
#

Ah yes 8 shorts

#

Why not 16 bytes

wary harness
#

So I am inconterin small problem need to track if block was placed by players

#

and save it on server shutdown

young knoll
#

?blockpdc

undone axleBOT
wary harness
#

currently I had just one hashset

young knoll
#

Or a full on database

wary harness
young knoll
#

Never!

ancient plank
#

Type in one message then

wary harness
#

Like I was saying I use to store it just in HashSet and then on server shutdown data was lost
So now want to upgrade and store it per chunk
Would it be ok to have one file per chunk and save it on chung unload and load it back on chunk load

smoky oak
#

is there a internal java structure for tuples of things? in this case, NAME - MATERIAL - MATERIAL, no order, elements may not be duplicated? i dont think hashmap works here

smoky oak
#

F

wary harness
#

and should I do this id = chunk.getZ() ^ (chunk.getX() << 32) for chunk ID's

eternal night
#

A set of tuples ? kekwhyper

river oracle
#

boom

smoky oak
#

no

river oracle
#

tuple with 3 elements

eternal night
#

Like

record YourTuple(String name, Material first, Material second){}
#

there

river oracle
#

Record's ftw

young knoll
#

No generics?

river oracle
#

Generics too limiting fr

eternal night
#

I mean

river oracle
#

specially in this case

eternal night
#

I doubt they need a generic case here

#

yea

young knoll
#

Everything must be generic

eternal night
#

worrying statements

young knoll
#

Man gifs are too big

#

This is why nitro was made

young knoll
#

Maybe I can convince MD to add a kek emote here

river oracle
#

CH_KekLaugh no

young knoll
#

yes

chrome beacon
#

Could just make a smaller gif

young knoll
#

True

young knoll
#

But effort

smoky oak
#

not a chance

chrome beacon
young knoll
#

I could also just use a client mod

eternal night
#

thank you stash

smoky oak
#

its not like you cant just copy paste the emjoi 🙄

young knoll
#

Yeah you can paste the url

marsh hawk
#

Hello,
Im not sure if this is possible, I find mixed answers in the internet but with no actual solutions, so I wanted to ask here.
Is it possible to get how many entities are rendered for a player? Like, in f3 the E: value at the top left? Is there any packet for that?

young knoll
#

But that requires having it in my clipboard :c

river oracle
#

please

eternal night
#

prs created, time to finally get back to paper work NODDERS

river oracle
river oracle
#

you have more spigot work to do

#

haven't figured out what it is yet, but trust me

#

oh wait I know now. Lynx you're in charge of async chunk loading on spigot, have fun!

eternal night
#

Actually, I do need to chat up machine again for coll's pr

icy beacon
eternal night
#

smh

#

I just wanna downstream in peace

young knoll
#

Boo downstream

river oracle
river oracle
young knoll
#

Settle the generic debate with a fight to the death

#

MD vs Machine

eternal night
ancient plank
river oracle
river oracle
eternal night
#

I have this

river oracle
#

lynx IRL

eternal night
#

it was drawn for the paper discord christmas banner

#

(thank you lax pepe_hand_heart_2 )

river oracle
tender shard
#

this building looks like an evil person lives there

smoky oak
#

uh... can i obtain the item used to place a block in the blockPlaceEvent

icy beacon
smoky oak
#

or is the description here just dumb

river oracle
ancient plank
#

It has the 6 lines that are used to draw the funny S that we would draw when we were young

smoky oak
#

so description dumb gotcha

tender shard
icy beacon
icy beacon
#

The item in the player's hand when they placed the block must have been the block item

river oracle
#

tis correct since the event hasn't actually happened yet

icy beacon
#

Could you place a block with a sword

smoky oak
#

'whe the block is placed' might mean if you place with offhand that it returns the sword in your main hand

sleek ridge
#

dunno if this is the right channel, but how would I put my resource to private?

smoky oak
#

this should rather be described as 'gets the item in hand USED TO place this block'

smoky oak
tender shard
#

private resources? that doesn't exist on spigot

icy beacon
ancient plank
tender shard
#

it's either public or deleted

river oracle
icy beacon
#

Maybe the phrasing is not perfect but definitely understandable

eternal night
smoky oak
#

well it clearly didnt do what i expected it to so debug time

#

wait

#

i forgor to register teh event

sleek ridge
river oracle
#

no

#

just report it and say delete my resource

tender shard
#

report it and enter "please delete"

sleek ridge
#

alright then xD

chrome beacon
slender elbow
#

what was that building called again

#

ah the shard

tender shard
#

idk but it reminds me of the citadel in half life 2

#

now it looks like a mixture of gta 5 and far cry 1

#

and now it reminds me of the train levels in half life 1

#

WHEN DOES IT FINALLY GO TO THE PUZZLE SOLVING LEVELS D:

hushed spindle
#

is there some special way to tell if a given item is worn by the player or is just checking slot.equals(item) good

young knoll
#

Grab the item in the armor slot and use isSimilar

river oracle
#

isSimilar takes into account durrability

young knoll
#

True

#

PDC time

river oracle
#

we really need isSimilar without durrability

young knoll
#

isSimilarNoDurability

river oracle
#

since all items technically have durrability

river oracle
#

every item has durrability

young knoll
#

true

river oracle
#

for some reason bukkit separates it out

eternal night
#

itemstack.compare(other, b -> b.durability(false).pdc(false))

young knoll
#

What is b

eternal night
#

ItemStackComparisonSettingsBuilder

young knoll
#

Smells like paper

eternal night
#

hm ?

#

no

young knoll
#

Ah

eternal night
#

more like adventure

#

they have a replaceText method on components that does it similarly

young knoll
#

So you are making a pr then yes?

#

:p

eternal night
#

woah I just did the PDC one kekwhyper

#

cannot overwork myself

river oracle
#

get to work buddy, I'm already head first in Inventory PR so I can't have the time yk

eternal night
#

nor is like, item comparison really that useful imo

#

like

#

it should just always be a PDC identifier

young knoll
#

True

smoky oak
#

how can i make an item not burn while in lava? setFireTicks(0) doesnt remove the flames

exotic obsidian
#

hello

#

guys i have question

#

how can i hide particles with protcolLib?

#

anyone have idea?

river oracle
#

stop the particle packets from leaving the server, if youre talking about hte particles you see on the client like when walking etc I don't think you can pretty sure those are client side

smoky oak
#

is there a spigot equivalence to ItemRemovedFromWorld or do i have to track the damn things?

lost matrix
smoky oak
#

i want to teleport items to world height when they fall into the void

exotic obsidian
#

do u think i can do that with protcolLib?

lost matrix
#

Dont call player.spawnParticle

grim hound
#

Doesn't that just send a particle packet?

tender shard
lost matrix
#

Context:
If you dont want to send particles to a player, simply dont call player.spawnParticle

exotic obsidian
#

i am using 1.8 version 👀

#

i can't find this method 😂

woeful crescent
#

there’s a good ParticleEffect utility class if you’re on 1.8

woeful crescent
#

idk if there’s a better way

smoky oak
#

welllllllllllllll
theres this thing called overhead

#

i'd rather not lag a server cuz someone blows up a tnt

young knoll
#

Does a damage/death event not get called?

smoky oak
#

nope

lost matrix
#

Wasnt the EntityDamageEvent fired for when items get damaged?

smoky oak
#

nope

#

its just dead = true

young knoll
#

Hmm

smoky oak
#

once it falls below some height

lost matrix
#

Ill... test that out myself

young knoll
#

Probably should call a death event

lost matrix
#

Well death is for LivingEntity exclusively

#

But damage isnt

young knoll
#

Ah

smoky oak
#

well i tested that

young knoll
#

Could also call ItemDespawnEvent

smoky oak
#

damage aint called for void

#

despawn also isnt

#

im trying to work around it but im running into other road blocks

#

like

young knoll
#

Damage isn't called for void specifically with items?

smoky oak
#

no

#

im trying to track the item specifically right now but

#

BlockDispenseEvent doesnt give me the item entity, only the item stack, and idk how to obtain the entity afterwards

#

scanning around the block with a 1 tick delay sounds janky asf

river oracle
#

@eternal night your unit test covers the list types right?

young knoll
#

Listen for the EntitySpawnEvent and check if its next to the dispenser

#

ig

river oracle
#

I'm assuming it just runs through the registry

smoky oak
eternal night
#

wtf

#

where are my tests

river oracle
#

yeah I don't see them

eternal night
#

yikes still in paper

#

lemme ship them over

river oracle
#

lmk when you post them then I'll switch to approved

young knoll
#

Omg code is being contributed upstream

river oracle
#

lgtm besides that

young knoll
#

It's a miracle

river oracle
#

lynx loves us

#

he's just like that

young knoll
#

I think he may be the only one

quaint mantle
#

teeth

ivory sleet
young knoll
#

🦷

river oracle
young knoll
#

Okay so 2 people :p

eternal night
river oracle
#

yep

eternal night
#

I'll have you know, I have the 12th highest commit count since 2016

lost matrix
#

Hm ok the damage event was called for cacti and lava but not void

young knoll
#

What is the damage amount in that case

#

Since items don't have health

#

Is it just 1

lost matrix
#

Probably

river oracle
young knoll
#

I can easily PR it being called for void

#

Just want the amount to be consistent

river oracle
young knoll
#

maybe?

eternal night
river oracle
#

oh xD never used

smoky oak
#

soo trying the dispenser it works but showed me a new bug in my code

#

how do i check if a clicked bloc has a container?

#

yall have a mud tag but not a container one wtf

rotund ravine
#

Vanilla

young knoll
#

Those match vanilla tags

rotund ravine
#

@smoky oak Just check if it's a instance of container

young knoll
#

you can check if getState instanceof container

ancient plank
#

Tags are great but Mojang only adds to em when they need em

river oracle
#

Contianer's Contianer's someone said containers

young knoll
smoky oak
#

aaaalright, lemme rephrase that

#

how do i check if a block has interaction with the player

#

ie, conainer, redstone, etc

rotund ravine
#

What type of interaction

smoky oak
#

right click interaction with any item

lost matrix
#

PlayerInteractEvent?

smoky oak
#

well yes but no

#

im in that

#

i need to know if the clicked block has an interaction

#

you can right click anything

#

doesnt guarantee something will happen

#

maybe check if the block has variations?

young knoll
#

Best you have is Material#isInteractable

smoky oak
#

no?

#

is that something specific to the materials themselves?

ancient plank
#

Let's find out

young knoll
#

Not really

ancient plank
#

?jd-s

undone axleBOT
vast ledge
#

Oh god

young knoll
#

lol

smoky oak
#

wtf why dont i have that

vast ledge
#

You

#

you

#

cant

young knoll
#

The # is to specifically show its an instance method

vast ledge
#

..

#

hm

#

yea

smoky oak
#

ah

#

why doesnt it show on Material# then?

young knoll
#

because...

vast ledge
#

😢

young knoll
#

It's not a static method

#

And also # isn't valid

vast ledge
#

😭

ancient plank
#

Checks if this Material can be interacted with. Interactable materials include those with functionality when they are interacted with by a player such as chests, furnaces, etc. Some blocks such as piston heads and stairs are considered interactable though may not perform any additional functionality. Note that the interactability of some materials may be dependant on their state as well. This method will return true if there is at least one state in which additional interact handling is performed for the material.

smoky oak
#

ah wrong button

vast ledge
#

it needs to be a .

smoky oak
#

it'd be Material:: to see that

vast ledge
#

Heh

rotund ravine
#

Yep

lost matrix
#

I dont see a way of detecting removal of items in the void.
Thats a hole in the api imo.

young knoll
#

Already on it

vast ledge
#

It should fire an event

#

like item death

#

or smth

smoky oak
#

yea sure

young knoll
#

Yeah idk if the damage event is fitting

#

Since you can cancel it

#

Which would result in the item just falling forever I assume

vast ledge
#

Yea

lost matrix
#

Not sure. Maybe its time for an EntityRemovedFromWorldEvent and EntityAddedToWorldEvent 😄

vast ledge
#

you could mvoe the item upwards

ancient plank
#

Minecraft moment, can't wait until air

young knoll
#

Although I guess you can do the same for normal entities

young knoll
#

That is already an open PR :p

#

But it probably should fire for void if it fires for lava and cactus

smoky oak
#

does anyone know the current item fall speed and item death barrier?

inner mulch
#

is there a way for me to save a server to a sql database ( i want certain code to only react if its a specific server )?

young knoll
#

Give the server some form of id

#

Like a UUID in a file or something

inner mulch
vast ledge
#

on startup

#

save it somewhere

rotund ravine
#

Ahh, ur not trying to actually save the whole server to sql

valid burrow
inner mulch
#

i know that

#

but how should i articualte

valid burrow
#

Well dont say you want to save the server

#

cause that

#

is gonna be rather complicated

rotund ravine
#

How would i differentiate between the servers that the plugin is currently being run on?

smoky oak
eternal night
#

@river oracle done

vast ledge
eternal night
#

idk why the fuck spigot wants static imports at the TOP of the imports but sure

rotund ravine
#

I just remade his question

valid burrow
#

ohh

#

alrighr

river oracle
lost matrix
eternal night
ancient plank
#

Google is my friend

river oracle
#

ultimate PDC storage

vast ledge
eternal night
#

literally free real estate

lost matrix
#

Aj

rotund ravine
#

Or the chunk dupe glitch

young knoll
#

Tis why you must be careful with PDC

lost matrix
valid burrow
#

@inner mulch well to answer your question on startup create a config file (if not existing yet) and save a uuid in it then save that to the databse. Next time the sever starts and the file is already there you can get the uuid from the file and find the wanted data in the database

river oracle
rotund ravine
young knoll
#

wtf items actually do have health

#

wack

valid burrow
#

well yh because they can break

#

health is just durability isnt it

river oracle
rotund ravine
#

he means the entity

smoky oak
#

How can i merge this stream<? super List<Entity>> into one List / Stream Entity?
Bukkit.getWorlds().stream().map(World::getEntities)

rotund ravine
#

flatmap?

smoky oak
#

googling intensifies

valid burrow
lost matrix
smoky oak
#

got any better ideas?

#

runnables get eaten on server reset

#

i need to track items past server restart

lost matrix
#

Add a PDC tag to them and pick them back up when they load

smoky oak
#

is there a specific event for entity load or is it just chunkload?

young knoll
#

There is now

lost matrix
#

Just ChunkLoadEvent

#

Unless the PR comes through

eternal night
#

how to mark PR on stash as draft

river oracle
smoky oak
young knoll
#

ChunkLoadEvent does not have the entities anymore

eternal night
river oracle
#

yeah lol

eternal night
#

LUL

young knoll
#

Use EntitiesLoadEvent

river oracle
eternal night
#

yea

#

I don't want it merged until I got some feedback from the paper team too

young knoll
#

Man where the heck do we even call the damage event for items

eternal night
#

which means now I have to create a patch and ship it to them

#

because stash

storm crystal
#

is there a way to see interact entities?

lost matrix
river oracle
lost matrix
#

Ah thats what he means

river oracle
#

idk whatever hotkey shows hitboxes is useful

storm crystal
#

I mean those were invisible rectangular things right?

#

or did I remember them wrong

young knoll
#

f3 + b

river oracle
#

f3+b ^^^

storm crystal
#

okay

smoky oak
#

event.getEntities().stream().filter(e -> e instanceof Item).map(e -> (Item) e) there a way to merge the filter and map here?

young knoll
#

Why do we call damageByBlock event for void

#

Void isn't a block

eternal night
#

no

smoky oak
young knoll
#

No idea, this damage event code is a mess

#

Doc has a PR to redo damage stuff since damage types are now data driven

#

Hopefully that gets merged soon :p

river oracle
#

doubt

young knoll
#

;c

spare hazel
#

itemFortuneKey = new NamespacedKey(getServer().getPluginManager().getPlugin("HypixelCustomItems"), "fortune");

will this even work?

rotund ravine
#

Holy shit

#

wtf

#

why

spare hazel
rotund ravine
#

Does the plugin not offer the key somewhere in their api?

#

But yes, that would work.

spare hazel
spare hazel
#

like getting it from pluginManager

rotund ravine
#

There is probably a reason, i just feel like it looks bad, and the HypixelCustomItems should instead offer API that in some way allows you to utiliize their system

wet breach
#

aas long as it isn't being changed or removed it should be fine for reading purposes

#

might cause issues if you modify it or tamper with it since most plugins don't design for such things

spare hazel
wet breach
#

should utilize github XD

ancient plank
#

I agree

spare hazel
#

how to convert a double to int

young knoll
#

(int) myDouble

#

Is the direct way

hazy parrot
#

Round or convert

wet breach
#

yeah generally reading is fine 🙂

young knoll
#

Dangit

#

Why is the client mean

wet breach
young knoll
#

I'm about to

smoky oak
wraith apex
#

Anyone know how to register custom enchantments in such a way that you can view them and apply them via the enchantment table?

young knoll
#

You can't

#

Even if you did they won't have a name on the client

river oracle
wraith apex
rotund ravine
#

with events

#

and probably if they're smart pdcs

young knoll
#

The enchantment is sent by id

river oracle
young knoll
#

The client would need to have an enchantment with that id registered

river oracle
#

can you do that with datapacks yet?

icy beacon
young knoll
river oracle
young knoll
#

blah I have an event firing for entities going into the void

#

But teleporting them in the event causes them to vanish on the client

wraith apex
young knoll
#

no

#

All of their logic is server side

wraith apex
#

naw

#

if it was we can just send the client any enchants we want

#

like how we already send it the commands it can use

river oracle
#

translations != logic

wraith apex
#

the fact that I can't send it a custom enchant implies the client already as pre-defined some enchants

#

translations?

river oracle
#

thats the issue, even if you add your custom enchant to the enchantment table the name won't pop up seeing as it has no translations

river oracle
wraith apex
#

you mean converting the id to a name yes?

river oracle
#

Minecraft stores Enchantments as an ID and sends that to the client, if it doesn't match any enchantment on the client the client can't use the lang files to provide a proper translation

wraith apex
#

right

#

so we're in agreement

#

both server and client have a hardcoded set of enchantments. Server sends client an id and the client performs a lookup and shows it in the enchant table

#

I was interested in at the very least if I could manipulate the name

#

or cannibalise an existing enchantment to do that

#

but if it's sending an id, nothing will work :/

smoky oak
#

but they probably wont display on the client

river oracle
smoky oak
#

ah

smoky oak
#

isnt there a list of enchants somewhere?

river oracle
#

which is why the server can add to it, mojang has yet to allow the server to send enchantments to the client though

wraith apex
#

it's in the Enchantment.class

river oracle
#

which is why his plan won't work

wraith apex
#

Well at least I don't have to use the bizarre enchantment and wrapper infrastructure anymore,
Pointless registering a command on the server when it's not even recognised at the client end. Might as well just be a book with some lore on it

river oracle
#

do the latter with a UUID

wraith apex
#

latter

#

don't use Player as a key

river oracle
wraith apex
#

Player can have many attributes that will change over time

#

a UUID is constant and non-changing

river oracle
#

but latter is more optimal

wraith apex
wraith apex
#

There is though?

#

if the player does so much as move an item in their inventory the gc will remove 'Player' from the weak hash map

#

the hash of it has changed

slender elbow
#

wat

wraith apex
#

wat

slender elbow
#

that is neither how weak references nor CraftPlayer hashcode works

storm crystal
#

do I split my code into methods even if I am not really gonna reuse it anywhere else?

river oracle
slender elbow
#

it is

#

and any field changing inside the reference does not invalidate the weakref

#

the player ref is the same

#

it doesn't magically disappear

wraith apex
#

it's good to use as a cache

slender elbow
#

there are also no guarantees that'll ever happen

slender elbow
river oracle
pseudo hazel
#

depends

#

I think it really depends

river oracle
#

splitting up into multiple methods what could be done in 1 is just really not worth it for the sake of "clean code" It really depends on the situation and whats going on, but the pursuit "clean code" isn't worth if its not being re-used anywhere and has no other applicable uses

wraith apex
slender elbow
#

and the server cleans up the refs

wraith apex
#

the player instance stays in there

slender elbow
#

???

#

the server gets rid of the ServerPlayer instances it has lying around

dry hazel
#

xd

pseudo hazel
#

atleast it should

wraith apex
#

If it does that, why does it have isOnline()

slender elbow
#

because you would be keeping a reference

wraith apex
#

a pointless method if the player instance magically goes bye bye

river oracle
slender elbow
#

not the server

river oracle
wraith apex
river oracle
#

just like Player#getPlayer seems useless but its actually just inherited from OfflinePlayer#getPlayer

slender elbow
#

huh

river oracle
#

its completely different

wraith apex
#

the underlying implementation does not get gc'd

dry hazel
#

wat

river oracle
#

if you're interested in internals you can find them on stash

#

?stash

undone axleBOT
wraith apex
#

How is it getting Gc'd if the plugin dev holds a reference of it in a map

river oracle
#

That's the whole point of a WeakReference

wraith apex
#

oh its an interface

#

nvm

storm crystal
#

who was it that gave me code for removing and caching armorstands spawned by player's actions?

#

tried looking for it with keywords in search but didnt succeed

quaint mantle
#

Illusion

wraith apex
#

UUID still better than Player as a key for a map

storm crystal
#

😔

quaint mantle
#

Prob

storm crystal
#

ill check

wooden hearth
wraith apex
# river oracle WeakReference

So if I did Map<Player,Object>

and a player left the game. Their map entry goes bye bye? Or does it turn into a offlineplayer?

river oracle
lost matrix
wraith apex
#

....

slender elbow
#

the map implementation would need to use weak refs for keys

wraith apex
#

You just said it get gets gc'd

slender elbow
#

such as a WeakHashMap

#

a Map<Player, Value> doesn't tell anyone anything about how the key is handled

#

that is handled in the impl, if it's a regular HashMap then yeah, not cleaning it up manually would be bad

#

if it's a WeakHashMap then it's "fine"

wraith apex
#

I feel like the longer I spend in here, the more confused I'll get

wooden hearth
#

I would use Map<UUID, Value> because you can always get the player as from doing Bukkit.getPlayer(uuid);

river oracle
wraith apex
#

Maybe I am

#

¯_(ツ)_/¯

river oracle
#

I'll let smile explain he's smarter than me anyways :P

lost matrix
# wraith apex ¯\_(ツ)_/¯

The general rule for any game-linked object in spigot is:
Dont keep any hard references to them. Dont use them as fields and dont use them in collections or other data structures.
Always use an indirect reference like a UUID for Entities, Players, Worlds or xyz for Blocks and Chunks.

molten hearth
#

is uh BlockPhysicsEvent not the correct way to prevent a noteblock note change

wraith apex
storm crystal
wooden hearth
#

What's the best way to get the values from this 2d3h4m thank you

lost matrix
wraith apex
#

I can only assume a weak ref is a variable that has the same ref as the strong ref

#

like ItemStack weakStack = someItemStack

wraith apex
molten hearth
lost matrix
# storm crystal whats a weak reference for an item?

References of ItemStacks should only be used as templates.
If they are moved into an inventory then .clone() should be called beforehand.
Custom ItemStacks should always be referenced using a PDC tag in their data container.

wraith apex
#

PDC is also cursed

wraith apex
#

stack.clone()

quaint mantle
#

so if I were to getInv.addItem

#

something can still happen

wraith apex
#

otherwise you're editing the same reference of the item

quaint mantle
#

To that item?

lost matrix
river oracle
wraith apex
#

nah it's cursed

#

in a few ways

river oracle
#

Providing raw access to nbt would be dumb

lost matrix
#

Never had any real problems with PDCs

wraith apex
#

for example, I can't check if PDC has a key without also needing to give it a data type

#

which is dumb because the code underlying doesn't even need to check for type

quaint mantle
#

No it's not

#

that how json works

quaint mantle
#

Oh I mean u can check if it contains a key

#

I thought u meant getting the value

lost matrix
orchid gazelle
#

doesn't NamespacedKey need DataType?

river oracle
quaint mantle
#

ah but I'm saying that's how stuff like json worms

#

works

orchid gazelle
#

I remember sometimes needing a DataType for annoying reasons

slender elbow
wraith apex
#

I only have this

rotund ravine
#

Caught lacking

lost matrix
quaint mantle
#

wtf

wraith apex
#

PDC is def not json at all

quaint mantle
#

yeah why is it like that

wraith apex
#

but that would be nice

orchid gazelle
quaint mantle
#

what is PDC tho

wraith apex
quaint mantle
#

like underlying

wraith apex
#

hahaha can't do that

rotund ravine
lost matrix
#

You can actually create an AnyPersistentDataType which can just store any object in json 🙂

river oracle
orchid gazelle
#

but it just wraps NBTs I think

#

PDC is great tho

rotund ravine
#

It exposes a NBT tag BukkitValues

orchid gazelle
#

PDC is great but could be better

slender elbow
wraith apex
#

I rip into the code and use this for spigot plugins:

// Use faster method first
Map<String,NBTBase> tags = getCustomDataTags(data);
if(tags != null)
{
    if(tags.containsKey(NSKey.toString())) { return true; }
    return false;
}

private static Map<String,NBTBase> getCustomDataTags(PersistentDataContainer con)
{
    try
    {
        CraftPersistentDataContainer container = (CraftPersistentDataContainer) con;
        Field f = CraftPersistentDataContainer.class.getDeclaredField("customDataTags");
        f.setAccessible(true);
        
        @SuppressWarnings("unchecked")
        Map<String,NBTBase> customDataTags = (Map<String, NBTBase>) f.get(container);
        return customDataTags;
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
    
    return null;
}
river oracle
slender elbow
#

lynx 💀

wraith apex
#

Lynx?

#

💀

young knoll
#

A typeless has and get would be nice

#

👀

river oracle
orchid gazelle
#

I want easy boolean checks

wraith apex
orchid gazelle
#

please add PDC#isTrue(NamespacedKey)

#

or just boolean

rotund ravine
#

Dafiest

#

has

#

is basically a boolean

river oracle
#

Lol

orchid gazelle
#

well but that still requires you to set a boolean

#

you cannot just add no DataType

wraith apex
#

I wrote a DataUtils class that forced PDC to behave like json when you add, remove and check

hazy parrot
#

Why would u do that

wraith apex
orchid gazelle
#

PDC is like 10x easier than any other way of doing such thing lol

#

I remember back in the days where you had to use NMS to access your average plugin with NBT Tags

wraith apex
hazy parrot
#

Can I get example of your util lol

quaint mantle
#

yo the devs should update 1.8 api

rotund ravine
#

nty

#

1.8 should die

orchid gazelle
quaint mantle
#

Nah

orchid gazelle
#

yes.

wraith apex
river oracle
quaint mantle
#

🤓

wraith apex
#

I'm not writing PersistentDataType.INTEGER it's too long

river oracle
#

looks like you need to stop using java sir

orchid gazelle
dry hazel
#

it is already half dead

river oracle
orchid gazelle
wraith apex
#
// This
DataUtils.set("SomeKey",DType.INTEGER,2,itemStack);

// Over this
ItemMeta itemStack = stack.getItemMeta();
PersistentDataContainer pdc = stack.getItemMeta().getPersistentDataContainer();
pdc.set(new NamespacedKey(Pugin.instance,"SomeKey"),PersistentDataType.INTEGER,2);
itemStack.setItemMeta(meta);
quaint mantle
#

Is it true kotlin has no np

#

npe

hazy parrot
#

Yes

orchid gazelle
#

kotlin 🤮

quaint mantle
#

What if I throw one tho

hazy parrot
#

Only if you are using kotlin wrongly, u will get npe

wraith apex
hazy parrot
#

I mean exception exist of course lol

river oracle
hazy parrot
#

But you just cany get it if u use kotlin correctly

quaint mantle
#

void myVariable = void;

wraith apex
#
var idkWhatThisIslmao
quaint mantle
#

idk why void

#

like why void

#

what if they just did something like nothing

#

public nothing setText(String text);

#

That would be a wild update

#

And what if they renamed the String class to Text

wet breach
#

without the large communities mc wouldn't be as popular as it is

wraith apex
quaint mantle
#

if java dies ima have to learn prob like cpp

#

idk tho cpp looks so complicated

wraith apex
#

every language has it's problems and annoyances

#

C++ 💀

wet breach
quaint mantle
#

yeah ig

hazy parrot
orchid gazelle
#

bedrock is garbage

golden turret
#

how can I get a null value from a config? When the config is loaded, the key is not there

quaint mantle
#

oh yeah I heard rust is an amazing language

#

Is it easy to learn?

wraith apex
#

Honestly community edition would be based af. No more code obfuscation! NO MORE NMS!

wet breach
wraith apex
#

Who wants to code a minecraft plugin in fortran? 💀

quaint mantle
#

assembly

wet breach
desert loom
wraith apex
wet breach
wraith apex
#

we can start by adding all the mobs from previous mob votes

wet breach
#

so you either fix it or you just remove it and move along

wet breach
#

it would indeed be interesting nonetheless when Mojang stops supporting the Java edition

wraith apex
wet breach
#

well we already get mappings for quite a bit

wraith apex
#

true

wet breach
#

and then the rest of the stuff is either dependencies or mojang already provides it in their repo's

blazing stream
#

where do i get spigot-api jar? compiled binary if possible, otherwise ill compile myself

blazing stream
#

omg thanks

#

the buildtools was killing me

#

on my broke ass laptop

blazing stream
#

nvm im blind

rotund ravine
#

You can't have my eyes

blazing stream
#

why? 😭

#

you would help a man in need

rotund ravine
#

Cause you use web discord

#

disgusting

blazing stream
#

i dont want to run that proprietary piece of garbage on my machine raw

#

what if it gets pregnant with some malware?

rotund ravine
#

Maven ftw

blazing stream
#

which one do i use

#

i dont use maven

rotund ravine
#

Do u need libraries?

blazing stream
#

yes

blazing stream
#

why shaded tho?

rotund ravine
#

It's the libraries

blazing stream
#

whats that mean

#

oh

rotund ravine
#

No clue why u want the jar

#

instead of just using maven or gradle

blazing stream
#

my buildtools is done compiling

#

💀

blazing stream
#

idk if its possible

#

im new

hushed scaffold
#

use an ide

blazing stream
#

when you're on a 2GB RAM laptop

#

that isnt an option

hushed scaffold
#

is there no lightweight option

#

that would support maven

blazing stream
#

idk

#

too lazy to be bothered tbh

eternal oxide
#

2GB? Can that even be called a laptop?

rotund ravine
#

Vscode

slender elbow
#

ah yes, the web browser code editor

blazing stream
hushed scaffold
#

does vscode support maven

blazing stream
#

i think it was a beast back then

#

dont remem tbh

#

maybe not

blazing stream
hushed scaffold
#

but srsly instead of trying to do it with no ide js find a lightweight one

blazing stream
#

i dont want to start an unnecessary debate

#

BUT

hushed scaffold
#

itll save a ton of time

blazing stream
#

which is better, maven or gradle

hushed scaffold
#

probably maven idk doe

rotund ravine
#

GRADLE!

#

jkjk

#

Maven for newbies

blazing stream
#

now fight

hushed scaffold
#

whats the difference

eternal oxide
#

Maven for Spigot

blazing stream
#

gradle for?

hushed scaffold
#

maven for me is the thing that adds the compile button and nothing else

blazing stream
#

haha

inner mulch
#

is there an event for when a player presses cntrl + middle click? (used in vanilla to get a chest with the nbt data for example)

eternal oxide
#

gradle for multi-dev projects (possibly)

blazing stream
#

pls dont kill me im new

rotund ravine
rotund ravine
upper hazel
#

how can I get the highest y point and the lowest y point of a chunk (16x16x16) from the resulting objects the chunk itself is available

inner mulch
#

why is it being sorted like that?

upper hazel
inner mulch
#

?

eternal oxide
#

because you are sorting by each character

#

string sort

upper hazel
eternal oxide
#

no I just type like shit

upper hazel
#

oh

finite radish
#

Hello, does anyone know why I can't use the player's connection in 1.20.1 ? I keep getting an error "java.lang.NoSuchFieldError: c"

EntityPlayer serverPlayer = ((CraftPlayer)player).getHandle();
        System.out.println(serverPlayer.c);
upper hazel
#

I have a keyboard for a VERY small amount but it somehow continues to live

eternal oxide
#

?mappings

undone axleBOT
upper hazel
#

what the "c"

#

were you found this

finite radish
#

I've already checked the mappings and it says that c is the player connection

eternal oxide
#

first off you should be using ServerPlayer on 1.20.1 for mojang mappings

#

not EntityPlayer

#

?nms

eternal oxide
#

use Mojang mappings, its much easier

finite radish
#

The thing is that I am on gradle and I am already kind of too far to go back to maven, I am trying to send packets to players through entityplayer

molten hearth
#

so does anyone know how to cancel a noteblock note change

#

because cancelling its BlockPhysicsEvent does not prevent it changing

river oracle
molten hearth
#

isnt there other ways noteblocks change apart from player interact

#

i mean

#

sure ill try

wet breach
river oracle
molten hearth
#

yeah i want the note change not when its played, if its played and the client sees it its too late

wet breach
#

ideally, but its the better event because you have to record what the note was before. I believe notes can change via some redstone mechanisms

#

not just player interactions of the block itself

wet breach
#

not sure if its doable though

river oracle
wet breach
#

I would, but I don't like messing with patches

#

I always screw them up lmao

river oracle
#

do you even have a stash account

shadow night
#

I don't like messing with patches because it's weird

#

Can you patch a patch

wet breach
wet breach
young knoll
#

This is why you don't manually edit patches

shadow night
#

Editing patches is ass

river oracle
#

they're so easy to work with I never got how its hard

#

sure dealing with merge conflicts is a pain, but besides that idk

shadow night
#

I once tried editing patches, nothing worked and I hated it

river oracle
#

then do makePatches?

#

they're just sh files

shadow night
#

Idk what I did, it was from some app I downloaded

river oracle
#

💀 what

#

you don't need an app

shadow night
#

I mean, it's patch files for a certain thing which I defined as an app

river oracle
#

ahh

#

spigot automates it

#

you really don't even need to touch the patch files

rotund ravine
#

Thank god

shadow night
#

The patch files were in some weird format, but they definitely were patch files

river oracle
upper hazel
#

i gess no

sullen wharf
#

Any heads up on why this could be happening?

#

Getting this error when opening a GUI with a skull in it

young knoll
#

send output of /version

sullen wharf
#

sec

river oracle
sullen wharf
#

uh, client is using paper so I wont bother posting the /version output here lol

lament slate
#

Anyone know how to make a simple 10 minute timer? I am confused on it currently

sullen wharf
#

Use bukkit scheduler

lament slate
#

Thank yous!

#

Im still new do i need to import that or no?

#

import org.bukkit.scheduler.BukkitScheduler;?

river oracle
sullen wharf
#

I just told him to update his paper

#

guy was 31 versions behind lol

lament slate
#

I am confused on the timer do I need a class for it or some input since all I have right now is BukkitTask.runTaskTimer(this, new Runnable() {});

hazy parrot
#

Just () -> {}

#

It's called lambda expression

#

Or make anonymous class which implements runnable (sorta what u did there)

#

Or normall class which implements runnable

#

Choice is yours

molten hearth
#

do you fellas™️ have any examples on how to shade a submodule with gradle

#

or is it just

#
shadowJar {
    relocate("submodule","submodule")
}```
#

although i doubt it

rough drift
#

Does the PlayerSpawnLocationEvent trigger even on a player's first join?

grim hound
#

It just tells you where the player will spawn

dry hazel
dry hazel
grim hound
#

And allows for a more efficient location set, instead of, for example, a much slower Player#teleport in join event

#

Does a netty channel handler stay on the same netty thread?

molten hearth
#

okay well now it broke lol

grim hound
molten hearth
#

i added gradle dependencies { compileOnly "api" }

grim hound
#

Because even if there are more netty threads, not all of them are necessarily used

dry hazel
molten hearth
#

> Could not find method implementation() for arguments [project ':api'] on root project 'CustomBlockAPI' of type org.gradle.api.Project.

#

ah wait

#

i probablky placed it in the wrong place

dry hazel
#

in the dependencies block

molten hearth
#

yea i did

#

now i get CustomBlockAPI:main: Could not resolve project :api.

#

lol

#

i mean

#

i have an api submodule

dry hazel
#

does it work if you remove the colon?

molten hearth
#

it actually still appends a colon

#

does my submodule gradle build need something more than ```gradle
plugins {
id 'java'
}

group = 'test.test2'
version = '2023.1.0'

repositories {
mavenCentral()
}

dependencies {
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}

test {
useJUnitPlatform()
}```

dry hazel
#

yeah that just sounds like the subproject is not actually named api

#

what's in your settings file

molten hearth
#

uh which settings file

dry hazel
#

settings.gradle

molten hearth
#
rootProject.name = 'CustomBlockAPI'
include 'api'

#

this is for the main project

dry hazel
#

what's the entire error

#

it usually appends more info

molten hearth
#
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
Could not resolve: project :api
Could not resolve: project :api

BUILD SUCCESSFUL in 740ms
molten hearth
dry hazel
#

and what's in the api folder

molten hearth
#

okay wait

#

now im getting

#

is it to do with my gradle build file for api

dry hazel
#

I think you might need to set the source and target java compatibility for the subproject

#
java {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}
molten hearth
#

uh

#

is there any way to like

#

namespace it

#

bc

#

now its not shaded under api

#

its just

#

in the main folder

#

or is it what i sent earlier

dry hazel
#

huh