#help-development

1 messages · Page 626 of 1

vagrant stratus
#

Except for in my case, I want the second

eternal oxide
#

I hate most games that perform physics calculations. They rarely get it right

#

They mess up especially when there is any acceleration of time.

vagrant stratus
#

Well I'd prefer something more like the linked video over just hardcoded animations kek

eternal oxide
#

They always forget to account for the accelerated time and apply an incorrect force

rough drift
#

tell me from when

#

actually explain it a bit

vagrant stratus
#

.

rough drift
#

k

vagrant stratus
#

video more or less shows what I'm talking about, although it would be different given it's ya know, mc

echo basalt
#

sometimes I hate working with futures

rough drift
#

I really like Verlet because it can do that and it's lightweight, all you need really is a block display entity that can display X model, and then have corresponding "vertices" and "connections" for those vertices to plug into verlet, then every once in a while get the position of all those vertices and rotate the model such as it conforms to those rotations more or less

#

per fragment

#

though verlet is cheap asf, you also need to pass in the surrounding blocks as "walls" which you can do by using more sticks

#

or you can use Euler if you want

onyx fjord
vagrant stratus
#

The thing is this would be done w/ real blocks, unless they all got replaced w/ display entities real-time instead of falling blocks

rough drift
#

If you want rot then you need to use display entities

vagrant stratus
#

rot?

rough drift
#

rotation

echo basalt
rough drift
#

If you want them to be hit and rotate you need to simulate that

echo basalt
vagrant stratus
#

ah, so I assume real-time replacement then?

rough drift
#

Yep

#

As well as if you want them to interact with the world you need to pass the entity bounding boxes & block bounding boxes

onyx fjord
vagrant stratus
echo basalt
#

I'm not gonna use streams

#

Also this is db queries

#

That's mongo code

rough drift
vagrant stratus
#

IkePhysics when kek

rough drift
#

If a point is inside a point push each out by 1/2 of the intersection distance

#

If a point is inside a stick push the point back out 1/1 of the intersection distance

#

if a stick is inside a stick push it back to the nearest time it wasn't inside

onyx fjord
rough drift
#

using sub-steps (running phys 1/8th of the speed for 8 times) improves the collision resolution and doesn't really lag

echo basalt
#

For one you can't stream a mongo finditerable

rough drift
#

Optic Physics

vagrant stratus
echo basalt
#

for two I'm anti-stream and generally dislike the API as it often loops through the collection multiple times for something basic

slender elbow
#

no it doesn't? lol

echo basalt
#

also wtf is this code

slender elbow
#

?

echo basalt
#

That's java's streaming code for you

slender elbow
#

I know

#

what about it

onyx fjord
echo basalt
#

Looks uggo

slender elbow
#

sez u

echo basalt
#

I have standards ok

#

basic for loops do the job

slender elbow
#

streams can do things for loops can't, or at least not easily

echo basalt
#

If it takes forever to do something with a for loop and streams end up looking much nicer sure, we use streams

#

But in most cases a for loop does a perfect job

onyx fjord
remote swallow
#

kacper

#

he uploaded a plugin to rankshop

onyx fjord
#

co

remote swallow
#

its a tad sus

onyx fjord
molten hearth
fallen scaffold
zealous osprey
#

Custom resourcepack

echo basalt
#

happyhud iirc

fallen scaffold
lilac dagger
zealous osprey
#

damn, how did they do it then, gotta check out happyhud then

echo basalt
#

just a bunch of pixels with weird offsets

#

and they send like a character for each pixel in your face

onyx fjord
#

likely

#

idk how

fallen scaffold
echo basalt
#

No because you can use rgb colors

#

It's a feature since like 1.14

fallen scaffold
#

which parameter would that be then?

echo basalt
#

It's.. not a parameter

#

You know how color codes work yeah?

#

So in 1.14+ you can send rgb messages in the chat and scoreboard

#

what if.. you have a character that's just a pixel

#

and you send that character with some rgb colors

zealous osprey
echo basalt
#

🤯

#

It's a pain

zealous osprey
#

ye

quaint mantle
#

when we open a file with java, do we have to close it?
does that file close when the program closes?
and when run over and over with the code, does it open more than one file or does it not open because only 1 is open?

zealous osprey
#

formatting text to lineup with anything is a pain

fallen scaffold
#

Hmm, but then one pixel would have to be contained in the resource pack?

echo basalt
#

1 at each height

fallen scaffold
#

let me see

onyx fjord
#

shaders 100%

quaint mantle
echo basalt
#

When you open files

#

You're reading the contents through a file stream

#

You gotta close the stream

#

typically just use a try-with-resources

quaint mantle
#

opened files is closing ?

#

and i run my code for open files
do the files overlap?

#

if do this i don't need close

fallen scaffold
echo basalt
#

I got no clue what you're talking about at this point

quaint mantle
#

alright

tender shard
echo basalt
#

no

chilly hearth
#

nope

#

no cakes here

tender shard
#

Ok bye

chilly hearth
#

NO

#

WAIT

echo basalt
#

thanks for the ping

chilly hearth
#

there are cakes

echo basalt
#

there are no cakes

#

let alex leave

chilly hearth
#

: (

#

alr

#

bye bud

rare rover
#

ughhh

#

i hate annotations

#

so finicky

tender shard
#

paper loves the deprecated annotation

last abyss
#

Hi ! someone know why in the BlockBreakEvent, the getDrops.clear() doesn't work ?

shadow night
rare rover
#

and idk why

lilac dagger
tender shard
rare rover
#
private static @NotNull Field[] getAnnotatedFields(ConfigClass configClass) {
        List<Field> fields = new ArrayList<>();
        Class<?> clazz = configClass.getClass();

        for (Field field : clazz.getDeclaredFields()) {
            if (field.isAnnotationPresent(ConfigValue.class)) {
                fields.add(field);
                Bukkit.getLogger().info("Found annotated field: " + field.getName() + ", Value: " + field.getAnnotation(ConfigValue.class).value() + ", Type: " + field.getType().getName());
            }
        }
        return fields.toArray(new Field[0]);
    }```
lilac dagger
#

pretty sure there is

tender shard
#

There is not

chilly hearth
#

is

rare rover
#

and then the class:

@Config
public class ConfigExample implements ConfigClass {

    @ConfigValue("test-testing")
    @Comments({"line 1 of comment", "line 2 of comment"})
    private final String test = "test";

    @ConfigValue("testing-value")
    private final String testing = "ew";
}```
delicate lynx
chilly hearth
#

?learnjava!

undone axleBOT
tender shard
delicate lynx
#

just do setDropItems(false) ez

chilly hearth
#

is there a spawner event ?

chilly hearth
last abyss
#

event.getBlock().getDrops().clear() exist

lilac dagger
tender shard
rare rover
#

nice, now how do i fix this

#

idk

#

it just wont work

#

i've debugged it

#

and it only gets the @Config

last abyss
tender shard
delicate lynx
#

can you show us the error....?

#

?notworking

undone axleBOT
#

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

lilac dagger
#

not sure if you get to that step yet

chilly hearth
#

ah alr

rare rover
#

the fields aren't null

#

and i've tried setAccessable

lilac dagger
#

this is mine

#

it's a bit different since i wanted to get the Setting's information in 1 go

rare rover
#

let me try it

#

hopefully

tender shard
rare rover
#

nope

tender shard
lilac dagger
#

i see

#

thank you for that

tender shard
#

it's just an int, if it's e.g. public and static and final, then the getModifiers() is the result of Modifier.PUBLIC + Modifier.FINAL + Modifier.STATIC

rare rover
#

yeah value is null

rare rover
#
private static @NotNull Field[] getAnnotatedFields(ConfigClass configClass) {
        List<Field> fields = new ArrayList<>();
        Class<?> clazz = configClass.getClass();

        for (Field field : clazz.getDeclaredFields()) {
            ConfigValue value = field.getAnnotation(ConfigValue.class);
            Bukkit.getLogger().info(value.toString());
            if (value != null && !Modifier.isFinal(field.getModifiers())) {
                fields.add(field);
                Bukkit.getLogger().info("Found annotated field: " + field.getName() + ", Value: " + field.getAnnotation(ConfigValue.class).value() + ", Type: " + field.getType().getName());
            }
        }
        return fields.toArray(new Field[0]);
    }```
#

the annotation is Retention.RUNTIME

lilac dagger
rare rover
#

hmm

#

idk why this isn't working

lilac dagger
#

what exactly isn't printing?

rare rover
#

the annotation is null

#

but it shouldn't be

#

because its clearly there

#
@Config
public class ConfigExample implements ConfigClass {

    @ConfigValue("test-testing")
    @Comments({"line 1 of comment", "line 2 of comment"})
    private String test = "test";

    @ConfigValue("testing-value")
    private String testing = "ew";
}```
#

ConfigValue annotation

lilac dagger
#

Bukkit.getLogger().info(value.toString()); i see you use to string

#

do you get null pointer?

rare rover
#

ye

#

java.lang.NullPointerException: Cannot invoke "Object.toString()" because "value" is null

lilac dagger
#

show the config value @annotation

rare rover
#
@Target(ElementType.TYPE_USE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ConfigValue {
    String value() default "";
}```
lilac dagger
#

or print configClass's getCanonicalName

rare rover
plush sluice
#

what is the attribute to armorstand so i can break blocks through it

#

it exists but it doesnt

zealous osprey
lilac dagger
#

nah

#

but i do agree

rare rover
#

yeah

#

i'll do that rn

lilac dagger
#

if someone forgets to write an id it could lead to clashes

rare rover
#

but why tf does this not work 😢

#

i've been that this for an hour and a half

lilac dagger
#

print the field's names

quaint mantle
#

Is there any way to remove every player's advancements without using an iterator object? I can't find something like player.removeAdvancements()

rare rover
#

which correlates with the variables

lilac dagger
#

yeah i don't know

rare rover
#

well wtf

lilac dagger
#

deobfuscate the jar and look for the annotations

rare rover
#

alr

#

ohhh

#

hmmm

lilac dagger
#

hmm

#

it seems they're not kept

#

so you probably forgot to keep them at runtime?

rare rover
#

the Retention is RUNTIME tho?

lilac dagger
#

very weird

rare rover
tender shard
#

how does Comments look like

lilac dagger
#

maybe target?

rare rover
#

same thing

#

maybe

#

has to be

lilac dagger
#

@Target(ElementType.FIELD)

#

use this

rare rover
#

whoops

lilac dagger
#

oh yeah

#

type is something else i think

rare rover
#

yep works now

sterile breach
#

Hello, someone have a tutorial/ecemple for pagnited menu/gui (no library)

rare rover
#

thanks so much

tender shard
#

TYPE_USE is for generics or something iirc

#

e.g. List<@NotNull String> for a list of not-null strings

lilac dagger
#

would be cool if this worked for arrays^

#

unless i'm wrong

quiet ice
# tender shard TYPE_USE is for generics or something iirc

Type use if for everything where a type is involved INCLUDING methods and fields.
This causes the infamous issues with jetbrains-annotations because they have not yet figured out that also making use of METHOD and FIELD makes 0 sense

dull goblet
#

?paste

undone axleBOT
dull goblet
#

Am i maybe using the iterator wrongly?

#

yeah but it's only checking the first element

#

(its 4 times repeated bcs its called 4 times)

quiet ice
#

The dark oak log could be caused by coercing a tag as a material

#

For why it is only printed once: See the break and return

young knoll
#

It’s a MaterialChoice

quiet ice
#

Or well coercing a MaterialChoice as a single material - same thing

young knoll
#

If you want to get the input -> output of every smelting recipe I have code for that

tender shard
quiet ice
#

I'll eventually PR a fix to eclipse so they fix their stupid auto-completion taking some things a bit too much at face value

dull goblet
young knoll
dull goblet
#

Thank you

quiet ice
#

And what about exact choices?

#

Well I guess you only want Material -> Material I guess

dull goblet
#

I'm trying to smelt all items in a container

young knoll
#

Exact choices are said to only work for shaped recipes

#

However I do believe you can use them for smelting

quiet ice
dull goblet
#

So I shouldn't use Furnacerecipe but instead cookingrecipe?

quiet ice
#

If you also want to include recipes included in the blaster, campfire, smoker and standard furnace

dull goblet
quiet ice
#

Generally always use the cached variants unless you want to explicitly refresh the cache

#

The caching is a bit bork though given that it depends on Material - but using ItemStack would be a bit too computationally expensive

dull goblet
#

Does it automatically convert for example 54 ore to 54 ingots?

out.setAmount(out.getAmount()*input.getAmount());
lilac dagger
#

why not out.setAmout(input.getAmount)?

#

unless out is 1 which it doesn't matter then

#

but still it asks for bugs

quiet ice
#

I implemented this class in a rather paranoid way just in case some datapack does not return itemstacks of size 1

#

Do beware that you need to split itemstacks if they go over the maximum stack size.
Unless you don't care

#

Since I always drop the items to the world I never bothered to handle this case

dull goblet
#

Are there recipes where you get more output then input?

quiet ice
#

In vanilla no - but I would not be suprised if that is a thing with datapacks

vast ledge
#

The beauty of java

vast ledge
#

like sticks?

quiet ice
#

Just use EnumMaps

quiet ice
dull goblet
#

yeah

vast ledge
#

oh

young knoll
#

No bad

vast ledge
#

furnace

#

no

#

xD

dull goblet
#

okay thanks

young knoll
#

Don’t use enum maps for material

#

Naughty

scenic onyx
#

hi, my plugin dont save the config: "config.getC().set("kit." + kitname + ".item." + slot + ".Enchant", listen);" listen is a List but dont save it.

vast ledge
quiet ice
twilit roost
quiet ice
vast ledge
twilit roost
#

then show us the whole code

vast ledge
#

Material Factor?

quiet ice
vast ledge
scenic onyx
# twilit roost then show us the whole code

if (item.getItemMeta().hasEnchants()) {
Map<Enchantment, Integer> enchantments = item.getItemMeta().getEnchants();
List<String> listen = new ArrayList<>();
for (Enchantment enchantment : enchantments.keySet()) {
int level = enchantments.get(enchantment);
String enchString = enchantment.getName();
int lvl = level;
listen.add(enchString + ":" + lvl);
}
for(String e : listen){
p.sendMessage(e);
}
config.getC().set("kit." + kitname + ".item." + slot + ".Enchant", listen);
config.save();
config.reload();
} else {
config.getC().set("kit." + kitname + ".item." + slot + ".Enchant", null);
config.save();
config.reload();
}

young knoll
#

Eventually™️ a lot of enums in spigot will be replaced with classes

worthy moat
#

I want to write a firend system...It will be Bungeecord plugin...How can I make the Bukkit plugin communicate with my Bungee plugin?

#

I want to make a GUI

quiet ice
vast ledge
worldly ingot
#

You also really don't get any benefit whatsoever from an EnumMap

#

The Material enum is too large

#

HashMaps are probably going to end up being faster and use less memory

dull goblet
#

Also, I tried to find out earlier but I didnt really get an answer, is it possible to give my custom item a max stack size of 1. I have wands with a stick material, and i want to prevent them from ever stacking. If i create the wand they get assigned a random UUID, but when copied, they can still stick. Is there any way to prevent this?

vast ledge
#

or add a uuid somewhere

#

it will make them a nonstackbale item

quiet ice
#

Yeah but if you copy it in creative mode it still stacks

young knoll
#

Put it in pdc

vast ledge
#

That works?

dull goblet
#

I did

vast ledge
#

Are you using the same UUID?

dull goblet
#

but copy in creative mode for example it still stacks

young knoll
quiet ice
#

At which point eh, you did everything you could

vast ledge
young knoll
#

Nothing you can do about creative mode

dull goblet
#

Well if there is a duplicate it stacks

vast ledge
#

Yes

dull goblet
#

Most of the problem is for example if players want to use shops

vast ledge
#

You have to randomize the UUID for each item

quiet ice
#

UUIDs are very unlikely to collide

vast ledge
quiet ice
#

If you do it correctly it is actually impossible to collide

vast ledge
#

ye

quiet ice
#

At least impossible within a reasonable timeframe

worthy moat
dull goblet
#

The UUID's colliding isn't the problem. The problem is if the item gets copied ingame, they aren't unique anymore

vast ledge
#

if its smth rly important just if(isUsed(uuid)) return UUID.randomUUID();

quiet ice
dull goblet
#

For example a villager shop, you would input the wand, and if it gets sold to a player, it would be the same wand and possible to collide

#

Because then they have the same UUID bcs it copied

vast ledge
#

When buying the item, have it randomize a new UUID

quiet ice
#

Just set the most significant bits to the current system time and the least significant bits to the the most sig bits of the player UUIDs XORd with the least sig bits of the player (or whatever outside factor you need to use)

dull goblet
#

The shops are from an external plugin

vast ledge
#

like playerPurchaseItem()

#

if so then you can regen a new UUID

quiet ice
dull goblet
#

Yeah that's what i was trying to prevent. I don't want to treat the symptom but i want to treat the problem.

quiet ice
#

Because I have never seen a non-malicious plugin that has duping as a feature

quiet ice
dull goblet
#

If you tell it to sell that specific item it does

quiet ice
#

Yes, but that is the case for admin shops?

dull goblet
#

yeah

quiet ice
#

Because like you can never sell the same item twice (thus duplicating it) ... or is the plugin THAT stupid?

vast ledge
#

its that stupid

dull goblet
#

No i'm talking about admin shops

vast ledge
#

It clones the itemstack

#

Its copies everything

dull goblet
#

But it's just an example, if i would have to find a workaround for every plugin that might get added that would get very annoying, so i'd prefer to treat the root problem

quiet ice
#

Yeah okay. In case of an admin shop your best bet is to actually treat the symptom - i.e. listening to click events and de-duplicating in that case

vast ledge
#

or have a registry

#

with the existing UUIDS

#

which would become laggy

dull goblet
#

i wish we could set instead of only getMaxStackSize()

quiet ice
#

You could also treat the problems by the power of ||MASS ASM||, but beware there be dragons if you do that

dull goblet
#

is generating UUID expensive?

vast ledge
#

It takes resoureces

quiet ice
#

Depends on how you do it

dull goblet
#

just random

vast ledge
#

Depending on how much its getting called

shadow night
#

what does config.getCurrentPath() return? is it like parent/path/config.yml or just parent/path?

vast ledge
#

where the files is located

#

so if the file is in sys/data/myfile.txt

#

it will reutrn

#

sys/data

dull goblet
#

I think i'll just leave it like this for now. If the user finds there is a problem, and they don't want to use tools (its configurable the material), i might try find a solution

quiet ice
#

If you do it correctly (system time + 8 random bytes) not that expensive.
16 random bytes would be even less expensive.

shadow night
dull goblet
#

is there a reason why there is only getMaxStackSize and not setMaxStackSize

vast ledge
shadow night
kind hatch
vast ledge
#

ye

#

that

#

im dumb

echo basalt
vast ledge
shadow night
vast ledge
#

.getFile()

#

after ur fileconfiguration

#

should return the working ifle

quiet ice
shadow night
vast ledge
#

bruh

#

you have to s ave it

quiet ice
#

Of course you could do a deep-dive into NMS internals to just allocate your own item that has a custom stack size

vast ledge
#

fileConfig.save("file")

quiet ice
#

But bukkit probably would not like it

vast ledge
#

At some point ur setting the file that all the configuration gets written to

shadow night
dull goblet
#

Yeah im also trying to prevent NMS way more work to code

vast ledge
kind hatch
vast ledge
#

but no path

shadow night
vast ledge
#

new File(getServer().getPath)

#

or smth

shadow night
vast ledge
kind hatch
shadow night
vast ledge
#

You have to

shadow night
#

bruh...

kind hatch
#

How tf are you expecting to save this data to disk then?

vast ledge
#

Hes gna save it cache

#

send ur constructor

#

for FileConfiguration

shadow night
#

wait, I'm stupid

#

it's the default configuration file (config.yml) lmao

vast ledge
#

😢

#

friggin smart

dull goblet
#

why does spawnParticle shoot the particle to idk where but far?

world.spawnParticle(Particle.FLAME, block.getLocation(), 1);
lilac dagger
#

Offset and speed

#

You gotta control those if you want your particle to stay still

vast ledge
#

yea

#

rogue particle go brrr

dull goblet
#

is that extra?

vast ledge
#

no

#

it speed

#
  • offset
dull goblet
#

where is speed

vast ledge
#

oh

#

ye

#

had to read the wiki agian

#

docs*

vast ledge
#

an mp4 file

twilit roost
#

ain't clicking on that thing

vast ledge
#

Its a plugin

spring plume
#

I did not find anyone who knows his name

quaint mantle
twilit roost
#

frick :D
I forgot my KASM login and the free demo doesn't let me access it :D

but its legit as it seems from your messages

spring plume
vast ledge
#

?paste

undone axleBOT
vast ledge
#

Doesnt makes sense

#

since im setting values

tender shard
#

Your enum is depending on itself or sth

carmine mica
#

its because the type is still be initialized

tender shard
#

Or another class thats not initialized yet

#

Thats a design error and typically means your enum shouldnt be an enum

carmine mica
#

what is in the constructor for that enum?

vast ledge
carmine mica
#

yeah, that writeToArrays function tries to use the the values() method which can't be called yet because they all don't exist yet

vast ledge
#

ye

carmine mica
#

what do you expect the values() method to return before all the instances have been created?

vast ledge
#

nothing

#

im dumb

chilly hearth
#

...m

mortal hare
#

is there any way to force gradle to overwrite currently loaded plugins inside plugins directory

vast ledge
#

not on windows

mortal hare
#

its so annoying to copy and paste everytime i want to test niche things

vast ledge
#

You can have it stop the sevre

#

server*

#

insert file

#

and resart

#

start the server*

mortal hare
#

for some reason

#

i can copy and paste it

#

without restarting it

#

at least on purpur 1.20.1

vast ledge
#

on windows?

mortal hare
#

yea

#

but gradle refuses to copy and paste

#

because its already used by javaw.exe

#

so basically i can do it manually

#

but its so annoying

vast ledge
#

I cant even do it manually

river oracle
#

or maybe set your gradle output dir there

mortal hare
#

but it cant copy it

#

because when i use file() to specify path

#

it tries to open the file

#

when its already used by another process

river oracle
#

hmmm maybe try making a python script to insert it and run it with Gradle if possible

#

I mean live updates would be cool if you can get it working, though idk how that's even possible

mortal hare
#

its possible

#

you just need one more plugin to reload that plugin

vast ledge
#

plugman

mortal hare
#

what the checksum of the file changes

#

yea

#

but its not really recommended

#

since it memory leaks

#

after a while

#

due to how class loading works for plugins

#

but it works for dev environments

pseudo hazel
#

can I somehow use markdown on my plugins spigot page?

#

its really annoying since I usually keep a readme in github but converting it to whatever spigot text is is a pain

mortal hare
#

maybe there's some kind of converter

#

but im not quite sure

chilly hearth
#

Why I can't understand anything 🥹

mortal hare
#

it takes time

#

and a lot of cries for help

#

😄

remote swallow
pseudo hazel
#

yeah I feel like tahts also an answer to me

#

oh its bbcode

#

okay

#

then I know enough xD

remote swallow
#

spigot uses a modified version iirc

chilly hearth
chilly hearth
tender shard
#

bbcode sucks

#

it's the reason why I never update plugin descriptions

pseudo hazel
#

yeah but I changed like all features

#

like why cant they just use markdown like a sane platform

mortal hare
#

M A R K D O W N

chilly hearth
#

Can you guys tell me where I can learn spigot development correctly

young knoll
#

Is this why people do images for their plugin description

pseudo hazel
#

probably

mortal hare
#

no they do it because it looks great

tender shard
mortal hare
#

and flashy

pseudo hazel
#

im one step away from just putting a link to my github readme

#

but that will probbaly plummet downloads

chilly hearth
mortal hare
shadow night
pseudo hazel
#

also whats the fastest way to upload a version of your plugin for multiple version, like 1.18, 1.19, 1.20 etc

tender shard
mortal hare
tender shard
pseudo hazel
#

is there like a specific way to do that?

mortal hare
#

it sucks to create wrappers

mortal hare
tender shard
pseudo hazel
#

and also then I guess I cant use new api on older version ofc

#

so I guess those will just get the yeet

mortal hare
#

detect what's the current version of the server

#

then load the class using classloader

#

that is named according to the format you've decided to have to mark down version per changes

pseudo hazel
#

okay yeah thats too complicated for me, ill just change the version in spigot.yml

shadow night
mortal hare
pseudo hazel
#

I dont have nms

mortal hare
#

then its mostly backwards compatible

#

at least until 1.13

pseudo hazel
#

okay that's fine

rare rover
#

hmm

pseudo hazel
#

I guess I will need an actual solution if I want to use new api stuff though

rare rover
#

why isn't it adding comments to the YamlConfiguration?:

@Override
    public void addField(String path, CachedConfigField<?> cachedConfigField) {
        configuration.set(path, cachedConfigField.getValue());

        if (cachedConfigField.hasComments()) {
            Bukkit.getLogger().info("Adding comments to " + path);
            configuration.setComments(path, cachedConfigField.getComments());
        }
    }```
tender shard
# pseudo hazel is there like a specific way to do that?

basically you have one module per NMS version, and one core module. the core module does all the stuff possible with the API, and it has something like an interface that each of your NMS modules implements. then in onEnable you create the proper instance based on the craftbukkit package name. the final .jar shades all your modules into one .jar. for example take a look at jefflib, especially core/JeffLib -> getNmsHandler() and all the separate NMS modules https://github.com/JEFF-Media-GbR/JeffLib

the dist module is what's shading all the modules into one .jar, hence it doesn't have any code on its own

rare rover
#

it does execute

#

but doesn't set the comments

mortal hare
#

if you dont use new api features from 1.16+, and the plugin is basic

#

its fine

pseudo hazel
#

basic is debatable

mortal hare
#

or just classes

pseudo hazel
#

but if your definition of basic is not using nms

twilit roost
tender shard
#

like "subprojects"

mortal hare
#

oh

#

im on gradle

young knoll
#

Grade also has sub projects

mortal hare
#

so its yeah subprojects

shadow night
mortal hare
#

well i dont do subprojects for the compat layers

#

but its seems like a good idea

#

since you can remove it anytime you want

#

without manually removing the classes

rare rover
#

im making a lib for configs

mortal hare
#

and it decoupled from the main classes

rare rover
#

aka:

@Config
public class ConfigExample implements ConfigClass {

    @ConfigValue("test-testing")
    @Comments({"line 1 of comment", "line 2 of comment"})
    private String test = "test";

    @ConfigValue("testing-value")
    private String testing = "ew";

    /*
     * In file: test-testing:
     *            value: ew
     */
    @ConfigValue("test-testing.value")
    private String value = "ew";
}```
twilit roost
tender shard
mortal hare
#

so that i can get plugin.yml synced with the provided version of my project configuration file

shadow night
tender shard
young knoll
#

Yes you can do it with mods

#

Just most modders don’t bother

tender shard
mortal hare
#

@JsonProperty(value = "key")

#

im not sure for yaml tho

chilly hearth
#

@tender shard how you so pro at coding

shadow night
mortal hare
#

but afaik jackson support serialization to yaml

shadow night
tender shard
chilly hearth
#

Then how tf ;-;

tender shard
#

i studied law and only do coding in my free time

chilly hearth
#

U made soo good plugins

shadow night
#

programmer either means pro(fessional) grammer or poor grammer lmao

chilly hearth
#

Olt every programer studies law ;-;

chilly hearth
young knoll
#

Probably the same place most people learned it

#

The internets

tender shard
#

the rest I learnt through just trying and googling and doing stuff

#

oh and books ofc

chilly hearth
#

;-;

tender shard
#

a book is much better than any shitty online tutorial

chilly hearth
#

😲

twilit roost
#

cuz it takes more effort to make that book

mortal hare
#

i've learned java in like 3 years, but i cant say im not pro at it, but it works for me

#

i've started from skript

#

until someone insulted me

#

from using it

shadow night
mortal hare
#

so i was like fuck it and ill prove i can code in java

#

ant that's how i started lol

shadow night
#

Lmao

#

I had a similar start

mortal hare
#

tbh my skripts used skript-mirror

#

so basically i've been calling api already

#

i've once a made a fricking factions plugin inside one skript

#

it took me like 3k lines of code

#

and bunch of procedural programming functions

shadow night
#

It started with me making discord bots with bot maker lol. Then I wanted to port my bot to a 24/7 hosting instead of using the app and watching ads, I've tried and failed. I've been told I'm stupid when they tried to help me so I started coding in js. I then wanted to make minecraft mods, as it was and still is my favourite game and when I saw java I was like: holy shit this looks like javascript, but with a shitton of unnecessary shit

mortal hare
#

i remember i've once made skript clone perform faster than some shitty memory leaking minecraft plugin

tender shard
#

unfortunately I learnt recently that this groupid is invalid and I had to change it for maven central

shadow night
#

Wait what

#

Oof

tender shard
#

yeah new stuff will be jeff-media

shadow night
#

Naming conventions be like

tender shard
#

yeah it's annoying because I have like 50 dependencies in jeff_media

#

33*

shadow night
#

Imagine having to change each _ to - by hand

tender shard
#

at least the package names won't change

shadow night
#

Imagine if you had to change each of them

mortal hare
#

im currently working on my own lightweight command api. It right now supports greedy and literal dynamically registered commands, and it hooks perfectly with bukkit api (you can retrieve plugin command via JavaPlugin.getCommand())

fast merlin
#

hello, im currently making my own fork of spigot, is there any way to set the default amount of ram my spigot will start with or can that only be done by the users arguments

mortal hare
#

im looking for a way to hook into brigadier in the future

#

so that i can color it with types (booleans, strings, floats etc.)

shadow night
tender shard
shadow night
#

As it could be used for malicious purposes

tender shard
#

or your server.jar could start itself using a processbuilder ofc

#

but that's pretty pointless

#

just let the user decide??

mortal hare
shadow night
fast merlin
#

i have this one spigot fork that does it somehow but idk how

#

no idea where i would find it in the code

twilit roost
#

in your start script

tender shard
#

just create a ProcessBuilder that starts java

twilit roost
#

oh you meant this
dunno :D

tender shard
#

or Runtime.exec(...)

mortal hare
#

Why you want this in a first place

tender shard
#

yeah it's a stupid idea

mortal hare
#

hardcoding ram amounts is a disaster waiting to be happen

tender shard
#

i mean we do it in buildtools GUI

#

but that's a different story

mortal hare
#

but why

#

what's the point

#

i guess to prevent heap expanding

tender shard
#

so that buildtools has enough RAM?

mortal hare
#

?

#

but it should expand

tender shard
#

BuildTools GUI runs with your native JDK. But then it starts a subprocess with the appropriate JDK needed for the selected version

tender shard
mortal hare
#

but what's the point of hardcoding ram values, Allocated heap amount should expand with the usage of it, no?

tender shard
#

if you don't specify an amount it uses like only 256mb on some systems and buildtools requires at least 512mb

kind hatch
#

The default value is dependant upon how much system ram you have available, but even then it's not consistent. Having the ability to set the minimum value is only beneficial.

tender shard
umbral ridge
#

who is jeff

tender shard
#

JEFF Media GbR

kind hatch
#

Mappings & Javadocs. Also useful for devs who need specific PRs built.

umbral ridge
#

Ohh

#

nice :D

rare rover
#

anyone have any good YAML libaries?

#

bukkit's is doodoo

tender shard
#

SnakeYAML is fine imho

#

what's the issue with bukkit's yaml stuff?

rare rover
#

it wont write comments

#

and its dumb

#

and yes i need it

tender shard
#

it can write comments just fine

eternal oxide
#

yes it will

rare rover
#

then im doing something wrong

tender shard
#

enable that before loading the file

eternal oxide
#

default is enabled

tender shard
#

ah then nvm

kind hatch
#

Gotta be using 1.18.1+

#

For comments to be saved.

tender shard
#

the main thing that annoys me in spigot's yaml stuff is that it uses path separator stuff

#

that's sometimes annoying if you wanna have dots in key names

rare rover
#

yeahh

tender shard
#
person1.name: "mfnalex"

person1:
  name: "mfnalex"

for bukkit this is the same

eternal oxide
#

you can set the path separator though

tender shard
#

yeah but to what? what if I don#t know which chars the keys will contain

#

can one set it to null?

#

i havent checked

#

nah it can't be null, it always forces you to use a pathseparator

eternal oxide
#

can;t set null

tender shard
#

I mean for 99% of people it's useful to have this separator but sometimes it's annoying

#

but in those cases I just use SnakeYAML directly

#

would be nice if it'd take a Character instead of char so one can just null it to disable this

chrome beacon
#

Configurate uwu

mortal hare
rare rover
#

nah

#

i fixed it

#

thanks tho

tender shard
#

there's too many Configurate versions lol

#

what even is hocon

chrome beacon
#

Human-Optimized Config Object Notation

quiet ice
#

Hocon is nice. It's like JSON but actually accepts comments.
And isn't as bad as YAML

chrome panther
#

I'm trying to use buildtools to get a remapped jar of 1.17 but I'm getting these errors:

org.apache.maven.artifact.resolver.ArtifactNotFoundException: Could not find artifact org.spigotmc:minecraft-server:csrg:maps-spigot-fields:1.17-R0.1-SNAPSHOT

This is how I'm running buildtools:

java -jar ./BuildTools.jar --rev 1.17 --remapped
chrome panther
#

Yes

chrome panther
#

Yes

#

I can give a full log

tender shard
#

oh wait that error is not from buildtools?

chrome panther
#

Well I scrolled up a bit to see it

#

Its an error when buildtools is running, trying to compile

tender shard
#

but does it say Build Success at the very end?

chrome panther
#

No

chrome beacon
#

Ah yeah I read that error wrong

chrome panther
#

Let me send more logs

chrome beacon
#

Try building 1.17.1 instead

tender shard
#

try to run buildtools in a path without a space

chrome panther
#

Oh I didn't think about that

#

it works fine for 1.16 though

#

hm

#

I'm trying it now

chrome panther
tender shard
#

hmm weird, it's working fine for me

#

on both windows and macos

chrome panther
#

I'm on linux

tender shard
#

do you have anything weird in your /etc/hosts ?

chrome panther
#

I've never changed it, I can check though

#

No its normal

chrome beacon
#

Could you send the entire BuildTools log

unborn sable
#

Is there a way to render a beacon beam from a specific block

tender shard
chrome panther
#

No, I haven't made maven changes

chrome panther
#

I haven't installed maven though

chrome beacon
#

Well actually it does depend

chrome panther
#

I forgot about that. I can try to install it and rerun

chrome beacon
#

You could probably use display entities on top of a beacon

#

But the beacon still needs to be there

tender shard
unborn sable
chrome beacon
#

The gate way blocks have their own renderer

chrome panther
#

Thats with the system install of maven though, I wonder if the error is something to do with the built in buildtools maven

#

I could try to run that command with the packaged maven

chrome beacon
tender shard
chrome beacon
#

Also this ^

#

?paste

undone axleBOT
tender shard
#

it's probably too large for paste

#

unless it dies very early lol

chrome beacon
#

It should be fine

chrome panther
#
❯ apache-maven-3.6.0/bin/mvn dependency:get -DgroupId=org.spigotmc -Dversion=1.17-R0.1-SNAPSHOT -DartifactId=spigot-api -Drepo=https://hub.spigotmc.org/nexus/content/repositories/snapshots/
fish: Unknown command. 'apache-maven-3.6.0/bin/mvn' exists but is not an executable file.
tender shard
#

chmod +x mvn

chrome panther
#

I used pastebin

#

Yeah, I chmod +x and it gave build success

tender shard
#

run buildtoosl again with --rev 1.17 --remapped

trail coral
chrome panther
#

I'm going to try to clear buildtools cache and then rerun

tender shard
#

then when it failed, paste your buildtools.log.txt somewhere

chrome panther
#

Okay

unborn sable
trail coral
#

is it mojang magic

young knoll
#

It’s client side stuff

tender shard
civic apex
#

how should i go about making players have different names in tablist and above their heads?

chrome panther
#

Okay its working now! Thanks @tender shard @chrome beacon

calm robin
#

where can i find the documentation for block dig protocollib packet? its not under that name in wiki.vg

chrome panther
#

I'm guessing it was something to do with those files that buildcache puts in CWD

#

and not having maven installed

calm robin
#

protocolManager.addPacketListener(new PacketAdapter(plugin, PacketType.Play.Client.BLOCK_DIG) {

#

this packet

#

i need to cancel the animation associated with it as its causing my vanished players to reveal, cancel the animation while still allowing them to break blocks

unborn sable
#

The animation of what

#

The block breaking or the player breaking it

calm robin
#

the player gets revealed when they left click a block

#

the dont get reveled if i cancel that whole packet

#

but i want them to still be able to break blocks

#

but i dont want them revealed

#

same with eating food, placing blocks, right clicking air with blocks, placing blocks, etc.

unborn sable
#

I’m not that good with spigot but could you set them as vanished on the block break

calm robin
#

they get revealed for a tick when i do that

#

i need to stop this at the packet level

unborn sable
#

Hmm

calm robin
#

but this stuff is syntactically hard

young knoll
#

Can’t you instead just cancel the packet that’s revealing them

#

Whatever that is

calm robin
#

yes

#

im cancelling the break block packet

#

that makes them not reveal

#

but

#

then they cant break blocks

young knoll
#

No like the actual packet that shows them to the client

calm robin
#

yea thats what im trying to do

young knoll
#

I think it’s like

#

ClientboundAddPlayerPacket or something

calm robin
#

no such packet exists

#

im doing

#

PacketType.Play.Client.XXXXX

#

XXXXX is the packetr

#

for client bound

young knoll
#

Ah idk protocollib names

pure dagger
#

i have "teams" and every team has name, maxplayers and list of players in it what would be the best way to store these teams? i would need a hashmap with 2 values. what should i use

grizzled flame
#

so how do hipixel modify their packets so they dont need to be limited to inventory guis like us ?

chrome beacon
#

They still use inventory guis

mortal hare
#

is there any way to disable tab completion for the command label without specifying the permission for it inside command object?

#

i would like to have a predicate instead

#

or smth like that

umbral ridge
#

There would be a way to make an actual working elevator right?
Eg.

Move the whole structure down on (on y axis) and AS SOON as that happens, teleport the player down for 1 axis.. without modifying their looking direction or anything

#

So basically if the player is within the bounds of an elevator structure then he can't leave until the elevator is at the certain y level (elevator levels)

#

This would be possible right

#

I'm kinda thinking of making this for my underground mine shafts for skyblock

flint coyote
#

would be a little less stuttery when using falling blocks and velocity but yes your approach would work, too

umbral ridge
#

For the structure I'd use boundingbox

umbral ridge
flint coyote
#

like sand. You can create every block as a falling block

#

And then they don't have to be on a .0 coordinate but can move freely like an entity

young knoll
#

I would use block displays

umbral ridge
#

hmm

young knoll
#

If you’re in the appropriate version

umbral ridge
#

i'm in the latest

#

always

#

thanks for the ideas i'll think it out

young knoll
#

Invisible shulkers also provide a solid floor the player can stand on

#

That can be at fractions of a block

umbral ridge
#

Btw also, by teleporting the player on y axis for 1 block up or down, I don't have to change their eye location or anything right? So that it wouldnt cause weird glitch issues

#

I could just grab the previous location and modify the y

#

Eg. if they're looking around and while they're teleporting to a new y position, that wont cause any weird glitches

flint coyote
#

yes. Might still be recognizable though

umbral ridge
#

hm

flint coyote
#

That's why you should apply upwards velocity instead

#

or downwards

umbral ridge
#

Yes but would player still be able to move in the elevator and look around then?

flint coyote
#

Look around yes. Moving will make it harder to implement but could work by just changing the y of the current velocity and setting them into active fly (as they can't walk otherwise since theres no blocks beneath them). Falling blocks/display entities aren't solid

flint coyote
#

Maybe something like a tabcompletionevent you can change/cancel?

grizzled flame
#

what's a good tutorial to start coding in spigot rather than looking at the api reference randomly ?

#

yes I looked at the pins

eternal oxide
#

which IDE and do you know java?

flint coyote
#

Probably look at some open source plugins and know about basics like event listeners and command executors (maybe also configs)

grizzled flame
#

intellij idea (no choice) / alledgedly was forced to work with java before while being paid to code but not enough to write java on my resume

eternal oxide
#

lots in there

grizzled flame
#

Like to avoid getting fired Ill code in java but if there is some security implications Id rather a more experienced colleague review/fix it but it should sorta works in production (kinda)

#

like my state is running my code at the moment and I havent been arrested yet

#

that was in netbeans ide though and j2ee. sorry maybe too many details but Im not sure how to answer 'do you know java" accuratly

eternal oxide
#

use the link above to learn how to create a basic plugin. The framework is all you need

#

So long as you understand that, pretty much everything is event driven

flint coyote
#

You just need basic experience in java. No need to be an expert for common plugins

#

If you wanna dive deeper into nms (net.minecraft.server) you will need reflection which is a little advanced but you can do a lot of things without that

eternal oxide
#

yep, ignore anything mentioning nms until you are unable to do what you want via the api

flint coyote
#

Also start coding on 1.20.1 as there's a lot of helpful things compared to legacy versions like 1.8 (that are still used from time to time)

eternal oxide
#

New api is SO much better than previous versions

waxen plinth
#

what's new api wise since 1.16?

eternal oxide
#

profiles

#

displays

#

view renaming

waxen plinth
#

oh yeah displays seem amazing

tender shard
#

chunk PDC

#

world PDC

waxen plinth
#

awesome

#

after all this time it looks like I might actually be coming back to mc development

#

looking like it won't be in java though

#

which I am grateful for

grizzled flame
#

I cant code on 1.20 Im using arclight for a 1.16.5 modpack

#

Barring that I must have ice & fire working, mods that add metal armors, diagonal blocks and a few other things or I quit arclight same with a couple of plugins

quaint mantle
river oracle
#

new ban API

#

Maybe BungeeChat support for everything soon uwu

final monolith
#
living.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 150, 2), true);

The potion effect is applying for just zero seconds, not 7.5 (150 ticks)

#

lol

hybrid sapphire
#

can someone help me with a plugin error

remote swallow
#

?paste it or send a screenshot

undone axleBOT
hybrid sapphire
hybrid sapphire
#

do you know how to fix that

final monolith
hybrid sapphire
#

thats my the code

#

the^

trim lake
#

How you updating .yml files in your plugins? I just want add some thinks to it. I can just post update and say "you need add this or regenerate file". But Im looking for something what will automaticly add thinks and keep the settings in file.

ivory sleet
young knoll
#

Just add any keys that are missing

#

Fairly simple

#

Changing the types or names of existing keys is a bit more complicated

trim lake
#

But, they will need regenerate file

young knoll
#

No?

#

You can update the file with code

#

Based on the new one in your jar

trim lake
#

I have file in .jar and If I change the file, the changes will be not aplied to file in plugins folder.

young knoll
#

Yes that’s why you change the one in the plugins folder

#

If it exists

trim lake
#

I just wanna update the file for plugin folder and add some things

hybrid sapphire
#

is this about what i sent

#

or are you guys having a convo

delicate lynx
#

have a config version system. track what changes based on versions. when the version is old, apply the changes to the file in the plugin folder

ivory sleet
#

isnt it just open event?

hybrid sapphire
#

😭

young knoll
#

Nah vanilla has an advancement trigger that runs when the players inventory changed

#

But we don’t have an event for it

ivory sleet
#

oh

#

yeah just spigot api :)

young knoll
#

Make a feature request

hybrid sapphire
#

can yall help

#

thanks

delicate lynx
#

be patient...

#

what even is your issue

trim lake
delicate lynx
#

you don't need to generate the files for each config version. just write code to update the contents of the file, add things, remove things, etc

hybrid sapphire
#

im patient i was just asking if you guys can help

delicate lynx
#

ok, and what is your problem you need help with?

hybrid sapphire
#

so i compiled this plugin from github

livid dove
#

Ngl inventory change events would change the game for anti duping.

Always wondered why noone didn't set up a bunch of sanity checks to detect when the logic of an inv wasn't followed.

E.g: dupes that don't send inv close packets etc.

It'd be pretty easy for spigot to be like "ayo an inv oprn3d by this player... then it opened again... with no close event... nani the fuck?

hybrid sapphire
#

and im getitng this error

#

this is the github repo

livid dove
#

Also be the change you wanna see ^_^

hybrid sapphire
#

word

young knoll
#

Well if I don’t feel like beating my head against vectors tomorrow

#

Maybe I’ll do this instead

#

It’ll depend what is available when vanilla fires the trigger

#

Maybe

#

I don’t have the code in front of me so I have no idea atm

buoyant viper
livid dove
#

Ngl would be a huge win

#

The inv changes

#

Performance would need to be handled with care tho

ivory sleet
#

how do you mean now?

livid dove
#

The thing they proposing above

ivory sleet
#

I mean its just an event

livid dove
#

For it to work the event would have to record the inventory per change no?

#

That's a lot of snapshots lol

grave lagoon
#

after 1 year i still cant figure out a way to stop items from being put in other containers besides the players inventory, all the "solutions" never work

rare sedge
#

I'm having issues with the new custom world generation API.

    @Override
    public boolean shouldGenerateCaves(WorldInfo worldInfo, Random random, int chunkX, int chunkZ) {
        Bukkit.getLogger().info("Testing");
        return true;
    }
    @Override
    public void generateCaves(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, ChunkGenerator.ChunkData chunkData) {
        Bukkit.getLogger().info("Generating caves for chunk at coordinates: (" + chunkX + ", " + chunkZ + ")");
    }

I can see shouldGenerateCaves being called, but my generateCaves method is never being called. What am I doing wrong/misunderstanding?

#

I know it has to be something obvious which makes it even more frustrating.

sterile axle
#

Gets if the server should generate Vanilla caves.

The Vanilla caves are generated before generateCaves(WorldInfo, Random, int, int, ChunkData) is called.

Only this method is called if both this and shouldGenerateCaves() are overridden.

#

that method declares whether vanilla caves are generated, which happens before generateCaves is called; it does not govern whether generateCaves is called

rare sedge
#

Yes, I included that tidbit to show that I have the world generator setup correctly and generateCaves should be getting called

#

Otherwise, shouldGenerateCaves wouldn't be getting called.

buoyant viper
#

i think it means both shouldGenerateCaves methods

#

oh wait nvm

sterile axle
#

I'm not 100% sure but have you tried not overriding shouldGenerateCaves? I could be wrong but it seems to me that those methods are only to be overridden if you want to delegate to the vanilla generator and not handle that yourself - therefore by overriding shouldGenerateCaves, you are implicitly causing the server not to call your generateCaves implementation and instead letting the vanilla impl do it.

rare sedge
#

If you look at the javadocs, it reads as if you override it to use vanilla generation then have generateCaves called so you can modify it

sterile axle
#

I get that impression from here:

Some aspects of world generation can be delegated to the Vanilla generator. The following methods can be overridden to enable this:
shouldGenerateNoise() or shouldGenerateNoise(WorldInfo, Random, int, int)
shouldGenerateSurface() or shouldGenerateSurface(WorldInfo, Random, int, int)
shouldGenerateCaves() or shouldGenerateCaves(WorldInfo, Random, int, int)
shouldGenerateDecorations() or shouldGenerateDecorations(WorldInfo, Random, int, int)
shouldGenerateMobs() or shouldGenerateMobs(WorldInfo, Random, int, int)
shouldGenerateStructures() or shouldGenerateStructures(WorldInfo, Random, int, int)

#

at the top of the page

#

but I could be wrong 🤷

rare sedge
# buoyant viper

Look at here, "The Vanilla caves are generated before generateCaves(WorldInfo, Random, int, int, ChunkData) is called."

buoyant viper
#

yeah after i sent that i was like wait

sterile axle
#

welp idk ima step out, but hopefully some chunkmaster pops in at some point

rare sedge
#

I really think this should be working as-is, I just don't think this feature is used much because I couldn't find any example code.