#help-development

1 messages · Page 407 of 1

twin venture
#

it mean location right?

#

l = location?

brave sparrow
#

Not necessarily

#

The server is obfuscated

remote swallow
twin venture
#

using paper xd?

remote swallow
#

paperweight?

tender shard
#

"l" could be anything

twin venture
tender shard
#

decompile the class, then check which type "l" has

twin venture
#

ok

brave sparrow
#

Yes, it’s still obfuscated

left plover
#

What are the terms of use for including the remapped JARs from BuildTools inside a GitHub repo?

tender shard
#

the terms are "not allowed"

brave sparrow
#

^

left plover
#

Figured

tender shard
#

no matter whether it's remapped or not

#

it contains mojang's code and hence you must not publish it

remote swallow
#

idk why you would even add that to a repo

tender shard
#

that's the whole point of why buildtools exists

tender shard
remote swallow
#

its probably like the one plugin i found that used maven full of system scopes

#

and they were just distributing paid forks

brave sparrow
#

Presumably to avoid having to run buildtools on the machine of any contributor

#

Exactly, local maven repos

tender shard
#

I usually include a run-buildtools.sh file that builds all the needed versions, or for some people, I give them access to my nexus repo which has all the versions

remote swallow
#

distributing mojang code :!!??!?! uh oh

tender shard
tender shard
remote swallow
#

would that still get classed as distributing

tardy delta
#

who cares lol

#

a bunch of people probably

tender shard
brave sparrow
#

Technically yes but the actual damages are minimal

tender shard
#

well the damages are zero

brave sparrow
#

Lol

tender shard
#

even uploading spigot.jar, there wouldn't be any damage mojang could claim

brave sparrow
#

Fair

tender shard
#

they upload the server .jar themselves to the public, I doubt they could claim ANY damage if I'd now upload a spigot.jar that everyone could produce themselves

#

they could still tell me not to do it, ofc

#

I mean, running over a red light also doesn't cause damages if there's no accident 😄

brave sparrow
#

Gonna cause damage to your wallet when I write you that ticket though 😂

tender shard
#

yeah D: red light violations are very expensive here

brave sparrow
#

Technically that’s an arrestable offense here

tender shard
#

here it's just an infraction, 228,50 € plus 1 month prohibited to drive + 2 penalty points (8 points = license gone)

brave sparrow
#

In my state all traffic violations are classed as criminal offenses

tender shard
#

damn that's harsh

brave sparrow
#

So anything not explicitly stated to be non-arrestable is arrestable

tender shard
#

I ALWAYS drive 20kmh too fast lol

#

or 30kmh outta town

#

because 21/31kmh is the limit where you get penalty points

#

and it's where the fine jumps from like 30€ to over 100

brave sparrow
#

Most times I see people get the actual ticket dismissed as long as they pay the court and do a driving class or whatever

#

That way it gets off their record and their insurance doesn’t go up

tender shard
#

insurance can see which tickets you get? o0

brave sparrow
#

Yeah

tender shard
#

yikes

brave sparrow
#

It’s a conviction, it’s public record

#

If you get a final conviction on a ticket your insurance looks for and sees it

tender shard
#

that's quite funny

#

to me

#

insurance here can't see anything, all they can see is the damages you report to them

left plover
#

Morefor github actions to compile a plugin

remote swallow
#

use sprax dev spigot thing

echo basalt
#

@dry yacht weren't you the one constantly asking about how to optimize maps & itemframes?

#

I remember there was a guy constantly making threads about this

left plover
tender shard
echo basalt
#

asking if there was a way to precache frames to render gifs at 60fps

tender shard
#

Eg 17 for 1.19 and 8 for 1.12

#

Also doesnt it rebuild it everytime even when it was already built?

#

Thats gonna take a long time if you need 12 spigot versions

brave sparrow
hazy parrot
tender shard
#

No idea how but its possible

hazy parrot
tender shard
#

Ah ok

hazy parrot
#

But it's persistent for like an week

twin venture
#

hi , where i can find the wiki for protocollib 1.8.8?

solar mauve
#

hey
string: Dave jumps.over the detroit
i want to check if string matches (contains) "jumps." (the jumps word with the dot):
i used the following regex but however, if i type jump and then type anything after that, it would match the string when shouldn't (false math), what should i do?:

^.*(play.)*$

i want this to be matched along with the dot only, not any other characters

wet breach
echo basalt
#

lmao ik im idiot

#

or maybe not

#

interpolation ??

#

image blur

dry yacht
dry yacht
echo basalt
#

maybe it was someone else

#

but I remember going back n forth for like an hour

#

and I saw you do stuff with maps n itemframes

dry yacht
#

Yeah, I was working on bringing browsers into minecraft, but that project has been put on the back burner for now, as my attention gravitated towards something else again, xD

#

There were multiple people interested in this topic, btw

wet breach
# echo basalt interpolation ??

but the main problem with gifs though, is the fact they don't typically contain 60 frames in a second, let alone double the amount for backup

dry yacht
#

30fps is kind of the threshold of where this makes sense anyways, pushing 60fps is pretty adventurous

wet breach
#

well, while you might not notice a difference and there are some people who can, it lets your display devices select the best images if you can stuff more in there

#

not only that, if a single image is rendered weird for whatever reason the odds of you noticing it is far less likely

dry yacht
#

You just cannot compress the image data at all, especially not across multiple frames. You're gonna kill people's internet connection with that

solar mauve
wet breach
shadow gazelle
#

Okay, I'm just going to explain this and get opinions on whether or not loading the extensions as plugins would be a better idea. I'm basically trying to do what Bedwsrs1058 does, but make it so that one core has an API to make multiple minigames easily but also make extensions for minigames that exist. Right now I'm loading jars from the plugin's folder, would it be better to make it to Bedwars1058 does and have them be plugins? Part of the loading them from the plugin's folder was to combine everything into one or two master command(s), but I think I could do that either way now that I think about it.

ivory sleet
#

u can just use compile("play\.")

solar mauve
solar mauve
#

exact same thing happens

wet breach
#

but I wasn't talking about compression anyways

dry yacht
solar mauve
wet breach
#

no, I was talking about gifs

#

and fps

dry yacht
#

Illusion talked about displaying gifs on item frames, I thought

#

Of course you can compress images, that's nothing new, xD

ivory sleet
#

ali use Matcher::find

wet breach
#

he stated someone wanted to render gifs at 60fps which you can, but to display a gif at such speeds fluidly you need minimum double the images

wet breach
#

and then not only that gifs typically don't have 60 frames a second anyways

#

let alone they only last for a few seconds as well

dry yacht
#

So, to be more specific: 30fps seems to be the absolute limit on item frames. I don't think the internet connection of people would take more either.

Displaying gifs somewhere else is a whole different story, of course.

echo basalt
#

each 128x128 area is 16kb

#

what I did at work was a weird hashing system that re-uses duplicate frames across a player's session

#

you'd only need to send the frames once and then just send packets re-setting the ID to the following frame

solar mauve
echo basalt
#

So being honest you can actually achieve high frame rates, as long as the client isn't the one queuing up packets

wet breach
#

^

echo basalt
#

minecraft also uses a very limited palette which makes things easier

#

as there's less data

dry yacht
tardy delta
#

when the interesting conversation come up i have to sleep 💀

echo basalt
#

This is not limited to gifs

#

I use such a system to minimize outgoing bandwidth

dry yacht
#

You'd need a shit ton of IDs if there are many concurrent users

echo basalt
#

not really

#

well

#

true

dry yacht
#

So only after short map id, xD

echo basalt
#

The hashes are global

#

and generating an ID should be fast enough

#

in my case I just serialize the color array into a base64 and add it to a palette / list

#

the id is based on the position of the hash in the list

wet breach
#

can reuse id's if they are not long lasting as well

echo basalt
#

I do recycle ids

dry yacht
dry yacht
echo basalt
#

but it's not that complex

#

Only reason why I made such system is because my target audience is much more likely to be on a shitty internet connection

dry yacht
#

Yeah, it should be pretty manageable, now that I think about it. Great idea tho, I'm just really inexperienced with hashing algorithms.

echo basalt
#

I was thinking of some extra fancy way

#

to make the hash based on the player id + board position or something

#

and then I was just like "why don't we just have a global hash list"

#

and it took about 10 minutes of playing with code to get it working

#

a 1000x1000 (mostly single-colored) image went from 1.08mb to about 70kb

dry yacht
#

Do you know - round about - how many map IDs you use for a gif of a certain length? I kinda have a hard time imagining anything, because 128*128*256 are a lot of combinations.

kindred valley
#

gotcha

echo basalt
#

each id for a unique 128x128 section / frame

#

honestly Map IDs are not that limited and the amount of ids used is not really a concern

#

It works just like entities

wet breach
#

especially given you are not using negatives 😛

#

at least I hope not lmao

echo basalt
#

it's the same with entities

#

sure you're creating a ton of entity Ids for stuff like projectiles, arrows n all

dry yacht
echo basalt
#

hm

#

I guess a per-person palette would be more applicable in such cases

#

I expect you're not an idiot and run a minimally recent version

dry yacht
#

I think >= 1.13 was the version where they finally migrated to integer map IDs.

wet breach
#

well there is others ways to do it

#

just gets more complex

echo basalt
#

more recycling

wet breach
#

you could still use a short but have it backed by an integer

echo basalt
#

or just use the old system in the old versions

#

well

#

65k frames / player is more than enough imo

#

with the global system maybe not

#

but even then you'd need like 100 players with 650 unique frames each

#

and pray that none of them relogs so that half the ids get recycled

wet breach
#

lol

dry yacht
echo basalt
#

pretty sure it does

#

but certain plugins trip

#

like InventiveTalent's MapManager or whatever

#

trips balls when you toss negative ids

wet breach
#

yeah because everyone assumes no negatives 😛

dry yacht
#

Never heard of that, xD. I guess you're also rolling your own libs for maps.

#

Imagine people still using MapPalette#matchColor, xDD. I saw that a lot when I first researched the topic.

echo basalt
#

WAIT THAT'S A THING?

dry yacht
#

The slowest on earth, actually

#

I much prefer O(1) lookup

echo basalt
dry yacht
#

Oh, you use that?

#

I auto-generate all these values, xD

echo basalt
#

yeah I had one of the new devs make it manually

#

and then I just copypasted code from the wiki and made the caching thing

dry yacht
echo basalt
#

:)

#

can't bother coding much nowadays

kindred valley
#

gotcha

dry yacht
#

Well, I'm happy to know that at least my map color lookup is optimal, now that I found out that I completely missed hashing and reusing map-ids, xDD. I really, really gotta get into hashing algorithms more to develop a feel for this kinda stuff.

echo basalt
#

I mean

#

it was something that was always in my mind honestly

#

but it's not a necessity

#

I can see the likes of hypixel using it

#

because they send so much data

#

and network traffic actually costs money

dry yacht
echo basalt
#

it helps the client

#

and actually hinders the server ever so slightly

wet breach
#

a lot of this comes up when you are just hitting limits

echo basalt
#

I've only had to implement such culling systems when I Was actually facing problems

#

server I worked for was sending so many particles that people started dropping connections

#

and by so many I mean like 50k/tick

wet breach
#

lmao

echo basalt
#

was doing about 20mbps constant for every player

wet breach
#

death by particles

echo basalt
#

implemented a culler and it went real quiet

#

and looked just as good :)

#

packet-based culler, made a hash by splitting a block into 16x16x16 sections (particle pos values are decimal), and assigning each session a hash

wet breach
#

not even sure why you need 50k particles

#

not like someone is going to really see that many

echo basalt
#

the guy responsible for particles set the numbers way too high

#

he was rendering the whole thing every frame instead of just the changes

#

I wouldn't blame him, he does VFX for his day job

wet breach
#

well to be fair that is an easy mistake

#

a lot of people don't think about you could just only render changes

#

and not the the whole thing and including changes every single time

echo basalt
#

yeah

#

tbh those 50 lines for the culler system won't hurt anyone

#

and it's much easier to manage than rewriting the whole particle engine

#

to only display diffs

wet breach
#

reminds me I have particles to mess with too >>

echo basalt
#

only particles you got are snow particles in truck tires

#

and I guess water too

wet breach
#

o.O

echo basalt
#

o.O I gotta get myself one of these

#

you can read so much nms

dry yacht
# wet breach don't need to get into hashing algos specifically for this

Well, I was just noticing for a while now that I have difficulties with hashing and that I should really up my knowledge on that topic. I'm having a hard time thinking about how I would hash a ~65k sized byte array into something that corresponds to a map ID quickly. Like, there can be hash collisions, and if you then find a bucket, you'd still need to check on equality, so you're kinda iterating the whole thing twice, once for computing the hash and once for comparison. I don't know if that's ideal, I'm sure Illusion is doing something better.

echo basalt
#

and storing it in a list

#

literally

#

you don't need to make perfect mathemathical hashes

#

you just need to convert a 65k array into a numerical ID, and if it exists already, just return the existing one

#

Making a mathemathical solution to always calculate the same one will cause collisions

#

Just caching results will not

dry yacht
#

So you're hashing the string? I mean, you gotta have some sort of Map<byte[], Integer>. How does base64 help you there?

echo basalt
#

TBH I could store the array directly but that's a lot more data

wet breach
#

base64 kind of compresses

echo basalt
#

I don't hash the string, I just use the string as a UUID type deal

dry yacht
#

I just don't see how you're ending up with an integer if you never hash it. You said you keep it in a list, I'm sure you won't do O(n) search through that list...

echo basalt
#

I could

#

or maybe use a set for O(1) contains checks

#

and another list for indexOf

wet breach
#

O(n) searches are faster then you think

echo basalt
#

tbh looping through 60k elements isn't THAT slow

wet breach
#

espcially on modern CPU's

#

it could do it like 1k times in a feasible second XD

echo basalt
#

a CPU operates on GIGA hertzz

#

we're talking about KILO iterations here

#

:)

#

shitty analogy but my code is the equivalent of like

#

Instead of determining someone's riches by their net worth, I just see if they own a lambo

#

or if their name is frostalf

wet breach
#

But yeah unless you had something like millions of elements in a list or something, then yeah I would recommend using better methods but just a few thousand you are not going to notice how slow it really is

dry yacht
# echo basalt tbh looping through 60k elements isn't THAT slow

No, but you gotta iterate 65k items and then check a lot of characters (if base64 compresses, bytes otherwise), so it's not just that. Maybe I'm just really lacking a feel for this kind of estimations, but it sounds horrible to me. Like, there's gotta be a better solution. Sounds like you're making it work out great tho.

echo basalt
#

it's an equals check

#

like sure it can get slow but when it does, you just go out there and make a better solution ??

#

just start storing map ids in SQLite??

dry yacht
#

Yeah, sure thing, again, I'm just trying to understand it. I'm not talking bad about the solution in any way.

echo basalt
#

we're not really storing colors individually, we're just putting them all in a big line and seeing if that line is in a list

heavy mural
#

Is it possible to prevent an armorstand (passenger) from dismounting a player when the player is swimming?

echo basalt
#

use packets and half the stupid nms logic is gone :)

#

the other half is client-sided predictions

wet breach
#

you could always simulate the armorstand riding the player while they are swimming

#

not sure why this would need to be a thing

heavy mural
#

Earlier I had found a post of somebody using a "buffer entity" to fix this, but the answer seemed so vague to me :(
Maybe it rings a bell for you?

heavy mural
# wet breach not sure why this would need to be a thing

I am attempting to display another nameline above the username and BELOWNAME lines with a passenger armorstand, but I think the water thing kinda makes it not worth it?
What I could do is spam teleport the armorstand on the player

echo basalt
#

@dry yacht in case you're curious,

#

you could probably optimize that contains -> add -> indexOf

#

by doing

indexOf -> if -1 -> add -> indexOf = size() -1

wet breach
#

and then if you want more elaborate mechanisms you can use 2 or 3 dimensional arrays

wet breach
heavy mural
#

As in
If player is swimming
Then teleport armorstand ontop of player
If player not swimming
Set that armorstand as passenger again of the player?

wet breach
#

yep, just don't be surprised if you have to mess with the teleporting stuff to where you are not lagging the server out

#

its not optimal, but I mean not really much else you can really do

heavy mural
#

Hmmm I will only need it for staffmembers which means it will only affect a few players, yet it ain't optimal no hmm

wet breach
#

it shouldn't be an issue with a few players, but if for some reason 50 or more players decide they are all going to go swim, then might best to implement a system to handle that, it doesn't need to be perfect just good enough

wet breach
heavy mural
#

Would the teleport just be in a runnable and then per tick?

#

I think I'll go for that approach

wet breach
#

doesn't need to be per-tick. There is 20 ticks per second, I would probably teleport it every 10 ticks or every 5th

#

players are not going to be moving super fast in water every second 😛

heavy mural
#

That is a fair point I'll look into that tomorrow. Thank you 🫡

echo basalt
#

hmm I don't feel like coding this week

#

I might just type javadocs for 10 hours and get paid

wet breach
#

yeah, that is like me right now with tires

echo basalt
#

team's a bit scattered atm

wet breach
#

I am like at 60 tires now for this week -.-

dry yacht
echo basalt
#

one guy's travelling, the other is fixing a project that has been stalled for 6 months

#

and I'm here, just commenting stuff and optimizing some parts

#

like for some reason, dithering an image makes the performance go boom

#

takes like 40ms to dither

#

might be because I'm reading and calculating pixels manually

#

instead of using some graphics api

wet breach
echo basalt
#

and also I'm not caching colors hmm

echo basalt
wet breach
#

ah

dry yacht
# wet breach base64 kind of compresses

Btw, I don't want to beat the topic to death, but now that I think of it... how can base64 compress anything? It limits the character space and thus requires more characters per byte than if you had just one byte. It's still one compare instruction per value, no matter if char or byte. Shouldn't it actually make the situation worse? A 16384 sized byte array gets turned into a 21848 length string.

wet breach
#

well I don't know what exactly you have for dithering or your images per-say but look into nearest neighbor algo

echo basalt
#

floyd steinberg

eternal oxide
#

base64 makes most things bigger

echo basalt
#

:)

#

You can store the array directly if you want

eternal oxide
#

it's not a form of compression

echo basalt
#

that should also work

#

I don't use it to compress, I use it to convert to debuggable text

dry yacht
echo basalt
#

if you really want to, wrap it in a new String(colors) and see what yo uend up with

dry yacht
#

Didn't even question it

echo basalt
#

probably faster too

wet breach
# eternal oxide it's not a form of compression

While it isn't inherently compression in itself, it does use less to represent more. In other words I can take 20k characters and base64 it and it won't use 20k characters to represent it

dry yacht
wet breach
#

this in itself is compression

eternal oxide
#

its encoding not compression

wet breach
#

that is true

#

but it can be used to compress

#

since it does do what the definition of compression is

#

depending how you use it

eternal oxide
#

oft times it will expand rather than compress, but you could utilize it for compression if it happens

wet breach
#

I have never seen a base64 grow larger then the thing you are base64'ing unless the data was already binary

echo basalt
eternal oxide
#

most base64 encoded ItemStacks are expanded

dry yacht
eternal oxide
#

over just serializing

echo basalt
#

base256 would achieve a string that's the same size as the input

wet breach
#

and in most systems and in programming its automatically assumed 2 bytes minimum

echo basalt
#

by shortening the base you're expanding the amount of characters required to represent the same amount

dry yacht
echo basalt
#

not every time

wet breach
#

no, not necessarily

echo basalt
#

you can shorten very small numbers

#

like

#

49

eternal oxide
#

so unless your original object is all bytes in the lower 64 bits it will be larger encoded as base64

echo basalt
#

into a single character

dry yacht
#

Yeah, sure, but that's a case that's totally negligible. It's of next to no use... xD. On average, it makes everything bigger, where average means 90%

echo basalt
#

eh

#

it's like midnight

#

I got some workshop to attend in 8 hours

#

why tf are we arguing about base64

wet breach
#

idk, I have to get ready for work anyways 😛

dry yacht
#

Well, we can switch to base96 if you want to

eternal oxide
#

no clue 🙂

dry yacht
#

You can still read it, but it'll be shorter, lol

wet breach
#

well you can use whatever base you want really

dry yacht
#

Those are printable, tho

wet breach
#

some bases are more ideal then others

#

just work with a ternary base 😛

#

you should have fun then

echo basalt
#

base 2 empty

wet breach
#

ternary is base 3

echo basalt
#

watch me use boxed Booleans to make base 3

#

as null is the 3rd value

dry yacht
# echo basalt 49

Btw, how's that shortening anything? 49 is still one byte, and it'll make one character. You're not gonna encode the string "49" as an interpreted number, if you meant it as a string value.

wet breach
#

lol

echo basalt
#

or a single base64 letter

#

we're talking about string representation

#

if we represent any base in binary, it's the same shit

dry yacht
#

"49"="NDk="

wet breach
#

strings always take up more space

echo basalt
#

oh yyeah it has padding

#

bro just fuckin

dry yacht
#

Well, you're always encoding binary data, no matter what

echo basalt
#

encode the full name of each color

#

like my comments

#

so if it's fulyl blank

#

it'd be transparenttransparenttransparent...

#

16k times

#

:)

wet breach
#

I see someone went through the pain to hand write this

echo basalt
#

it was not me

#

junior devs just doing junior stuff

wet breach
#

not sure why but I mean they were dedicated to it lmao

echo basalt
#

man's getting paid hourly

#

and this is his best code

dry yacht
echo basalt
#

don't mac pros have 2tb ram?

#

for a humble +25k

wet breach
echo basalt
#

me omw to make a base anagram algo

#

so we can just reverse strings and save ram

#

haha string pool go boom

copper scaffold
dry yacht
# echo basalt junior devs just doing junior stuff

Fair tho, as it takes quite the adventure to find out that the minecraft server already has these base colors from 1.8-present, and that you can generate the shades yourself on the fly, then blow the approximations out into an O(1) lookup array once, where you access using bitshifting, which you then compress to disk using gzip. It's a bit more than you could ask a junior developer to do, haha

echo basalt
wet breach
#

String saves = npcConfig.getServerPlayer("de.server." + uuid + ".player.list");;

#

this is null

echo basalt
#

my code just does it like

wet breach
#

and probably don't need a double ;

echo basalt
#

if it don't exist, cache it

#

if it cached, return cache

echo basalt
#

npcConfig is most likely null

dry yacht
echo basalt
#

nvm I'm blind

echo basalt
#

16 million colors ??

#

RGB scope

#

that's 16mb

dry yacht
#

255 * 255 * 255

#

Map colors

wet breach
#

and follow hte path

dry yacht
#

So that at least map colors are instant lookup

echo basalt
#

well

wet breach
#

it does't match what you are iterating

echo basalt
#

you aren't gonna use most of those colors anyways

#

so just save those 2mb ram

#

and make a lil lazy cache

#

:)

#

it's good practice to be mindful of your resources

#

and encode everything into base64 after micro-optimizing your color cache

dry yacht
copper scaffold
wet breach
#

for(String uuid : npcConfig.getConfig().getConfigurationSection("de.server").getKeys(false))
de.server should be de.npc.server

and this String saves = npcConfig.getServerPlayer("de.server." + uuid + ".player.list"); should be de.npc.server.

#

as I said, your config path isn't the same in the code

swift flower
#

predicate

dry yacht
wet breach
#

just don't store duplicate characters

#

should fix that 33%

echo basalt
#

You could just run it through Arrays.hashcode

#

but that can have collisions

wet breach
#

while true, doubt you are going to run collisions in the short term

#

unless you are just that unlucky

echo basalt
#

hmm

#

sha256 and convert it to a string?

#

sure it's slow as hell and probably will hinder performance

#

but you'll have a constant size string

#

that's hella small

dry yacht
wet breach
#

33% is actually the amount it will grow on average mathmatically

#

which you obviously experienced yourself

eager jacinth
#

Hello. Currently, I'm developing a plugin and I've encountered a small issue. Basically, my plugin has a "wanted level" for players and I want to display all wanted players in a GUI, but the problem is that players are cached as needed, so most of them may not be present there. What do you think is the best way to approach this?

ornate patio
#

is it possible to remove the blue name from an enchanted item

#

meta.setDisplayName(ChatColor.RESET + "...") doesn't remove the blue

echo basalt
#

The blue is client-sided and matches the item's "rarity"

#

Do ChatColor.WHITE instead

quaint mantle
#

The getCustomSign method returns null

#

even tho when i do the broadcasts they are the exact same

ornate patio
#

how do i check if a player has right clicked a liquid

#

from a PlayerInteractEvent more specifically

#

when a player right clicks water, it sends an event with type RIGHT_CLICK_AIR

drowsy helm
torn shuttle
#

is player#getinventory#remove not meant to remove items from the armor slots?

drowsy helm
#

pretty sure armor contents is counted as a separate thing

torn shuttle
#

that's... fun

#

man there isn't even a good way to access these globally

#

I have to do it individually

drowsy helm
#

sounds annoyng lol

ornate patio
ornate patio
quaint mantle
#

anyone know

charred blaze
#

how do i get dependency & repository urls like this?

#

for example i want to import bungee as dependency

#

how do i?

#

(gradle)

quasi flint
#

compileOnly 'net.md-5:bungeecord-api:1.15.5-R0.1-SNAPSHOT'

#

this should be it

#

dont forget

storm stump
#

Is it possible to extend from the NMS LivingEntity?

#

The super method requires an EntityType and I don't know how to create a new one

#

Trying to do this so I can have an entity agnostic positional/health/movement/AI etc. interface for my NMS models which are visual only and merely get replicated to the client

#

Then I can have player entities, zombies, skeletons, whatever

#

And then just send the movement packets

quasi flint
#

a custom entitytype

#

prob doesnt work well with the client

#

as it doesnt know that type

storm stump
#

Of course, I'll try to intercept the packet and make sure it's never sent out

charred blaze
charred blaze
storm stump
#

I only want to do this just so that I can have an entity on the server for movement, raycasting, everything you'd need, but then replicate the real entitytype but with associated positional data

charred blaze
storm stump
quasi flint
storm stump
#

EntityType builder gave me some registry frozen error

charred blaze
#

hm okay

quasi flint
quasi flint
storm stump
#

Is there a pre-registry event to subscribe to?

charred blaze
#

compileOnly 'net.md-5:bungeecord-api:1.19.2-R0.1-SNAPSHOT'

#

does this exist

tardy delta
#

Isn't the frozen field just a simple boolean?

quasi flint
storm stump
#

Is that an annotation

charred blaze
quasi flint
tardy delta
#

Ye looked into sourcecode recently

storm stump
quasi flint
#

but with STARTUP prob not needed

storm stump
#

Oh it's just a spigot.yml thing?

quasi flint
#

ye

storm stump
#

Thank you brother

charred blaze
quasi flint
#

i suppose so

charred blaze
#

where did you get that value?

#

is it listed somewhere?

quasi flint
quasi flint
charred blaze
#

as far as i remember i need to tabcomplete Plugin in bungee api right?

#

where is it

quasi flint
#

u reloaded gradle

charred blaze
charred blaze
quasi flint
#

ah shi

#

use implementation

#

instead of compileOnly

charred blaze
#

testImplementation?

#

why

quasi flint
#

and you prob dont want the jUnit trst stuff

charred blaze
storm stump
#

onEnable?

quasi flint
#

ye

storm stump
#

Oh yea ofc

charred blaze
quasi flint
#

compileOnly is right

charred blaze
#

isnt this reload

quasi flint
#

does it throw an error?

charred blaze
quasi flint
#

under build

#

bottom left

charred blaze
#

hm

#

then

#

whats wrong?

#

compileOnly 'net.md-5:bungeecord-api:1.19.2-R0.1-SNAPSHOT'

#

i think

#

this url

#

does not exists

#

(i know its not url)

quasi flint
#

that is your dependency

#

this is ur repository

charred blaze
#

ill try change it to net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT

#

instead of 1.19.2 one

#

yeah its working now

#

but how do i get access on latest versions?

#

isnt 1.19.2 better than 1.19's api?

quasi flint
#

there is no 1.19.2

#

1.19 works for 1.19.x

charred blaze
#

why

charred blaze
quasi flint
#

because there were no breaking api changes

#

i thonk

charred blaze
#

how do i change gradle's build export location?

torpid blaze
#

Hey,
I have a small problem with casting....
I save a custom object in a map to the yml config and when getting it I of course what to cast it into the original map with the custom object.

But I get this error already in IntelliJ:
Inconvertible types; cannot cast 'java.util.Map<java.lang.String,java.lang.Object>' to 'java.util.LinkedHashMap<java.lang.String,at.kessaft.getdown.utils.JumpMap>'

Has anyone any Idea on how to cast this properly?

charred blaze
#

for (JumpMap jumpmap : mc.getConfigurationSection("jumpMaps").getValues(false)) {
maps.put(jumpmap)
}

#

i guess

#

(maybe)

quaint mantle
#

In case anybody conflicts with Bukkit deserializing objects whenever doing JavaPlugin#getConfig
This is caused because this method calls JavaPlugin#reloadConfig in case of the cache FileConfiguration found null. Reloading it has this behavior of copying defaults. This specific action deserializes ConfigurationSerializables.

In case you are upset because of this, I already provided a robust solution around this. It loads objects from YAML files asynchronously if you are looking for this as well. Besides that, I hope fellow programmers could be a little more respectful towards us who spend time trying to help you...

charred blaze
#

does this code saves loaded config in data file or does the opposite?ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, data);

quaint mantle
#

What are you trying to achieve Greened?

#

Maybe xy?

charred blaze
#

what is xy

quaint mantle
#

?xy

undone axleBOT
charred blaze
#

im trying to save memory loaded config into a file

quaint mantle
#

YamlConfiguration

charred blaze
#

yeah

#

is this doing that?

#

ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, data);

chrome beacon
#

?configs

undone axleBOT
charred blaze
#

not written in details

chrome beacon
charred blaze
chrome beacon
#

As for saving, for custom configurations, you need to call FileConfiguration#save(File) (which saveConfig() does under the hood for config.yml) to write the data to the disk.

#

Bottom of the page

charred blaze
#

there is no FileConfiguration in bungee

#

(last time i "checked")

#

nvm i think i get it now

chrome beacon
#

Ah you were using Bungee

charred blaze
chrome beacon
#

Didn't see that

torpid blaze
#

I also have the problem that, when reloading the config file, the map is null when trying to get it using getConfigurationSection(). In the YML File everything is right but in the memory not. It is also working before saving, when I wrote used createSection() to save the map and it is saved into the memory.

Anyone any idea why this happenes after reloading or restarting the server?

quaint mantle
# charred blaze im trying to save memory loaded config into a file
File directory = getDataFolder();
String fileName = "config";

Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(directory, fileName+".yml"));

ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, new File(directory, fileName+".yml"));```
charred blaze
#

doesnt it do same thing?

quaint mantle
#

The first line will provide an instance of Configuration

#

Which is required in ConfigurationProvider

charred blaze
#

ah

quaint mantle
#

I have no idea how it works, I have not worked with this in bungee yet

charred blaze
#

right

quaint mantle
#

I just understood that the second/last depends on the first

chrome beacon
torpid blaze
#

?paste

undone axleBOT
charred blaze
#

how do i check vanished players in bungee? i was doing it in spigot like this. but there is not MetadataValue in bungee

torpid blaze
torpid blaze
chrome beacon
torpid blaze
#

at the moment never. I restart the server

chrome beacon
#

Which means you're never loading the config

torpid blaze
#

onEnable I load it and afterwards I am not relaoding it

chrome beacon
#

Show that code

#

?paste

undone axleBOT
torpid blaze
#

I just saw that I removed the laoding code line from the constructor before pasting it 😄

#

This is my Config in the yml file and when trying to access it, logged it to the console and it looks like this:

torpid blaze
charred blaze
#

does args[0] return command name in bungee api?

#

thx

oblique igloo
#

Bit of a weird question here.

Please keep in mind that this is NOT an anti-xray but is in fact an xray.

I have written a server side xray that when used turns all of the blocks inside of a chunk into barriers except for ores. I use _https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#sendBlockChange(org.bukkit.Location,org.bukkit.block.data.BlockData)_ to de-render the blocks. I am wondering if there is a way (without caching the blocks, or teleporting the player away and back.) to re-render the effected blocks back to their original material

I can send the class in a pastebin if needed

torpid blaze
#

?paste

undone axleBOT
torpid blaze
#

Hey,
I had some issues with my config but just figured out that the config doesn't get loaded correctly.
I call the constructor of my Conf manager in onEnable before anything else but when printing the read config on the constructor to the console, it is empty although it shouldn't be.

The Path to the File is also correct because saving the config works fine.
https://paste.md-5.net/sucikukeyo.java

Anyone any idea why it doesn't get loaded?

#

I am the dumpest person in the world. First I always resetted the config in the onEnable and not I used YamlConfiguration and not FileConfiguration.#

charred blaze
#

how do i register command aliases in bungeecord api?

ivory sleet
smoky scroll
#

How do I integrate Metrics into a Plugin?

opal juniper
#

i can’t remember if that resends the blocks

oblique igloo
torpid blaze
sullen canyon
#

😒

#

yes

lost matrix
#

If you have a plugin on bungee and spigot then you can just make them communicate and let the
bungee plugin do everything you want on the server. But dont clutter your proxy with logic like that. It has one purpose
and it should not have any game related logic in it.

tender shard
lost matrix
#

So possible but not advisable

#

Commands on bungee should only affect bungee. For example /server /lobby and maybe /mute because its
ok to manage packets on a proxy level.

glad prawn
#
public static <T> T writeAll(Collection<T> coll, Sink<? super T> snk) {
    T last = null;
    for (T t : coll) {
        last = t;
        snk.flush(last);
    }
    return last;
}
 
    public static void main(String[] args) {
        Sink<Object> s = new Sink<>();
        Collection<String> cs = Arrays.asList("A", "B");
        String str = writeAll(cs, s); //
    }

Can someone explain why I can pass s to writeAll?

lost matrix
lost matrix
#

Well im trying to figure out where Sink comes from

#

Reactor?

glad prawn
quaint mantle
#

hi i am getting error

#

anyone can help me ?

tender shard
#

alright IJ, I'll rename myself to "finale"

tender shard
#

because "i am getting error" is not very useful to us

lost matrix
#

Well this works in theory

  public static <T> T writeAll(Collection<T> coll, Sink<? super T> snk) {
    T last = null;
    for (T t : coll) {
      last = t;
      snk.flush(last);
    }
    return last;
  }

  public static void main(String[] args) {
    Sink<Object> s = new Sink<>();
    Collection<String> cs = Arrays.asList("A", "B");
    String str = writeAll(cs, s); //
  }

As in: It will compile.

#

But it will lead to problems on runtime

#

eventually

quaint mantle
#

i am getting error unable to intercept a read client packet and another some messages also

lost matrix
#

No. The fly command should be on your servers. Not on the proxy.
On your server you can store information on players in a DB so its
accessible on all servers. For example if your fly command should
transfer to other servers. But keep your bungee away from that.
It should be light weight and not worry about if and where players
can fly.

#

If you want to grant fly for a player on another server then you can
use the proxy as a relay to message other servers. I personally prefer
Redis for this but bungee can do that as well. The proxy doesnt understand
what is being relayed. It just receives a message from Server A and sends
it to Server B.

lost matrix
quaint mantle
#

can i send u ss in dm ?

lost matrix
#

Nope

quaint mantle
#

so how i can

remote swallow
#

?img

undone axleBOT
quaint mantle
#

not able to send

eternal oxide
#

no one can help you with no information

quaint mantle
#

this is the error

eternal oxide
#

is this with your own plugin?

lost matrix
#

Stack trace from your console pls

quaint mantle
eternal oxide
#

then you are in the wrong channel

#

This is for plugin devs

terse ore
#

One question guys

#

in my config.yml I have different types of rewards, money, claim blocks or playerpoints

#

how could I make so you're only required to have the necessary plugin installed

#

for exampel, if you set it to money, you need to have Vault installed (but no need for griefprevention), if you have it for griefprevention no need for vault

#

idk if I explaine dcorrectly

wet breach
#

By adding conditional checks first starting with the plugin second checking config for boolean of they want it on.

terse ore
#

so I remove the depends on in the polugin.yml and check it on enable?

lost matrix
#

Plugin hooks. You just need to be careful which classes are loaded by checking
which plugins are enabled and not creating instances of your plugin hooks if they are not.

wet breach
#

Correct and if the plugin is not there or the config says not to use it. Then your check would essentially skip the code for those things

terse ore
#

ok tysm I will give it a try

wet breach
#

Using methods that would cause something to load from the plugin you depend on. You dont want to try loading anything from a plugin that isnt there otherwise null pointers everywhere

#

Easiest way to implement the check is from the onenable check for those things and then set a global boolean.

tidal barn
#

Can someone tell me an idea to create a plugin?

terse ore
#

thanks, I will try to do it!

lost matrix
lost matrix
lost matrix
drowsy helm
#

Bot net

smoky scroll
#

How can you use the ChatColor.of(String value)

#

what are the string values

wet breach
#

Make a plugin that generates an upside down world

smoky scroll
#

I tried "AQUA" and it did not work

drowsy helm
#

Just any string and it will return the used color of it

smoky scroll
#

Ohhh

#

ok thanks

#

my bad

drowsy helm
#

Iirc

#

Should be on docs

swift sequoia
wet breach
#

?jd-s chatcolor

undone axleBOT
wet breach
#

Seems i failed at the command to give specific link

smoky scroll
#

I made a mistake in my code forget about it

lost matrix
smoky scroll
#

I first asigned the ChatColor via ChatColor.of(String value) and a few lines after I asigned the same color cause i was working on documentation for what values u can use)

#

make sence that color always stayed the same

lost matrix
#

Then store the fly state in a DB. But the server connects to the DB. Not the proxy.

hazy parrot
#

It's not really Minecraft plugin specific

lost matrix
#

Not sure if you should tinker with databases then. Here are old barebones examples from Spigot:
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
https://www.spigotmc.org/wiki/mysql-database-integration-with-your-plugin/

chrome beacon
#

Did you register the listener? Add some debug messages and see what's failing

lost matrix
#

This cancells all damage on the server if pvp is disabled.

  1. Is the listener registered
  2. Is plugin.gameWorld not null?
  3. You should def check for instanceof Player
round finch
#

curious how would someone get the players have joined before

round finch
#

does spigot have something for that?

wet breach
#

You want to check if they been on the server previously?

round finch
#

no i mean get the players

wet breach
round finch
#

my bad

#

HasPlayed sort of list

hazy parrot
#

You mean get all players that ever joined the server?

round finch
#

yes

wet breach
round finch
#

OH thank you

#

i never thought about that

small hawk
#
    @EventHandler
    public void onShulkerCaseInventoryClick(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();
        if (event.getCurrentItem() == null) return;
        if (!(event.getClickedInventory().getHolder() instanceof CaseInventoryHolder)) return;
        event.setCancelled(true);
    }

I have this event, how can i get TileState to get PDC from the block. I heard that is somehow possible?

wet breach
#

You can get a block by using its location

fickle ivy
#
        for (String key : config.getConfig().getConfigurationSection("stops").getKeys(false)) {
            sender.sendMessage(key);
            String worldb = config.getConfig().getString("stops." + key + ".Location.world");
            if (worldb.equalsIgnoreCase(world)) {
              if(compareLocation(key, sender)){
                  matches = true;
             }
           }
        }```  This errors out saying worldb value is null.  Anyone that can tell me what is wrong here?  ```stops:
  bus:
    ReportedBy: Ray1974
    Location:
      ==: org.bukkit.Location
      world: world
      x: 49.64787901236507
      y: 65.0
      z: -159.30000001192093
      pitch: 49.34998
      yaw: 58.949966```  This is my config.  What am I doing wrong here?
tall dragon
#

show me how you are doing it with a screenshot or something

tardy delta
#

You Cant create a static outer class

small hawk
tall dragon
#

well u dont need to make the class static

#

make the methods static

#

only inner classer can be static

#

well thats more of a general java concept but aight

#

but you wont need an inner class for your application

#

u want to do stuff like this with util methods

#

great

tardy delta
#

Help my code is abusing me

ivory sleet
# tall dragon

That’s a static nested class, inner classes are non static nested classes

tall dragon
#

but i did not know that fact

ivory sleet
#

Yeah, sorry I was just picking on your words, but apart from that good explanation

tall dragon
#

thats fine. thanks for the correction.

trim lake
#

Why Im getting null?

String path = "jobs.miller.cleaning";
        RoleJob.console.sendMessage("test: " + RoleJob.inst.getConfig().get(path + ".triggers"));

YML:

jobs:
  miller:
    cleaning:
      lastTriggerID: 1
      triggers:
        '0':
          ==: org.bukkit.Location
          world: world
          x: 7.0
          y: 72.0
          z: -9.0
          pitch: 0.0
          yaw: 0.0
eternal oxide
#

not enough information. my guess is inst is null

trim lake
#

What else I should give?

#

you can see its not null

eternal oxide
#

the actual stacktrace

#

we can see zero information about inst or the error

trim lake
#

?paste

undone axleBOT
trim lake
eternal oxide
#

CleaningTrigger.java:34

trim lake
#

If you look in yml there is something under that path so, idk why Im getting null. That dosent make sanse.

#

if (RoleJob.inst.getConfig().getConfigurationSection(path + ".triggers").getKeys(false).isEmpty()) return locs;

eternal oxide
#

exact code on that line

quasi raptor
#

@trim lake sk?

trim lake
#

I even try this in main class and still getting null:

@Override
    public void onEnable() {
        inst = this;
        this.saveDefaultConfig();
        console = Bukkit.getServer().getConsoleSender();
        console.sendMessage("jobs: " +       this.getConfig().get("jobs"));        
eternal oxide
#

either the path you are passing is not what you are expecting or your config does not contain what you think it does

trim lake
#

it contains I can see that in yml 😄

quasi raptor
#

How you can send triggers?

eternal oxide
#

you are looking at teh config as saved on your server?

quasi raptor
#

you must pass triggers.'0'.world

#

or what you want ig

rotund ravine
#

?paste your full yml

undone axleBOT
eternal oxide
#

the yaml from your server, not from your project

trim lake
#

that is from server from plugin folder

eternal oxide
#

server plugin folder

#

ok

quasi raptor
#

try

RojeJob plugin = Bukkit.getServer().getPluginManager().getPlugin("RoleJob")
rotund ravine
#

jobs is null

#

getConfigurationSection or whatever you are trying to get.

trim lake
rotund ravine
#

it's a section sure

quasi raptor
#

maybe paste the error

trim lake
eternal oxide
#

he already has

quasi raptor
#

oh sorry

quasi raptor
eternal oxide
#

your yaml is valid

trim lake
#

I think, server is not loading that yml for some reason

#

or cannot acces that

quasi raptor
#

did you saveDefaultConfig();?

#

ok i am just blind...

eternal oxide
#

is that file actually called config.yml and is in the plugins folder?

trim lake
#

yup

@Override
    public void onEnable() {
        inst = this;
        this.saveDefaultConfig();
        console = Bukkit.getServer().getConsoleSender();
        console.sendMessage("jobs: " + inst.getConfig().isConfigurationSection("jobs"));
    }```
quasi raptor
#

show us the files, like how they are in the folder

#

oh 💀

#

the specific issue is that the method getLocations in the CleaningTrigger class is trying to invoke the method getKeys(boolean) on a ConfigurationSection object that is null

eternal oxide
#

your error makes no sense. It doesn;t match what you have shown us

trim lake
#

hmmm, I remove the folder and server didn't generate that folder again

quasi raptor
#

impossible

trim lake
#

idk how but there is no that folder anymore 😄

eternal oxide
#

is your servers RoleJob.jar actually updated or are you running an old jar

remote swallow
#

Did you reload winscp

quasi raptor
#

ig you have to provide more code

#

or other error message

trim lake
#

nwm... Im stupid.... I have bad plugin name in plugin.yml ... Oh god.. How this happend

quasi raptor
#

...

#

:bruh:

trim lake
#

I didnt expect that I forget to change that 😄 sorry

hard socket
#
        ChatColor[] colors = {ChatColor.RED, ChatColor.GOLD, ChatColor.YELLOW, ChatColor.GREEN, ChatColor.BLUE, ChatColor.LIGHT_PURPLE};
        final int[] tick = {text.length() - 1};
        final int[] colorIndex = {0};
        Bukkit.getScheduler().runTaskTimer(AnimateText.getPlugin(AnimateText.class), () -> {
            tick[0]--;
            if (tick[0] < 0) {
                tick[0] = text.length() - 1;
                colorIndex[0] = (colorIndex[0] + 1) % colors.length;
            }
            StringBuilder newName = new StringBuilder();
            for (int i = 0; i < text.length(); i++) {
                if (i == tick[0]) {
                    newName.append(colors[colorIndex[0]]);
                }
                newName.append(text.charAt(i));
            }
            armorStand.setCustomName(newName.toString());
        }, 0, 1);
    }```
#

This method works fine but I want it to save the previous color and sets the new one

#

this method btw changes the color of text from left to right

eternal oxide
#

save old color?

hard socket
#

yes

eternal oxide
#

what do you mean

hard socket
#

like it changes color every tick and text variable its white

#

when it changes colors it becomes white then changes the colot

eternal oxide
#

so you mean it's alwasy startign from white?

hard socket
#

yes

eternal oxide
#

if I remember ChatColor has a method to get teh last color

hard socket
#

nooo

#

look the text variable is white

#

wait

#

I will show you

#

Sorry my obs is broken

eternal oxide
#

I still have no idea what you are having an issue with

quaint goblet
#

how do i make custom commands?
is there a plugin for it?

hard socket
#

as you can it becomes white then change color

eternal oxide
#

something about white, but I see no white

hard socket
#

hein?!

#

its literally white at the start

eternal oxide
#

what is white? I see blue/purple, changing to orange then yellow

hard socket
#

its white

#

trust me its white

quaint goblet
#

its white but it shows as blue becuase of screen glare

eternal oxide
#

what is white?

lost matrix
#

Ok but whats wrong with it being white?

eternal oxide
#

blue is white?

quaint goblet
hard socket
#

I want it to keep the previous color and sets the new one

quaint goblet
#

screen glare

#

how do i make custom commands?
is there a plugin for it?

hard socket
#

learn Java then SpigotAPI

lost matrix
#

Wait what is this scuffed logic

#

Honestly this method should be a class with at least 4 or 5 methods

marsh burrow
#

FEllas, anyone know how I could change the block a item places?

lost matrix
marsh burrow
lost matrix
#

What version are you on?

marsh burrow
marsh burrow
#

When I SET the block through a command, it works just fine, but when I go through the blockbreak event, even with a delay, the spawner doesnt update

lost matrix
#

Did you call a force update on the BlockState?

#

Do that

marsh burrow
cold field
#

Does anyone know how PDC works? From what I know it should use in-memory data, so when the holder is loaded it's data are put in memory and when the holder get unloaded it's data are saved.

marsh burrow
# lost matrix Do that

apparently just gotta live with placing the spawner 2 ticks with delay, flickers but it'll work for now

ivory sleet
#

just a map

#

and then gets saved/loaded at appropriate times like unload/load/command /entity data thingy

cold field
#

k ty

lost matrix
marsh burrow
hard socket
#

@lost matrix what about now

lost matrix
hard socket
#

can you help or no

lost matrix
worldly ingot
#

lol, yeah, that's uh... a little bit awkward

#

At the very least you would use Atomic objects rather than abusing (I guess it's abusing?) arrays

#

But I'd better opt for a proper class

lost matrix
# hard socket can you help or no
public class ArmorstandAnimationTask implements Runnable {

  private final ArmorStand armorStand;
  private int ticksAlive = 0;

  public ArmorstandAnimationTask(ArmorStand armorStand) {
    this.armorStand = armorStand;
  }

  @Override
  public void run() {
    ticksAlive++;
    nextAnimationStep(this.armorStand);
  }

  private void nextAnimationStep(ArmorStand armorStand) {

  }
}

Here is a template you can get started with.

quaint mantle
#

Hello guys, please, I’m asking you, make me a very easy plugin, please

#

Pleasseeeeee

#

Guys

tardy delta
#

?services

undone axleBOT
ivory sleet
ivory sleet
#

like idk if there's a definite answer

#

but using volatile (atomic) in these situations feels unnecessary

tardy delta
#

man dropped his access modifiers

ivory sleet
#

yea

worldly ingot
tardy delta
#

dont abuse arrays, get abused by them instead

ivory sleet
#

hmm, I mean I remember reading bout it, but cant remember the convention

tender shard
remote swallow
#

tldr

chrome beacon
#

tldr: Javadocs exist

quaint mantle
#

How can I get the total harvested crop count?

tender shard
#

for who?

#

a player? all players?

quaint mantle
#

A player

tender shard
#

loop over all things you consider crops, then add it up

eternal oxide
#

over time? for a single plant?

tender shard
#
        Statistic blockBreaks = Statistic.MINE_BLOCK;
        Player player = null;
        Material[] crops = new Material[] { Material.WHEAT, Material.POTATOES};
        int cropsBroken = 0;
        for (Material crop : crops) {
            cropsBroken += player.getStatistic(blockBreaks, crop);
        }
#

sth like this

quaint mantle
#

Ah alright. Thanks.

eternal oxide
#

Does MINE_BLOCK include harvesting?

quaint mantle
#

What about killing an entity?

#

Statistic.KILL_ENTITY?

eternal oxide
#

as often the block is not actually broken

tender shard
#

could also use Tags to automatically get all crop types

    private static final Set<Material> CROPS = new HashSet<>();
    
    static {
        for(Material material : Material.values()) {
            if(Tag.CROPS.isTagged(material)) {
                CROPS.add(material);
            }
        }
    }
    
    public static int getCropsHarvested(Player player) {
        int harvested = 0;
        for(Material crop : CROPS) {
            harvested += player.getStatistic(Statistic.MINE_BLOCK, crop);
        }
        return harvested;
    }
tender shard
#

do you mean harvesting stuff like berry bushes?

eternal oxide
#

also Tag.CROPS.getValues() shoudl work too

#

rather than looping all Materials

ancient plank
#

muh performance

tender shard
eternal oxide
#

does it?

tender shard
#

oh wait no, it doesn't

eternal oxide
#

I thought it was a baked enum

tender shard
#

but it streams / maps every tagged vanilla material to its bukkit material everytime and creates a new set out of that

ancient plank
#

Can I become the java garbage collector

tender shard
#

so best would be this:

    private static final Set<Material> CROPS = Tag.CROPS.getValues();

    public static int getCropsHarvested(Player player) {
        int harvested = 0;
        for(Material crop : CROPS) {
            harvested += player.getStatistic(Statistic.MINE_BLOCK, crop);
        }
        return harvested;
    }
eternal oxide
#

yep

ancient plank
#

I love tags

tender shard
#

yeah unfortunately they often are one version behind

ancient plank
#

which is why I have library where I made my own

#

I think

small current
#

what does material.isBlock() return if its air

worldly ingot
#

Air is a block

#

Air is also an item

worldly ingot
#

Also, not sure what you meant by them being one version behind?

tender shard
#

sometimes, new stuff gets added, and it's only tagged in the version released after that

worldly ingot
#

We're missing a lot of tags atm. Like... a lot. We don't even have biome tags

cold field
#

I need to serialize an itemstack.
The simplier approach would be serializing it as a map, converting it to a string and then encoding it to base64.
I don't know if this approach is reliable when using different spigot versions so I thought of saving it as nbt (by using nms) and converting it to a base 64 string, what do you suggest me?

tender shard
#

ItemStacks are already ConfigurationSerializable, why not just use that?

#

you can get it as Map<String,Object> or as byte[]

worldly ingot
#

Alternatively, depending on where you're serializing it, you can use the output and input streams

lost matrix
#

Spigots ItemStack serialisation is rubbish. It breaks every now and then. Try serializing a head with textures for example.

tender shard
tender shard
lost matrix
#

I had so many problems with Map<String, Object> -> Gson -> String -> Base64 encode

worldly ingot
#

you can use the output and input streams

#

Why do people not know about these my goodness

tender shard
#

I already said to use byte[]

lost matrix
lost matrix
#

Yeah but they need CraftBukkit on the classpath

worldly ingot
#

No they don't?

carmine rivet
#

Hi! is there anyone good with packets/nms who knows how to register a new biome, willing to help me with an error i'm getting?

worldly ingot
#

Those are Bukkit API classes

tender shard
#

yeah it's in norma bukkit

#

org.bukkit.util or sth

lost matrix
#

Since when? Let me check that.

worldly ingot
#

I linked the docs above!

tender shard
#

at least since 1.16.5

#

probably since forever

worldly ingot
#

Way, WAY before that

#

2013

tender shard
#

1.16.5 is the oldest craftbukkit version i got open

worldly ingot
lost matrix
#

Well i remember them being only accessible with CraftBukkit on the classpath for a long time. Never knew they where exposed

carmine rivet
cold field
#

SO.... is it safe to assume that things gonna work even for items with PDC etc?

swift onyx
#

Hey there, just a quick question.
I don't know if this is the right place, if not, I'm sorry.
I have a few custom items in my 1.19.3 plugin and wanted to cancel the event when a player tries to remove enchantments with a grindstone, I found the org.bukkit.event.inventory.PrepareGrindstoneEvent but the server seems to give me the warning:

[16:44:34 WARN]: [Project] "Project v1.0.0" has registered a listener for com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent on method "public final void dev.dasischbims.project.listener.GrindstoneListener.onPrepareGrindstone(org.bukkit.event.inventory.PrepareGrindstoneEvent)", but the event is Deprecated. "Server performance will be affected"; please notify the authors []..

However when I look into the Javadocs it clearly doesn't say deprecated anywhere on the page. Is this intended or is this an issue with paper?

eternal oxide
#

?fork

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

swift onyx
#

Thanks, I'll go there instead

cold field
#

I remember that spigot serialization system isn't the best system it easily breaks, most people says that it is unreliable.

bright spire
#

Hey! Is it possible to execute runTask() inside a runTaskAsynchronously() block?

#

I think the runTask() is not executing at all for some reason