#help-development

1 messages · Page 1042 of 1

mortal hare
#

☝️

#

at this point why not just use switch expressions and not pollute interfaces with concrete types, allowing for interfaces exist without concrete types in a first place, making it agnostic to any type it supplies the declarations to

#

am i wrong?

#

imo visitors are a code smell

short drift
#

Talking about code smells, this code is teleporting the players to 0,0,0.

#

And I have no idea why.
AFAIK there should be nothing in there which even can affect the player's position.

torn shuttle
#

text entities don't exist in bedrock right

small current
#

Hello. this is the 1.19.4 code. it defines custom name visible before the custom name itself. but in https://wiki.vg/Entity_metadata#Entity, it shows a different order. if i want to modify the custom name and custom name visibility, which index should i modify?

#

im want to use a packet libarary btw if you wonder why im not using the setCustomName method

slender elbow
#

the order in which they are added to the SynchedEntityData is not the one that matters, but the order in which those DATA_* constants are defined is

#

if you go to where they get assigned, you'll find

protected static final EntityDataAccessor<Byte> DATA_SHARED_FLAGS_ID = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BYTE);
private static final EntityDataAccessor<Integer> DATA_AIR_SUPPLY_ID = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Optional<Component>> DATA_CUSTOM_NAME = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.OPTIONAL_COMPONENT);
private static final EntityDataAccessor<Boolean> DATA_CUSTOM_NAME_VISIBLE = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BOOLEAN);
private static final EntityDataAccessor<Boolean> DATA_SILENT = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BOOLEAN);
// ...
robust ginkgo
#

Is there a better way to not update blocks of a specific type?

#

I really don't know how else I could do it.

dusty totem
#

I solved the problem by simplifying the code and spreading logic between two different events.

tardy delta
#

uhh

trail coral
#

is there a way to make hashmaps put the same input twice? i kinda built my whole plugin around this and i cant recode it all

#

like if i .put() the same key and value in the hashmap that it already has, it just doesnt

slender elbow
#

the old value will be replaced with the new one

trail coral
#

i dont want that

#

i want both values to be there

#

and both keys

#

two seperate entries

slender elbow
#

check out guava's Multimap

trail coral
#

does that work like a sortedmap?

slender elbow
#

if you want it to

trail coral
#

thats not what i meant that just makes 1 key have multiple values

slender elbow
#

sure, that's what you want

#

it's basically a wrapper for Map<K, Collection<V>>, for any kind of Map impl and Collection impl you tell it to use

trail coral
#

i want jt to act normally like if i have name: data in there i want to be able to add the same exact key and value but as a seperate entry

#

like this for example

zeradris=emily is alr in the hashmap, but i can add it again so its

zeradris=emily,
zeradris=emily

#

im making a kill tracker kinda thing

#

same player could kill the same player multiple tines

slender elbow
#

yes, you can do that with a multimap

mortal hare
#

what if you wanted to mod minecraft

#

but god said

trail coral
#

does it act too different to a sortedmap? like am i gonna have to change a lot of things

mortal hare
slender elbow
#

it's literally just a Map<K, Collection<V>>

pseudo hazel
trail coral
#

alr

#

thanks

pseudo hazel
#

and warning means you can ignore it 😎

trail coral
#

you can disable the warning in ide settings i think

#

in eclipse you can disable any warning

slender elbow
#

-Xerror in shambles

dawn flower
#

how would i make it so some players can't see entities glow

echo basalt
#

✨ packets ✨

dawn flower
#

naw fr?

#

i don't want to loop all entities in the player's world every tick and listening for glow packets then cancelling works but it has one flaw

trail coral
#

on packet send or something

#

ive done it with enchantment glint

#

use packetevents but i used protocollib

dawn flower
#

i want to make entities not glow if the player sets a setting, however if they choose not to see entities glow and there's already glowing entities then the already glowing entities wont stop glowing

trail coral
#

entity glow packet

dawn flower
#

the same thing happens if they choose to see glowing for entities then they would have to either rejoin or reload the chunk for them to see already glowign entities

trail coral
#

then youre doing it wrong

#

probably

dawn flower
#

how?

trail coral
#

idk how youre doing it bro

dawn flower
#

it's entity metadata packet insn't it?

dry forge
#

Hello, so I made a ClickAble Message using TextComponents and I wonder why they wont translate HexColors.

Here is the Code:

List<String> messages = msg.getStringList("tpahere.sent-target-messages");
        for (String message : messages) {
            TextComponent textComponent = new TextComponent(ColorUtils.format(message.replace("%player%", requester.getName())));
            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpaccept " + requester.getName()));
            target.spigot().sendMessage(textComponent);
        }

Does anyone have like a colorizer for TextComponents where I can use Hex and ChatColor?

slender elbow
#

I'm assuming you are shoving legacy codes in that new TextComponent?

#

don't do that, use TextComponent.fromLegacy(ColorUtil...)

dry forge
#

Oh thanks

trail coral
#

@slender elbow could you help me with guavas multimap?

#

i dont understand how to make it have a seperate key-value and not just make a key have multiple values

slender elbow
#

why? there is no practical difference

worldly ingot
#

When you use put(), it adds it to the collection

slender elbow
#

^

dry forge
#

TextComponent textComponent = TextComponent.fromLegacyText(ColorUtils.format(message.replace("%player%", p.getName())));

fromLegacyText is a BaseComponent[] and you can't do clickevent on it

slender elbow
#

fromLegacy, not fromLegacyText

worldly ingot
#

Name matches Map#put() but like Emily said earlier, it's equivalent to a Map<K, Collection<K>>, so put() is akin to get(K).add(V)

dry forge
slender elbow
#

oh you're on an old version

worldly ingot
#

You can use the component builder

slender elbow
#

you can pass that array to a new TextComponent

umbral ridge
#

Yes

worldly ingot
#

Yeah that also works

#

new ComponentBuilder().append(TextComponent.fromLegacyText("blah")) and doing your actual event handling through that is probably the preferred way though

short drift
wintry dagger
#

Are there any cuties here who wants to review code

worldly ingot
#
BaseComponent[] message = new ComponentBuilder()
    .append(TextComponent.fromLegacyText("your legacy text stuff"))
    .event(new ClickEvent(
        ClickEvent.Action.RUN_COMMAND,
        "/tpaccept " + requester.getName()
    ))
    .create();

target.spigot().sendMessage(message);
eternal night
#

choco is a cutie, idk if he wants to code review tho

remote swallow
worldly ingot
#

We did. This user is using older API

worldly ingot
short drift
worldly ingot
#

No

#

At least I don't think so

short drift
#

Oh 😨

#

Then how would I, hm, get a meaningless copy which doesn't mutate the original object?

worldly ingot
#
    /**
     * Gets the location this player moved from
     *
     * @return Location the player moved from
     */
    @NotNull
    public Location getFrom() {
        return from;
    }

    /**
     * Gets the location this player moved to
     *
     * @return Location the player moved to
     */
    @Nullable
    public Location getTo() {
        return to;
    }
#

Not copies

short drift
#

😢

worldly ingot
#

You can either .clone() the Locations yourself, or you can turn them into Vectors with toVector()

#

The latter is probably the preferred option tbh

dry forge
short drift
#

Thank for the excellent advice. I think I can take it from here.

dry forge
#

Thank you!

worldly ingot
#

Also, your multiply(1) doesn't do anything 😅

#

normalize() does what you want. Sets the length to 1. Multiplying 1 by 1 will keep it the same

trail coral
#

when i .put() same keys it just adds the value to an already existing key

slender elbow
#

yes, that's literally what you want

trail coral
#

you said i could make it so its just a seperate entry

worldly ingot
#

Yeah but in a Multimap the value is a collection

trail coral
slender elbow
#

practically it's the same behaviour

#

why does it matter

trail coral
#

dude

slender elbow
#

stop calling me dude lmao

short drift
trail coral
#

its not the same thing

short drift
#

Dudette.

trail coral
#

if it wasnt possible why did you direct me to it

worldly ingot
#

If you make a ListMultimap that is what you want, yes

slender elbow
trail coral
#

you said i could do what i wanted not "practically do the same thing"

slender elbow
#

how is it different

trail coral
#

im using it for something different i need it to register the keys and values seperately

slender elbow
#

that doesn't tell me anything

river oracle
slender elbow
#

sure? a Multimap basically does that, practically it's the same thing

trail coral
#

I DONT NEED IT TO BE PRACTICALLY THE SAME I NEED IT TO BE THE SAME

slender elbow
#

chill the fuck out

trail coral
#

you said it was the same not "practically does the same thing"

slender elbow
#

again, why does it matter?

#

you aren't telling me why it matters

trail coral
#

Because then i would need to explain my whole plugin concept and its not relevant

#

i have a hashmap that has 5 maximum entries

slender elbow
#

okay then multimap is not for you, and neither is a java map

trail coral
#

and when you add an entry a entry comes out

slender elbow
#

go figure out your own solution lol

worldly ingot
trail coral
#

i want it to be seperate

slender elbow
#

why

worldly ingot
#

Then you want a List of pairs

trail coral
#

Zeradris=Emily,Zeradris=Emily

#

i want a sortedmap of String,String

#

that can accept 2 of the exact same keys and values

#

and not overwrite anything

#

just add to it

remote swallow
#

ngl

#

?xy

undone axleBOT
worldly ingot
#

Instead of a Map.Entry you can use either a Pair or some other object that holds two strings

#

You can't easily look those up though

slender elbow
#

i mean you can get the Collection<Entry<K, V>> from a multimap

#

and they "are" "separate entries"

trail coral
#

i need to access them and key/value basically everywhere

mortal hare
#

is there any better way than visitor design pattern to decouple part of your code for generic types

slender elbow
#

okay, so, get(key), what would that return?

trail coral
mortal hare
#

switch expressions doesnt work really with generics

worldly ingot
#

Yep, Emily's correct about that as well

trail coral
slender elbow
#

which entry would get(key) return?

#

cuz there are multiple

young knoll
#

Both!

#

New class, QuantumValue

worldly ingot
#

oh no

#

Don't give them ideas

slender elbow
#

it picks one at random :pepelaugh:

trail coral
#

doesnt matter to me ngl cause i need to access them by index so ise my own function

worldly ingot
#

That's what I was thinking too lol

slender elbow
#

index

#

lmao

trail coral
#

and i dont need it

slender elbow
#

just use a List<Map.Entry<K, V>>

worldly ingot
#

Okay so if you're getting them by index, then a List is fine

trail coral
#

yeah im gonna use a list

slender elbow
#

it won't be sorted unless you explicitly sort it

worldly ingot
#

If you don't want to lookup by name or UUID or anything, List will suffice

trail coral
worldly ingot
#

Heck, maybe even a Queue if you want. Depends on what you're doing

young knoll
#

SortedList incoming

worldly ingot
#

¯_(ツ)_/¯

slender elbow
#

lists are not sorted

#

by definition

trail coral
#

by sorted i mean it keeps the original order of entry

worldly ingot
#

That's fine

slender elbow
#

sorted != ordered

remote swallow
#

this very much seems like a giant xy issue i cannot lie

slender elbow
#

lists are ordered and sequential

river oracle
#

Array lists keep order

trail coral
#

i never said i wanted it to be sorted i said i used a sortedmap

#

alr im gonna use lists then thanks

slender elbow
#

i want a sortedmap of String,String

slender elbow
#

sounds like you said you wanted it to be sorted

mortal hare
#
public interface DataVisitor {
    void visitBoolean(Data<Boolean> data);
    void visitInteger(Data<Integer> data);
    void visitRangedInteger(RangedData<Integer> data);
    void visitColor(Data<Color> data);
}

right now i have visitor design pattern on an object with .accept() method on Data interface. Is there any better way to decouple part of your implementation into another place?

remote swallow
undone axleBOT
trail coral
mortal hare
#

for generics switch expressions do not work, as that would need nasty casting

trail coral
#

literally said that

slender elbow
#

so, sorted

#

and now you said you didn't say you wanted sorted

worldly ingot
#

I think pattern matching accounts for generic types now doesn't it?

river oracle
trail coral
slender elbow
#

🫡

river oracle
slender elbow
river oracle
#

™️

slender elbow
#

like, record patterns, if you have a record Foo<T>(T t), you can't exactly match the type parameter, but the type of the t value

remote swallow
#

""it depends™️"™️"™️

worldly ingot
#

Ah, yeah, not quite to the degree that I thought

slender elbow
#

"™️" sure looks like something

remote swallow
#

literally

worldly ingot
#

™️

young knoll
#

Soon™️

#

Wait no hypixel has that trademarked

#

Fuck now imma get sued

slender elbow
#

so if you have something like record Foo<T>(String idk) it's useless lol

worldly ingot
#

I don't think anyone has that trademark but it's generally associated with Blizzard, not Hypixel

remote swallow
#

same thing

worldly ingot
#

sadge

mortal hare
#

that would be awesome to have, i can mitigate this by checking #Data#getValue(), as it determines the generic type, but in that case nasty casting would need to occur

mortal hare
#

and visitor design pattern right now eliminates all of those problems

slender elbow
#

you could replace the generics with a little bit of inheritance

#

switch (node)
case IntegerData intData -> ...

#

or w/e

mortal hare
#

but that's concrete types

#

i like to hide implementation classes as much as possible

slender elbow
#

do you have any type identification information besides the generic?

#

some Type enum or whatever

mortal hare
#

no

slender elbow
#

then add some lol

#

it's gonna look ugly otherwise

mortal hare
#

tbh this is not even for the spigot/paper

#

this is fabric clientside mod

#

so im working with native minecraft code mostly

young knoll
#

That doesn’t really make a difference

mortal hare
#

ikr

young knoll
#

Why didn’t anyone tell me Mojang added even more attributes in 1.21

slender elbow
#

i did

#

I sent you a DM

tardy delta
#

data oriented design 💪

young knoll
#

Now you can properly disable movement

#

Since negative jump boost wasn’t perfect

dry forum
#

i found this scoreboard helper on a spigot form but the numbers on the side of the text are negative, any reason why?

https://pastebin.com/c7tKevCr

echo basalt
#

I mean

#

If you want reverse order just do MAX_LINES - list.size

dry forum
#

the numbers start at 6 and go to 15

short drift
#

And I got it working after I did the clone thing.

#

Which is nice.

#

Concentration camp MC here we come.

upper hazel
#

who undestand how work DI can explain smth?

quiet ice
short drift
#

Seems to work very nicely now.

tidal kettle
#

this is how you create a folder right?...

upper hazel
remote swallow
#

new File(JavaPlugin#getDataFolder, "file-inside.yml")

worldly ingot
#

You can simplify your constructor, new File(Bukkit.getPluginsFolder(), "SkyblockPlugins/Schematic"). But if "SkyblockPlugins" is your plugin, then yes, do what Ebic is suggesting instead

#

File(directory, path) is the constructor, saves having to do the string concatenation yourself

quiet ice
shadow night
worldly ingot
#

Because at that point you could just make a single string and all that constructor would be doing is concatenating the strings together

shadow night
#

Yeah but it looks better and then we also don't need to worry about stuff like File.seperator

worldly ingot
#

/ will replace with the file separator

shadow night
#

oh what

young knoll
#

Yeah the file constructor handles that

shadow night
#

damn

robust ginkgo
#

I don't know if I'm supposed to put this here or in #help-server, but how would I build vivecraft with this file structure? I can't find a POM file anywhere.

fleet imp
#

How do the event listeners know which function to call?

remote swallow
quiet ice
robust ginkgo
robust ginkgo
#

everything is local too yay
oh no wait that's the output jar

quiet ice
#

I give you a small tip: If it isn't a maven or gradle project, it's not a project worth considering.
Except perhaps with Ant, but it really depends on the context and you are extremely unlikely to encounter Ant projects in the wild these days

robust ginkgo
#

Were you replying to me?

trail coral
#

my plugin doesnt load because it says spigot.yml is missing, but its there

#

tf is going on

hazy parrot
#

Have u opened the jar to check if is it really there

trail coral
#

its there in my ide

tardy delta
trail coral
#

i just opened the .jar and its there

quiet ice
trail coral
#

plugin.yml sorry

hazy parrot
#

Isn't that spigot configuration file

trail coral
#

i get the name mixed up

#

sometimes

robust ginkgo
# quiet ice yes

Ah! The problem is: the vivecraft devs haven't released a jar file for 1.21/1.20.6, but there are branches for it.

#

That's why I'm looking for it.

#

I always wondered why people put build instructions in their readme.

#

oh amazing

#

of course they left out the gradle files

remote swallow
#

those are the files you are meant to exclude

#

if anything thats a default ij generated gitignore

robust ginkgo
#

huh? aren't projects meant to contain a file for gradle to read?

remote swallow
#

yeah

#

it would be build.gradle

robust ginkgo
#

it's not in the repo, but neither is it in the gitignore

remote swallow
#

the files you should push for gradle are build.gradle(.kts) gradlew gradlew.bat /gradle

#

.gradle contains cached downloads which shouldnt be pushed and /build contains built binaries that shouldnt be pushed

robust ginkgo
#

yeah I just read "gradle" and immediately made assumptions

blazing ocean
#

what does pom mean

#

askin the real questions here

robust ginkgo
blazing ocean
#

oh

robust ginkgo
#

so a DOM but for projects
because html-like

blazing ocean
#

maven sucks ngl

robust ginkgo
#

people really hate the fact that it uses gradle lmfao

#

these PRs are ancient too

short drift
blazing ocean
#

gradle >>> because it uses kotlin

dry forum
#

how would i make text bold using kyori text component

blazing ocean
#

(component.decorate(BOLD))

dry forum
#

k thanks

robust ginkgo
#

So what do I do if a build.gradle file is missing?

#

I think it's because the vivecraft spigot extention is a subproject of vivecraft, which probably has the file.

trail coral
#

is it possible to depend on 2 versions of spigot in maven?

my plugin is 1.16+ but some features are only available in 1.19.4+ because of text displays, how would i go about importing both of those api versions? i know about the res

#

rest*

shadow night
#

Just import 1.19.4?

#

If you use 1.19.4 only features it won't work on 1.16 anyways

trail coral
#

i need to import both apis

shadow night
#

Why tf would you need that

blazing ocean
#

except you don't need to

shadow night
#

It doesn't make sense

trail coral
#

1.16 api version

blazing ocean
#

if you're using text displays

#

you can't use 1.16

trail coral
#

BRO

blazing ocean
#

support*

trail coral
#

its not the main feature of the plugin

shadow night
#

1.19.4 contains everything 1.16 does and everything from 1.19.4 you use will not work in 1.16

blazing ocean
shadow night
trail coral
#

just help me out with what im asking stop trying to change my plugin

blazing ocean
#

you can but should not depend on both

shadow night
#

It makes 0 sense

trail coral
#

elaborate on the modules thing

blazing ocean
#

have one core plugin and a sperate one with the displays

shadow night
#

It doesn't matter how main or not main your feature is it will always require you to use 1.19.4 to use 1.19.4 features

blazing ocean
#

and a shared api

trail coral
blazing ocean
#

no

shadow night
#

It's a 1.19.4 feature

trail coral
#

then why would you say that

#

bro

#

im talking about

blazing ocean
#

no class def found exceptions

trail coral
#

the features that are available in 1.16

blazing ocean
#

you don't understand what he's talking about

#

and no need to be rude

shadow night
trail coral
#

so if i use 1.19 and set the apiversion in 1.16

#

all features that are also in 1.16 will work fine

#

with 1.16+

#

right ?

shadow night
#

yes

blazing ocean
#

yeah no

shadow night
#

besides everything that changed

trail coral
#

rad leave me the fuck alone bro

blazing ocean
#

if you're depending on the 1.19 api you need to use 1.19+

shadow night
blazing ocean
trail coral
trail coral
shadow night
#

You can depend on 1.19 api and as long as you only use 1.8 features it should work afaik

blazing ocean
blazing ocean
shadow night
#

org.bukkit.world.World is always the same

blazing ocean
#

and i'm just tryna help you, if you're ignoring me and telling me to fuck off that's just rude lol

shadow night
#

Just that new methods come

blazing ocean
trail coral
#

im only ignoring you because youre literally trying to change my plugin

shadow night
#

Yep

trail coral
#

im asking one thing and youre just telling me to change everything

#

raydan helped me with what i needed

blazing ocean
#

you literally cannot do what you described KEKW

shadow night
blazing ocean
blazing ocean
shadow night
trail coral
tardy delta
#

gradle moment: gradle folder, build.gradle.kts, gradle.properties, gradlew, local.properties and settings.gradle.kts

#

ffs

shadow night
#

lol

#

Do you have .gradle

tardy delta
#

having the thought of "nahh it cant be that bad" was a mistake

#

AH FUCK I FORGOT THAT ONE

blazing ocean
#

what it's true

shadow night
blazing ocean
#

yea true

tardy delta
#

modern day build scripts should just be a python script lol

blazing ocean
#

i always forget there's other stuff in the gradle dir too lol

remote swallow
#

if you dont push the wrapper ill fight you

tardy delta
#

bun is just js?

shadow night
#

But I use groovy gradle so I'll still be fought

blazing ocean
remote swallow
#

yeah i stab you for that

blazing ocean
#

but they have bun script

#

to run wrappers of native commands

inner vigil
#

Can someone send me a Method how i can change a Nametag from a Player in a Plugin with a Command

tardy delta
#

tf is gradle even doing lol

#

file descriptors, bruh just build my project

#

i clearly havent been using gradle a lot

slender elbow
#

i mean, you don't really need to care about the wrapper scripts, they just spin a daemon and proxy commands to it, is all

tidal kettle
#

with 1.20.6, you can hide this right ?

#

but i forget how to do it, can someone help me 😅

twin venture
#

i that's thats something to do with item nbt?

quaint mantle
#

No it’s cs only

twin venture
#

not sure tho

remote swallow
#

its a new tooltip component

tidal kettle
#

THIS

remote swallow
tidal kettle
#

in theoris, this should work ?

remote swallow
#

yeah

twin venture
tidal kettle
#

don't work

twin venture
#

did you restart?

inner vigil
#
    private void setNametag(Player player, String newNametag) {
        Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();

        Team hideTeam = scoreboard.getTeam("hide");
        if (hideTeam == null) {
            hideTeam = scoreboard.registerNewTeam("hide");
            hideTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
        }

        if (!hideTeam.hasEntry(player.getName())) {
            hideTeam.addEntry(player.getName());
        }

        Team originalTeam = scoreboard.getPlayerTeam(player);
        if (originalTeam != null) {
            originalTeam.removeEntry(player.getName());
        }

        player.setPlayerListName(newNametag);
        player.setDisplayName(newNametag);
        player.setCustomName(newNametag);
        player.setCustomNameVisible(true);

        hideTeam.addEntry(player.getName());

        hideTeam.setPrefix("");
        hideTeam.setSuffix("");
    }

Can someone tell me why this dont work

#
    private void hidePlayerName(Player player) {
        String hideName = plugin.getConfig().getString("Configuration.HideName").replace("%player%", player.getName());
        player.setDisplayName(hideName);
        player.setCustomName(hideName);
        player.setCustomNameVisible(true);

        if (plugin.getConfig().getBoolean("Configuration.ChangeTabName")) {
            player.setPlayerListName(hideName);
        }
        if (plugin.getConfig().getBoolean("Configuration.ChangeNameTag")) {
            setNametag(player, hideName);
        }
    }
elder dune
#

Hey looking to see if anyone knows what the thing is called above the players heathbar is (showing in pictures) as I’m wanting to put a custom message their

remote swallow
#

action bar

inner vigil
#

Actionbar

remote swallow
#

Player#Spigot().sendMessage

elder dune
#

Thank you

twin venture
#

anyone can help me make a centerlized system to load , save , edit (cosmetics)?

#

i finished kits xD

#

now its time for cosmetics :p

echo basalt
#

I feel like you should go back to research if you can't finish a system without asking for help

twin venture
#

allot of questions in my mind

echo basalt
#

too much work to bother helping you

twin venture
#

its just to many ways to do it

#

and i don't want to waste my time to work on a bad way yk

echo basalt
#

That's how you learn

tardy delta
#

how have you still not figured it out? start with a file based smth?

twin venture
#

IK

lime stump
#

How long does it take for a plugin to show up on bstats?

twin venture
#

and i finished it

river oracle
lime stump
#

Because I've been devving this plugin for like a day and it still hasn't showed up on bstats that a server has run it

twin venture
#

now its time for cosmetics , which only have 4 fields , name , type , game_mode , price

hard socket
#

I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?

warped shell
#

kinda stuck with using mongodb, I included

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>5.1.1</version>
        </dependency>```

but i get a ClassNotFoundException for any class I try to use from it

Anyone know whats wrong?
twin venture
#

is this correct way to load them from database?

hard socket
twin venture
#

lets assume i have 10 SKYWARS_WINEFFECT

warped shell
#

its included at runtime

twin venture
#

how would that work :p

warped shell
#

erm compile

#

not runtime

lime stump
# river oracle It refreshes every 30 or so minutes from my experience

Any idea why my plugin might not be showing up on bStats? As far as I can tell, I've shaded in bstats and initialised the id in the plugin

https://github.com/ZepsiZola/ZAutoBroadcast/blob/master/src/main/kotlin/me/zepsizola/zautobroadcast/ZAutoBroadcast.kt

GitHub

AutoBroadcast/AutoAnnounce Paper Minecraft plugin that implements PlaceholderAPI and is compatible with Folia. - ZepsiZola/ZAutoBroadcast

warped shell
#

im following mongodbs website verbatim

warped shell
hard socket
warped shell
#

i make an artifact

hard socket
#

noooo

warped shell
#

i mean i can package it instead

#

is it different?

hard socket
warped shell
#

how is that any different?

hard socket
#

package it

#

artifact is just more work

warped shell
#

lmao

hard socket
#

it works

remote swallow
#

running package compiles with maven

hard socket
#

but you have to add it manualy to ur build

remote swallow
#

using artifacts compiles it with intellijs internal compiler

hard socket
#

packaging adds it directly

warped shell
#

ty

inner vigil
#

Is this correct, because my displayName dont gets changed

warped shell
warped shell
blazing ocean
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.

inner vigil
#

The display Name dont gets changed

hard socket
#

I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?

warped shell
inner vigil
blazing ocean
#

?xy

undone axleBOT
blazing ocean
#
  • you need to use text displays/armour stands if you're trying to set a custom display name
inner vigil
warped shell
#

ye that wont work

blazing ocean
#

doesn't change the name tag

inner vigil
#

ah thanks

blazing ocean
#

the name tag is only affected by scoreboard team prefix/colour/suffix

inner vigil
#

mhhhhhhhhhhhhhhhhh

warped shell
#

textdisplays are simpler for 1.19+

blazing ocean
#

yup, love em

quaint mantle
#

hey was wondering how i could edit and add attributes to an armor piece? whenever i use
ItemMeta#addAttributeModifier() to add the max health modifier it removes all other attributes. im applying this to a netherite chestplate but it can be added to any armor piece.

sullen marlin
#

adding any attributes will remove the default attributes, that's vanilla behaviour

#

you can use Material.getDefaultAttributes or whatever to add them

hard socket
#

I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?

quaint mantle
lime stump
#

Skill issue

#

but bStats can work with kotlin though right?

remote swallow
#

Thats kotlin love and yes it can

wintry elk
sullen marlin
#

?whereami

young knoll
#

The last damage cause is an event

#

Not a player

#

Iirc there’s Player#getKiller

kindred solar
#

I need help guys, I am trying to be able to use CraftPlayer, I have tried a lot of things but I'm not being able to import the necessary things

young knoll
#

?nms

kindred solar
#

I saw a guy on youtube that uses maven but when I try to do it in gradle doesnt work, example, he just removed the "-api" and he was able to use the CraftPlayer, I have tried to remove it on my gradle file like this: compileOnly "org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT" and it simply just doesn't work

young knoll
#

Did you run buildtools

hard socket
#

I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?

kindred solar
kindred solar
# young knoll Did you run buildtools

This is the 1st time im doing this btw, after changing the build.gradle like the blog says it now says: Could not find org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT

stiff grove
young knoll
hard socket
#

Like use json or object

#

Idk

kindred solar
stiff grove
hard socket
young knoll
#

Specifically for that version?

#

If so the spigot dependency should be in your mavenLocal

#

On gradle you need to manually specify mavenLocal as a repository iirc

kindred solar
stiff grove
#

Uh soo I would manage it with the same table, when a player add a friend insert a new row (player, friend), when you need the player list just use a select WHERE player = ?, just be sure to add a check to avoid to add multiple time the same friend

young knoll
#

And you have run buildtools for 1.20.1

lime stump
#
[00:27:49 WARN]: Could not submit stats of Folia
java.io.IOException: Server returned HTTP response code: 429 for URL: https://bStats.org/submitData/server-implementation
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1998) ~[?:?]
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1599) ~[?:?]
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223) ~[?:?]
        at com.destroystokyo.paper.Metrics.sendData(Metrics.java:211) ~[folia-1.20.4.jar:?]
        at com.destroystokyo.paper.Metrics.submitData(Metrics.java:171) ~[folia-1.20.4.jar:?]
        at com.destroystokyo.paper.Metrics.lambda$startSubmitting$0(Metrics.java:99) ~[folia-1.20.4.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
```Getting this error with bStats on my server
kindred solar
#

yes, after that, I created a folder called libs inside my plugin and copied the craftbukkit jar file to there, then I made this on my dependencies inside gradle: compileOnly files('libs/craftbukkit-1.20.1.jar')

young knoll
#

?

#

Depend on spigot and have mavenLocal as a repository

#

You don’t need to do anything silly with jars

ivory sleet
#

yea I mean isnt that dependency just a bootstrap jar anyway

young knoll
#

Yes

ivory sleet
#

so u wont get all the dependencies on ur classpath

kindred solar
#

so, what should I do? it generated me this:

#

and other folders

young knoll
#

I already told you

young knoll
#

spigot is the full server

#

spigot-api is just the api

ivory sleet
#
repositories {
  this.mavenLocal()
}

dependencies {
  this.compileOnly 'the classic spigot dep without api classifier'
}
kindred solar
#

ah ok, I was using mavenCentral

ivory sleet
#

u can layer them, that is declare both :>

lime stump
young knoll
#

Folia is a fork of paper

#

Paper is a fork of spigot

lime stump
#

yeah I know

young knoll
#

Neither are developed by us

kindred solar
ivory sleet
#

yea thats alright

lime stump
young knoll
#

Iirc it checks them in order

kindred solar
#

letsgooo

#

thank you!

young knoll
#

Also if you are using the full spigot dependency you don’t need the spigot repo

kindred solar
#

removing it then

#

thank you once more

#

:D

#

Just another thing, I am not being able to access the class "ServerPlayer", why is that?

#

nevermind, just found, it is EntityPlayer in Spigot mappings

ivory sleet
#

yea goofy mappings

vernal oasis
#

anyone have a good nms guide somewhere?

eternal oxide
#

?nms

golden basin
#

I need a Minecraft plugin where a cactus is located at coordinates ( x=0, y=0, z=0 ). The plugin should prevent the cactus from growing if there are blocks present at the following positions relative to the cactus:

  • ( x=1, y=1, z=0 )
  • ( x=-1, y=1, z=0 )
  • ( x=0, y=1, z=1 )
  • ( x=0, y=1, z=-1 )

In other words, the cactus should stop growing if there is a block directly above and on any of the four sides at the specified locations.

Please provide the necessary code to achieve this functionality, including the main class and the plugin configuration file.

#
package com.shadowcraft.antiautocactusfarm;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class CactusGrowthControlPlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        // Register the event listener
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        // Any necessary cleanup
    }

    @EventHandler
    public void onBlockGrow(BlockGrowEvent event) {
        Block block = event.getBlock();

        // Check if the block is a cactus
        if (block.getType() == Material.CACTUS) {
            // Get the location of the block
            int x = block.getX();
            int y = block.getY();
            int z = block.getZ();

            // Check blocks at specified locations
            boolean shouldCancel = isBlocked(block.getWorld().getBlockAt(x + 1, y + 1, z)) ||
                    isBlocked(block.getWorld().getBlockAt(x - 1, y + 1, z)) ||
                    isBlocked(block.getWorld().getBlockAt(x, y + 1, z + 1)) ||
                    isBlocked(block.getWorld().getBlockAt(x, y + 1, z - 1));

            if (shouldCancel) {
                event.setCancelled(true);
            }
        }
    }

    private boolean isBlocked(Block block) {
        return block.getType() != Material.AIR;
    }
}

This code doesn't work too

wraith delta
golden basin
#

Or atleast the logic behind it?

wraith delta
golden basin
#

yk the cactus farms which use fences, chains or any other blocks so that when a cactus grows it breaks

wraith delta
golden basin
#

We disabled village trading in my server so everyone needs XP to use the enchanting table

wraith delta
#
    @EventHandler
    public void onCactiGrow(BlockGrowEvent e) {
        if (e.getBlock().getType() == Material.CACTUS) {
            e.setCancelled(true);
        }
    }
golden basin
golden basin
#

We don't want that

wraith delta
#

then its not gonna happen.

golden basin
wraith delta
#

if players are enjoying farming why take it away

golden basin
#

not giant auto farms

wraith delta
wet breach
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

golden basin
wet breach
#

?services

undone axleBOT
wraith delta
golden basin
#

It just doesn't work

golden basin
young knoll
#

In the grow event, check if the block it’s growing to has a block on any of the 4 sides

young knoll
#

You may need to just remove the + 1 to the Y in your code

#

Not sure if the block in the event is the source or the target

golden basin
blazing robin
#

Hey guys

#

I have a questions and I wanna upload with my code

#

but the discord text limit spigot

#

which site that I can upload the code?

blazing ocean
#

?paste

undone axleBOT
blazing robin
#

I've tried this to detect player afk with worldguard, But is there better efficient way?

tranquil ferry
#

hey can someone guide me what to do when a dev blames false stuff on you just because you have a similar named guy in your discord ?

#

my plugin is kinda direct competition to his plugin so he blames the 1 star bec as troll review planned by me

#

i asked the guy in my discord with similar name whether he is the reviewer and he said "no". so i doubt the dev is intentionally misguiding the review to made me look bad.

slate surge
#

'

#

ProxyConfig#isIpForward deprecated?

lavish hemlock
#

anyone knows why my start up ends with: Listening on /0.0.0.0:25577?

#

im using bungeecord

sullen marlin
#

what's the question

#

it's telling you that it's listening on all ips at port 25577

wet breach
tranquil ferry
# wet breach why are you concerned with this o.O

he dmed me saying
"Hey, I would appreciate it if you didn't send people to give 1 star reviews to my plugin. I've never given your plugins bad reviews or bad talked them in general and you doing the same is not cool."

wet breach
tranquil ferry
wet breach
#

ok so its all settled, you are not obligated to do anything more then that let alone they should be pleased you even did anything at all 🙂

tranquil ferry
wet breach
#

well its just they have nothing in facts just baseless assumptions

#

therefore it is immature of another to accuse you of something when they have nothing to show for it. However you shouldn't stoop to their level either

#

and you shouldn't hold yourself as being obligated to another either if they haven't done anything to warrant such things

tranquil ferry
#

ye its always this dev who shows up every 3-4 months just to argue a topic

  • previously he joined my support server and tried to dm and promote his plugin in support chat which lead me to ban him
  • he is also accusing me i have copied his ideas and i always have to explain him that "i didnt even know he existed"
  • now he is doing this stuff
wet breach
#

either way, it seems you dealt with it in the mature manner and therefore there is nothing left to do.

wet breach
#

nor do you have any obligations to do anything about what they are doing

tranquil ferry
wet breach
#

if people want to come ask you that is one thing and if you tell them the truth and they don't believe it, that is on them nothing you can do about that

#

hence I don't worry about drama XD

tranquil ferry
wet breach
#

sure, but not everyone is going to like you but you don't need them to anyways

#

as long as you have people that like your stuff and support you, that is all you need

tranquil ferry
#

idk why he feels like this he has 5x the sales then me

wet breach
#

because people are dumb and feel they are owed something lol

tranquil ferry
#

lol

tranquil ferry
wet breach
#

np

river yew
#

?

pliant topaz
#

?tas

undone axleBOT
green prism
#

Oh wait, aren't there InventoryHolders in 1.14?

#

Well, it works for chest inventories but doesn't work for other types of inventories. What do you suggest? What about a 1.14 wrapper that compares titles instead of GUI holders?

green prism
#

Storing (very complex) inventories inside a Map doesn't look like a solid solution

drowsy helm
#

titles and inventory holders are both wrong

green prism
drowsy helm
#

like item animations

#

why not use item arrays

#

instead of whole new invs

green prism
shadow night
#

Well, it will stay the same inventory in this example because of references I think

green prism
green prism
#

thank you buoobuoo 🙂

green prism
blazing ocean
#

imo using an inventory framework is just the best option

#

like IF, interfaces and triumph-gui

green prism
blazing ocean
#

why reinvent the wheel

green prism
#

I need a way to create guis from configs

blazing ocean
#

ok?

#

nothing the existing ones can't do

green prism
#

I'm at 98%, I won't stop but thank you ahah 😛

shadow night
green prism
blazing ocean
#

why use 1.14

#

epic emoji fail

green prism
#

I'm actually trying it in older versions, it's for a premium plug-in

#

I can't create a 1.20 only premium plugin lmao

blazing ocean
green prism
blazing ocean
#

idk?

#

1.20 is the most stable version atm

#

so why not use it

vague topaz
#

is there a way we can remove eating animation for specific items?

blazing ocean
#

about 60% of spigot servers use 1.20+

#

okay almost 70% :p

green prism
blazing ocean
#

ok

green prism
#

ohh I've found it... thank you

blazing ocean
wintry dagger
quiet ice
#

not really

#

1.8 and 1.12 has quite the amount of people remaining

#

whether that is a demographic you want to target is a different question

chrome beacon
#

4.1% running 1.8.8 and 3.7% running 1.12.2

wet breach
blazing ocean
#

yeah

wet breach
#

the majority of all servers are on version 1.20+

blazing ocean
#

using 1.8 in 2024 makes zero sense

wet breach
#

all the rest only account for like 25-30%

wet breach
quiet ice
#

I mean all my plugins are still stuck on 1.18 :p

wet breach
#

1.8 still makes a good choice in terms of making a custom implementation

scarlet gate
#

Just wanted to check, something regarding the particle enum changes is this correct: REDSTONE -> DUST ITEM_CRACK -> ITEM BLOCK_CRACK -> BLOCK and any ideas regarding what BLOCK_DUST, SPELL_MOB and SPELL_MOB_AMBIENT were changed to?

alpine urchin
#

Just one has to deal with exploits in that version.

wet breach
#

I wasn't implying that it should use old protocols

#

just that it makes a good base for a custom implementation

quiet ice
#

but minestom

alpine urchin
#

Yeah sure, but I'm hinting that they need to "patch" them or find plugins that patch these.

#

That are present in 1.8.8.

wet breach
#

if its a custom implementation, all that matters is implementing the protocol, everything else isn't really all that relevant

alpine urchin
#

I see

#

Maybe update that one thing what was that library called

#

again

wet breach
#

but the reason for using 1.8 is that you have some code to work off that isn't quite easy to just make in a day

alpine urchin
#

that had the exploit

wet breach
#

like path finding, world generation etc

alpine urchin
#

ye

wet breach
#

personally if I was making a custom implementation I would switch to something else other then log4j

#

or make my own

alpine urchin
#

xd

#

since the issue

#

you dont trust thema nymore

wet breach
#

I never liked log4j

alpine urchin
#

log5j

#

make ur own

wet breach
blazing ocean
#

slf4j my beloved

quiet ice
#

what's the point of a logging lib if it does not integrate with SLF4J - seriously

blazing ocean
#

🤷

tardy delta
#

Java logger 🤓 ☝️

shadow night
#

What is slf4j for, I think I asked this before but forgot

quiet ice
#

Abstraction layer for logging frameworks

tall dragon
#

a logging api. to unite logging implementations

shadow night
quiet ice
#

There is also JUL (java.util.logging), but we do not talk about that one

shadow night
#

Lol

#

Doesn't bukkit use it

quiet ice
#

Well yes but actually no

blazing ocean
#

they have a custom logger based on slf4j afaik

quiet ice
#

I personally always used the paper-provided SLF4J logger and if that approach is not available I would frequently just create my own SLF4J logger

blazing ocean
#

oh is that a paper thing lmao

#

i hate the fact it just took me 10 min to debug this shit

quiet ice
#

Well spigot's JUL logger forwards for Log4j I believe

balmy coyote
#

Are there any changes in org.bukkit.Material and org.bukkit.inventory.EquipmentSlot for Spigot 1.21 API?
My IDEA can't seem to be able to find them anymore? (Updated just from 1.17 to 1.21)

blazing ocean
#

(advances is a field on a space provider)

#

update IJ

balmy coyote
#

I am already running latest available

blazing ocean
#

make sure you're using j21

quiet ice
#

Clear all caches and restart?

balmy coyote
#

Ah could be the J21 env-key

#

I might've forgot to re-route it

#

Let me look

blazing ocean
#

what

#

check the project jdk

#

and gradle/maven toolchain jdk

quiet ice
#

I mean ideally that is the job of maven or gradle

balmy coyote
#

I don't have installed J21 😂

#

Okay I got it now

#

I am on J17

blazing ocean
#

yeah update

#

1.20.5+ requires j21

balmy coyote
#

Yeah, I completely forgot about that thing. Haven't dealt with API since 1.18

upper hazel
#

This hard return custom skin on offline mode? How I can

#

Nms?

#

Reflection

blazing ocean
#

what

blazing ocean
#

please phrase a proper question

icy beacon
upper hazel
trail coral
#

can you edit textdisplay's text after its creation?

blazing ocean
#

yes

trail coral
#

with setText() right?

blazing ocean
#

yes

trail coral
#

is there a way to save them over a restart?

#

like how do i get a text display reference if i know the coords and shit

#

or what would i do

icy beacon
blazing ocean
#

yes

icy beacon
#

if so you can probably use its uuid

upper hazel
trail coral
#

i can save info about them in a file and then load the info in but i cant really access the textdisplay instance like that

blazing ocean
#

it's just an entity

trail coral
#

i didnt know they were entities

blazing ocean
#

dfu it concernani

trail coral
#

whats dfu

#

ill just save the UUID

icy beacon
#

datafixerupper

#

don't let rad talk about it bc he won't stop

trail coral
#

what does it do lmao

icy beacon
#

no fucking clue

blazing ocean
#

mojang's serialisation lib

trail coral
#

fix ups data i guess

quiet ice
#

DataFixerUpper is rather useful

blazing ocean
#

yeah it really is

trail coral
#

how so

blazing ocean
#

mojang added codecs for almost everything in the game

icy beacon
#

the existence of datafixerupper implies the existence of datafixerlower and databreaker

blazing ocean
#

means you can pretty much serialise every single game object there is

quiet ice
#

Ensures that it does not break across versions

#

Something that is very well possible with bukkit serialization

trail coral
#

wdym serialise

blazing ocean
#

object <-> nbt/json

trail coral
#

ahh

#

no ill just save it like in my own format no?

#

is that bad?

#

like {name, text, uuid, etc}

blazing ocean
#

are you saving it to a config

trail coral
#

in a file yeah

#

should i do it another way?

blazing ocean
#

config file or just a save file

#

for save files or something you can very well use nbt

trail coral
#

data.yml or something like that

#

whats a save file

quiet ice
#

Is it meant to be edited by a human is what we are asking

blazing ocean
#

yep ^

trail coral
#

oh

#

no but i am supposed to update it everytime a certain data changes

#

only i change it

blazing ocean
#

then you can just use dfu

quiet ice
#

then DFU

trail coral
#

can you explain dfu?

quiet ice
#

Paper should expose DFU serialization methods

blazing ocean
#

((CraftTextDisplay) display).getHandle() you should be able to serialise this

blazing ocean
quiet ice
#

Otherwise that

balmy coyote
# blazing ocean 1.20.5+ requires j21

Doesn't seems that to be the case sadly:

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] ****/QuestHive.java:[67,37] cannot find symbol
  symbol:   method getHoneyLevel()
  location: variable beehive of type org.bukkit.block.Beehive
[ERROR] ****/QuestHarvest.java:[47,9] cannot find symbol
  symbol:   class Material
  location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[63,22] cannot find symbol
  symbol:   class Material
  location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[65,21] cannot find symbol
  symbol:   class Material
  location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[65,36] cannot find symbol
  symbol:   variable Material
  location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[70,28] cannot find symbol
  symbol:   variable Material
  location: class deadlykill.toons.QuestHarvest
trail coral
#

in a .yml file?

blazing ocean
#

nbt

trail coral
#

im so confused rn

blazing ocean
#

okay, i'm gonna give you a quick breakdown of DFU

trail coral
#

if the server resets wtf do i do

#

go ahead

quiet ice
undone axleBOT
blazing ocean
#

where are entity codecs

dry forum
#

is it possible to use kyori text component to send players messages

quiet ice
#

yes

#

Under bukkit you need to make use of the bukkit compatibility module though

blazing ocean
#

i cannot find entity codecs

dry forum
#

wdym

#

how would i do that

blazing ocean
#
blazing ocean
#

hm yeah

trail coral
#

@blazing ocean anything on dfus lol

#

i cant find any docs on it either

blazing ocean
#

dfu isn't documented

#

gl

trail coral
blazing ocean
#

there's a documented jd iirc

trail coral
#

just save it normally in my own format or

trail coral
#

how do dfus even work

trail coral
#

like just saving dfus to a file and then turning it back into data?

blazing ocean
#

with dfu you can save nbt to a file and deserialize it yes

#

encodeQuick and decodeQuick are extension functions: ```kt
/**

  • Encodes to a dynamic ops format.
  • Stolen from mcbrawls/codex
    */
    fun <A, T> Encoder<A>.encodeQuick(ops: DynamicOps<T>, input: A): T? {
    return encodeStart(ops, input).result().orElse(null)
    }

/**

  • Decodes from a dynamic ops format.
  • Stolen from mcbrawls/codex
    */
    fun <A, T> Decoder<A>.decodeQuick(ops: DynamicOps<T>, input: T): A? {
    return parse(ops, input).result().orElse(null)
    }
#

it's kotlin but you get the gist of it

trail coral
#

yeah

#

ill look into it

#

thanks

wary harness
#

So I need advise on something stupid

#

I got stuck with so easy thing I think

#

well so

#

PlayerInterectEvent gets called 2 times for main and offhand

#

for each hand once

#

now I got case that player is holding item named banana in both hands

#

I would like to execute code only on one hand

#

in that case

tall dragon
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
wary harness
#

stop

#

take it slow

#

still explaning

#

but in case item is only present in offhand I was to be able to still exetute code

#

but priority would be main if item is in both hands

#

I got code which rund double

#

if same item is held in both hands

drowsy helm
#

write a paragraph then

wary harness
#

so how would I prioritise executing coe only on main hand

drowsy helm
#

you would have to do some sort of delayed runnable which keeps track of each event then executes accordingly

#

or use some sort of cooldown system

#

would probs be easier

wary harness
#

oh yeah coold down could work

#

so it ignors second click

#

thanks

drowsy helm
#

yeah can literally be 1 tick if need be

wary harness
#

yeah grate idea

wary harness
upper hazel
#

how to load a custom player skin if online mode is false

#

reflection? nms

#

where the skin comes from

drowsy helm
#

but it has to be a mojang encrypted one, can't just be a random b64 img

upper hazel
#

Isn't the skin in the player's metadata?

drowsy helm
#

in their gameprofile, yes

icy beacon
#

''t you modify it in playerprofile

drowsy helm
#

oh dang when was that added

upper hazel
#

Where do we get the skin that the player created?

icy beacon
drowsy helm
#

mojang api

drowsy helm
upper hazel
icy beacon
drowsy helm
#

yes it is lol

icy beacon
#

holy fucking shit

upper hazel
#

isn't the skin stored in the client?

#

lol

drowsy helm
#

not in offline mode

upper hazel
#

that is, he literally takes the skin data from the Mozhang website?

#

lol

spare sky
#

Hello, is there event to check what item player put into Inventory?

drowsy helm
upper hazel
#

but this plugin add random skin

drowsy helm
upper hazel
#

Well, there's a player's skin that he created and you need to display it.

#

in offline

#

not random

#

skins

drowsy helm
spare sky
drowsy helm
drowsy helm
#

but there are many edge cases you will have to account for

spare sky
upper hazel
#

that is, you need to use another source to store skins? How can I make the plugin understand that this player skin when he join?

spare sky
#

maybe I am missing something

drowsy helm
#

but it's impossible to convert a png to skin without using mojang servers

spare sky
spare sky
drowsy helm
#

you shouldn't be using InventoryHolder for custom uis

#

does the initial event fire at all?