#help-development

1 messages ยท Page 1725 of 1

acoustic pendant
#

how could i solve this?

paper viper
#

You have to turn it into a string

acoustic pendant
paper viper
#

ChatColor.RED

#

turn that into a string

acoustic pendant
#

with ""?

#

doesn't make sense for me ig

eternal oxide
#

or just .toString()

acoustic pendant
#

oh

#

i got it

#

ty

tender shard
#

get the ItemStack's itemmeta and store, apply the custom model data to it, and set the meta back to the item

#
ItemMeta meta = itemStack.getItemMeta();
meta.setCustomModelData(69);
itemStack.setItemMeta(meta);
#

np

#

what's the error message?

#

it should work fine, unless you are on some ancient API version?

quaint mantle
tender shard
#

also java noobs be like

quaint mantle
#

wtf lol

#

how is intellij allowing that ๐Ÿ˜‚

tender shard
#

Oh it doesn't compile. Better cast it to something

quaint mantle
#

i see that too much in here

#

ClassCastExceptionFactory

tender shard
#

yeah no idea why they always think casting fixes something ๐Ÿ˜„

#

they see red lines in their IDE and think it will work when the red lines are gone

quaint mantle
#
Dog dog = new Dog();
Car car = (Car) dog;
tender shard
#

but after all, intelliJ suggests people to cast stupid things sometime

paper viper
#

and then when you do

#

it will give a big ass fat warning

#

unchecked cast warning

quaint mantle
#

unchecked cast 'Dog' to 'Car'

paper viper
#

if the coder cant even see that, they are stupid

#

lol

tender shard
#

no warnings for me lol

quaint mantle
#

you're living in a parrallel universe

tender shard
#

doesnt even show a warning when running analyze code

paper viper
#

you def changed something in your warning settings then

#

cause i know that its included by default

tender shard
#

but there is no setting about unchecked casts, or at least I dont find it

#

ah found it: Casting to incompatible interface

#

but I just reset the settings and its not enabled by default for me

#

lol no idea

paper viper
#

then ur intellij on crack

#

lol

tender shard
#

it's even the paid version D:

acoustic pendant
#

What am i missing?
Bukkit.getScheduler().runTaskLater( damage.remove(), 100);

#

before damage.remove()

acoustic pendant
#

uh

#

i don't remember the other way

#

so i tried that one

tender shard
#

then check the javadocs

acoustic pendant
#

not the javadocs

#

scheduling

#

ig

eternal oxide
#

?scheduling

undone axleBOT
tender shard
#

runTaskLater's syntax is:

#

runTaskLater(Plugin, Runnable, Long)
or
runTaskLater(Plugin,Consumer<BukkitTask>,Long)

#

so basically

#

insert reference to your main class and wrap your "damage.remove()" inside a lambda, method reference or create a "real" runnable or consumer for it

#

if you don't know what a lambda is, just write this:

Bukkit.getScheduler().runTaskLater(myPlugin, () -> {

}, 100);

and then put the code that should be run later inside the { }. But a better way would be to try to understand what a lambda actually is. I used them for a year without knowing what I'm actually doing lol

#

does anyone have an idea on how I can make this better?

https://github.com/JEFF-Media-GbR/MorePersistentDataTypes/blob/master/src/main/java/de/jeff_media/morepersistentdatatypes/ConfigurationSerializableArrayDataType.java

Right now the constructor takes two classes as input T and T[]. I'd rather have it to only take a T type but how can I get the generic array type of this then?

GitHub

Adds a ton of new PersistentDataTypes to the Bukkit API! - MorePersistentDataTypes/ConfigurationSerializableArrayDataType.java at master ยท JEFF-Media-GbR/MorePersistentDataTypes

#

I love generics but haven't understand on how to get the array class type of a given T

#

I somehow doubt it's even possible

eternal oxide
#

its not due to type erasure at compile time

tender shard
#

sad

#

anyway, thanks, I used to spent hours on that until I settled with this ugly solution

eternal oxide
quaint mantle
#

how to remove the error (I hover over it idk what to do)

unreal quartz
#

?learnjava

undone axleBOT
tender shard
#

do you at least have a class called CustomModelData? ^^

quaint mantle
tender shard
#

so your question is "how can I add custom model data to an item?"

tender shard
#
meta.setCustomModelData(69)
#

don't forget to set the meta back to the itemstack afterwards

quaint mantle
#

a error

#

say add cast to meta

tender shard
#

add cast to what?

#

setCustomModelData expects an integer in like every version that I ever used

quaint mantle
#

I use 1.12.2

#

update

tender shard
#

1.12.2 doesn't even have a setCustomModelData method

quaint mantle
#

aaa

tender shard
#

in 1.12.2 people used dirty workarounds

#

by overriding the texture for certain damage values

quaint mantle
#

so what version 1.13? 1.16?

tender shard
#

1.17.1

#

it's the only supported MC version

#

everything else is history

quaint mantle
#

O_o

#

1.17.1 trash

tender shard
#

yeah... 1.12.2 is so much better with all the missing features

acoustic pendant
#

why this error?

#

i have the instance in the main class

tender shard
#

because DamageIndicator is not an expression

#

it's simply the name of your class

acoustic pendant
#

so, what do i have to put there?

tender shard
#

a reference to an instance of your main class

#

I don't know your main class, so no idea

acoustic pendant
#

private static DamageIndicator instance;

#

this you mean?

tender shard
#

yep

#

didn't I already explain that you yesterday by passing your main instance using constructors?

acoustic pendant
#

yes

tender shard
#

I mean static getters for the instance are also fine, but - you should stick to one thing and not do it like this today and then another way tomorrow

acoustic pendant
#

and i have it

tender shard
#

either always pass a reference to your main class (when you need it), or always use a static getter to retrieve it. mixing both things up is like not very good

acoustic pendant
#

oooh

#

i just realized what i have wrong

#

nvm, sorry

#

ok, so ig this should work?

chrome beacon
#

Yes

tender shard
#

yes

acoustic pendant
#

yes, it does

#

ty ๐Ÿ˜„

tender shard
#

"drink at your own risk" that reminds of something funny I found on quora

#

btw looks tasty lol

quaint mantle
#

ItemFlag.HIDE_ATTRIBUTES

#

use that

#

gets rid of the beetroot thing and the nbt

tender shard
#

they are only shown because of the advanced tool tips

quaint mantle
#

well the beetroot thing at least

tender shard
#

F3+H and they are hidden

#

that is also just the advanced tool tips

quaint mantle
#

๐Ÿ˜ฆ feel like that should be default enabled in creative mode

tender shard
#

HIDE_ATTRIBUTES is for all those "Walking Speed +69%" I think

quaint mantle
#

and the creative category

tender shard
#

go!

quaint mantle
#

just add a bunch to a set

tender shard
#

or just

#

add all effects to a collection and then do Collections.shuffle and get the first 3

quaint mantle
#

just

ivory sleet
#

Collections#shuffle ๐Ÿฅด

young knoll
#

You could also just use the array returned by PotionEffectType.values

quaint mantle
#
<T> T randomElement(Collection<T> collection) {
    if (collection.size() == 0) {
        return null;
    }
    return collection.get(ThreadLocalRandom.current().nextInt(0, collection.size());
}
tender shard
#

or hardcode 999999 possible combinations lol

lavish hemlock
#

I wouldn't use shuffle, personally.

tender shard
lavish hemlock
#

I prefer speed over conciseness in most cases unless it really makes a difference in conciseness.

young knoll
#

Why bother with the lower bound

lavish hemlock
#

But shuffling is much different from generating a random number.

quaint mantle
ivory sleet
#

Cache the array of Enum::values then use a SplittableRandom which yields an integer from 0 to index-1 would be my take (:

lavish hemlock
young knoll
#

In fact when did random get a method that takes a lower bound

tender shard
lavish hemlock
#

the two are very different

#

ThreadLocalRandom is for thread-safe operations as it confines the random instance to the current thread.

young knoll
#

Doesnโ€™t thread local random.current return a standard random

lavish hemlock
#

no

ivory sleet
#

SplittableRandom is a random which can split itself whilst effectively where distribution is similar and randomness is dissimilar.

lavish hemlock
#

it returns a ThreadLocalRandom

tender shard
lavish hemlock
#

current() meaning "current thread"

ivory sleet
#

Thread local random should mostly be avoided

young knoll
#

Ah I always store mine as a regular random

lavish hemlock
young knoll
#

Forgot extending exists

quaint mantle
#

Do yall create a singleton instance when a class takes no parameters

public final class OnlyClassMethods implements Listener {
    public static final OnlyClassMethods INSTANCE = new OnlyClassMethods();

    private OnlyClassMethods() {}

    // Methods
}

like listeners ^

ivory sleet
#

You cannot reproduce a random behavior because the seed of the instance is bound to the thread

ivory sleet
quaint mantle
#

ok

tender shard
#

not when I don't need it elsewhere

#

^^

ivory sleet
#

SplittableRandom works good when it comes to parallelization

quaint mantle
#

can you access threadlocalrandom in a different thread?

tender shard
#

I love how someone just wanted three potion effects and now people are discussing about the (un)reproducable results of random, threadlocalrandom, etc bla bla like they are inventing a new cryptography thing ๐Ÿ˜„

ivory sleet
tender shard
#

yeah, it would be horrible if people would know the exact server startup time to figure out whether they can eat this spider soup or not ๐Ÿ˜„

quaint mantle
#

masterminds

#

why is kite automatically installed to intellij now

tender shard
#

nandgame is frustrating

lavish hemlock
#

but uh yeah in all fairness, Jeff's impl is actually decent

young knoll
#

I always use threadlocalrandom now ๐Ÿ‘€

quaint mantle
#

get off my ide

ivory sleet
lavish hemlock
#

although the fact it converts to array is... concerning

#

and also polymorphic methods exist

quaint mantle
#

is 32 the max parameter size

tender shard
#

I just needed it for exactly this purpose: get random enums etc

#

soooo nothing that would ever contain more like 1000 items

lavish hemlock
#

(fun fact: did you know enums store all their values internally as an array called _VALUES? (at least, iirc that's the name))

tender shard
young knoll
#

You can reflect it too

#

If you really want to

tender shard
#

like I have a list of 1000 strings, to get a random one

#

not just enums

#

just... a random entry from any collection

#

it's not meant for huge collections so I didn't bother to make the performance perfect, I just needed a generic method that worked

lavish hemlock
#

ohh

tender shard
#

but if someone has a suggestion feel free to tell me ^^

lavish hemlock
#

at least, you can't set it

#

there's specific checking for an enum's values array

#

I know this bc I tried to do that myself lol

tender shard
#

why would you want to do that? ๐Ÿ˜ฎ

lavish hemlock
#

expanding the enum's values :)

#

it's useful if you're doing some weird game mod framework shit

tender shard
ivory sleet
#

Maybe with the use of unsafe?

lavish hemlock
#

you'd just have to get the field via getDeclaredField (if possible)

#

then get its offsets from Unsafe

ivory sleet
#

Yuee

lavish hemlock
#

and then set it via Unsafe as well

#

Unsafe directly modifies memory as opposed to reflecting it

lavish hemlock
tender shard
young knoll
#

PlayerConsumeItemEvent

tender shard
#

your item is actually eatable yes?

#

then what @young knoll said

#

are you also on 1.6? o0

young knoll
#

Is it PlayerItemConsumeEvent?

tender shard
#

oh yeah

#

sorry

#

it is

#

I didnt even realize when I googled it

#

btw how do you recognize your custom item?

#

like, how is it different from normal beetroot stews?

#

PersistentDataContainer

eternal night
#

|| watch nalex hook you on pdc ||

#

yes

tender shard
#

@eternal night is already replying lol

eternal night
#

๐Ÿ˜‚

tender shard
#

?pdc

lavish hemlock
#

PDC'd be cool

#

if it weren't so null-unsafe

eternal night
#

the concept of null was the biggest mistake of programming languages to this point

tender shard
#

I always just use getOrDefault

lavish hemlock
#

it has getOrDefault?

#

shit

tender shard
#

yep ๐Ÿ™‚

lavish hemlock
tender shard
#

I love how PDC is like magic to so many people at first but everyone instantly loves it when they know it

eternal night
#

simping for pdc

lavish hemlock
#

mainly bc null was a mistake that cost billions of dollars in damages lol

#

PDC wasn't magic to me

tender shard
#

yeah I'd drink PDC's bath water

lavish hemlock
#

I just understood it as a way of storing data

eternal night
#

tbh null can be handled so much better

tender shard
eternal night
#

rust's Option is pretty fun

tender shard
#

where did you get that from?

#

from the first tutorial?

#

that's outdated

lavish hemlock
tender shard
#

read further

#

the first part explains how it used to be in 1.13

lavish hemlock
#

unless you work with a version of Rust before ? existed

tender shard
#

then use this:

lavish hemlock
#

in which case, have fun unwrapping your presents Options

eternal night
#

how is the first tutorial outdated

#

what

#

it highlights the name chages from the previous API xD

#

read the entire article

tender shard
#

I meant the first part

#

because he instantly went on to use customTag on ItemMeta and then said it's too much reading lol

eternal night
#

:bruh:

tender shard
#

Write what for you? There's literally an example for it in the text ๐Ÿ˜„

#
ItemMeta meta = myItemStack.getItemMeta();
meta.getPersistentDataContainer().set(someNamespacedKey, PersistentDataType.INTEGER, 1337);
myItemStack.setItemMeta(meta);
#

yeah well then

#

do it the disgusting way and check your item's lore to identify your item lol

young knoll
#

Quick, someone get the lore changing plugin

tender shard
#

RetardedAnvil: Adds a random lore from lore-checking plugins to all of your items

#

actually that would be a funny idea for anarchy servers

young knoll
#

This is why you don't check lore

tender shard
#

I'm bored, I'll write a PDCUtils class now

young knoll
#

Write cool PDC types that we don't have

tender shard
#

I already did that

young knoll
#

Very nice

#

I have a Set<String> type

tender shard
#

thx

#

feel free to make a PR, always looking for new data types ๐Ÿ˜„

unkempt peak
#

How are you going to fit that in 1 recipe

#

Also why lol

young knoll
#

A type to convert a location into a single int would be good too

tender shard
young knoll
#

Doesn't work with stack size

#

Gotta use the event

tender shard
#

Oh I thought ExactChoice compares ItemStacks

young knoll
#

Not stack size

tender shard
#

alright

young knoll
#

Everything else afaik though

#

I wish we could do custom RecipeChoices

elder oyster
#

How can I get all the valued entries from the list of items in the config file? I already retrieved the config file with FileConfiguration

items:
  emptyBowl: BOWL
  sword: IRON_SWORD
tender shard
#

then you can do getKeys(false) on that to get a list of all keys

young knoll
#

Then use getKeys

#

I wish the config api had a getMaterial built in

elder oyster
#

Thanks

tender shard
#

I always just use Enums.getIfPresent instead

golden turret
#

im here

#

to

#

repost

#

pls

#

i want to change the speed while the animation is happening

tender shard
#

Or maybe I'm confusing it with something else

golden turret
#

yes

#

but it did not helped a lot

tender shard
#

oh well

#

I just realize

#

I already have a PDCUtils class lol

#

but I marked it deprecated because I didnt lik eit

#

we are all dead serious all the time

young knoll
tender shard
#

so instead of having it null, I want to use just CHEST instead of sth and Enums.getIfPresent does that in one line ๐Ÿ™‚

unkempt peak
#

Are you using an event or adding a ShapedRecipe?

young knoll
#

Gotta do both

#

Event for checking stack size

unkempt peak
#

Ah ok

#

That makes since

#

Sense

#

Lol I'm on my phone

#

Lol

#

Dark red title with red warning might look better

#

What is it for?

tender shard
#

it gives 3 random potion effects IIRC

mortal hare
#

does any of you know how tf handles its own commandmap

#

i've searched the CraftServer DedicatedServer MinecraftServer classes

#

yet the best i found is the console command handling

tender shard
#

do you want to know how it internally works, or just want to register your own new command?

mortal hare
#

internally

#

i already injected the commands i want to make injection more efficient since im wasting some resources rn by creating dummy wrappers

tender shard
#

all I know is that the CommandMap is a private field inside SimplePluginManager called "commandMap"

#

that's everything ๐Ÿ˜„

mortal hare
#

fuck intellij cant search inside decompiled files

ivory sleet
#

do u want to know about the nms or just the craftbukkit impl?

stiff ember
#

Anyone know how to damage a flint and steel?

tender shard
#

then set the damage and set the meta back to your itemstack

stiff ember
eternal night
#

wrong damagable

tender shard
#

Wrong import

eternal night
#

there are two

stiff ember
#

o

#

i see

young knoll
#

Thanks Obama

tender shard
mortal hare
tender shard
#

check org.bukkit.command.SimpleCommandMap

#

oh sorry

mortal hare
#

i think i found something on PlayerConnection class

tender shard
#

I misread

mortal hare
#
    public void chat(String s, boolean async) {
        if (!s.isEmpty() && this.b.getChatFlags() != EnumChatVisibility.c) {
#

got it!

#

PlayerConnection.class

#

3 hours of searching

#

tons of classes

#

finally

#

yep

#
        PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, input, new LazyPlayerSet(this.e));
        this.cserver.getPluginManager().callEvent(event);
#

there's our hook

tender shard
#

quick question: what would you prefer here? Objects.requireNonNull or Validate.notNull, and why? (I can never decide and flip a coin then)

    @Nullable
    public static <T, Z> Z get(@NotNull final ItemStack holder,
                               @NotNull final String key,
                               @NotNull final PersistentDataType<T, Z> type) {
        Objects.requireNonNull(holder.getItemMeta());
        Validate.notNull(holder.getItemMeta());
        return get(holder.getItemMeta(), getKey(key), type);
    }
ivory sleet
#

I use Objects::requireNonNull

mortal hare
#

i use Objects.requireNonNull

paper viper
#

same

tender shard
#

sorry just edit the code

#

meant holder.getItemMeta() not holder

lavish hemlock
#

Validate is smaller visually, but Objects is part of standard library so I just use that

young knoll
#

Just use both

tender shard
#

lol

ivory sleet
#

Validate::nonNull or Preconditions::checkNotNull require their respective libs which is annoying if you're working on something platform independent like both fabric, sponge and minestom

lavish hemlock
#

Architectury?

silent vigil
#

How do I interact with worldguard regions in my plugin?

ivory sleet
#

ya

lavish hemlock
tender shard
lavish hemlock
#

but Architectury works via a combination of platform-dependent and platform-independent

tender shard
#

thx

lavish hemlock
#

you specify a platform-independent API and then make a platform-dependent implementation

paper viper
young knoll
#

One modloader just needs to start supporting the mods for the other :p

paper viper
#

Bukkit is coded ass

ivory sleet
lavish hemlock
lavish hemlock
lavish hemlock
young knoll
#

I've heard forge mods could run on fabric easily enough

ivory sleet
#

without*

lavish hemlock
#

no lol (in response to Coll)

paper viper
#

oh, yea, i didnt know if im late to this. But essentials has this mohist warning

#

im prolly super late lmao

lavish hemlock
#

PW isn't even finished

young knoll
lavish hemlock
#

it's not even close to being finished I believe

ivory sleet
#

oh it only supports forge and fabric though

subtle folio
#

does anyone have any idea why this doesnt run?

public void registerTimers() {
        new BukkitRunnable() {

            @Override
            public void run() {
                System.out.println("This should run every second");
            }
        }.runTaskTimer(this, 0L, 20L);
    }```
 i call registerTimers() in startup
mortal hare
#

Fabric has its own eco system

#

and it doesnt need any compatibility system on top

ivory sleet
lavish hemlock
#

the point of Patchwork is to allow Forge mods to run on Fabric Loader

young knoll
#

At least fabric doesn't spend time freezing registries

subtle folio
mortal hare
#

I adore Fabric

lavish hemlock
#

it is to quench the dying dreams of Forge fanboys who want to use certain Fabric mods

mortal hare
#

I havent used forge in years

tender shard
stiff ember
#

idk why

subtle folio
#

registerTimers();

#

mhm

ivory sleet
#

fabric can suck their useless refactors lol but else its pretty neat

stiff ember
#

oops

mortal hare
#

your code is not thread safe

paper viper
#

are u doing that inside a loop

stiff ember
tender shard
#

whoever just sent the ConcurrentModificationThing:

young knoll
#

A lot of devs won't port to fabric so /shrug

tender shard
#

you were adding to the collection while looping over it

mortal hare
#

ConcurrentModificationException means that you're executing non thread safe code

stiff ember
#

removing but still

#

How else can I do it?

young knoll
#

Need to use iterator for that

tender shard
#

didn't you use something like HashMap.put() inside the screenshot you removed?

lavish hemlock
#

@ivory sleet what refactors are useless

stiff ember
#

that was wrong screenshot

mortal hare
#

how do the exceptions for thread safety work tho now i wonder

tender shard
#

oh

mortal hare
#

who throw and how throws that

lavish hemlock
ivory sleet
stiff ember
#

How else can I remove while iterating?

paper viper
#

iterator

#

or stream

stiff ember
#

e

mortal hare
#

iterator.remove()

#

i think to remove

#

iirc

lavish hemlock
mortal hare
#

could be

tender shard
lavish hemlock
tender shard
#

or simply

YourCollection.removeIf((thing) -> ...);
ivory sleet
#

yeah

paper viper
#

Yeah

ivory sleet
#

but many fabric mod devs use yarn tho

lavish hemlock
#

Yarn is still a nicer set of mappings over MCP imo

paper viper
#

i was about to copy that

tender shard
young knoll
#

MCP is dead anyway

ivory sleet
#

so it is and was a problem still

tender shard
paper viper
lavish hemlock
#

Mojmap is cool but you can't use it if you want support in Fabricord

stiff ember
#

nvm i was wrong

#

im putting and removing

ivory sleet
#

and iirc mojmaps doesnt map param names

young knoll
lavish hemlock
#

Tiny is a decent mapping format

#

although it could be made smaller

young knoll
#

We can mojmap all 3 platforms now

paper viper
young knoll
#

It is truly the future

ivory sleet
#

Using parchments makes mojmaps acceptable

mortal hare
#

tbh i think forge will die someday

ivory sleet
#

but I'd rather just stick with yarn

mortal hare
#

Fabric is good enough and flexible enough to beat forge

ivory sleet
#

in which it becomes a problem due to the random and excessive refactors

forest edge
#

I am trying to kick a player who is logging in if they have not accepted the server resource pack. However, if I try to set a message, it will not work, as if the player is kicked too fast they get an IOException message. I'm pretty sure this is based on ping. One solution would be to kick them a few seconds later (I don't like this, as it still shows them the world around them among other things). What is a better way to deny a player connection if they haven't accepted the server resource pack?

young knoll
#

When you have a project that runs on 3 platforms, using the same mappings is very helpful

ivory sleet
#

yeah true

acoustic pendant
#

?jd

ivory sleet
#

?jd-s :p

undone axleBOT
acoustic pendant
#

That's for me np

lavish hemlock
#

it's also just nice to use the same set of mappings for any of your platforms since it means you don't need to re-learn mappings every now and then lol

paper viper
#

(just reminder)

forest edge
#

On 1.16.5 for now ;/

paper viper
#

but otherwise do what is suggested above

young knoll
#

Before we had to switch between MCP and whatever spigot used

ivory sleet
#

hhe

#

lol

forest edge
ivory sleet
#

apple

acoustic pendant
#

Is it there something related to criticals hits in javadocs?

ivory sleet
#

hmm I think you can calculate whether it is a critical hit or not

acoustic pendant
#

And something related to change how crit hits are executed?

#

I mean instead of jumping like chance or smth like that

young knoll
#

"In melee combat, a critical hit occurs when a player attacks a mob while falling, including while coming down from a jump, but not while jumping up. The attack deals 150% of the attack's base damage (after strength is applied and beforeโ€Œ[JE only] / afterโ€Œ[BE only] enchantments or armor are applied). "

#

Easy enough to replicate, not so much to detect

acoustic pendant
#

But is it posible?

young knoll
#

Hmm

#

Check if they are in the air and have downwards velocity?

acoustic pendant
#

No

#

Check if the Hit is crit

#

And change how the crit is executed

young knoll
#

Not from what I can see

acoustic pendant
#

And change the crit damage

#

Not from what I can see
@young knoll well, so hypixel doesn't use spigot ig

young knoll
#

Hypixel uses a modified version of spigot

acoustic pendant
#

I see

ivory sleet
#

1.7.10 iirc

young knoll
#

And plenty of NMS

acoustic pendant
#

Well i will gather more informaciรณn about crits to see if it is posible

young knoll
#

I remember a dev saying they use the NMS itemstack because the bukkit one has too much overhead

severe marsh
#

How can I obtain number behind two dots? 139:1

young knoll
#

Split on ":" and parseInt

lavish hemlock
#

someone should benchmark the two

ivory sleet
#

I think someone called Auxilor did

severe marsh
#

Yeah but I have only item

young knoll
#

Or don't use the old numeric ids :p

lavish hemlock
severe marsh
#

Then what can I do?

young knoll
#

What is your goal

ivory sleet
golden turret
#

?paste

undone axleBOT
ivory sleet
#

but he left this discord when we got rid of some trolls

lavish hemlock
#

mind sending me his benchmark?

ivory sleet
#

let me see if I can find it

severe marsh
#

Basically I want to obtain item's type and store it in file. In case the item is Yellow wool it will be stored as WOOL and it will need some kind of "byte" to make it yellow.

young knoll
#

getData iirc

#

Or was it like

paper viper
young knoll
#

getData.getData

paper viper
#

they have their own discord btw

#

now

severe marsh
ivory sleet
#

yeah

#

better that tho

young knoll
#

Is that where lax went

golden turret
ivory sleet
lavish hemlock
#

eh that's fine

ivory sleet
#

you might just benchmark it properly

lavish hemlock
#

I just wanna see his code

#

I'm not used to NMS ItemStack so I'm curious to see the differences

#

and whether it actually is faster

ivory sleet
#

still cant find the tests he made Ima ask him sec

severe marsh
#

@young knoll it's working, thanks for help :)

ivory sleet
#

okay so maow he doesnt have it stored but apparently way way faster

young knoll
#

Ludicrous Speed!

ivory sleet
lavish hemlock
#

damn that's cool

ivory sleet
#

did u test?

#

๐Ÿ˜ฎ

lavish hemlock
#

I didn't

#

I still do not know how to use NMS ItemStack lol

ivory sleet
#

oh me neither lol

forest edge
lavish hemlock
#

idk
what is the problem?

#

you've given no error

ivory sleet
#

you havent registered your main class instance as a event listener first and foremost

#

you never yielded an error to console to begin with

#

so no doubt it wont pop up an error

paper viper
#

aiyo

#

dont use main

lavish hemlock
#

he means an uncatched exception

ivory sleet
#

probably lol

#

its fine

vague oracle
#

How can you be charging people money when you canโ€™t even register a listener :/

young knoll
#

As if you have never forgotten to register a listener

lavish hemlock
#

you're under arrest for money

quaint mantle
#

๐Ÿ˜ญ

ivory sleet
#

๐ŸŒ

quaint mantle
#

too drippy ๐Ÿฅถ

young knoll
#

Did ya forget an API version

vague oracle
#

Literally has a store link in the lore

elder oyster
#

Is getStringList("items"); the correct syntax to retrieve this list for a yml file? Or is something wrong with the YAML file itself?

items:
  - emptyBowl: BOWL```
vague oracle
#

And yes I never have itโ€™s the first thing you do :/

young knoll
ivory sleet
#

its a List Map

#

so not a list of strings precisely

elder oyster
#

So for it to be a list it has to be like

items:
- Bowl
```?
young knoll
#

yes

elder oyster
#

Damn, I'm so tired that I didn't even consider that

#

Thanks a lot

torn oyster
#

i need ideas

#

what shall i make

young knoll
#

Beans

torn oyster
#

amazing

#

i will do that

ivory sleet
#

A better version of Vault

torn oyster
quaint mantle
#

all vault is, is a bunch of interfaces

#

none of it is handled by the api itself

torn oyster
#

surprisingly, i have never made an interface

#

never needed to idk

ivory sleet
#

Make it such that we can choose what data type the currency can be, make it also platform independent and a good framework with base classes for making a thread safe implementation

quaint mantle
#

Heya could anyone help me out here. I created a wrapper interface, which is used by both wrapper_12 and wrapper_17

In wrapper_12 there's the following code:

    @Override
    public ItemStack getSkullItemStack() {
        return new ItemStack(Material.SKULL_ITEM, 1 , (short) 3);
    }

and in wrapper_17 the following code:

    @Override
    public ItemStack getSkullItemStack() {
        return new ItemStack(Material.PLAYER_HEAD);
    }

This works well, except when I'm trying to build the jar. Then I get the 'cannot find symbol' error. How do I fix this?

quaint mantle
torn oyster
quaint mantle
#

always

torn oyster
#

lol wit

#

wut

young knoll
#

Listener is an interface

torn oyster
#

o

ivory sleet
#

JavaPlugin serves kind of like an interface sometimes

#

CommandExecutor and TabCompleter also

torn oyster
#

never made one

#

i have used them before though

ivory sleet
#

oh yeah

torn oyster
#

i sorta understand how they work

ivory sleet
#

It's very nice

#

especially in test driven development

mortal hare
#

WTF

#
            if (SpigotConfig.replaceCommands.contains(wrapper.getName())) {
                if (first) {
                    this.commandMap.register("minecraft", wrapper);
                }
            } else if (!first) {
                this.commandMap.register("minecraft", wrapper);
ivory sleet
#

lmao

quaint mantle
#

lol wtf

mortal hare
#

this adds minecraft commands into bukkit commandmap

quaint mantle
#

spigot needs a recode

ivory sleet
#

might be due to decompilation

mortal hare
#

but commandMap returns null for these commands

quaint mantle
mortal hare
#

So command api in NMS is completely overriden

#

even brigadier emulation of vanilla commands is done via bukkit command api

#

it utilizes Bukkit's VanillaCommandWrapper

young knoll
mortal hare
#

to register commands in commandwrapper

lavish hemlock
quaint mantle
#

lol

torn oyster
#

i have a team

mortal hare
#

there's no way to completely use brigadier without using Bukkit Command API

#

sadpepe

quaint mantle
torn oyster
#

i have one

quaint mantle
#

???????

ivory sleet
#

he's the ceo of the team ๐Ÿ’ฐ

lavish hemlock
#

that means you're in the team tho

torn oyster
#

yes

lavish hemlock
#

if you are the owner of a team, you are in the team

torn oyster
quaint mantle
#

what...

torn oyster
#

i manage them

lavish hemlock
#

ye

torn oyster
#

and do marketing stuff

lavish hemlock
#

that still means you're part of it

ivory sleet
#

business manager ๐Ÿ˜ฎ

torn oyster
#

yes

lavish hemlock
#

I considered myself part of one of my old dev groups since I was the "Leader"

paper viper
#

Bukkit

#

bukkit itself is a fuckmess

#

Spigot just continued it for support for later versions

quaint mantle
#

yeah bukkit was bad

young knoll
#

Are you volunteering

lavish hemlock
paper viper
#

its not spigot's fault really

ivory sleet
#

PulseBeat_02 I am estimating a full recode in 2 months thanks /s

paper viper
#

Yes

#

Pigot

ivory sleet
tender shard
lavish hemlock
#

who tf are you why are you in here

#

you're not verified

#

git out

#

it is now

tender shard
#

yeah git out or we commit murder

ivory sleet
#

lets all be friends :p

lavish hemlock
#

it's Maow, I changed it like 1-2 years ago

#

unfortunately I don't find spending $10 to change a username a worthy usage of my money

ivory sleet
#

I could change it but I doubt Im allowed to on my own

#

(in the dicord at least that is)

torn oyster
#

iโ€™m gonna go clean up my discord server list lol

ivory sleet
#

not if you're verified

lavish hemlock
#

it's $10 to change your Spigot username :p

ivory sleet
lavish hemlock
#

and your Discord nickname must == your Spigot username if verified

paper viper
#

soo close

ivory sleet
#

oooo

paper viper
#

did u do your hacktoberfest

#

conclure

lavish hemlock
#

contributing to open-source repos gives me anxiety

ivory sleet
#

uh pulse

#

sry

ivory sleet
#

I was to lazy this year

#

but I did last year!!!

lavish hemlock
#

too*

ivory sleet
#

thx

paper viper
#

Did u get a shirt

ivory sleet
#

no

#

still pending

paper viper
#

RIP

ivory sleet
#

yeah lol

paper viper
#

lol

young knoll
#

contributing to open-source repos gives me anxiety

muted sand
#

How do big servers like hypixel roll out a plugin update without having to reboot their entire network?

lavish hemlock
ivory sleet
#

they use docker first of all

young knoll
#

Their servers reboot all the time anyway

ivory sleet
#

secondly they dont do it all at once

paper viper
#

they do it gradually

muted sand
#

ohh

paper viper
#

so there are fallbacks

torn oyster
#

wait, there is jdk 17

lavish hemlock
#

he's got:

  • Robotics shit
  • Minecraft-in-Minecraft Fabric mod
  • 3d game that utilizes a Rust-based Vulkan renderer on top of some Kotlin/JVM logic
muted sand
quaint mantle
#

i need a chiropractor

ivory sleet
#

they have many backend servers haappi, in which they only shutdown some at each moment to update those

golden turret
#

hello

ivory sleet
#

greetings

golden turret
#

im using the configuration serialization api

#

but when im trying to get an object

#

it is returning null

ivory sleet
#

Why do u delegate serialization to itself lol

golden turret
#

'-'

mortal hare
#

How Brigadier communication works in Spigot:
โ€ข Craftbukkit implementation completely overrides brigadier parsing from PlayerConnection.class to its own Command API algorithm (PlayerConnection.class)
โ€ข NMS adds commands to brigadier's command dispatcher
โ€ข Whenever server launches, Spigot grabs CommandNode objects from Brigadier's command dispatcher and uses setVanillaCommands() method inside CraftServer.class to wrap those brigadier commands into Bukkit's command objects and add to its own CommandMap (not sure which commandMap contains the vanilla minecraft commands, because the plugin commandmap returns null?)

How Brigadier tab completion works in Spigot:
โ€ข CraftBukkit implementation completely override brigadier tab completion from PlayerConnection.class to its broken tab completion api. Tab completion search algorithm of brigadier is completely disabled, not even implemented. (BukkitCommandWrapper.class)
โ€ข When plugin gets enabled, all of its commands are grabbed from CommandMap via enablePlugins() method iirc
โ€ข Method syncCommands() from CraftServer.class is executed which adds BukkitCommandWrapper brigadier wrappers of bukkit commands to datapackResources command dispatcher.
โ€ข A commands packet is parsed async and sent getting sent via main thread to all players about the new commands. (in CraftServer.class somewhere)
โ€ข Every time the player writes a tab completion packet is sent to the player manually without any brigadier nodes. (Not sure about this, need more info).

This needs change, it just so hacky and feels very strange. They should make some kind of converter for old command api to the brigadier because this api sucks

ivory sleet
#

Maybe a pr?

eternal night
#

Don't you dare suggest a PR

young knoll
#

Bit late for that

paper viper
#

Lynx ur back!

golden turret
ivory sleet
#

it make take a year but I mean :x

ivory sleet
eternal night
#

๐Ÿ˜‚ Seems like a horrible amount of work especially if the community has already figured out/build more frameworks that do a lot of stuff better/the same as brigadier

ivory sleet
#

yeah true

eternal night
#

only real issue is tab completion no? tho I am not too up to date on latest command frameworks

#

e.g. brigadier colouring

ivory sleet
#

Yeah

#

that and suggestions

mortal hare
#

It doesnt use any node system from brigadier at all

ivory sleet
#

and argument tokens

stiff ember
#

Why does this not work?

ivory sleet
#

pretty sure uh what its called

#

commodore

stiff ember
#

Its being called

ivory sleet
#

fixes that

#

dovidas

stiff ember
#

that was big

ivory sleet
#

hehe paste thx

#

?paste

undone axleBOT
ivory sleet
#

or a better bin

mortal hare
ivory sleet
#

idk how fast md-5s invalidates

#

holy

mortal hare
#

this is how every bukkit command is initalized

#

with brigadier

stiff ember
#

not deleting

#

anything

#

at all

#

no errors

mortal hare
#

it doesnt even use run() method

ivory sleet
#

looks hacky

mortal hare
#

it just there as a dummy impl

ivory sleet
#

lol

stiff ember
#

like

eternal night
#

Maybe you could pull a generator API move

stiff ember
#

nothing looks wrong with it

ivory sleet
#

Tazi weird, I mean should delete any flint and steal with the amount of 1

stiff ember
#

oh

eternal night
#

and actually full deperecate the old command framework

stiff ember
#

maybe needs to be 0?

#

because

#

idk

eternal night
#

still rewire it

young knoll
#

No it tries to remove exactly 1 flint and steel

eternal night
#

and just expose brigadiar

stiff ember
eternal night
#

tho brigadiar alaways has the issue of, it is impl detail technically

#

mojang could jank it out next release

#

nothing we can do about it

mortal hare
#

its not that easy, but i was surprised that vanilla commands are actually ran through bukkit command impl

#

i thought it was a separate handling

#

but that explains why /help commands has mojang commands in it

stiff ember
#

e

#

It should be workinggg

ivory sleet
stiff ember
#

i tried 0

#

also no errors

#

but does nothing at all

eternal night
ivory sleet
#

oh yeah true

tender shard
eternal night
#

but yea, open a PR

eternal night
#

grab some feedback from the md_5

ivory sleet
#

the

eternal night
mortal hare
#

the max you could do from this is to create some sort of automatic tab completion generation

lavish hemlock
elder oyster
#

I'm deleting certain items from the world as soon as they are dropped using the following:

if(Boolean.parseBoolean(droppableItemInfo[1])) item.setAmount(-item.getAmount());

Is there a better way to do this, as 1 ghost of the item is visible when dropping

stiff ember
#

there we go

lavish hemlock
#

Brigadier is actually pretty fucking cool

#

although a bit verbose

stiff ember
#

got it working

#

but now how can I make it take less durability if it has unbreaking

mortal hare
#

because node system would be a drastic change for commands in spigot

quaint mantle
#

if everything in java is a pointer, why is storing high memory objects in collections bad? are they copied?

lavish hemlock
quaint mantle
#

im just asking

lavish hemlock
#

ah I see

#

well, it's a strong reference

#

it would only be deleted when the collection is deleted (as that clears up the final strong reference to the object)

#

but if the collection isn't deleted for the lifecycle of the program, then you have that high memory object for longer than you need

eternal night
#

well a lot nicer if the GC cannot remove a UUID compared to a Player with its whole world and chunk data referenced

#

yea

quaint mantle
#

i didnt think about that

lavish hemlock
#

ye

#

unless you're using weak references

quaint mantle
#

like?

lavish hemlock
#

WeakReference

#

basically, the GC ignores WeakReferences

#

if one remains, it will still start collection if no strong references remain

#

there are some collection impls I've seen that use weak references

young knoll
#

The world part of a location is a weak reference

ivory sleet
#

believe soft references may also lose their referents

#

if jvm is running low on on heap mem

#

or smtng

eternal night
#

๐Ÿ™

lavish hemlock
ivory sleet
#

yeah

lavish hemlock
#

and then there's also PhantomReference which is "add reference to reference queue before GC"

ivory sleet
#

yup

lavish hemlock
#

it's meant to be an alternative for finalize

paper viper
#

finalize is a nightmare

ivory sleet
#

since finalize got deprecated due to being somewhat unsafe in some cases

lavish hemlock
#

I believe Cleaner (internal in Java 8, public in Java 9+) provides an abstraction for PhantomReference?

eternal night
#

take that back :gun_fingers:

ivory sleet
eternal night
#

๐Ÿ˜ฆ

#

I should boost this discord

paper viper
#
@Override
protected void finalize() throws Throwable { 
    while (true) { 
        Thread.yield(); 
    } 
} 
#

๐Ÿคก

ivory sleet
quaint mantle
#

this is stored in a Set<Region>, the destroy method would clear the rules, unless clearing the set would delete the object anyways?

#

Set<Region> set;

#

set.clear();

lavish hemlock
#

yeah I believe so

quaint mantle
#

dumb question again

lavish hemlock
#

clear sets all values to null iirc?

quaint mantle
#

i got brainwashed by c++

ivory sleet
#

yeah maow

lavish hemlock
#

(also you can Region extends Closeable if you want to support ARM syntax)

ivory sleet
#

tho I believe

#

TreeMap just sets it root to null or smtng

eternal night
#

I can see maow and conclure as data structure profs in their 60s

paper viper
#

Boomer

ivory sleet
paper viper
#

Boomer alert

#

Conclure ur old af

#

thats proof

eternal night
#

^

ivory sleet
#

arent you as old as me? almost

eternal night
#

maybe a requirement for discord helper

lavish hemlock
#

do you mean that's how you see us now (as in you see us in our 60s) or that's how you'd see us in our 60s?

eternal night
#

how I see you now xD

paper viper
#

#general message

lavish hemlock
#

well

#

you're pretty off

#

I'm 15 lol

eternal night
#

just that I doubt you are 60 xD

#

but the mentality matches

paper viper
#

Conclure I'm old

young knoll
#

Dang kids

ivory sleet
#

poomer

lavish hemlock
#

z o o m e r

paper viper
#

You see

ivory sleet
#

I can see LynxPlay becoming a professional open source maintainer in his 60s :p

lavish hemlock
#

I'll probably be a well-known lang dev in my 60s

#

or dead

quaint mantle
lavish hemlock
#

either of the two work

ivory sleet
#

lol

ivory sleet
paper viper
#

I can see LynxPlay being the next Aikar after being paper mod ๐Ÿ˜ณ

lavish hemlock
mortal hare
#

what's more interesting is that minecraft commands are added to the commandMap later than any plugin's commands

lavish hemlock
#

wait is that legal in newer versions

mortal hare
#

trying to get minecraft commands in onEnable() override would result you getting null

paper viper
#

do you guys remember vipershow?

quaint mantle
mortal hare
#

yea

paper viper
#

what happened to him

mortal hare
#

idk

quaint mantle
#

he lost motivation

ivory sleet
#

so you'd have to queue a defered task that runs after startup then dovidas?

quaint mantle
#

im really only here for the community

lavish hemlock
eternal night
ivory sleet
#

lmao

paper viper
#

oh fuck

ivory sleet
mortal hare
#

vanillaCommands are added to commandMap whenever all of the plugins commands are added

paper viper
eternal night
#

perfect xD

lavish hemlock
#

I'm here for the community (since y'all are more chill than either of the 2 popular modloader communities) and advice (that I shall steal to become Spigot's best paid plugin developer)

ivory sleet
#

oo

eternal night
#

paid plugins ๐Ÿ‘€

ivory sleet
#

thats a big commitment certainly

lavish hemlock
#

ye well

#

I need to get money for vidogams somehow

ivory sleet
#

๐ŸŒ

young knoll
#

Have you considered time travel

paper viper
#

wish we could turn back time

lavish hemlock
#

"yOu ShOuld Be EnJOYinG yOUR yOuth" -Quora

b-but I enjoy programming
being paid to do what I love is enjoying my youth
let me make money too
just give me fucking advice I WANT TO KNOW HOW I CAN MAKE MONEY WHEN I AM NOT OLD ENOUGH TO APPLY FOR A JOB YOU FUCKERS

paper viper
#

to the good old days

lavish hemlock
#

when our mama sang us to sleep

paper viper
#

but now we're stressed out

young knoll
#

But now we have crippling depression

lavish hemlock
paper viper
#

Wake up you need to make money

#

Lol

lavish hemlock
#

WAKE UP, YOU NEED TO MAKE MONEY (yea)

young knoll
#

Hey you, you're finally awake

mortal hare
#

here's the output of the bukkit commandMap

lavish hemlock
young knoll
#

You were trying to make money, along with that thief over there

mortal hare
#

my theories were true ๐Ÿ˜›

ivory sleet
#

dovidas damn so 3 hours investigating this?

mortal hare
#

yes

ivory sleet
#

nicely done

mortal hare
#

thanks

lavish hemlock
#

weather

ivory sleet
#

yeah I did create a thread for this solely

lavish hemlock
#

Minecraft Weather Channel

mortal hare
#

there's really no way to use brigadier properly on spigot

ivory sleet
#

:p in case we need some references

paper viper
#

What's the forecast at time 1200?

lavish hemlock
paper viper
#

^

mortal hare
#

that's the thing

ivory sleet
#

ye

mortal hare
#

you can use it but it would still go through the bukkit

#

command api

lavish hemlock
#

oh I see what you mean

#

y'know the whole Spigot/Bukkit separation is very confusing

mortal hare
#

every command, even brigadier commands are going through bukkit command map

#

my life is a lie

stiff ember
#

Is there a way to keep doing something for as long as the player holds right click?

#

Not just once when they click

paper viper
#

i dont think so

#

but i may be wrong, maybe there is a hack

lavish hemlock
#

does the game send a hold packet?