#help-development

1 messages · Page 989 of 1

lilac dagger
#

yes

#

clicking the block where the prop arm is pointed at

#

since it doesn't trigger interact at entity i use interact event to get it in the line of sight

remote swallow
shrewd siren
remote swallow
#

email support

#

?support

undone axleBOT
lilac dagger
#

yeah

#

i click on the pickaxe

#

but it triggers all those 3

remote swallow
#

iirc that should be triggering an entity event and i have no idea how its calling left click

shrewd siren
#

got verified finally i need help with JPremium plugin

#

how can i fix this

lilac dagger
#

it seems right clicking a prop triggers left click animation

lilac dagger
#

unless i'm missing something

remote swallow
#

yeah i dont think the dump would include that

lilac dagger
#

i'mma add a delay and call it a day for now

polar forge
#

Hey guys

shrewd siren
#

got verified finally i need help with JPremium plugin

polar forge
#

https://paste.md-5.net/buroliwaju.java Here’s the code, I have a problem at line 30 to 40, when I try to /setfree a player, I get an error in the console telling me that the position is null, no position was saved when I did /investigate player. Why didn’t the server get his position?

#

When I do /setfree player, that player should return to the position saved b4 he got tped to me

lilac dagger
#

it might be a bug in 1.20.6

#

now that i think about it

polar forge
#

Are u talking with me?

lilac dagger
#

no

polar forge
#

Ah no

lilac dagger
#

about my bug

charred blaze
#

how do i give items to players with respawn screen?

dawn flower
#

is there anything close to an entity covering half of your screen that follows you around clientside? i want it clientside so there isn't a delay

blazing ocean
#

what are you trying to do

dawn flower
#

covering half of their vision

blazing ocean
#

i guess display entities with billboard=center?

dawn flower
#

that doesnt follow you around tho?

blazing ocean
#

it does

#

if you turn your head

dawn flower
#

i want it so if u move it follows your eye

blazing ocean
#

i mean you could do that

dawn flower
#

it wont have delay?

blazing ocean
#

no

dawn flower
#

aight

blazing ocean
#

try it in singleplayer

dawn flower
#

also can i stop them from doing f5

blazing ocean
#

probably not

dawn flower
#

crap

#

can i at least listen for that

blazing ocean
#

just check on jd for some keywords

dawn flower
#

doesn't exist, im just gonna put a block on top of their head so its hard to bypass the half vision with f5

blazing ocean
#

yeahh

lilac dagger
#

oh i figured it out

#

it has something to do with the itemstack

dawn flower
#

does spigot have an api for fake display blocks (clientside)

rotund ravine
#

sendBlockChange or smth

#

?jd-s

undone axleBOT
rotund ravine
#

Oh display blocks

#

Ehh

#

Idk

blazing ocean
flat hound
#

guys

#

in your history with plugins that affect commands have any ever stopped data commands from working

chrome beacon
#

data commands?

flat hound
#

bc im running into an error where trying to append a book with data from a storage and it works on a normal world but not on a server

#

using esssentials plugin

#

like thjis data merge storage journal1:data {master_index1:['{"text":""}','{"text":"Locations:"}']}

eternal night
#

Make sure you use /minecraft:data

flat hound
#

minecraft:give @p[scores={update_journal1=1}] written_book{journal:true,title:"Journal",author:"John",pages:['[{"storage":"journal1:data","nbt":"master_index1[]","separator":"\n","interpret":true}]']}

flat hound
eternal night
#

or /minecraft:give

#

essentials overides these commands (at least give, idk if it also overides data command)

flat hound
#

the confusing thing is the data is there in storage if i do /data get but wont be put into the book

chrome beacon
#

Essentials does mess with the vanilla commands

flat hound
#

like this specifically works on my world but not on the server "storage":"journal1:data","nbt":"master_index1[]" idk if theres reports of essentials doing anything

chrome beacon
#

so yeah use minecraft: to force it to run the vanilla ones

flat hound
#

ye im trying n I just have no idea why its not changing the contents of the book

#

hold on lemme check the console for errors

#

this is it on my world

#

i cant paste it rip

#

ill figure some tout

#

basically its "storage":"journal1:data","nbt":"master_index1[] this bit but inside the master index theres the data of the text that goes into it

twilit geode
#

sorry, how do I put the ranks like this? Is there any plugin or how should I do it...

dawn flower
#

thats a texture pack

flat hound
#

are there any p[lugins that affect written books or their ability to hold information

dawn flower
quartz basalt
#

how is display.getHeight() returning 0.... (line 24)

https://pastebin.com/wcYZcVXF

the textdisplay is being made but it has a height of 0 apparently, doesnt make sense

smoky anchor
#

I believe that returns the entity hitbox height
for display entities this is 0 for both height and width

quartz basalt
#

then how could i get the actual height of a textdisplay

smoky anchor
#

By height, what exactly do you mean

quartz basalt
#

how height the textdisplay goes (y axis)

smoky anchor
#

as in the text ?

blazing ocean
#

Display#getDisplayHeight iirc

#

just a quick little ctrl-f on the jd page can often help

alpine urchin
#

@dusty herald send pfp

quartz basalt
#

alr ty

quartz basalt
#

https://imgur.com/a/605gt81

im trying to make chat bubbles with seperation but rn only messages with little amounts of text seperate as seen in the screenshot, the bigger texts overlap, and i dont know what i should do to fix this, right now im doing

textDisplay.teleport(textDisplay.getLocation().clone().add(0, display.getTransformation().getScale().y * (display.getTransformation().getScale().y / 6), 0));
full code:
https://pastebin.com/SJBd1zEB

restive mango
#

Anyone know if there's a way to have an entity class without spawning it? I'd like to have a way to temporarily store entity information (armor being worn, enchantments for that armor, etc.) and let the player edit it (in a menu), and then use like a wand to actually spawn the relevant entity.

buoyant viper
trail coral
#

?paste

undone axleBOT
trail coral
#

I'm making a custom enchants plugin and for some reason the enchants code doesnt work but i know it executes?

        container.getKeys().forEach((key) -> {
            
            if(modulesList.getList().keySet().contains(key.getKey())) {
                modulesList.getHandlerFromList(key.getKey()).doAction(1, event);
            
            }            
        
        });

So I know this code is executing, and the code in .doAction() with some logger checks, the prolem is: the code executes, and it logs correctly but nothing past that executes

Here's the code for one of the modules (enchant):
https://paste.md-5.net/femowinowa.java

the "Poison Module" is sent to the player, but the rest doesnt work.

Here's the full listener class:
https://paste.md-5.net/ejeludonur.cs

#

the same happens for all the other modules

quartz basalt
#

why dooes display.getTransformation().getScale().y max out at 1.0? i have 2 textdisplays, 1 is 5 lines tall the other is 1, both return 1.0

buoyant jasper
#

I have problem when i click on chest it open the GUI in delay

#

?paste

undone axleBOT
buoyant jasper
smoky anchor
dawn flower
#

how do i make curved blocks (block displays) possible to walk on like this

inner mulch
#

barrier blocks

#

block displays

smoky anchor
#

Or shulkers riding some entity for more custom hitboxes
They can be scaled since 1.20.5 too!

inner mulch
#

wait what

inner mulch
#

shulkers can be scaled

smoky anchor
#

they added generic.scale attribute

#

you can scale any entity

dawn flower
#

since when

smoky anchor
#

do you lack the ability to read

inner mulch
#

1.20.5

#

yooo

dawn flower
#

do i get to scale each position in x y z

inner mulch
#

no

smoky anchor
#

no

dawn flower
#

crap

smoky anchor
#

You can use several shulkers tho :D

dawn flower
#

ok

#

wait would it work for people on older versions such as 1.20.1 (viaversion)

smoky anchor
#

No

smoky anchor
#

Ye, but they probably did not use scaled shulkers for fancy hitboxes
I'm just sharing the possibility of this

inner mulch
#

you can spawn shulkers with different y offsets if you really want the correct hitbox

smoky anchor
#

This can help you create this kind of display thing

dawn flower
#

ik abt this

dawn flower
# inner mulch on the picture you can see the guys it floating, they are using barrier blocks

https://youtu.be/aYi5wnCOXm4?t=101

at this second in the video you can see that it's def not barriers

CHECK OUT BLOCK DISPLAY STUDIO HERE: https://eszesbalint.github.io/bdstudio

Check out my profile on block-display.com for the commands used in this video!
https://block-display.com/author/daftcraft/

Comment which build was your favorite!

#minecraft

▶ Play video
quartz basalt
#

does anyone know how to get the height of a textdisplay

dawn flower
quartz basalt
#

that gets the scale but my scale is 1, 1, 1 yet if the message is long it makes new liens

#

that doesnt get the height of the display

#

just the original scale

dawn flower
#

get the y scale

quartz basalt
#

that doesnt work

#

no matter what it returns 1

dawn flower
#

idk then

quartz basalt
#

since the original scale is 1

smoky anchor
#

count how many lines it has, then do some math

quartz basalt
#

how do i get the amount of lines

#

ive tried

        String text = display.getText();
        int lineWidth = display.getLineWidth(); 
        int numLines = (int) Math.ceil((double) text.length() / lineWidth);
        return numLines;
    }```
but it returns 1 no matter what
inner mulch
#

why do you need the number of lines?

quartz basalt
#

so i know the height of the textdisplay to properly seperate my chatbubbles

inner mulch
#

you have to calculate when go into a new line, right?

quartz basalt
#

yea

inner mulch
#

why not just count the newlines you create

quartz basalt
#

textdisplays automatically create new lines

#

since you set a linewidth

smoky anchor
#

don't use the linewidth then, create the new lines yourself ?

quartz basalt
#

i dont think u can do that

#

if theres no way to get how many lines/the height of a textdisplay that seems like a massive oversight, thats something that should 100% be a thing

young knoll
#

You can make new lines with \n

quartz basalt
#

so id have to make new lines and do math to split the message just to get the height/how many lines there are?

smoky anchor
#

If there is no better way of doing that, then ye, probably.
I don't think you can even get the line count 'cause it could be different for people with different fonts.
If it works in the way I think it does at least.

quartz basalt
#

alright then thanks

young knoll
#

You can split strings with ChatPaginator.wordWrap

quartz basalt
#

ok thanks

trail coral
#

how do I check if a creeper is a passenger? im making like a pickup feature where a player can pickup entities and i need to cancel a creeper exploding if its a passenger, so if its picked up

#

I alr have an array of all the picked up creepers and check if its in that array but that doesnt seem to work for some reason

#

also is there a way to listen for when the creeper starts to ignite?

#

I want to stop the animation from appearing

trail coral
#

(if a player has the entity as a passenger)

#

how do I check players in range for that creeper?

#

like detect every player in a 3x3x3 radius

#

i would loop thru them and check if that creeper is a passenger to anu

#

any

#

nvm i figured it out with some math

young knoll
#

Entity#getVehicle != null

worldly ingot
#

Should've seen the monstrosity I did on Hypixel a couple weeks ago

carmine mica
lilac dagger
#

and did they ship it?

worldly ingot
#
Entity passenger = entity;
while ((passenger = passenger.getVehicle()) != null) {
    passenger.remove();
}
#

Or something like that lol

lilac dagger
#

oh, this is fine

worldly ingot
#

Yeah it caused a stackoverflow

#

So

lilac dagger
#

but can a vehicle be inside another?

worldly ingot
#

Yeah you can have vehicles riding other vehicles. Honestly not entirely sure why it caused a SOE

#

One sec, lemme find the snippet lol

worthy yarrow
#

Choco broke hypixel

lilac dagger
#

i'd keep track of the vehicles in a list

#

or a set, depends what's more optimal

worldly ingot
#

Ah, here it is

    private void removeEntityAndRelatedEntities(Entity entity) {
        entity.remove();

        // Passengers
        Entity passenger;
        while ((passenger = entity.getPassenger()) != null) {
            if (!(passenger instanceof HumanEntity)) {
                passenger.remove();
            }
        }

        // Vehicles
        Entity vehicle;
        while ((vehicle = entity.getVehicle()) != null) {
            if (!(vehicle instanceof HumanEntity)) {
                vehicle.remove();
            }
        }
    }
#

I probably just did something stupid tbh lol

lilac dagger
#

not the worst, probably best to have methods that do one thing

worthy yarrow
#

Is that hypixel naming conventions or you're just that specific haha

lilac dagger
#

instead of a and b methods

worldly ingot
#

That's a me naming convention

#

I like to be specific

tardy delta
#

you working at hypixel?

worthy yarrow
#

been

lilac dagger
#

i wonder if hypixel would hire me

worthy yarrow
#

Choco best hypixel dev 100%

worldly ingot
#

I mean I'm literally describing how I caused a stackoverflow exception so

buoyant viper
worthy yarrow
#

Best and most humble dev right there

worldly ingot
#

I also totally broke tf out of hide and seek for a bit there

#

On live, too

worthy yarrow
#

Hell yeah!

worldly ingot
#

It was kinda sick ngl

lilac dagger
#

what happened?

worldly ingot
#

All props were invisible 😄

#

Well, "invisible". They were just a few hundred blocks in the air

buoyant viper
worldly ingot
#

Oooo recursive 😄

lilac dagger
#

it happens

worthy yarrow
#

I mean

lilac dagger
#

why did u use recursion?

buoyant viper
#

i dont remember

#

i wrote that like last year

worldly ingot
#

To prove a point

worthy yarrow
#

Recursive methods kinda depend on the context more eh?

worthy yarrow
#

I know I've got a couple looking the same

buoyant viper
#

it was for my /sit command on smp

tardy delta
#

whats with people sitting on things theyre not supoosed to sit on

worthy yarrow
plucky rock
#

is the 1.26 api out?

tardy delta
#

i dont even want to know what you mean with that

plucky rock
#

1.20.6*

worthy yarrow
buoyant viper
#

im fairly certain i didnt need to write the method becos it wouldnt matter in the end i think

#

since i just .remove() the entity

#

but maybe i had a bug from just that

worthy yarrow
#

Now you've got me interested in recursive methods... when to use them more or less

tardy delta
#

use them on things that are absolutely awful to implement non recursively

worthy yarrow
#

I guess I don't even really know how to apply it

clear elm
#

ItemStack item = new ItemStack(Material.SPAWNER);
how can i do this to an Zombie Spawner

worthy yarrow
#

Uh you might have to do that after it's placed... don't quote me

eternal oxide
#

You never stored a location

remote swallow
#

use block data meta iirc

polar forge
#

Mmmh

worthy yarrow
# clear elm ItemStack item = new ItemStack(Material.SPAWNER); how can i do this to an Zombie...
ItemStack item = new ItemStack(Material.SPAWNER);
        BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
        if (meta != null) {
            BlockState blockState = meta.getBlockState();
            if (blockState instanceof CreatureSpawner) {
                CreatureSpawner spawner = (CreatureSpawner) blockState;
                spawner.setSpawnedType(EntityType.ZOMBIE);
                spawner.update();
                meta.setBlockState(spawner);
                item.setItemMeta(meta);
            }
        }```
This should work
worldly ingot
#

The update() isn't necessary. update() is only for in-world stuff

worthy yarrow
#

ah gotcha

remote swallow
worthy yarrow
#

I didn't remember

worldly ingot
#

I already updated my component PR today, Epic >:(

#

No updates required

remote swallow
#

no i want to update you

#

not ur prs

worldly ingot
#

to?

remote swallow
#

latest

worthy yarrow
#

Pop the panel on your back choco

#

we got some work to do

worldly ingot
#

I'm being asked to throw it back

worthy yarrow
#

I

remote swallow
#

youve heard of the cat distribution system now its the choco distribution system

worthy yarrow
#

If that is how you interpreted it...

obtuse kayak
#

I would like help on my spigot plugin. my problem is that I have 2 different special bows, and both of them are doing the same thing. should I send the code?

eternal oxide
#

?paste

undone axleBOT
worthy yarrow
#

I like the sounds of special bows

obtuse kayak
#

what do i do at that website?

worthy yarrow
#

Paste ya code

eternal oxide
#

click save and copy link here

obtuse kayak
#

should i copy the code of both bows there at the same time?

torn shuttle
#

I just saw chatgpt call someone cringe

#

what a great day

worthy yarrow
eternal oxide
obtuse kayak
worthy yarrow
#

Well maybe you should tell md to make a pastebin application instead

#

Then it'll still upload the paste to web and you'll still have to open in web... that is unless you also have the application 😄

#

What a great idea

eternal oxide
#

Does nothing with a ; at the end

trail coral
#

how do i make a creeper just never be able to explode/start exploding? I guess clear its pathfinder and target or something? its supposed to be a custom entity

trail coral
ionic thicket
#

Yo, what should I tag as "Source" in my intelliJ maven project?

ionic thicket
eternal oxide
worthy yarrow
eternal oxide
#

You could cancel it's target event

trail coral
eternal oxide
#

then cancel its target event

trail coral
#

that would make it not ignite right?

#

like when a creeper starts the exploding animation

worthy yarrow
#

If there's no target to ignite on, then it shouldn't ignite

trail coral
#

Thanks!

#

I thought i would have to work with nms and I was so sad

worldly ingot
#

Just don't do anything too crazy in that event. From experience, it's just as bad, if not worse than, PlayerMoveEvent

clear elm
#
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName("Zombie Spawner");
                item.setItemMeta(meta);
                item.setAmount(Integer.parseInt(amount));
                p.getInventory().addItem(item);```
how can i give the item like an "key" that i can ask for in an if?
worthy yarrow
clear elm
#

like if item has key

worldly ingot
#

You're looking for the persistent data container

#

?pdc

worthy yarrow
#

^

#

What can't pdc be applied to?

pseudo hazel
#

blocks 🙂

worldly ingot
#

Anything that doesn't have NBT

worthy yarrow
#

Gotcha

clear elm
#

so what can i do

pseudo hazel
#

but then in most cases, like blocks, there are other libaries people have written to kind of still use pdc with those objects anyways

worldly ingot
#

See the thread linked above

#

It explains how you can use the PDC to assign arbitrary NBT values to items

clear elm
#

okay

pseudo hazel
#

use getItemMeta().getPersistentDataContainer() and add some string to it

clear elm
#

and how can i add this to the item

worthy yarrow
#

See the thread

#

It explains all of this

worldly ingot
#

:p

pseudo hazel
#

well its the itemmeta, so yeah same thing as with other meta stuff

worthy yarrow
#

Pdc essentially gives that item a key -> value state within your plugin. That being said another plugin with perhaps the same key -> value pair, they won't conflict because it's plugin dependent as it were, correct?

worldly ingot
#

Yes, the keys are namespaced to your plugin

worthy yarrow
#

Ie: the namespace is held plugin dependent

worldly ingot
#

If you're using the NamespacedKey API correctly, that is, it should be fine

obtuse kayak
#

i got my thing to work. thanks for the help!

pseudo hazel
#

you should create a namespacedkey with your plugin instance yes

#

xD

clear elm
#

itemMeta.getPersistentDataContainer().set(key, PersistentDataType.DOUBLE, Math.PI);
what do i have to set for key here

worthy yarrow
#

the NamespacedKey("KeyValueHere", plugin) string is your key

worldly ingot
#

(missing a plugin arg)

worthy yarrow
#

^

#

dont forget that

pseudo hazel
#
    public static NamespacedKey createKey(String key)
    {
        return new NamespacedKey(MyPluginClass.getInstance(), key);
    }```
#

I just have a helper function for it

#

or whatever

worthy yarrow
#

That's better for like a lot of keys, which in your case would be nice as I assume you're going to have multiple custom bows

pseudo hazel
#

(yes I use my plugin class as a singleton, hate me if you like)

worthy yarrow
#

You could just make a constant instance for every class you need the main instance in:

Plugin plugin = Plugin.getPlugin(Plugin.getClass);

clear elm
#

meta.getPersistentDataContainer().set(, PersistentDataType.DOUBLE, Math.PI); i have this

worthy yarrow
#

So the NamespacedKey object you put there

#

And it's good

#

Just make a different key for each item

pseudo hazel
#

a different key for each property you wanna save

worthy yarrow
#

NamespacedKey("TeleportBow", plugin) ,
NamespacedKey("TntBow", plugin), etc

clear elm
#

meta.getPersistentDataContainer().set("dd", PersistentDataType.DOUBLE, Math.PI);
this dont work

#

i dont understand what this means

worthy yarrow
#

You put the OBJECT there

pseudo hazel
#

you need to create the namespacedkey

worthy yarrow
#

Not a "string"

pseudo hazel
#

it means you need to create a new namespacedkey

clear elm
#

oh i undersnad

worthy yarrow
#

NamespacedKey teleportBowKey = new NamespacedKey("TeleportBowKey, plugin) -> meta.getPDC.set(teleportBowKey, etc, etc, etc)

pseudo hazel
#

the easiest thing is just to create a static one like new NameSpacedKey(plugin, "type") and then save the type of item as the value

#

you dont have to create a new key for every item if its just a different name

worthy yarrow
#

All the bows have different properties, you might want to put those into their own pdc's no?

pseudo hazel
#

yeah

worthy yarrow
#

Idk why I thought this was the bow guy

#

my b

#

lol

pseudo hazel
#

but you should create a new key for each kind of property, not for each value

worthy yarrow
#

Oh did I say value

pseudo hazel
#

no

#

but your example made it seem that way

worthy yarrow
#

Just good clarification for sure

clear elm
#

meta.getPersistentDataContainer().set(new NamespacedKey(Legacy_spawner.getPlugin(), "zombie"), PersistentDataType.DOUBLE, Math.PI);
i have it now like this and it dont gives errors

pseudo hazel
#

if you save pdc on an item like what kind of bow it is, it should just be a single key and specify the bow in the value

worthy yarrow
#

I don't think you want that

pseudo hazel
#

because rn the PI thing is just unused

worthy yarrow
#

Considering context, won't this try to create a new key every time a zombie spawner is needed?

#

And if one already exists, does that mess it up?

eternal oxide
#

if the key already exists it's returned from the registry

pseudo hazel
#

I assume it doesnt get messed up xD

worthy yarrow
clear elm
#

i wanna do an /give command and the item you get gets this key

worthy yarrow
#

Are you trying to use the vanilla /give command?

pseudo hazel
#

and what are you going to do with that information

clear elm
worthy yarrow
#

ok good

clear elm
pure rivet
#

Guys i need help

worthy yarrow
pure rivet
#

plugin im developing

#

look

clear elm
worthy yarrow
# clear elm no custom command

So then the logic for creating this spawner should be in the command class, when you need to give that item to the player, just pass the ItemStack object rather then trying to get a random key from the namespace

clear elm
#

it is in a normal class

young knoll
worthy yarrow
#

How many spawners are you trying to manage?

young knoll
#

That being said theres no reason not to cache it

worthy yarrow
#

He a bit new coll

pure rivet
#

im doing a plugin where by doing /investigate <playername>, he will get teletrasported by a base already setted with /setinvastigate and as soon he got tped there he is frizzed, but i want that as soon i type /free <playername> he gets tpd to the old position where he was

worthy yarrow
#

Well you've got zombie right? Are there any more?

pure rivet
#

i need help for scripting the last part

#

where i gets tped back

clear elm
worthy yarrow
#

And what are you trying to do after the fact they've been given to the player?

clear elm
#

if you place them

#

and break them

#

if the have this key smth should happen

#

and i wanna do if you rightclick them smth should happen

worthy yarrow
#

Ok cool, so now that we've got this. You'll only need the key when they break/place the block. I forget the events for these, but if you look on the spigot jdocs you'll find em. Once you've got the events you just need to detect when its your spawner that broke/place which entails creating a new itemstack object -> getting the pdc -> checking for the key. After you verify its your spawner, you do whatever it is you want to do

eternal night
#

I mean, loop through the list and check every x?

#

to check if a chunk contains an x coord you just do locX >> 4 == chunkX

clear elm
worthy yarrow
#

You should just cache the key rather than create a new one every time

#

NamespacedKey keyName = new NamespacedKey(plugin, "someKey");

#

Then you can use that object when you need it

#

Makes it easier and maintainable

#

When you have the itemstack object defined, you just pass that itemstack to the player.addItem(itemStack);

ionic thicket
#

Yo, what should I tag as "Source" in my IntelliJ maven project?
src, main or java folder?

clear elm
worthy yarrow
#

if x = chunkX

tardy delta
#

<< 4 is * 16

worthy yarrow
#

wait

#

no you did it backwards

#

It might work

#

#YodaTechnique

polar forge
#

I really can’t go further

#

I’m trying to save the location of the target when I try to teleport him to an investigation room. So when I do /investigate target, the plugin must save the current location of the target and then tp him to the interrogation room

#

I get method call expected on line 45

#

I don’t understand, I could drop the whole code if someone needs to check it

pearl forge
#

hi, how could I make it so that if I hit a mob that is in a boat, it gets out of the boat?

eternal oxide
#

you can;t invent a method that does not exist savePlayerLocation

polar forge
#

In another class

eternal oxide
#

not in that class it doesn't

polar forge
#

No it does not exist in that class

#

But I imported it with a private

eternal oxide
#

You expect it to magically know where that method exists?

polar forge
#

I told u, I wrote a private line 8

eternal oxide
#

you defined a Field with that name. Thats not a method

#

its also not instanced

polar forge
#

I can’t add a method in my class

#

In that class

glad prawn
#

?learn j-

polar forge
#

That’s why I wrote the method in another class

glad prawn
#

wtf bro

polar forge
hollow vessel
#

hi! How can I get trowed snowball custom persistence data using ProjectileHitEvent? Is it even possible?

polar forge
#

Can anyone please explain me what I am doing wrong?

eternal oxide
#

So much

glad prawn
#

field != method bro 😭

polar forge
#

I told u, my method is in a separate class

polar forge
glad prawn
#

i dont see the class you used to save data

polar forge
#

Should I just drop the whole code?

#

So it gets easier?

eternal oxide
#
private LocationSave savePlayerLocation;```NOT useable as its not even assigned and it's not a method
polar forge
#

So what’s the solution?

eternal oxide
#

learn java 😛

glad prawn
#

🥰

polar forge
#

To this problem

#

And I am learning Java

#

How can I learn Java if I don’t excercise? Now explain

eternal oxide
#

It looks like you want to use a method IN your locationSave class

polar forge
#

I want to save the last location of the target in a yml file

eternal oxide
#

to do that you need access to it

polar forge
#

If I do the command

glad prawn
#

It's the first basic things you're learn, how could you not know?

eternal oxide
#

does your LocationSave class handle saving the location?

polar forge
#

Yes

#

Should I send the code?

eternal oxide
#

then you need access to it. Rember DI you did for passing your plugin instance to this class?

polar forge
eternal oxide
#

?di

undone axleBOT
polar forge
#

Oh dependency injection

glad prawn
eternal oxide
#

so you can use java this.plugin.getConfig()...etc

polar forge
eternal oxide
#

You need to be able to access your LocationSave class/instance the same as you do your plugin

polar forge
eternal oxide
#

where do you instance/initialize your LocationSave class?

polar forge
#

In my main class

#

With new LocationSave();

eternal oxide
#

then add a method in Main to getLocationSave()

#

make it public and it shoudl return yoru LocationSave instance

polar forge
#

Will it return also in my Command class?

eternal oxide
#

then in yoru command class you can use java this.plugin.getLocationSave().savePlayerLocation(target);

polar forge
#

So public void getLocationSave() { return instance of LocationSave }

#

?

eternal oxide
#

no

#

public LocationSave getLocationSave() {...

quaint mantle
eternal oxide
#

it has to return the instance not void

#

your LocationSave instance needs to be a Field set in Main

polar forge
#

So public LocationSave getLocationSave() { return instanceof LocationSave }

eternal oxide
#

closer, but no

polar forge
#

So public void getLocationSave() { return instance; }

eternal oxide
#

return this.locationSave;

glad prawn
#

basic things..

polar forge
#

So public LocationSave getLocationSave() { return this.LocationSave }

#

Yursi

glad prawn
#

bro even missing ;

eternal oxide
#

so long as you created a Field in your Main called locationSave AND intialized it.

polar forge
#

And this should be written in my Main class

#

Right?

eternal oxide
#

yes

#

lower case l on locationSave as it shoudl be refering to a Field not a class

polar forge
#

Enable or?

#

Or outside disable

eternal oxide
#

where do you create your new locationSave instance?

polar forge
#

Inside enable

eternal oxide
#

At the very top of the class, you should have a Field called java LocationSave locationSave;

#

then in yoru onEnable you do java locationSave = new LocationSave(...

#

adding whatever args you already do to initialize it

eternal oxide
quaint mantle
#

It has nothing to do with any plugin, right? that would become my Mysql

eternal oxide
#

it could be a plugin killed it, but unlikely

eternal oxide
#

Which class is your getter in?

polar forge
eternal oxide
#

You don;t understand what a getter is

knotty meteor
#

player.spigot().sendMessage(ChatMessageType.ACTION_BAR, "");
Why does ChatMessageType cannot be resolved to a variable?

eternal oxide
#

getConfig() is a getter as it returns a Object/instance you want. Its not YOUR getter though

polar forge
eternal oxide
#

you just created a getter

polar forge
eternal oxide
#

looks like you didn;t and just ignored most of what I told you

polar forge
eternal oxide
#

creating the getter, creating the Field

polar forge
#

If u look closer I’ve created the field

eternal oxide
#

you are also creating FOUR instances of your InvestigateCommand class

#

no you have not created a field

#

you copy/pasted the assignment, but you did not create any field

polar forge
#

But do u see any getters here in the main class?

eternal oxide
#

this line does nothing in your code (un-needed) getConfig().options().copyDefaults(true);

eternal oxide
polar forge
#

U asked me where the getter was

eternal oxide
polar forge
#

Aaaah so that’s the getter

hollow vessel
#

hi! How can I get trowed snowball custom persistence data using ProjectileHitEvent? Is it even possible?

eternal oxide
#

?pdc

eternal oxide
#

If you set it, you can read it

polar forge
#

I didn’t write it bc I didn’t know where to place it

#

As u didn’t answer me and ignored what I asked

eternal oxide
#

I answered every question you asked (when others did not)

polar forge
eternal oxide
#

And I answerd you with a question

glad prawn
#

getter is just a method that return the value.

#

bro pls learn java

eternal oxide
#

well a getter is a get method that returns something

polar forge
polar forge
eternal oxide
#

SO add your getter and teh Field that still have nto added

polar forge
#

And I asked u where

#

Inside enable or what?

eternal oxide
#

No

#

fields do nto go in methods

#

its a local variable if its in a method

#

you need a Field

polar forge
#

Ok

eternal oxide
#

a Field is a class level variable. It sits outside any method

#

You litterally have an error right now which when hovered over tells you there is no assignment

#

or something close

#

it will also suggest you create a field or a variable

polar forge
#

Cannot resolve symbol locationSave

eternal oxide
#

hover over it

#

it will give you suggestions

#

just look for the one mentioning a Field

polar forge
#

Create field in MainClass

eternal oxide
#

yes

polar forge
#

It made a private LocationSave locationSave

eternal oxide
#

correct

#

did you add the getter to Main?

polar forge
#

Yea, that’s what I was doing

#

I added the getter and I got this error

#

That I corrected by hovering over it

eternal oxide
#

ok

polar forge
#

Now that I did all of this

eternal oxide
#

If you did it all correctly thats all you need

polar forge
#

But it still tells me

#

Method call expected

#

In the other class

eternal oxide
#

Theres a LOT of bad code in your Main but you'll discover that once you begin to understand instancing

polar forge
#

Wdym discover?

#

It practically didn’t resolve for nothing what we just did now

ionic thicket
#

Since Java automatically "uses all the ram in task manager" how do i know if my plugin is bad optimized?

tardy delta
#

could use visualvm and see how the memory usage evolves

dawn flower
#

how can i tell if the last server close was a crash

hazy parrot
orchid gazelle
dawn flower
polar forge
#

Does anyone know a solution for my problem?

chrome beacon
#

yeah but we're not here to spoon feed you

polar forge
chrome beacon
#

ElgarL has told you what to do

polar forge
hazy parrot
chrome beacon
#

Something tells me you didn't

#

and you only think you did

hazy parrot
#

idk if there is different way

dawn flower
#

hm

polar forge
hollow vessel
zenith gate
storm crystal
#

how can I cache inventory object into a database?

#

like a very long character?

river oracle
#

you can also use Bucket's Object Output Stream which is worse for that but it works

storm crystal
#

is there any tutorial on that?

river oracle
#

no the BOOS works like any other stream

#

for NMS you're on your own

#

if you can't figure out streams figure out how to use google the java io and java nio API has had probably millions of questions asked and answered about it

storm crystal
#

is there no other way to do it?

river oracle
#

no why would you do it any other way

#

when you have the objectively best way to do it literally layed out for you

storm crystal
#

well I dont understand like 70% of what you are talking to me about

river oracle
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

river oracle
#

The BukkitObjectOutputStream use is basic java knowledge you should be able to use IO Streams by now. If you can't use IO Streams and are involved with databases. Go back and learn more. You don't know enough to effectively use a database

hazy parrot
#

oh learn java updated

buoyant viper
#

?learnjava!

undone axleBOT
buoyant viper
#

mi favorito

storm crystal
river oracle
#

doesn't seem like it considering you don't know how to use OutputStreams to put blobs in SQLite

storm crystal
#

why would I learn excessively too much if I already know what I want

river oracle
#

"learn excessively" the basics are not excessive

hazy parrot
#

just to notice, iirc you can't just call setBlob on PreparedStatement as its not implemented in jdbc driver

hazy parrot
#

yeah

#

but java sqlite driver

#

doesn't implement setBlob method iirc

young knoll
#

I just use setBytes

river oracle
#

bukkit uses JDBC3

hazy parrot
#

still, pretty sure you have to setBytes

river oracle
#

I didn't even know setBlob was a method

storm crystal
#

what about converting to base64 string and storing it

#

will it work

river oracle
#

don't pursue a poor solution because you refuse to learn

#

that's defeatest attitude

#

Use BOOS or NMS with NBT

#

not to mention you'll have to turn the Map<String, Object> into a base64 string ItemStack#toString won't give you what you want

storm crystal
#

how to get nbt

river oracle
#

with NMS

#

based on your java knowledge tho I'd reccomend BOOS tbh

#

IO Streams are not that hard man

storm crystal
#

so its literally just that and then using setBytes?

river oracle
#

yeah but NMS is version dependent

#

so you also need to setup modules

storm crystal
river oracle
#

what are Inventories?

storm crystal
#

object?

river oracle
#

true but what are they on the inside?

#

I mean what data makes up an inventory

storm crystal
#

string

river oracle
#

no

#

what data do you think is stored inside an Inventory

#

its not just a string

storm crystal
#

?

eternal night
#

friendship?

river oracle
storm crystal
hazy parrot
#

boos is just impl of OutputStream

grim hound
#

Wth is boos

hazy parrot
#

bukkitobjectoutputstream i assume

storm crystal
#

its just it?

grim hound
#

Is it for like nbts

hazy parrot
grim hound
worldly ingot
#

It supports ConfigurationSerializable objects

#

That's really it

chrome beacon
#

It's just to help with serializing classes with the ConfigurationSerializable API

worldly ingot
#

If you used another type of standard output stream, it'd have no clue how to use ConfigurationSerializable :p

valid burrow
grim hound
storm crystal
#

???

grim hound
#

Oh wait it's a load xD

#

Not a store

#

Makes sense

storm crystal
#

I want to store inventory

valid burrow
#

yeah

#

the entire inventory object or would the contents be enough

#

cause what else could u need from an inventory object lol

storm crystal
#

I want to make persistent openable inventory

#

thats literally it

grim hound
valid burrow
storm crystal
#

and take a wild guess who told me to make SQLite database

grim hound
#

Is the inventory under any external influence?

storm crystal
#

I dont have anything else implemented and Im stuck with this

valid burrow
#

okay

valid burrow
#

wait

#

dusk

#

1 second

storm crystal
valid burrow
#

there could be reasons to use a db BUT

lilac dagger
valid burrow
#

please explain what exactly you are doing

lilac dagger
#

i've looked

valid burrow
#

do you need the invs cross servers?

storm crystal
#

what I need

valid burrow
#

ksndownfowbfk

grim hound
valid burrow
#

there is still many questions you leave open

#

for example

valid burrow
grim hound
#

And it doesn't require any communication between servers?

storm crystal
#

why would it?

#

where did I mention several servers

valid burrow
#

omfg

#

you are not easy to help

#

you are trying to use a databbase

grim hound
valid burrow
#

and we are trying to find out why

worldly ingot
valid burrow
#

if you want help

#

its easier for everyone

chrome beacon
grim hound
storm crystal
grim hound
#

And why hou haven't questioned him

storm crystal
#

other than "just use what you want"

#

which is

storm crystal
#

a very very very vague statement

chrome beacon
#

The help you get is based on the information we have. If you don't give enough information people may try to fill in the missing parts themsleves

storm crystal
#

that doesnt help with anything

grim hound
valid burrow
#

„where do i store my data“ is even more vague

lilac dagger
#

it would've been nice if configuration serialize required a map constructor

storm crystal
grim hound
#

I just save my data with a text file

valid burrow
#

it depends on the kid of data

grim hound
storm crystal
valid burrow
#

when handling user sensitive information cross server you should use a db

valid burrow
chrome beacon
grim hound
#

Everything

valid burrow
#

wow

grim hound
#

No need for a db

valid burrow
#

great argument

storm crystal
valid burrow
#

a video can store everything too

#

doesnt make it a good solution

hazy parrot
#

db is actually a file 💥

grim hound
valid burrow
hazy parrot
#

i mean just write it on paper and use ocr to read data into memory

storm crystal
#

I made SQLite database to store player statistics like deaths because thats what Ive been told to use for shit that changes over time
Then I was told to not use it for shit that doesnt change like custom enemy statistics or custom weapon data, so Im left with no implementation for that

valid burrow
#

Databases and files both have valid use cases

#

but you cant just say every data should go in either

storm crystal
#

and now I wanted to implement inventories into SQLite database and yet it will be referenced upon a lot

grim hound
storm crystal
#

and yes no.2, each player will have their own set of inventories

valid burrow
storm crystal
#

as GUIs

valid burrow
#

thats correct

#

okay so dusk

#

you should not store guis

#

instead

#

store the building blocks of the gui

#

and regenerate them every time requested

#

for example

#

lets say the inventory should display your deaths

#

just an example

#

every time they join you get their deaths

#

and generate the inventory accordingly

grim hound
valid burrow
#

and remove it after they leave

grim hound
valid burrow
#

ah i give up

#

do what ever you want

#

but dont complain about it being inefficent later

grim hound
#

I would leave it empty

storm crystal
#

you literally give the most vague answer

#

and dip out in the middle of explaining it

valid burrow
#

?

storm crystal
#

what do you expect me to do

#

xd

valid burrow
#

how is this vague

storm crystal
#

yes store items but how exactly

#

what do use

valid burrow
storm crystal
grim hound
storm crystal
#

when you send one message at a time instead of entire explanation in one message I have no idea when you are supposed to finish

chrome beacon
storm crystal
#

so im waiting for you to say when you are done

valid burrow
#

can you tell me what exactly these inventories contain?

#

Is it like a storage, or a menu of some sort

storm crystal
#

the easiest example I can provide is look at hypixel's guis

valid burrow
#

wellll

#

why would you want to store that

#

just generate the GUI when requested

storm crystal
#

because each player has their own data to be shown there?

valid burrow
grim hound
valid burrow
#

not the inventory

valid burrow
storm crystal
#

great but how

valid burrow
#

didnt you say you are already storing deaths and shit?

#

the exact same way

storm crystal
#

ill trash it

grim hound
valid burrow
#

brotha

#

what-

storm crystal
#

because its supposedly unnecessary to use sqlite for that

valid burrow
#

are you drunk and high?

grim hound
#

What do you not get?

grim hound
valid burrow
#

WHY TF WOULD YOU STORE THE INVENTORY INSTEAD OF THE DATA

grim hound
#

Back at you

chrome beacon
#

If I want a GUI showing my stats I store my stats not the GUI

valid burrow
#

SOMEONE WITH A BRAIN

chrome beacon
#

^^ just an example

grim hound
storm crystal
#

so like what hypixel stores every single thing like "has X crafting recipe unlocked" in database that is 10000000000 blocks long or what

valid burrow
storm crystal
#

not at all

valid burrow
#

????

#

yes?

storm crystal
#

no?

valid burrow
#

do you know how many bytes a single itemstack is

grim hound
storm crystal
#

idc its in one place instead of being spread around god knows how many

#

okay then

#

how would I make an enderchest in that case

#

Id have to store the entire inventory

valid burrow
#

thats something completly different

#

no store the items

#

not the inventory

#

the inventory contains unecesarry information

storm crystal
#

whats the difference

valid burrow
#

wasting space

storm crystal
grim hound
#

Ah, the 0.001 KB more

#

Oh man

grim hound
valid burrow
# storm crystal whats the difference

Look whats easier to save:
siea has 10 kills
siea has 10 deaths
Or
Theres this gui its 20x3 wide it has 41 slots of them are 3 filled
for each of the 3 items
Name
Desc
Material
Size
Texture
Additional Data
Slot

storm crystal
valid burrow
#

im talking about data size

#

but i give up

#

do it

storm crystal
grim hound
#

What is with you

valid burrow
grim hound
#

Have you ever actually seen the Inventory object?

storm crystal
#

classic

valid burrow
#

sorry mb

#

only about 20x bigger

grim hound
valid burrow
#

i will caculate it rn

hazy parrot
#

it doesn't really matter

grim hound
storm crystal
#

what data type is inventory when in database

#

is it integer

valid burrow
grim hound
valid burrow
#

integer is number

grim hound
#

It's a byte array

#

If serialized

grim hound
#

You could also have it as a convertable String

#

Depends on how you save it

storm crystal
#

so how do I write it into SQLite database

grim hound
#

Okay, still, why the database

valid burrow
#

Itemstack

Item ID: Assuming it's stored as a short integer (2 bytes)
Metadata: If stored as a byte, it's 1 byte
Count: integer 4 bytes
NBT Tags: say 50 bytes, for this example (could be much more)
``` Total around 60 bytes

Now for a normal Large Number (2 147 483 647 32bit limit)
Thats 4 bytes.
#

now 60/4

#

how much is that?

grim hound
#

Or whatever, let's just stick with it

storm crystal
#

going

#

to be

#

changed

#

over time

#

why else would it not be database then

grim hound
storm crystal
#

?

grim hound
#

And requires a set-up

storm crystal
#

I dont care I have it

grim hound
storm crystal
grim hound
valid burrow
#

lolz

hazy parrot
chrome beacon
grim hound
#

Packet level

chrome beacon
#

It got changed in 1.13

buoyant viper
#

me when i flatten

#

im a real flattener

grim hound
storm crystal
grim hound
young knoll
#

Items probably get a numeric id for networking

#

Blocks do at least

storm crystal
hazy parrot
#

we have no idea what is dataAccessObject.getInventory(), but we can assume its not returning byte array

grim hound
#

With boos

storm crystal
#

how to do it as one liner

grim hound
#

Just create a local var

grim hound
young knoll
#

Yeah that’s not gonna be a one liner

storm crystal
#

yeah I quit it

grim hound
#

So that in the code it'll just delegate to it so that it's a one liner

chrome beacon
chrome beacon
#

And even if you handled that yourself you'd need to migrate the data or ensure unqiue ids cross versions

grim hound
valid burrow
young knoll
#

Yeah I’d just store the namespaced key

valid burrow
#

Coll you dont understand the pure insanity that is going on here

#

they are storing player data

#

in an inventory

young knoll
#

Eh?

grim hound
valid burrow
grim hound
storm crystal
grim hound
#

Talking about

valid burrow
young knoll
#

Yes

#

Yes they do

storm crystal
grim hound
#

The guy is trying to save an inventory into a db

valid burrow
grim hound
#

Dassit

young knoll
#

The only reason to do that

valid burrow
storm crystal
young knoll
#

Would be to store stuff like the players inventory across servers

storm crystal
valid burrow
#

What else would you call played x unlocked x

storm crystal
#

I want a way to store interactive inventory GUIs for both menu and stash purposes

grim hound
#

An example

#

Brotha

storm crystal
#

cant I just

#

ditch that fucking sql database

#

and just store it in normal files

grim hound
#

Yes

storm crystal
#

even if its a changing data

valid burrow
#

Okay tell me

#

what does the GUI display

young knoll
#

Don’t store a menu, just store what you need for the menu

valid burrow
#

that cant be saved by itself

buoyant viper
valid burrow
young knoll
#

Storing an inventory for a stash makes sense tho

valid burrow
#

2 even

buoyant viper
#

it fits in a byte :(

valid burrow
#

we all start somewhere

storm crystal
valid burrow
#

mines a boolean

#

0

buoyant viper
#

true

young knoll
#

Yeah you can

#

Items are configuration serializable

#

Would be an ugly file tho, lul