#help-development

1 messages Β· Page 310 of 1

eager flax
#

fixed it

#

sorry πŸ€¦β€β™‚οΈ

quiet ice
#

does not compute

zinc egret
#
getPlayerGroups(player)
                .map(g -> new Group(this.config, g))
                .sorted(Comparator.comparingInt(Group::getPriority))
                .forEach(
                        group -> group.isWhitelist() ? commands.addAll(group.getCommands()) : commands.removeAll(group.getCommands())
                );

@compact haven you mentioned ternary operators, i thought i'd give it a try

#

unfortanetely...

quiet ice
#

Wrap it up in arg -> { <code goes here> }

compact haven
#

^ that's because addAll and removeAll actually return a boolean

#

and the type is Consumer<Group, Void> or smth similar

quiet ice
#

Just Consumer<Group>

zinc egret
compact haven
#

it can't be a consumer<void>

#

sorry mb, Function<Group, Void>

#

or Supplier<Group>

#

whatever the fuck it is

quiet ice
compact haven
#

LMAO

vale ember
#

its Consumer<Group>

quiet ice
zinc egret
#

not a statement

compact haven
#

yeah I know, I realized after I sent it

quiet ice
#

Consumer takes in the arg and returns void

zinc egret
#

should i assign it to smth?

compact haven
vale ember
#

semicolon

compact haven
#

I know the functional interfaces lol

#

ty tho

zinc egret
compact haven
#

uhm

#

oh you can't use ternary like that

vale ember
#

f*ck java

compact haven
#

ternary is an expression, it should be returning something

#

yeah just don't use ternary in this case my friend

#

but anyways, what is the whole stream?

#

honestly no point in using streams if u have it like that

#

try and engineer it to be 1 whole stream

zinc egret
#

and couldnt find

compact haven
#

walk me through the logical process

crude loom
#

I'm using this method to send a message to a player using ChatComponent API but the API generates a line break between every chat component, how do I cancel it?

 //Sends a message to the player using ChatComponent API
    public static void stringToTextComp(String message,Player recipient){
        ComponentBuilder builder = new ComponentBuilder();
        String[] split = message.split("%");
        for(String s : split){
            if(s.length() == 0) continue;
            TextComponent text = new TextComponent(s.substring(1));
            text.setColor(fromCodeToChatColor(s.charAt(0)));
            text.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/helloworld2"));
            builder.append(text);
        }
        for(BaseComponent textComponent : builder.create())
            recipient.spigot().sendMessage(textComponent);

    }
zinc egret
# compact haven walk me through the logical process
        Set<String> commands = new HashSet<>();
        getPlayerGroups(player)
                .map(g -> new Group(this.config, g)) // cast it to a `Group`, contains fields (name, priority, isWhitelist, commands)
                .sorted(Comparator.comparingInt(Group::getPriority)) // sorts all the groups based on their priority
                .forEach( // loop over the groups, if isWhitelist, add the functions, if not isWhitelist remove them
                        group -> {
                            if (group.isWhitelist()) {
                                commands.addAll(group.getCommands());
                            } else {
                                commands.removeAll(group.getCommands());
                            }
                        }
                );
#

i need a second set to manipulate, rather than the stream

#

unless i can do it recursively maybe lol

#

idk

compact haven
#

comments unnecessary but do need the other stream

zinc egret
#

the plugin im reading the config from, allowes blacklists, whitelists and a priority for each group (so if someone has two or more groups which collide, like one group blacklists the command, but the other one whitelists it, then the priority is taken into consideration)

compact haven
#

well from the code in the ss

#

it seems commands is used not

#

like you manipulate it but the returning stream doesn't use it

zinc egret
#

ohh yeahh

#

because i was still editing it

#

it should be return comands; at the end

#

dammit

#

i forgot to edit it before the build

eager flax
#

how would I check if an item equals this item ItemStack sword = ItemStack unranked = new ItemStack(Material.IRON_SWORD);
ItemMeta unrankedItemMeta = unranked.getItemMeta();
unrankedItemMeta.setDisplayName(ChatColor.RED + "Unranked Queue");
unranked.setItemMeta(unrankedItemMeta);

vale ember
#

item1.equals(item2)

#

if you wanna ignore their amount then isSimilar

tall dragon
#

#isSimilar would be better, applying a pdc tag is even better

quaint mantle
#

Im trying to add org.apache.commons.net.ftp.* to my Eclipse project, and I see what I can add it in plugin.yml under libraries but not sure exactly how to put it there? Does anyone know I can add it in?

compact haven
#

yeah I sure tried @zinc egret, there's no way I can think of to make it 1 stream

#

even with bullshitting some of the functions not meant for it, u cant because a stream is an Iterator internally, and no method allows you to backtrack

last bolt
#

I've made a few of my classes ConfigurationSerializable but when I save them to the default config, my classes are being prefixed in the file with :== my.package.my.Class . Is there any way to stop that happening? They load in fine without that annotation.

remote swallow
#

without it the config doesnt know how to deserialize it

tawdry parcel
#

but you have to pay for citizens right? :C

remote swallow
#

nah

last bolt
tawdry parcel
remote swallow
#

its probably some jank (craft)bukkit internal

remote swallow
#

its their jenkins

tawdry parcel
#

oh lol but why is it on spigot so expensive

remote swallow
#

fuck knows

tawdry parcel
#

ok thank you

topaz cape
#

bump

chrome beacon
zinc egret
#

if i pass YamlConfiguration into one of my commands and then use reloadConfig from another command, it doesnt update the YamlConfiguration i passed to the other command

#

what should i do?

#

pass plugin to the original command, make a reloader config function in the original command class, etc...?

hazy parrot
#

Objects in java are passed by reference, so if you reload configuration you passed trough Di or smth, it will be reloaded

zinc egret
chrome beacon
#

Reloading it would create a new YamlConfig from the file

zinc egret
chrome beacon
#

You can pass the plugin instance instead

#

and use getConfig on that

zinc egret
#

alright πŸ‘ thanks

deft wadi
#

what event should I be listening for when a player tries to open a smoker?

remote swallow
#

interact event

deft wadi
#

ahh makes sense thanks

frank kettle
#

check if the action is right_click_block also

#

πŸ€” wait, what if they use the smoker in the hand

remote swallow
#

they can only right click it as a block

deft wadi
spice shoal
#

guys how i can stop death screen?

pseudo hazel
#

stop in what way

spice shoal
#

on death event

chrome beacon
#

Call the respawn method

#

Make sure to delay it by a tick

spice shoal
#

how much tick?

torpid blaze
#

Hey,
I have a small problem. I made myself a custom ShopItem and ShopItemList class to handle the Items I save in a YML file for my shop Plugin. In the ShopItemList I have an ArrayList I always refresh from the file when calling the constructor.

I thought can now use it and when showing the items an in inventory I change the lore of the items so the price is shown and because I call the constructor nothing is going to be saved until I call the save() Method which I am not calling when just displaying the items.

A a CommandListener I want to be able to add new Items. So when I enter a command, it calls the Constructor and saves it to a variable. Now it adds the Item the admin has in his Hand with a add() method and than calling the save() method to save it to the file.

But now the Problem. When opening the display inventory before adding a new item, to all before added items the lore.

What am I making wrong?

pseudo hazel
#

1 tick

spice shoal
chrome beacon
#

If you're on 1.15+ you can use the doImmediateRespawn gamerule

spice shoal
#

oh pretty nice

#

thx

pseudo hazel
torpid blaze
#

ok, πŸ˜„

#

I have a costum List Handler with some methods to edit the list like add, get, remove, save(). When creating a new Instance of the Handler the List is newly gotten from a yml file. when calling the save() method, it is saved to the file.

Not when the player enters a command I will create a new Instance of the Handler and show him the Items. To display some data I add a lore to the item meta. But this List is not going to be saved.

When the Admin enteres a command, a new Instance of the Handler is created and the item he has in his main hand is added to the list and after that I call the save() function.

#

But now when I look into the file, the lore I added when viewing the items in the inverntory is save eventhough the lists have nothing to do with eachother.

crude loom
#

How do I get the code of a ChatColor?

#

I assume spigot formats it as something like : ChatColor.BLUE +Hello World = %bHello world, how do I get that '%b'?

torpid blaze
#

maybe ChatColor.GREEN.toString()

#

or getChar()

pseudo hazel
#

you use toSTring yes

#

it will return the 'Β§' + code character

crude loom
#

getChar will? or toString?

pseudo hazel
#

ChatColor.toString()

#

assuming you are using bungee version of ChatColor I guess

#

probably bukkits version too

crude loom
#

I see, it's very hard to debug since it doesn't show in chat, is there a way to print the string as color code+text instead of the actual colored text?

torpid blaze
#

System.out.println() would work

zinc egret
#

it doesnt seem to like that i am passing a string to that function

remote swallow
#

dont get how you manage that one

#

when the method is made for a string

pseudo hazel
#

xD

remote swallow
#

you didnt listen to what you were told

crude loom
remote swallow
#

Bukkit.getPluginManager().getPlugin

pseudo hazel
#

yes, I would just save the material names and save/load teh actual items that way

crude loom
zinc egret
zinc egret
echo basalt
pseudo hazel
#

shouldnt you already know your plugin name in your own plugin class πŸ€”

#

or have the plugin instance

#

namely this

torpid blaze
pseudo hazel
#

well then it will also save the additional lore you added

#

is that what you want?

tardy delta
pseudo hazel
zinc egret
# tardy delta i said PluginManager#getPlugin

yes and i actually tried PluginManager#getPlugin(name) thinking it was just something i just hadnt heard of before, but you just meant call getPlugin on an instance of PluginManager

tardy delta
#

thats javadocs notation

tender shard
#

almost

#

it would be String instead of name πŸ˜›

tardy delta
#

im only reading parts of the messages people sent me

torpid blaze
# pseudo hazel is that what you want?

no, It does it but I don't want it to. I don't even know why it is doing it. It seams like one ArrayList in the Handle is shared between multiple Instances of it. I don't want this ether.

I also don't know why he is event saving the lore to the list because I also never want this to happen. everything is broken

tardy delta
#

what will happen when it reaches 24

#

ig it will go to 25

pseudo hazel
#

I think so

#

can you show the code for showing and saving the items?

torpid blaze
pseudo hazel
#

?paste

undone axleBOT
pseudo hazel
#

yes

torpid blaze
#

yea xD

tardy flame
#

These aren't maps

torpid blaze
tardy flame
pseudo hazel
#

how do you know they arent maps

frank kettle
tardy flame
#

They aren't having this animation

frank kettle
#

The panel is exactly like maps are

#

Even the size

tardy flame
#

When you break them

crude loom
#

I'm using String.split to try and split a String containing ChatColor like so:
String[] split = message.split("\\?");
Why am I getting [?aHello World ?eYellow World] (length=1)
On the input : ChatColor.GREEN+"Hello World "+ChatColor.YELLOW+"Yellow World"

tardy flame
#

They also don't hide when you look in other direction

pseudo hazel
pseudo hazel
frank kettle
tardy flame
#

It's vanilla

tardy flame
remote swallow
#

those are maps

frank kettle
torpid blaze
frank kettle
#

so im asking if maybe there's an option for maps

tardy flame
#

Even if it's he is not using it

torpid blaze
#

you try to split at a \ but maybe there is no \

tardy flame
#

I atleast think so

crude loom
torpid blaze
tender shard
#

if you use ChatColor toString, it would use Β§ and not ?

crude loom
tender shard
#

ChatColor doesn't use question marks

#

it uses the section sign Β§

crude loom
#

Oh what

pseudo hazel
#

where do the double // come from

tender shard
tardy flame
#

It works on vanilla

tender shard
#

you should just split by Β§

tardy flame
#

And these aren't maps

pseudo hazel
#

oh I didnt know strings had a ? operator xD

tardy flame
#

The guy killed all entities

tender shard
tardy flame
tender shard
#

String#split(String) takes a regular expression as argument

pseudo hazel
#

oh right java splits on regex oof

#

nvm me then

crude loom
tender shard
#

np! probably your terminal couldnt display UTF8 characters

crude loom
#

I just used system.out.println

quiet ice
#

I am unfamilliar with any way of doing this that doesn't involve maps @tardy flame

quiet ice
#

It is possible that this plugin is just very, very clever, but I highly doubt so

topaz cape
#

https://paste.md-5.net/jacesekise.cpp

Hello PEOPLE, This code is what I use to change what a player looks like into an entity and it has been working nicely in OW
but going to the nether it seems to not work? This is executed on PlayerChangedWorldEvent to refresh both players in Nether and the Player joining Nether and if the disguised player walks in Nether first then refreshed when someone joins him it doesn't work. but it does work when the disguised players joins after other players join. is there any logical explination for this?

torpid blaze
tardy flame
#

Friend of mine did it

quiet ice
tardy flame
#

And they wrote this in skript

#

And they say it is a Minecraft feature from 1.8+

#

That's in the game

#

Using some packets

quiet ice
#

Oh then it is likely maps

torpid blaze
tardy flame
#

It's not

#

Nope

#

Clear vanilla

pseudo hazel
frank kettle
#

send server ip

tardy flame
#

They are using shaders for showcase

quiet ice
#

Just that the maps are a bit different than what you are familiar with

tardy flame
chrome beacon
quiet ice
#

Shaders were not a thing in 1.8

#

At least not in vanilla

tardy flame
#

He said that this block is just a normal block

#

So I assume they render something on them

#

But it can't be map

quiet ice
#

You can overlay a map on it even if the server is not familiar with it

chrome beacon
quiet ice
#

Clientside entities are a thing

pseudo hazel
tardy flame
#

They said that it's not used anywhere else

pseudo hazel
#

so then you are just playing a guessing game?

tardy flame
#

Yeah

pseudo hazel
#

okay

#

sounds like client side maps

#

perhaps

tardy flame
quiet ice
#

Drawing stuff on maps without direct protocol access is a death sentence

#

They defo use maps but do the entire drawing pipeline themselves.

tardy flame
#

Clear vanilla ^

quiet ice
#

Fun fact: this is the reason LWJGL is an optional dependency for minestom

pseudo hazel
#

are the blocks any thicker than the other ones

tardy flame
#

Yeah!!

#

The text is like

quiet ice
#

Then 100% maps

tardy flame
#

Pixel before

tardy delta
#

i wanted to run minestom and then i realized i got exams

pseudo hazel
#

so its maps

tardy flame
#

But it's not maps

torpid blaze
pseudo hazel
#

how is it not maps

quiet ice
tardy flame
#

I have no idea

tardy flame
quiet ice
#

The maps are not on the server

#

But are simply sent directly into the netty pipeline

#

Only the client and plugin knows about them

torpid blaze
tardy flame
quiet ice
#

The datapack wouldn't be able to do anything

topaz cape
quiet ice
#

And maps were changed in 1.8 to be more useful, so it explains his 1.8+ constraint

tardy flame
#

He still says that it doesn't use any maps

quiet ice
#

Any other feature such as shaders would require post-1.14 features

quiet ice
frank kettle
#

yeah he can be just lying to advertise something that doesn't exist

#

wait till he opens server and u can look at it yourself

tardy flame
#

Yeah I will

tardy delta
pseudo hazel
torpid blaze
#

makeing it easier

torpid blaze
tardy delta
#

why not using a List<ShopItem> then?

torpid blaze
#

because I need it in much more classes so it is easier

#

I need it in multiple commands and Listender classes

pseudo hazel
#

a list of shopitems instead of a shoplist isnt gonna fix the issue

#

anyways, where is the lore being used

tardy delta
#

probablt want a Map<ItemStack, ShopItem> then, dunno itemStack::equals impl is good but whatever

pseudo hazel
#

is there like an inventory gui or what

echo basalt
#

those are so fun to code

torpid blaze
#

I display the items in a inventory gui yes

echo basalt
#

those map things

#

there are all kinds of optimizations you can do

pseudo hazel
#

can you show the code for adding those items to the gui, since thats also where you would need to get them from

tardy delta
#

arent you better off with storing a pdc tag in the items itemmeta and then using that to retrieve the ShopItem?

torpid blaze
#

the rest is opening an closing the inventory

#

and the showing is not the problem but saving+

#

now it is working but I still don't know how the items with the lore came in my inventory at the same slots as I had the other before

pseudo hazel
#

well yes but you say thats the only source of the lore these itemstacks must actually be the ones that get saved at some point

#

wait its fixed?

torpid blaze
#

I think so

#

I had the Items with the lore in my inventory and I didn't notise

#

I have no idea how they did get there

#

so I always safed them with the lore from ly hand xD

pseudo hazel
#

lol

torpid blaze
#

yes xD

pseudo hazel
#

you probably at one point forgot to lock the items in the inventory you shown

#

by like not cancelling inventory events

tardy flame
torpid blaze
#

ne, it is a admin view so the item should be given to the admin when clicking on it. but there is still the bug that the lore is given too. But I did never click on an item I think

tardy flame
frank kettle
#

he's not showing it working in that pic tho

quiet ice
pseudo hazel
#

a client map still shows just the model of a 3d map model in the game

tardy flame
#

As the normal map if you look it from an angle you will see that it's bigger than block it's placed in

#

And on this map you don't see it

#

Or whatever this is

#

But it surely doesn't look like map

frank kettle
#

he's not showing it working there tho

atomic swift
#

why doesnt OfflinePlayer have hasPermission

limpid bloom
#

so in my plugin i am setting a block with this code
loc.getBlock().setType(oakLeaves, b);

Context:
Location loc , gotten when method that code is in is called
Material oakLeaves = Material.OAK_LEAVES
boolean b = false

problem is that i am setting the applyPhysics option to false so it doesn't update observers ..... problem is that it's still doing it and i have no clue why

#

most events have an iscancelled method with a boolean return

torpid blaze
limpid bloom
frank kettle
limpid bloom
pseudo hazel
crude loom
#

How do I create a list of type net.md_5.bungee.api.chat.hover.content?

pseudo hazel
#

List<Content>

#

?

#

idk what class is in there

crude loom
#

I mean how do I create the object itself sorry

wise pumice
#

Any NameTag API?? without nametagedit?

crude loom
#

But I can't figure out how to do this

pseudo hazel
#

instance one of its subclasses

#

i.e. Entity, Text, etc

#

since its abstract you cant directly instance it unless you make an anonymous or actual class

crude loom
#

Ahhh I see, how did you get it's subclasses?

pseudo hazel
#

its on the docs

crude loom
#

Oh I see it in the docs, nevermind !

#

Thanks !

dry yacht
# tardy flame

If that's actually a map, it makes use of some orthographic projection to create this feeling of depth. This would be possible, but I don't know whether you can get it to look as good as the game does. It's still a 128x128 canvas. You could tile multiple of them together to create something similar tho.

echo basalt
#

it's basically just a 2d image

pulsar parcel
#

How can I check if player have an advancement?

rotund ravine
undone axleBOT
undone axleBOT
chrome beacon
#

^^

snow compass
#

I try to find out if it client limit, bug in spigot api or how i use it. The problem:

Seams you can't do #undiscoverRecipe() and then #discoverRecipe() that combo only works when player join server not when he is on the server.

The problem is it remove the recipes fine, but when it shall force player to learn it not work so long he is online on the server (it bug out) and if you make the recipe without help of the green book it never get added to the book.

And when google on anything recipe relented, seams like all hate the custom recipe system (no info anywhere). I have try on 1.19.3 and i think this "bug" will persist for long time (seams no one care about fix the recipe api in bukkit/spigot). If that not are intended behaviour.

river oracle
#

I like how I've been using spigot API for 2 almost 2 years now and still have no clue wtf period and delay mean in the Schedulers so I just brute force the numbers until I get the desired result

remote swallow
#

its in ticks

#

for runTaskLater its the delay before it runs

#

20 ticks = 1 second

river oracle
#

yeah I know that

remote swallow
#

runTaskTimer, the delay is before it runs, the period is how often it runs

river oracle
#

okay πŸ™πŸ½ bless

tender shard
#

hello I'm Miles

river oracle
#

What

#

No your Alex

robust zenith
#

Hi everybody guys, is possible to block blocks breaking from tnt explosion but keep damage from those?

#

Sincerely i would do something like that with every type of explosion but i don't know if is possible

stiff knot
#

Hey I'm looking for a specific piece of lore in some ItemMeta but I'm not sure how to do it without causing a NullPointerException, any help?

public void onRightClick(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        List<String> lore = p.getInventory().getItemInMainHand().getItemMeta().getLore();
        if (lore == null) { return; }
        p.sendMessage(lore.get(0));
}
robust zenith
#

try with lore.isEmpty

#

or equals lore.lenght < 0

chrome beacon
#

ItemMeta is null if the item is air

stiff knot
chrome beacon
#

So check if it has item meta before using it

tardy delta
#

item can be null, meta can be null

#

check event#getAction

robust zenith
chrome beacon
#

Better to check if the item has item meta

stiff knot
#

This is the part causing errors so I'm not sure checking it after would really help

chrome beacon
#

Why would you check it after

#

Do it before...

tardy delta
#

1am moment

stiff knot
#

aaauu

tardy delta
#

id better go to bed instead of this nonsense

stiff knot
#

it is infact nearly 1am

#

i'll try it hold on lmfao

tardy delta
#

the docs are your answer to everything

stiff knot
#

yeah i couldn't find as much info as i needed about this lol

#

idk maybe i'm just being dumb

chrome beacon
tardy delta
#

gn man

stiff knot
#

😭

tardy delta
#

? check if it has a meta and a lore

slate coral
#

Can’t cause a null pointer if this is checked before

stiff knot
#

thats what im tryna check in that line?

tardy delta
#

im outta here

remote swallow
tender shard
remote swallow
#
if (!item.hasItemMeta() || item.getItemMeta().getLore().isEmpty()) return;
river oracle
#

No I'm miles you're Alex

tender shard
#

oh ok

stiff knot
#

thats a method?

remote swallow
#

thats a method?

chrome beacon
#

Yes

remote swallow
#

i should know that

#

because ive probably used it

stiff knot
#

well it is but it still causes the same problem

remote swallow
#

ignore it

#

ij isnt very smart

pseudo hazel
#

"ah yes, my boolean function will return null"

stiff knot
#

last time it said it may produce null errors, it did

#

but

#

idk i'll test it

remote swallow
#

if you have the null item meta null check first you wont get it

pseudo hazel
#

I think the error is actually talking about the item meta

stiff knot
remote swallow
#

you need to invert the 2nd

stiff knot
#

oh yeah woops

pseudo hazel
#

if i doesnt have item meta it will fail teh second check doesnt it?

chrome beacon
#

Or should be or

#

Not and

remote swallow
#

that

#

i was just about to say

stiff knot
#

ah right

pseudo hazel
#

okay that makes more sense

remote swallow
#

its too late for our brains to brain

rotund ravine
#

meh it's fine

stiff knot
#

it's still throwing warnings at me but i'll test it anyway

rotund ravine
remote swallow
pseudo hazel
#

and ij probably complains because you dont explicitly check for if the itemmeta is null , but using teh hasItemMeta is good enough

remote swallow
#

it doesnt know that your checking the thing that you use next

stiff knot
#

yeah it worked

#

thanks

#

i only asked because i've had this same issue before and i'm pretty sure my previous "solution" was a try catch block πŸ’€

narrow sphinx
#

Trying to emlulate slow falling but with a boots enchantment, I'm using this code to slow the fall however it also impedes natural horizontal movement. Any suggestions how to improve it?

Vector v = e.getPlayer().getVelocity();
if (v.getY() < -0.3) {
v.setY(-0.3);
e.getPlayer().setVelocity(v);
}

pseudo hazel
#

why not apply slow falling when the player has the boots on

remote swallow
#

you can hide the icon iirc

pseudo hazel
#

and the particles

narrow sphinx
#

It felt cheaty I don't know how to hide the effect

pseudo hazel
#

imo this feels more cheaty

#

i dont remember how to hide the effect but im sure there was a way

stiff knot
#

theres no such thing as cheaty, but thats definitely a much more janky way of doing it

remote swallow
#

then just apply it to the player

sterile token
#

?eclipse

#

It must be a command similar to ?1.8 but for shity Eclipse tho

willow grotto
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

rotund ravine
#

It’s

#

?cc list

willow grotto
#

?cc

rotund ravine
#

Not in here it seems

#

Do it in #bot-commands

nova sparrow
#

What would you use to send text to a player above their hotbar?

rotund ravine
#

?ecosia

undone axleBOT
green tapir
#

how to fix??? the args doesnt work

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.

green tapir
#

oh

rotund ravine
undone axleBOT
worldly ingot
#

I'm shocked your IDE even suggested importing those

green tapir
rotund ravine
green tapir
#

i used intellij

rotund ravine
# green tapir

it's telling u that u are not putting @urban grotto on them not to import stuff

green tapir
#

o

worldly ingot
#

Your command should work fine. The unused imports you have can be removed. If you have to import anything from sun.*, you're probably doing something wrong

green tapir
#

.o.

#

i'll check

faint pumice
#

Hey guys, i always used breakNaturally() method without any problems, but today i was trying to use it with a pressure plate and it didn't work, setType() also didn't work. The objective of the code is to create an explosion after steping on the pressure plate, and that part is working, but after that the pressure plate just stays floating in the air (really don't know how), that's why i'm trying to force it to break or set the type to AIR... The code is super simple:

@EventHandler
public void test(PlayerInteractEvent event) {
    Block block = event.getClickedBlock()
    if(block.getType().equals(MATERIAL.STONE_PRESSURE_PLATE // and some other conditions) {
        block.breakNaturally()
        // do some other stuff, create explosion
    }
}
rotund ravine
#

What happens if u right click it afterwards.

#

it does that by default.

faint pumice
#

Sorry, i didn't think it was relevant, since everything is working except for the breakNaturally part, i'll get the full code

faint pumice
rotund ravine
#

I also need some reassurance that you actually make it to that statament.

faint pumice
faint pumice
faint pumice
#

The logic is inverted on my code, but it behaves the same way. Also i tried putting the breakNaturally method after the explosion but it had no difference

@EventHandler
    public void onStepOnPressurePlate(PlayerInteractEvent event) {
        Block block = event.getClickedBlock();
        if(!event.getAction().equals(Action.PHYSICAL) || !event.hasBlock()
                || !block.getType().equals(Material.STONE_PRESSURE_PLATE)
                || !block.getRelative(BlockFace.DOWN).getType().equals(Material.GRAVEL)
        ) {
            return;
        }

        block.breakNaturally();
        block.getLocation().getWorld().createExplosion(block.getLocation(), EXPLOSION_POWER);
    }
rotund ravine
#

You tried a tick after?

faint pumice
rotund ravine
faint pumice
#

does it make any difference? I'm not a java dev i really don't know

buoyant viper
#

oh god not this again

buoyant viper
rotund ravine
buoyant viper
#

^

rotund ravine
# faint pumice with the bukkit scheduler?
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, 
        () -> {
                block.breakNaturally();
                block.getLocation().getWorld().createExplosion(block.getLocation(), EXPLOSION_POWER);
        }, delayInTicks);
faint pumice
#

Good to know ty

faint pumice
#

Why did i need to wait this 1 tick for it to work?

#

🀨

rotund ravine
faint pumice
#

lol now i don't even need the breakNaturally, the explosion is now breaking the pressure plate

buoyant viper
#

its not not often i get suggested sun classes or even the completely wrong String class

rotund ravine
#

Haven't really had that in ages, though I also have copilot

pulsar parcel
#

I have little problem with HoverEvent. My code is this:
TextComponent message = new TextComponent(ChatColor.GREEN + "[" + "JAJ" + "]");
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Tohle je nΔ›jakej text").create()));

                linkedAdvancement.put(PlayersAll, advancementName);
                PlayersAll.sendMessage(prefix + ChatColor.YELLOW + ChatColor.BOLD + "TvΕ―j advancement je: " + message);

And I am getting result on the picture.

#

Player#spigot is what?

#

I used Player.sendMessage(component);

#

ok

#

I will try it

south skiff
#

Hey. I am spawning a chest with a custom name and want to add items to it.
Somehow this isn't working, can someone help me with it?

        Block chestBlockLocation = chestLocation.getBlock();

        chestBlockLocation.setType(Material.CHEST);

        Chest chest = (Chest) chestBlockLocation.getState();
        chest.customName(Component.text("Β§cMeteorite"));

        locBlock.set(blockX, y2, blockZ).getBlock().setType(chest.getBlock().getType());

        chest.getBlockInventory().addItem(new ItemStack(Material.STONE, 1));
        chest.getBlockInventory().setItem(2, new ItemStack(Material.STICK, 1));

        chest.update();```
#

No errors, but there isn't a item in the chest :o

pulsar parcel
#

One more question, how can I connect two Text components together in one message? Because + doesn't work

#

ok

buoyant viper
#

using paper api but still doing colors the old way 😭

south skiff
#

What exactly do you mean? :D

buoyant viper
#

not even

#

the Adventure components have styling and coloring methods

#

with like NamedTextColor

south skiff
#

What do you mean with that? ^^

#

Oh I see. It's a function that places blocks, everything works fine, only the items are not going in the chest ^^
I can send you the whole method code, if you want :)

#

exactly yes

#

It's spawning, with the name and where I want it, but no items :o

#

Yeah, it's really messy, but I will update it :D

#

It's just so I get an rough idea how I want it to look xD

rotund ravine
#

ew

stone dust
#

Whats the best way to make blocks invisible for a single player, temporarily?

I know i can use sendBlockChange, and store all the blocks, but that seems really inefficent, and doesnt feel ideal.

All ideas are appreciated :)

south skiff
#

Oh wow, thank you ^^

#

didn't knew that I wouldn't need it, don't even know where I got that line of code from :D

#
        chest.customName(Component.text("Meteorite", TextColor.fromHexString("#FF5555")));
        chest.update();

        locBlock.set(blockX, y2, blockZ).getBlock().setType(chest.getBlock().getType());

        chest.getBlockInventory().addItem(new ItemStack(Material.STONE, 1));
        chest.getBlockInventory().setItem(15, new ItemStack(Material.STICK, 1));```
Now it's working :D
Are those Components also used in spigot or is this a paper only thing? ^^
buoyant viper
#

theyre part of paper through Adventure api

#

spigot has its own components but theyre not as integrated with the api yet like paper iirc

south skiff
#

Ah okay good to know, thank you! ^^

river oracle
south skiff
#

Sorry got another completely different question :D
When creating a custom minecraft item, with a custom texture and I want to use CustomModelData what Item is the best choice to use for that. CustomModelData works only on usable items right? So like a carrot on a stick for example or is there a better item to use for it?

river oracle
#

you can use CustomModelData on any item

worldly ingot
river oracle
#

I want to eventually pr changing inventory titles

south skiff
thorny crypt
#

We have an issue where we try to teleport two players to an Area, but when the teleport triggers, that server falls behind and eventually times out the player.
Any ideas?

player.teleport(team.getId() == 1 ? locationA.toBukkitLocation() : locationB.toBukkitLocation());```
hazy parrot
#

what is toBukkitLocation()?

thorny crypt
#

A custom location system

#

When we comment out that line, it works fine

hazy parrot
#

any errors ?

thorny crypt
#

No errors

proven jay
#

@hazy parrot, any ideas?

hazy parrot
#

πŸ€·β€β™‚οΈ

tall dragon
thorny crypt
tall dragon
#

can i see the report ?

tall dragon
tall dragon
# proven jay Yes

yea, cant get much wiser from this. i think you guys will benefit from running a spark profiler

proven jay
tall dragon
#

looks like its stuck loading the chunk

#

looks like ur making some sort of practise pvp plugin

#

you should probably load the chunks beforehand

regal scaffold
#

Hey! I need some help

#

How can I use PersistentDataStorage to store a list of strings and respective ints. I need to create a primitiveDataType but that's the part where I'm completely lost. I can't seem to wrap my head around how this works

regal scaffold
#

I've gotten a fully functional code which allows me to store PersistentData with a string and a int

#

But only 1 element

#

Trying to scale to multiple strings and matching ints

tall dragon
#

so ur storing an object that contains a String and int?

#

and now u want to store a list of those?

regal scaffold
#

Yes, exactly

tall dragon
#

u can just create a custom persistent data type that takes an array of your object

regal scaffold
#

Currently I'm using the PersistentDataContainer.set() method which takes
set(NamespacedKey key, PersistentDataType<T,Z> type, Z value)

And i'm using PersistentDataType.STRING

but

regal scaffold
#

Read this

#

I'm using 2 different keys, since it's only for a single item it's no issue.

example: I'm using string for the name and amount for the amount.

I don't mind using those 2 NameSpacedKeys but I need to be able to string String[] ( or similar ) and int[] ( or similar )

#

Ideally just use 1 key and contain a datatype which has <String[],int[]>

#

but that seems even harder

tall dragon
#

hmm let me write something up for you

regal scaffold
#

Don't put too much into it I like figuring things out this just seems to be way more advanced than what I know

#

Like I've been lost for hours

#

Appreciate it ❀️

tall dragon
#

yea. il just show you how u could do it

wet breach
#

you could make an object accept two arrays

#

not sure why that would be difficult

tall dragon
#

im guessing he wants a key - value thing tho

regal scaffold
#

Well for me it's quite hard at the moment. I'm just having trouble figuring out the PersistentDataType<>

#

I do want a key value

#

String - int

in a list

tall dragon
#

ya

wet breach
#

even if it had to be key value

#

still wouldn't be hard

#

you would use a key that would be easily to tell it belongs for another data

regal scaffold
#

Actually just thought about something now I need another field to add to that

#

Specifically a UUID field

#

Wait let me rephrase that

#

I need a UUID[] String[] and int[] for each

#

I started creating a class to then use as my data

tall dragon
regal scaffold
#

Much rather learn to do it myself than use a lib

#

Although it seems insanely quick

tall dragon
#

fair

regal scaffold
#

I won't give up just yet

tall dragon
#

anyway. one way you can do it. is to create your own Persistent data type

public class SuperCoolPdcType implements PersistentDataType<byte[], SuperCoolObject[]>
{

    @NotNull
    @Override
    public Class<byte[]> getPrimitiveType() {
        return byte[].class;
    }

    @NotNull
    @Override
    public Class<SuperCoolObject[]> getComplexType() {
        return SuperCoolObject[].class;
    }

    @NotNull
    @Override
    public byte[] toPrimitive(@NotNull SuperCoolObject[] src, @NotNull PersistentDataAdapterContext pdac) {
        // convert to byte array
    }

    @NotNull
    @Override
    public SuperCoolObject[] fromPrimitive(@NotNull byte[] bytes, @NotNull PersistentDataAdapterContext pdac) {
        // convert byte array back to array of your custom object
    }
}
regal scaffold
#

Yes that's exactly what I'm doing rn

tall dragon
#

the obj being something like this

public class SuperCoolObject
{
    String string;
    int numba;

    public SuperCoolObject(String string, int numba) {
        this.string = string;
        this.numba = numba;
    }
}

regal scaffold
#

Ok so I'm on the right track

#

Give me 2 minutes if you can!

tall dragon
#

sure

regal scaffold
#

Wait real quick

#

Why not use String[] in the object?

#

And use it in the <byte[], SuperCoolObject[]>

tall dragon
#

i mean. u can but then ur storing an array of your object containing an array of strings

regal scaffold
#

Can I remove it from <byte[], SuperCoolObject[]>?

#

So I only store 1 object?

#

Or is that a bad idea

tall dragon
#

i mean. then u still dont achieve ur goal right?

regal scaffold
#

1 object with arrays of stuff inside

tall dragon
#

then u might as well just store a list of string and a seperate list of integers

regal scaffold
#

1 sec

#
public class ItemInformation {

    private List<String> itemName;

    private List<Integer> itemAmount;

    private List<UUID> playerUUID;

    public ItemInformation(String[] itemName, int[] itemAmount, UUID[] playerUUID) {
        this.itemName = new ArrayList<>();
        this.itemAmount = new ArrayList<>();
        this.playerUUID = new ArrayList<>();
    }```
#
implements PersistentDataType<byte[], ItemInformation>```

@tall dragon
tall dragon
#

uh. but i mean how do you know which amount belongs to which name

regal scaffold
#

That means I can access all 3 lists using just 1 namespacedKey no?

#

Alright so the way it's working is

#

wait I need to clarify this in my own head

#

I'm gonna draw

#

So confusing

#

Alright @tall dragon

#

Apologies for this

tall dragon
#

thats ok

regal scaffold
#

Don't blame the angle

#

I think the way I'm saying it would work

#

In this case the unique identifier for each object would be it's location since no 2 items can be at the same location at the same time

#

Right?

tall dragon
#

prolly better if you first tell me what ur even trying to create

regal scaffold
#

Infinite Storage of 1-9 unique items

#

If you wanna hop in a call I can show you what I've got so far

tall dragon
#

ok

wet breach
#

why do we need pdc?

tall dragon
#

hes storing those items in a "special chest"

wet breach
#

items?

#

So we got items, being stored in a special chest, got it so far

#

and what is the goal?

tall dragon
#

yea bassically hes making a plugin that can store up to 9 different items with unlimited amounts

#

inside a special chest

#

so for example 5k cobblestone

river oracle
#

store pdc on the items to make them infinitely stackable basically overriding the minecraft system seems like best way to do that

tall dragon
#

hes not tryna override the minecraft system tho

#

it should only stack like that inside the chest

wet breach
#

not sure if you are going to get the items to stack like that

tall dragon
#

he just has a menu to take like 64 items and some other options i believe

wet breach
#

oh so now there is a menu involved

tall dragon
#

πŸ˜„

river oracle
#

with amounts above 64 ofc

wet breach
#

if we have a menu why we worrying about pdc again?

tall dragon
#

the point is hes tryna save a material with an amount

#

on the chest

river oracle
#

wouldn't it be best to serialize the ItemStack

wet breach
#

not really

tall dragon
#

not rlly.

#

the chest alrdy has the itemstack

river oracle
#

what if it has custom data

wet breach
#

best way is to just record overall amount and how much has left, subtract from amount being recorded

#

until it reaches 0

river oracle
#

can you add custom menus to chests? I've always serialized the contents of my custom menus

wet breach
#

probably?

#

but personally I wouldn't even use pdc for this though

tall dragon
#

i personally don't rlly like pdc for this kinda stuff either

#

i just use it to tag entities

wet breach
#

I am a very big fan of using DB's lol

#

mainly because I have to use one at some point anyways

#

therefore, why clutter my world files with a bunch of data when I can just use a DB

tall dragon
#

MongoDb baby

#

i hate sql based dbs with a passion

wet breach
#

also, I have been curious

tall dragon
#

mainly because i suck at writing sql

wet breach
#

if a plugin gets removed, does the server know to remove the relevant pdc the plugin created?

tall dragon
#

good question

#

no clue

#

i think it does not remove it tho

wet breach
#

another reason I wouldn't use it then or recommend it

river oracle
#

Frostalf I am making regenerating blocks, and when chunks unload I'm saving the data, rn I am saving the data to the pdc of the block using mfnalex's api, its just 2 long values time left and time saved, would you rec a DB.

wet breach
#

pdc of the block?

#

wouldn't you want it to be stored in the chunk?

tall dragon
#

alex made something that stores it in the chunk

#

automatically

river oracle
#

yeah its like a layer

tall dragon
#

but it only does that if the block type has no pdc or something

#

not sure

river oracle
#

blocks can't actually have pdc. I'm pretty sure the api just adds it to the chunk internally

wet breach
river oracle
#

NBT file?

#

I thought all pdc did was add to NBT data

wet breach
#

yeah, you can store an insane amount of information in an nbt file

#

a file that uses NBT

tall dragon
#

store it in binary PogChomp

wet breach
#

that is what NBT is

#

unless you just mean in actual binary form

river oracle
#

hmmm how would I go about doing that / managing that? never used NBT files before

wet breach
#

Anyways, some years ago I helped someone create a creative control type plugin. It saved all the data of any blocks touched/modified by those in creative

#

anyways, the data was saved using NBT

#

using memory mapping, and about 1GB extra ram to load the file

#

we got it to load 10million blocks of information in about 6 seconds and it saved it in 3 second

wet breach
#

similar to how worldedit uses nbt to create its schematic files

river oracle
tall dragon
river oracle
#

I honestly don't even know much about MC's NBT structure

regal scaffold
#

I'm back haven't been reading

#

I see we're talking about my thing

river oracle
#

nope

regal scaffold
#

oh disregard then

#

Now I'm trying to serialize and deserialize

package me.tomisanhues2.deepstorage.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class ItemInformation implements Serializable {

    private static final long serialVersionUID = 1L;
    private List<String> itemName;

    private List<Integer> itemAmount;

    private List<UUID> playerUUID;

    public ItemInformation(String[] itemName, int[] itemAmount, UUID[] playerUUID) {
        this.itemName = new ArrayList<>();
        this.itemAmount = new ArrayList<>();
        this.playerUUID = new ArrayList<>();
    }

    public List<String> getName() {
        return itemName;
    }
    public List<Integer> getAmount() {
        return itemAmount;
    }
    public List<UUID> getUUID() {
        return playerUUID;
    }
}
wet breach
# tall dragon woulnt just storing a byte array be faster?

it would be about the same. The problem most encounter with say yaml and trying to do the same thing, is that when you memory map the file, the OS has to translate everything into binary which can take some time. NBT is already binary, therefore no translating needs to be done.

river oracle
wet breach
#

look at how worldedit creates schematics

river oracle
#

also where would I store the NBT file just in my plugins data folder

wet breach
#

sure, not sure where else you would want to put it

eternal oxide
#

Why are you messing with NBT if you want to use Structures?

wet breach
regal scaffold
#

Question frost, what's the difference between using PersistentDataType as byte[] and NBTTagCompound

wet breach
#

One is the object type the other is binary form of the type

regal scaffold
river oracle
wet breach
#

well not sure what exactly the benefit would be to using a byte array yourself as opposed to obtaining a NBTTagCompound in regards to PDC since it has its own structured layout. But some advantages however in using a byte array could be, faster reading depending how you loop. You can use bitshifting with byte arrays which can really speed things up if you know what you are doing. They are a smaller memory footprint. All things you really don't need to worry about unless you need to

wet breach
regal scaffold
#

In that case would implementing with NBT be simpler than byte[]?

wet breach
#

probably

#

since the implementation of PDC the backend of it is NBT anyways

wet breach
#

you can either load the entire file all at once, recommended way to go for small files which yours will most likely will be

#

or you read through it as needed

#

so you would create like a buffer that dictates how much of the file to load at a time

river oracle
#

nvm legit says its a fork

#

smh

river oracle
wet breach
#

worldedit also has JNBT

#

but theres is slightly different and tailored to worldedit

#

anyways, you would shade JNBT into your plugin

#

minecraft has NBT too, but doesn't use the same names I don't think

regal scaffold
#

Hey forst, sorry to bother but I'm still not able to figure out how to serialize and deserialize my object for PDC

wet breach
#

JNBT just lets you use NBT without having to depend on NMS for NBT utilization πŸ™‚

wet breach
#

you could just base64 it and just store that lol

warped shell
#

Anyone know about persistant entities being saved when chunks unload?
I want to save their UUID and for certain entities delete them when they load back in but its acting like the uuid changes or somthing making the entity undetectable?

regal scaffold
#

lol so much PDC stuff tonight for some reason

wet breach
#

even though technically entities die when they unload

#

but I don't think that would be the issue at hand

warped shell
#

yea I noticed that

#

ok well thanks for verifying

river oracle
wet breach
#

also memory mapped files is a handy way to transfer information between applications of two varying types too

#

since multiple things can access the same memory mapped file

river oracle
#

yeah this was very enlightening

#

one thing I've always wondered is when to use pdc vs nbt vs database

wet breach
#

well you can use pdc for this, just I am not a fan of it since it seems it won't clean itself up

#

its a pet peeve of mine where game files get bloated with no system in place to clean up

river oracle
#

NBT seems like a cleaner way to do this

#

for me

regal scaffold
#

Required parameters for PersistentDataContainer.set() is (@NotNull NamespacedKey key, @NotNull PersistentDataType<T, Z> type, @NotNull Z value)

How do I pass my PersistentDataType<T, Z> as argument. ?

this?

#

Current class I'm on is declared as follows public class ItemNameDataType implements PersistentDataType<PersistentDataContainer, ItemInformation> {

wet breach
#

think you need to extend?

#

otherwise you are going to have issues where casting is necessary or used

#

?pdc

timid berry
#

what this code do

regal scaffold
#

Nowhere on that page does it say anything about extend. If we're talking about the same one

#

This is only for the seialize part

#
    @Override
    public PersistentDataContainer toPrimitive(ItemInformation complex, PersistentDataAdapterContext context) {
        PersistentDataContainer pdc = context.newPersistentDataContainer();
        pdc.set(Aliases.CHEST_KEY, this, complex);
        return pdc;
    }```
river oracle
# wet breach think you need to extend?

whats hte latest version of your nbt lib i tried

    <dependency>
        <groupId>org.jnbt</groupId>
        <artifactId>JNBT</artifactId>
        <version>1,8-SNAPSHOT</version>
    </dependency>

and

    <dependency>
        <groupId>org.jnbt</groupId>
        <artifactId>JNBT</artifactId>
        <version>LATEST</version>
    </dependency>
```  for some reason its bugging out
timid berry
#

WHAT DOES THIS CODE DO THO 😭

#

or this

wet breach
river oracle
#

oh so I need to clone

#

got it

timid berry
#

someone help me out πŸ’€

wet breach
#

eventually I will bring it back

#

but yeah need to clone and compile

#

for time being

river oracle
wet breach
#

go for it, its not mine

timid berry
#

bruh someone help me out πŸ’€

river oracle
#

alright lol

wet breach
#

JNBT was created by someone else

river oracle
wet breach
#

and it was hosted on sourceforge

timid berry
wet breach
#

their license permits you to modify it and what not as long as you leave the license intact

#

and give them credit etc etc

river oracle
wet breach
#

the reason I have JNBT in my repo

#

is because I updated it since it was missing NBT tags

#

and its a nice tool for NBT

#

and since MC doesn't change often in regards to NBT

timid berry
wet breach
#

I only have to update it every so many years XD

timid berry
#

@river oracle πŸ’€

buoyant viper
#

both Doc pages actually

river oracle
#

public static too

#

they are just straight up ignoring oop

warped shell
#

anyone know how to bypass or avoid this?

[22:36:12 WARN]: Entity EntityIronGolem['Tower Defender 3'/104, uuid='0fd2c9f4-c207-4cf3-aabd-a6e20e3707ba', l='ServerLevel[world]', x=-432.80, y=72.00, z=-327.38, cpos=[-28, -21], tl=130, v=true] is currently prevented from being added/removed to world since it is processing section status updates

regal scaffold
#

How can I pass a List<String> as a parameter for (@NotNull NamespacedKey key, @NotNull PersistentDataType<T, Z> type, @NotNull Z value)
PersistentDataType<T, Z>

river oracle
#

I'd reccomend mfnalex's more persistent data type lib if you need to do lists

regal scaffold
#

I didn't want to do a lib 😦

#

Wanted to try figuring it out myself

#

To learn but it's way over my head

river oracle
tacit yoke
#

hey, trying to use the Set Container Slot packet to rename an item, it says that if I set the window id to -2 then no item animation will be played, yet the item still does it

river oracle
#

ahaha well whatever he wants to think

regal scaffold
#

Y2K how do you suggest I make a custom PersistentDataType which includes List<Object> as fields

river oracle
regal scaffold
#

Appreciate it

river oracle
regal scaffold
#

Ok I tried

#

But having issues

#
public class ItemInformation implements ConfigurationSerializable {

    private static final long serialVersionUID = 1L;
    private List<String> itemName;

    private List<Integer> itemAmount;

    private List<UUID> playerUUID;


    public ItemInformation() {
        this.itemName = new ArrayList<>();
        this.itemAmount = new ArrayList<>();
        this.playerUUID = new ArrayList<>();
    }

    public static ItemInformation deserialize(Map<String, Object> map) {
        ItemInformation im = new ItemInformation();
        im.setItemName((List<String>) map.get("itemName"));
        im.setItemAmount((List<Integer>) map.get("itemAmount"));
        im.setPlayerUUID((List<UUID>) map.get("playerUUID"));
        return im;
    }

    public List<String> getName() {
        return itemName;
    }
    public List<Integer> getAmount() {
        return itemAmount;
    }
    public List<UUID> getUUID() {
        return playerUUID;
    }

    public void setItemName(List<String> itemName) {
        this.itemName = itemName;
    }

    public void setItemAmount(List<Integer> itemAmount) {
        this.itemAmount = itemAmount;
    }

    public void setPlayerUUID(List<UUID> playerUUID) {
        this.playerUUID = playerUUID;
    }

    @Override
    public Map<String, Object> serialize() {
        Map<String, Object> map = new HashMap<>();
        map.put("itemName", itemName);
        map.put("itemAmount", itemAmount);
        map.put("playerUUID", playerUUID);
        return map;
    }```
#

So that's my class

#

Then I assume I need to create a ItemDataType which I declared public class ItemNameDataType implements PersistentDataType<PersistentDataContainer, ItemInformation>

#

And then I'm lost

#

Like I'm confused as to what I'm actually passing, how do I access the elements inside one of the lists, for instance

#

holy crap this is confusing

wet breach
#

Notch used to have documents in regards to all the NBT stuff

#

and then after he left, it disappeared and what not lol

wet breach
#

it belongs to whoever initially created JNBT

buoyant viper
river oracle
#

I suppose mojang can do whatever though it's their code

wet breach
#

its their website too

#

which is where most of all you read about NBT

#

is it came from there

#

just we had copied it all before it disappeared fortunately πŸ™‚

river oracle
#

I wonder if that's saved on way back machine

#

Would be interesting to look and potentially useful

warped shell
#

Anyone know how to help with this?

wet breach
#

there you go

#

levelformat didn't get saved by wayback machine

#

but levelformat wouldn't be useful today anyways because it described the region file format

#

but for a format that is now outdated and not used lol

#

the NBT document wayback managed to save is outdated in that it doesn't contain the added tags since then

lime moat
#
    @Override
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("You can't teleport to other servers, console!");
        } else {
            Player p = (Player) sender;
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            out.writeUTF("Connect");
            out.writeUTF("lobby");
            p.sendPluginMessage(this.main, "BungeeCord", out.toByteArray());
        }
        return true;
    }``` current code
#
[06:39:04 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'lobby' in plugin SlashLobby v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:916) ~[paper-1.19.2.jar:git-Paper-307]
        at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.2.jar:git-Paper-307]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.2.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:305) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:289) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2294) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1389) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.bukkit.plugin.messaging.ChannelNotRegisteredException: Attempted to send a plugin message through the unregistered channel `BungeeCord'.
        at org.bukkit.plugin.messaging.StandardMessenger.validatePluginMessage(StandardMessenger.java:544) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer.sendPluginMessage(CraftPlayer.java:2037) ~[paper-1.19.2.jar:git-Paper-307]
        at frostyservices.org.slashlobby.Commands.Lobby.onCommand(Lobby.java:34) ~[SlashLobby-1.0.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        ... 23 more``` Error
#

My end goal is to send a player to a specific server using a Spigot plugin. Would anyone by chance know how to do this?

sullen marlin
#

sir this is spigot

regal scaffold
#

I'm having issues converting a class to a PersistentDataType<T,Z>

I need to be able to access and modify efficiently the fields inside of it.

This is my class

package me.tomisanhues2.deepstorage.utils;

import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.entity.Item;

import java.io.Serial;
import java.io.Serializable;
import java.util.*;

public class ItemInformation implements Serializable {
    
    private List<String> itemName;

    private List<Integer> itemAmount;

    private List<UUID> playerUUID;


    public ItemInformation() {
        this.itemName = new ArrayList<>();
        this.itemAmount = new ArrayList<>();
        this.playerUUID = new ArrayList<>();
    }

    public List<String> getName() {
        return itemName;
    }
    public List<Integer> getAmount() {
        return itemAmount;
    }
    public List<UUID> getUUID() {
        return playerUUID;
    }

    public void setItemName(List<String> itemName) {
        this.itemName = itemName;
    }

    public void setItemAmount(List<Integer> itemAmount) {
        this.itemAmount = itemAmount;
    }

    public void setPlayerUUID(List<UUID> playerUUID) {
        this.playerUUID = playerUUID;
    }

}
sullen marlin
#

neither Serializable nor ConfigurationSerializable have much to do with PersistentDataType

#

you need to make your own serializer/deserializer for your type

#

?pdc

regal scaffold
#

I've already tried making a TagType which implements PersistentDataType<> but then I was having problems with the topromitive and fromprimitive

sullen marlin
#

See " Custom PersistentDataTypes and how to use them ?"

regal scaffold
#

Yeah i've pretty much memorized that doc

#

But it's all about Primitive data types

#

And the example on UUID doesn't really relate that much since i'm trying to store List<Object>

sullen marlin
#

well thats kind of like a PersistentDataContainer[]

#

I dont think there's a generic list type however

regal scaffold
#

Hmmm this might be way over my head

#

Maybe you can suggest an alternative to what I'm trying to do

I'll explain

sullen marlin
#

store it as a string and send it to/from YamlConfiguration lol

regal scaffold
#

I'm trying to store
List of strings, "itemname"
Numbers of items for each string, "itemamount"

Those work like a key

and a list of UUID, all for 1 block

#

Now I thought about yaml but there has to be a better way

regal scaffold
sullen marlin
#

store it as a byte[] and write your own serializer/deserializer

regal scaffold
#

Just like the example shows, I'll try that again I guess

sullen marlin
#

new DataInputStream(new ByteArrayInputStream

regal scaffold
#

Is that better than the example in the doc you linked?

sullen marlin
#

probably about the same but easier

regal scaffold
#

Ok great I'll give that a go

wet breach
# regal scaffold Ok great I'll give that a go

if you want to learn a couple of things if you are going the yaml route, you could learn how to use memory mapping from java's NIO package and NBT using the lib linked earlier πŸ˜‰

small current
#

i compiled my plugin with temurin 1.8 and installed it on a 1.8.8 server

buoyant viper
#

u sure the compiler was in fact ur temurin 1.8 install?

small current
#

i tried with jdk 8

lime moat
#
file = new File(ProxyServer.getInstance().getPluginsFolder() + "/config.yml");``` How could I make it have its own folder? Doing `"/SlashLobby/config.yml"` does not work, so I'm quite confused on this.
regal scaffold
#

Why when I use getPersistentDataContainer().set() and etPersistentDataContainer().get() in the same method it works but otherwise if I call it from a different method it returns null

wet breach
#

mkdir will create a directory

#

and then when you create the file object you use the appropriate path

eternal oxide
#

create a file object and call mkdirs() and it will create all folders as needed

regal scaffold
#

All my data is working fine on creation, just after that even running getPersistentDataContainer().getKeys() returns null

#
    public static void createNewStorage(Chest chest) {
        //Call location persistence also
        ItemInformation itemInformation = new ItemInformation();
        List<String> itemName = new ArrayList<>();
        List<Integer> itemAmount = new ArrayList<>();
        List<UUID> playerUUID = new ArrayList<>();

        String json = gson.toJson(itemInformation);
        Bukkit.getLogger().info(json);
        chest.getPersistentDataContainer().set(STORAGE, PersistentDataType.STRING, json);

        Location location = chest.getLocation();
        chest.getPersistentDataContainer().set(LOCATION, PersistentDataType.STRING, location.toString());
        Bukkit.getLogger().info("Created new storage at " + location.toString());

    }```
#
    public static ItemInformation getStorage(Chest chest) {
        //Call location persistence also
        String json = chest.getPersistentDataContainer().getKeys().toString();
        Bukkit.getLogger().info("The obtained string is + " + json);
        return gson.fromJson(json, ItemInformation.class);
    }```

Null already
lime moat
#
File f = new File("F:\\program\\program1");``` Would something like this work?
#

Just unsure if it would work in this scenario

#
        file = new File(ProxyServer.getInstance().getPluginsFolder() + "F:/SlashLobby/config.yml");
        Boolean bool = file.mkdir();``` Yeah, I'm just completely lost.
wet breach
#

this is almost correct

#

it should be this instead
file = new File(ProxyServer.getInstance().getPluginsFolder() + "/SlashLobby", "config.yml");

#

notice I added a comma in there

#

anyways, only thing is to ensure your directory for your config is created and that should work πŸ™‚

lime moat
#
        file = new File(ProxyServer.getInstance().getPluginsFolder() + "/SlashLobby", "config.yml");
        Boolean bool = file.mkdirs OR mkdir();``` `file` still appears to return null
#

Oh, wait a second

#

It created SlashLobby/config.yml just config.yml isn't a file

#

So, nearly there I think? :P

regal scaffold
#

Why when I use getPersistentDataContainer().set() and etPersistentDataContainer().get() in the same method it works but otherwise if I call it from a different method it returns null.

All my data is working fine on creation, just after that even running getPersistentDataContainer().getKeys() returns null.

    public static void createNewStorage(Chest chest) {
        //Call location persistence also
        ItemInformation itemInformation = new ItemInformation();
        List<String> itemName = new ArrayList<>();
        List<Integer> itemAmount = new ArrayList<>();
        List<UUID> playerUUID = new ArrayList<>();

        String json = gson.toJson(itemInformation);
        Bukkit.getLogger().info(json);
        chest.getPersistentDataContainer().set(STORAGE, PersistentDataType.STRING, json);

        Location location = chest.getLocation();
        chest.getPersistentDataContainer().set(LOCATION, PersistentDataType.STRING, location.toString());
        Bukkit.getLogger().info("Created new storage at " + location.toString());

    }```

```java
    public static ItemInformation getStorage(Chest chest) {
        //Call location persistence also
        String json = chest.getPersistentDataContainer().getKeys().toString();
        Bukkit.getLogger().info("The obtained string is + " + json);
        return gson.fromJson(json, ItemInformation.class);
    }```

Null already
summer scroll
#

Hey, I'm trying to modify the item's attributes (diamond sword for example) the vanilla attack damage is 7, but I'm struggling to increase it to 8 attack damage, can someone help me?

warm light
#

is it possible to generate vanilla structures in custom chunk generation?

wet breach
#

the way you did it

#

it assumed you wanted a directory named config.yml

#

so just remove the config.yml part

#

in file object

#

call make directory

#

update file object to have the file you want

#

also you are going to want to surround the making the directory with a try catch block

#

to catch IOException in the event one is thrown

lime moat
wet breach
#

yep

warm light
tawdry parcel
#

Do you guys also make config files for plugins that you only make for yourself?

sullen marlin
tawdry parcel
maiden thicket
#

for code blocks

topaz cape
topaz cape
#

i feel left out

sullen marlin
#

No one likes threads

topaz cape
#

😦

#

i used a thread because this is like 5th time i ask for help about the same issue

jagged monolith
#

I hardly ever look at threads.

topaz cape
#

Well that's why i bump them

#

so you can actually see the message

jagged monolith
#

I never check them, because I prefer normal channels. I don't really like the threads.

topaz cape
#

https://paste.md-5.net/jacesekise.cpp

Hello PEOPLE, This code is what I use to change what a player looks like into an entity and it has been working nicely in OW
but going to the nether it seems to not work? This is executed on PlayerChangedWorldEvent to refresh both players in Nether and the Player joining Nether and if the disguised player walks in Nether first then refreshed when someone joins him it doesn't work. but it does work when the disguised players joins after other players join. is there any logical explination for this?

#

OKE IS THIS BETTER NOW WILL PEOPLE STOP MAKING FUN OF ME FOR USING THREADS 😭

sullen marlin
#

Is the event too early maybe?

topaz cape
#

nope the world seems to be the nether

jagged monolith
#

That's what It sounds like. Player not getting refreshed at the right time

topaz cape
#

here's the thing i refresh the player when walking in Nether to other people on switching the world and it works but it doesn't work for people walking on the disguised player

#

so it's definitely not a timing problem

#

since i get the world from the refreshed and not the target

#

ill try sending it 4 ticks late still

frank kettle
#

Maybe add a function that repeats every 1 tick checking if the players location isn't null and then set his disguise? Maybe event is called before the chunks itself being loaded and so it can't update the player?

torn badge
#

Does anyone know how e.g. LuckPerms uses MongoDB while keeping a file size < 1MB?

#

When I shade Morphia into my plugin it bloats up to over 10MB, I figured I could use the libararies feature in plugin.yml, but it doesn’t seem like they are doing it that way

sullen marlin
#

Probably doing a similar thing manually - downloading it

tawdry parcel
# tawdry parcel and shouldn't I use this api here instead of the normal plugin: https://ci.citiz...

but if I use the api it outputs me an error in console:

[09:56:50] [Server thread/ERROR]: Could not load 'plugins\citizensapi-2.0.30.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.loadPlugins(CraftServer.java:428) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3633-Spigot-d90018e-a0d3dfa]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3633-Spigot-d90018e-a0d3dfa]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:973) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3633-Spigot-d90018e-a0d3dfa]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:301) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3633-Spigot-d90018e-a0d3dfa]
        at java.lang.Thread.run(Thread.java:1589) ~[?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
        ... 7 more
sullen marlin
#

No

#

You run the plugin but compile against the api

tawdry parcel
sullen marlin
#

Compile dependency = api

#

Honestly doesn’t really matter though

tawdry parcel
#

So shouldn't I put the API in the plugins folder?

plucky nexus
#

hi md_5

buoyant viper
#

my guess without looking anything up would be that u would probably need to run Citizens plugin itself on server to use api

tawdry parcel
# buoyant viper well, what does Citizens themselves tell u to do?

to put some stuff in the pom.xml of my plugin:

    <repository>
        <id>citizens-repo</id>
        <url>https://maven.citizensnpcs.co/repo</url>
    </repository>

    <dependency>
        <groupId>net.citizensnpcs</groupId>
        <artifactId>citizens-main</artifactId>
        <version>2.0.30-SNAPSHOT</version>
        <type>jar</type>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
#

but i thought I also need to put the api.jar into the plugins folder of my server

jagged monolith
#

You set it to provided, so you need to make sure you run the plugin on the server as well

tawdry parcel
#

ok is there a way that i only need to have the api on my server?

tawdry parcel
jagged monolith
#

The API is needed to talk to the main plugin

tawdry parcel
#

but the main plugin already contains the api

buoyant viper
#

no like the citizens api needs the citizens plugin to do stuff

jagged monolith
#

The CitizensAPI in your plugin needs to talk to the actual Citizens plugin. Otherwise the API won't be able to do anything

quaint mantle
#

?paste

undone axleBOT
tawdry parcel
buoyant viper
#

you use Citizens API in your plugin to interface with the Citizens plugin

#

you still need the Citizens plugin itself on the server to make it work

jagged monolith
#

The API is like a messenger. It sends messages to the Citizens plugins to do what you want it to do. The API alone isn't enough.

tawdry parcel
jagged monolith
#

You add the API to your plugin as instructed on the citizens api page, then add the citizens plugin to your plugins folder.