#help-development

1 messages · Page 815 of 1

kind hatch
#

Yes

young knoll
#

however there is a library for that

kind hatch
#

^

worthy yarrow
#

Please tell me 😄 that would be very kind

kind hatch
#

The library covers a lot of cases

worthy yarrow
#

I'll give it lookover either way

knotty harbor
#

will open jdk 21 work on 1.20.1 plugins?

chrome beacon
#

probably

true shuttle
#

ok i'm having some troubles with this, how exactly can I do this?

#

for context I'm trying to make a custom vehicle

native ruin
#

this works when i do a full file path, but not when i do a relative file path
im using new File(filepath) btw

hazy parrot
#

path inside of jar file ?

remote swallow
#

a java class or different

hazy parrot
#

if its inside of your jar file, that wouldn't work

native ruin
#

how should i handle it differently?

hazy parrot
#

what do you want to do

native ruin
#

inside my jar/project

remote swallow
#

what do you want to do with them

glossy venture
#

whats the event calledwhen a projetile hits a player

#

EntityDamageByEntityEvent?

young knoll
#

EntityDamageByEntity or ProjectileHit

glossy venture
#

aight

#

ProjectileHit doesnt hold the hit entity so yeah

#

if it calles EntityDamage thats great

native ruin
hazy parrot
#

dude what do you want to do with it

remote swallow
#

do you need an instance of the class for something, bc this gives xy vibes

grim hound
#

the fuq

hazy parrot
#

do you want to somehow export it outside of jar

grim hound
#

I type in "MobEffectList" in the mappings

hazy parrot
#

or just get all classes inside of package

grim hound
#

and it shows me the "MobEffect" class

native ruin
#

no just get the package with the files insde

grim hound
#

after clicking on the "MobEffectList" suggestion class

remote swallow
#

what do you want to do with the files after

hazy parrot
#

?xy

undone axleBOT
kind hatch
grim hound
#

WHY WOULD THEY REMOVE

#

THE MOST USEFUL FKIN

#

METHOD

native ruin
hazy parrot
#

still xy

remote swallow
#

okay, why do you need the file array of commands

hazy parrot
#

you can't easly get File instance of thing inside of your jar

rotund ravine
#

Why are ya looking in packages

kind hatch
grim hound
native ruin
grim hound
#

a replacing method

rotund ravine
remote swallow
hazy parrot
#

yeah that isn't really way to do it

native ruin
hazy parrot
remote swallow
#

why is there text files in there

#

those should be in resources

rotund ravine
#

They shouldn’t be in your package

grim hound
hazy parrot
#

packages are exclusive for .class files, all other should go to resources

#

but still, you can't add files there at runtime

native ruin
#

i also want to read the other packages inside of it, how do i do that

rotund ravine
#

what is in those

remote swallow
#

is there more text files in those packages

native ruin
rotund ravine
#

Show

native ruin
grim hound
#

for what purpose

native ruin
#

just the names

rotund ravine
#

Why

grim hound
kind hatch
# grim hound mmm

I guess you have to use the generic MobEffect class and go from there. It seems that it just points back to that class.

remote swallow
#

why not a method that takes a name and an instance

rotund ravine
#

And startup

#

Ur welcome

native ruin
kind hatch
#

Idek what this is used for, but it is the spigot equivalent of MobEffectList

rotund ravine
#

Read them

remote swallow
rotund ravine
#

Whatever you are trying to do is either completely shitty or stupid

grim hound
#

but

#

they removed the static method

#

for getting a MobEffectList from an id?

grim hound
native ruin
rotund ravine
#

Why?

native ruin
remote swallow
#

once again

#

?xy

undone axleBOT
grim hound
kind hatch
rotund ravine
grim hound
#

Class.forName

#

or does he not want to load them?

rotund ravine
#

.getSimpleName is already using the class

remote swallow
#

they want to get the class during runtime

#

and arent hard coding it

rotund ravine
#

It’s dumb

rotund ravine
#

You should not have floating classes like that

grim hound
#

link me the code to that

#

to the BuiltInRegistries class

#

and the byId method

worthy yarrow
#

Does anyone have an example of implementing another api?

native ruin
#

nvm ig

rotund ravine
kind hatch
worthy yarrow
kind hatch
#

That class (BuiltInRegistries) is still available in 1.20.2, so you should be able to use it.

rotund ravine
worthy yarrow
grim hound
#

in my spigot

kind hatch
#

Do you not use the mojang mappings?

dry hazel
#

it's never been named IRegistry either

#

IRegistry is the Registry class

river oracle
#

it was IRegistry a while ago I think

#

but the registries have moved

#

to Registries.java

dry hazel
#

old versions smh

grim hound
grim hound
kind hatch
#

Any particular reason for that? They've been available in spigot since 1.17. Plus they were originally added all the way back in 1.14

grim hound
#

and never actually needed the originals

#

I also never knew whether they were present on spigot servers

kind hatch
#

The mappings are purely for development purposes. So that you don't have to dig through all the obfuscated names.

valid burrow
#

do entities have uuids or something similar

young knoll
#

yes

dry hazel
kind hatch
#

The reason it's done this way is because Mojang said not to distribute the mappings. Hence why the spigot jar still uses the obfuscated names at runtime.

celest notch
#

How would i code ai for some nms player npcs im making a post apocalyptic rp kinda server if you've played rust kinda like the scientists

kind hatch
#

Might want to look into how Citizens does it.

chrome beacon
#

Or just use the Citizens API

celest notch
rough drift
#

look into the vanilla entities like Zombie

chrome beacon
#

Spawning them is the easy part

rough drift
#

they have pathfinding goals in there you can learn from

slate tinsel
#

How can you make it so that you cannot duplicate items in the inventory in creative?

chrome beacon
#

Well that's hard

#

You'd need to track and count each item in the inventory yourself

rotund ravine
#

You really can’t reliably

#

Creative is it’s own little thing

grim hound
#

In Class<T>

#

what is the T called

#

in reflections

#

?

river oracle
#

a generic

#

there is Type Erasure so you can't get that with reflection

grim hound
#

eee

#

I can't check whether a Field

river oracle
#

no

umbral ridge
#

can you create a pickaxe with a different durability, eg. for stone pickaxe default durability is 131. can I make it like 200?

#

only for specific item, not for all on the server

grim hound
umbral ridge
#

I don't understand

river oracle
#

its defined at compile time whether or not a field can be or is IRegistry<MobEffectList>

umbral ridge
grim hound
#

"Can you create (...)?"
"Yes"

#

you never asked how

grim hound
grim hound
#

but I already found it on the web

umbral ridge
grim hound
proud badge
#
                                CoreProtectAPI.ParseResult parseResult = CoreProtect.getInstance().getAPI().parseResult(result);
                                String lookupPlayer = parseResult.getPlayer();
                                if (!lookupPlayer.startsWith("#")) {
                                    if (!hasPlaced) {
                                        if (!hasRemoved) {
                                            AlertObject alertInfo = new AlertObject();
                                            alertInfo.griefer = player;
                                            alertInfo.block = block;
                                            alertInfo.material = material;
                                            alertInfo.frameItem = new ItemStack(Material.AIR);
                                            alertInfo.type = 0;
                                            alertInfo.timeStamp = System.currentTimeMillis();
                                            alerts.put(blockNumber, alertInfo);
                                            doAlert = true;

                                        }
                                    }
                                }
                                break;
                            }```
in theory that "break;" would make it so I get the first element only?
umbral ridge
grim hound
proud badge
#

ok thanks

grim hound
timid hedge
#

Can someone please help me, so my problem is that i have opened another eclipse project in intellij, and after i have closed that and opened a new one all the depencyes are at the other projects location. How do i fix that so i dosent be at the same location?

rotund ravine
#

What

glass mauve
#

how does MapRenderer#render works?

#

I thought it always runs through automatically

grim hound
#

you can set a map

#

a renderer

#

and when the servers decides to render something

#

it'll fire the render method

glass mauve
#

uh ok is there a reason why it only runs once in my case?

grim hound
#

rendered only once

glass mauve
#

ok I have a custom renderer, how can I let it run automatically?

grim hound
#
ItemStack item = new ItemStack(Material.FILLED_MAP);
MapMeta meta = (MapMeta) item.getItemMeta();
if (!meta.hasMapView()) meta.setMapView(mapView);
for(MapRenderer renderer : mapView.getRenderers()) mapView.removeRenderer(renderer);
mapView.addRenderer(new SexyRenderer());
item.setItemMeta(meta);
glass mauve
#

ok let me give some more context:

this.renderer = new Renderer();

MapView view = Bukkit.createMap(world);
view.getRenderers().forEach(view::removeRenderer);

view.addRenderer(renderer);

item = new ItemStack(Material.FILLED_MAP);

MapMeta meta = (MapMeta) item.getItemMeta();

if (meta != null) {
    meta.setMapView(view);
    item.setItemMeta(meta);
}

I have this for my Map

glass mauve
#
public class Renderer extends MapRenderer {

      private final @NotNull Queue<PixelChange> renderUpdates = new ArrayDeque<>();

      @Override
      public void initialize(@NotNull MapView map) {
          map.setTrackingPosition(false);
      }

      @Override
      public void render(@NotNull MapView view, @NotNull MapCanvas canvas, @NotNull Player player) {
          while (!renderUpdates.isEmpty()) {
              PixelChange update = renderUpdates.poll();
              canvas.setPixelColor(update.x(), update.y(), update.color());
          }
      }

      public void setPixel(@NotNull Color color, int x, int y) {
          renderUpdates.add(new PixelChange(color, x, y));
      }

      private record PixelChange(@NotNull Color color, int x, int y) { }

  }
grim hound
#

so what's the problem?

glass mauve
#

my MapRenderer#render only runs once

grim hound
#

that's

#

how

#

maps

#

work

glass mauve
#

but I want it to continuously run

grim hound
#

why would you

#

update a map many times

#

if it needs usually

#

to be rendered once

glass mauve
#

but the image on my map updates

grim hound
grim hound
grim hound
#

so if you want I can link you my github

glass mauve
#

I use packets as well, for sending the Item Frame + Map already

#

but I thought the rendering would work automatically

#

I use player.sendMap(view)

#

to send the MapView

grim hound
#

then can't you just

#

update the MapView?

glass mauve
#

I thought so, but the MapRenderer only runs once

#

to update a MapView I add a MapRenderer

glass mauve
#

but this should work without packets

timid hedge
cosmic quiver
#

Is there an easy way to test a plugin that involves multiplayer interactions with other players? I only have the one account.

timid hedge
# rotund ravine What

I have an example here, all the locations are like this: D:\clients\minecraft\abaac\workspace\jars\versions\1.8.8\1.8.8.jar but it should be: D:\clients\minecraft\FC-1.8\workspace\jars\versions\1.8.8\1.8.8.jar, and it is also like that with every other dependency with mcp (the abaac is the earlier project i wrote about)

cosmic quiver
grim hound
#

Citizens

#

Sentinel

#

both

#

are necessary

cosmic quiver
#

Okay thanks 👍

true shuttle
#

I'm trying to make a custom drivable vehicle. I've already made a resource pack to replace a mob, but how can I make the mob drivable?

#

I might just make the mob a pig so I don't have to do player input packets

#

but how can I make that mob drivable without having to hold a player on a stick?

#

or is that not possible

prime reef
#

alright I'm rusty on the API, how can you tell if a LivingEntity is fireproof?

prime reef
warm mica
prime reef
#

if you're using the mojang remappings I think it's ServerboundPlayerInputPacket now

#

yeah

prime reef
#

for my purposes though it should be alright ig

#

thanks

true shuttle
warm mica
prime reef
prime reef
#

as long as they can't be on fire lmao

true shuttle
#

where do you think the best place to start learning is?

prime reef
#

depends on what you're trying to learn

#

are you new to programming? new to spigot?

true shuttle
#

neither, but not well really familiar with the technical side of stuff like packet reading

prime reef
#

ah, that

#

I'll be honest, I don't do it much, but if you're already familiar with spigot then the best way to learn is to just mess around with it

true shuttle
#

alr, thx for the help!

prime reef
#

this might be of use

#

it's a bit dated

#

if you're using remappings it's probably not that useful actually

gleaming yarrow
#

anything more recent on this?

#

the materials ive found seem to be moderately to extremely outdated

prime reef
#

you could try replacing the entity via NMS and overhauling the collision hitbox, I guess

#

or use your own custom hitbox but if you're trying to do it for regular game events that's probably excessive

#

man, this is probably silly, but is there any reference in spigot to what cooks to what, or do I have to manually set that up? i'm replacing the "on fire" mechanic with one that doesn't devour your iframes

rustic hamlet
#

hey guys

#

anyone have good resources on bungeemessaging?

#

for some reason my bungee messaging only works for players in versions <1.20

#

im running 1.8 spigot backend and 1.20 waterfall bungee

sullen marlin
#

waterfall is not bungee

rustic hamlet
#

so i need to use bungee for bungeemessaging to work properly @sullen marlin ?

river oracle
#

Waterfall is a fork of bungeecord that isn't supported here

#

seek help elsewhere

true shuttle
#

Is anyone familiar with ProtocolLib?

#

I'm trying to use it and can't seem to install it even though i'm following a tutorial

#

nevermind, apparently i had to reset my cache or something but i'm good now i think

rustic hamlet
worthy yarrow
upper hazel
#

how i can create addon support in my plugins. I know what addons are but not at the software level

echo granite
mental spire
#

is it possible to make in mmocore so that when you tap on column 1 displays the skill branch 1, and when you tap on I column 2 displays the skill branch 2?

paper viper
#

If not i would suggest you search on google how to add a libary to my maven project or the second option you just copy paste the 4 files directly into your project

minor junco
#

Sometimes I feel like people don't value other people's time at all when they ask for the most basic shit you could google within 2s instead of waiting 2 hours for a response

quaint mantle
#

I have this, and wanted to ask what i can do with "World.Environment.CUSTOM". Can i change the sky so it matches end?

            WorldCreator wc = new WorldCreator("world_moon");

            wc.environment(World.Environment.CUSTOM);
            wc.type(WorldType.NORMAL);
            wc.generator(moonGenerator);
            wc.generateStructures(false);

            Bukkit.getConsoleSender().sendMessage("Started creation of the moon...");
            wc.createWorld();
            Bukkit.getConsoleSender().sendMessage("Moon created!");
proud badge
#

How could I get the skull owner from BlockData?

proud badge
#

well I can get a skullOwner from the Skull, but how do I get a Skull from a BlockData?

eternal oxide
#

don;t use BlockData

proud badge
#

well what do I use then?

#

block?

eternal oxide
#

TileState, BlockState

proud badge
#

hmm, I'm using the coreprotect API and trying to get a skullowner, could I get a blockstate or tiledata from blockdata?

eternal oxide
#

Does that API return a Bukkit BlockData or an NMS one?

proud badge
clever lantern
#

what is the difference between #sheduleSyncRepeatingTask and #runTaskTimer

eternal oxide
#

as far as I know you can;t go from BlockData to a Skull

proud badge
#

Rip

shadow night
#

isn't there a SkullData class

lost matrix
clever lantern
#

if i use return in the runnable it cancels the task?

lost matrix
clever lantern
#

so how can i cancel the task from the runnable itself

lost matrix
#

You would have to extends BukkitRunnable for that. It can cancel itself.

clever lantern
#

thanks

quaint mantle
lost matrix
# clever lantern thanks

Here is an example:

public class TimerRunnable extends BukkitRunnable {
  
  private final int targetTicks;
  private int currentTicks;

  public TimerRunnable(int targetTicks) {
    this.targetTicks = targetTicks;
  }

  @Override
  public void run() {
    if(++this.currentTicks >= this.targetTicks) {
      this.cancel();
      return;
    }
    System.out.println("Tick " + this.currentTicks);
  }
}

(PS: Dont use runnables like that for timers or cooldowns)

clever lantern
#

then cancel if current ticks == target ticks

lost matrix
# clever lantern then cancel if current ticks == target ticks

Cooldowns should always be done with timestamps in the future. Displaying the diff between now and this future timestamp can be done
with a runnable. In your case, its probably better to start a task for 5min in the future, which then starts a task for 1min later and each task
starting a new one with a shorter time delta to itself.

But running a single task with a tick timer internally is also viable because increment and modulo are very cheap operations.

#

Honestly scrap the idea of starting a new timer each time. Internally spigot does this increment & modulo for tasks anyways iirc

clever lantern
#

so just 1 task will be better?

lost matrix
#

I personally would even go for a single task, which is started when the plugin loads and never stops. This task would
have the responsibility of displaying any cooldown to anyone. I almost never create tasks then cancel them.

wraith dragon
quaint mantle
#
  • how do i ignore java version in start.bat ?
  • or spigot 1.16.5 works with jdk 17 ?
  • will i have a problem if i ignore the java version?
hazy parrot
lost matrix
lost matrix
wraith dragon
clever lantern
#

i think starting more tasks is more expensive than just 1 task

lost matrix
wraith dragon
lost matrix
wraith dragon
#

and like skip it if not needed?

lost matrix
wraith dragon
#

hmm

lost matrix
#

If you want a more in-depth guide then you can read my post about splitting workloads

#

*Only makes sense if you have a bit of programming experience

wraith dragon
#

Alright, thanks

gleaming yarrow
#

Actually I might have a workaround for this

#

Ill handle collision checking using custom logic

proud badge
#

Is TNT counted as an entity in the "EntityExplodeEvent"?

#

Or is it only for creepers

wraith dagger
#

hey

#

how to cancel knockback in EntityDamageByEntityEvent?

proud badge
#

How could I translate this into human readable stuff?

proud badge
#

check the spigot docs

#

for the exact method

remote swallow
clever lantern
#

and blockexplodeevent

remote swallow
#

tnt would use entity explode event

rotund ravine
remote swallow
#

because it becomes an entity

shadow night
grim hound
#

I'm really confused

#

I have this variable

#

public static final IRegistry<net.minecraft.world.effect.MobEffectList> e

#

and the

#

net.minecraft.core.Registry class

#

but when I check

#

e.getType().isAssignableFrom(theRegistryClass)

#

is shows false

rotund ravine
#

Is IRegistry Registry? I think not

rotund ravine
#

Oh

grim hound
rotund ravine
#

Weird naming conv smh

dry hazel
#

isAssignableFrom works the other way around

grim hound
dry hazel
#

theRegistryClass.isAssignableFrom(e.getType())

grim hound
#
Determines if the class or interface represented by this
{@code Class} object is either the same as, or is a superclass or
superinterface of, the class or interface represented by the specified
{@code Class} parameter.
dry hazel
#

yes

grim hound
dry hazel
#

this class (registry) is a superinterface of the class represented by the specified class parameter

devout vault
#

"Does anyone know how to connect three servers using BungeeCord? We have two servers, one serving as the main hub and the other running on BungeeCord. Additionally, we have a friend who operates their server on a different hosting platform. How could we link these three servers using the BungeeCord proxy to facilitate seamless interaction between them?

upper hazel
#

i was use another code for find random location in the quadratic zone https://paste.md-5.net/deremibeto.cpp but still outside the radius (for example from 1000 to 2000 and from -1000 to -2000)

upper hazel
grim hound
upper hazel
grim hound
upper hazel
#

"square radius"

grim hound
#

square

#

outside

#

a smaller square

eternal oxide
#

x/z +- min to max

grim hound
grim hound
#

easy stuff

#

(random.nextInt(1000) + 1000) * (random.nextBoolean() ? -1 : 1)

eternal oxide
#

^ once for x and again for z

upper hazel
eternal oxide
#

that looks such a mess

#

you just want a random location around the center at a minx/max distance?

upper hazel
#

yes

#

but

#

make the randomness more uniform while maintaining or improving the same search speed

eternal oxide
#

what? search speed?

upper hazel
upper hazel
#

while keeping the search speed the same

eternal oxide
#

um random is random, there is no uniform

upper hazel
eternal oxide
#

your getLocation is fine, but don;t pass a random. Not needed

#

your getLocation2 is junk

devout vault
#

Does anyone know how to connect three servers using BungeeCord? We have two servers, one serving as the main hub and the other running on BungeeCord. Additionally, we have a friend who operates their server on a different hosting platform. How could we link these three servers using the BungeeCord proxy to facilitate seamless interaction between them?

upper hazel
eternal oxide
#

I'm not reading a page of text

#

you drew a picture and asked hwo to get a random location in teh outer box

upper hazel
#

oh wait this wrong link

#

I wanted to optimize the location search by making it more uniform in area and took the code from here, but I couldn’t understand why it went beyond the required area

eternal oxide
#

or whatever your Location uses

#

um, in your picture you drew boxes. In the page you linked it uses an actual radius

#

which are you wanting to do?

upper hazel
eternal oxide
#

then the code I just posted will do that

#

except don;t use new Random

#

I only put it there as I was too lazy to type

quiet ice
#

Does anyone know how to read Kotlin code as knows the Java-transcribed equivalent of https://github.com/JetBrains/kotlin/blob/master/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ScriptingHostTest.kt#L108

I've somehow managed to figure out that the function call can be traced back to https://github.com/JetBrains/kotlin/blob/master/libraries/scripting/jvm-host/src/kotlin/script/experimental/jvmhost/BasicJvmScriptingHost.kt#L33, but is there an easy way to trace it back deeper? It does not seem as if I can call inlined functions from java code, hence my question

upper hazel
#

and the location itself, in what way is it searched, what is this code used for, it’s just similar to Location = get(get));

eternal oxide
#

There is no search, its Random

upper hazel
#

it biases the result?

eternal oxide
#

no

upper hazel
#

I mean why is a ready-made location accepted for input?

eternal oxide
#

for an origin

#

the min/max is an offset

upper hazel
#

That's why I asked how to get it to uh get it again?

eternal oxide
#

No idea what you are asking

upper hazel
#

i mean what method is used to create a ready-made location that is included in this method

#

public static getRandomLocation2D(int minRadius, int maxRadius, --> Location2D location <--) {

eternal oxide
#

it doesn;t really matter if you pass in a Location2D or an X and Z

#

its just an origin

upper hazel
#

I understand this is a 2nd layer to make the location more unique?

eternal oxide
#

no

upper hazel
#

what the "origin"

#

i dont undestand

eternal oxide
#

an origin is the point you start at

quiet ice
#

Might be 0/0, might be something else

upper hazel
#

what?

eternal oxide
#

so you could have an origin of 0,0 or 23423423,12312

upper hazel
#

oh you mean center ?

eternal oxide
#

yes, origin

#

origin = place where you start

upper hazel
#

i see

eternal oxide
#

actually that math is wrong

#

that would only give locations in teh 4 corners squares

twin venture
#

Hi i have a weird problem with redis , so :
i made a system where it get the arena data , etc etc and that's cool and all , but my problem that it works only for the first user who clicks it? it send him to the arena , but if i go back to the lobby server it does not do anything upon clicking on the gui

spiral light
twin venture
#

Let me try to do that now and see what's wrong .

spiral light
#

is there an error in console or did you try to send a simple message to the player when he clicks on a item

twin venture
#

it should send him to the sw server, and it did in the first try

#

but when i rejoined in lobby it stoped working

#

i will restart both of servers and see what will happen

#

using redis publish and subscribe for it

#

i added a remove method for the arena , from the redis map i created, so if a server closed it will be removed from redis

#

and the map

#

so in the gui , it will not duplicate i guess

proud badge
#

Ok how I understand is that first part 1 will run, then part 2 will run on a different thread, and after part 2 is done running part 3 will run?

spiral light
#

nope... part 2 runs outside of the pther parts

proud badge
#

so how could I make it so it runs like I mentioned?

#

so it says "Rollback started" then the rollback happens and it says "Rollback complete"

spiral light
#

move the 3 part inside the 2 part at the end

#

and use a Sync task for this

proud badge
#

I cannot call bukkit methods inside of a different thread

#

ah like runTask?

spiral light
#

yes

proud badge
#

ok

green plaza
#

If anyone could explain me why it is not updating?

        System.out.println(itemStack.getItemMeta().getPersistentDataContainer().getKeys());
        ((CraftPersistentDataContainer) itemStack.getItemMeta().getPersistentDataContainer()).putAll(write(new CompoundTag()));
        System.out.println(itemStack.getItemMeta().getPersistentDataContainer().getKeys());

Output:

[14:59:02] [Server thread/INFO]: [plugin:weapon_definition, plugin:slots]
[14:59:02] [Server thread/INFO]: [plugin:weapon_definition, plugin:slots]

Method write:

    @Override
    public CompoundTag write(CompoundTag compoundTag) {
        compoundTag.put("name", StringTag.valueOf(name()));
        compoundTag.put("rarity", StringTag.valueOf(rarity().name()));
        compoundTag.put("id", IntTag.valueOf(1));
        compoundTag.put("eventClass", StringTag.valueOf(actionClass().getSimpleName()));

        return compoundTag;
    }
#

Because i am getting confused asf. And the best part is that

spiral light
#

you need to use getItemMeta().setPeristendData ...

proud badge
#

so like this

spiral light
#

yes

proud badge
#

ok thanks

spiral light
#

when the async task is finished you need to go back into the sync task for bukkit stuff.... i think it will work

river oracle
#

ItemMeta is copied*

eternal night
#

it is

river oracle
#

You need to save it in a variable and then update it using setMeta

eternal night
#

it is just a copy

river oracle
#

Swhat I meant mb

eternal night
river oracle
green plaza
#

Well silly me if that works

        ItemMeta itemMeta = itemStack.getItemMeta();
        System.out.println(itemMeta.getPersistentDataContainer().getKeys() + " : " + itemMeta.getPersistentDataContainer());
        ((CraftPersistentDataContainer) itemMeta.getPersistentDataContainer()).putAll(write(new CompoundTag()));
        System.out.println(itemMeta.getPersistentDataContainer().getKeys() + " : " + itemMeta.getPersistentDataContainer());
        itemStack.setItemMeta(itemMeta);
river oracle
#

That's how you do it my friend

green plaza
river oracle
#

Should check out whatever your write api is

green plaza
# river oracle That's how you do it my friend
[15:06:31] [Server thread/INFO]: [plugin:weapon_definition, plugin:slots] : org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer@8eef6bb7
[15:06:31] [Server thread/INFO]: [plugin:weapon_definition, plugin:slots] : org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer@ba9da361

Even the addresses are changed afet "putAll" HOW?

green plaza
river oracle
#

Why are you printing the memory address that isn't going yo be helpful to see if things change

proud badge
#

Whats the difference between Material.CARROT and CARROTS?

river oracle
#

Items copy stuff a ton the memory address is bound to change unless you do literally nothing

green plaza
#

OKay but the memory addrese should stay still

river oracle
river oracle
proud badge
#

I thought Material was only for blocks and ItemStack was for items

river oracle
#

Go look at internals if you don't believe me

#

?stash

undone axleBOT
river oracle
green plaza
#

I belive you put then how can i write this into this itemstack DataContainer?

river oracle
#

Idk what that random api is that u use to write nbt so I can't help you

#

I'd assume that's the issue if it's not writing but again your sysout statements don't give you info on whether or not it actually wrote data

green plaza
#

It's just a spigot

river oracle
#

Don't think spigot contains CompoundTag

#

That screams NBT

green plaza
#

net.minecraft.nbt.CompoundTag

eternal night
#

that is internals

#

why are you using internals with the PDc

#

you can literally do nested PDCs with the API

clever lantern
#

whats the best way the get all items on the ground

river oracle
#

Like I the entire world?

clever lantern
#

yeah so i can take them into gui

green plaza
eternal night
#

it makes 0 sense

#

Why would you ever use internals

#

when you can just use api

clever lantern
#

I thought about Bukkit.getWorld(world).getNearbyEntities(location, x, y, z)

river oracle
river oracle
#

To get items in unloaded chunks you either have to load them or read the chunks dat file

clever lantern
#

yeah i think loaded chunks will be ok

green plaza
#

What is even PDC?

clever lantern
#

persistent data container

river oracle
#

And allows you to use nbt to store data persistently

eternal night
#

The fact that it wraps NBT is an implementation detail

#

its an API that you can throw data at in a speciifc format

#

and it persists it across restarts

clever lantern
#

what is nbt

green plaza
#

Oh yea now i get it

river oracle
green plaza
#

So i should create new PDC, add values normally without using Remapped, and then add this newly created PDC to the itemstack PDC?

eternal night
#

?pdc

eternal night
#

literally just follow the guide

#

it is a rather straight forward API to use

river oracle
#

Again important to stress you don't need craftbukkit internals or nms for this if you need help after reading please ask

clever lantern
#

what is the difference between nbt and pdc

eternal night
#

one is an API

#

the other is internals

green plaza
river oracle
#

Most things you can do with NBT can already be achieved by the api

rotund ravine
#

Pdc is nbt

river oracle
#

Exception would be reading .dat files from disk

green plaza
rotund ravine
#

Pdc and itemmeta are both nbt

quiet ice
#

All PDC is NBT one way or the other, but not all NBT is PDC

green plaza
#

Literally i fell so confused XD

rotund ravine
#

Just cause it wraps does not change what it is

river oracle
#

Don't worry about internals man

#

The api is there so you don't have to :P

#

Live in the blissful ignorance

green plaza
green plaza
quiet ice
#

Wha?

river oracle
#

@eternal night big fan of inventories? 😈

quiet ice
#

If the question is whether you want to use NMS - then don't.

shell robin
#
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
            saveDefaultConfig();
        }

        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event) {
            Player player = event.getPlayer();
            if (getConfig().contains("join-reward")) {
                String itemMaterialString = getConfig().getString("join-reward.item");
                int amount = getConfig().getInt("join-reward.amount");
                String displayName = getConfig().getString("join-reward.display-name");
                Material material = Material.matchMaterial(itemMaterialString);
                System.out.println(itemMaterialString+"\n"+amount +"\n"+displayName+"\n"+material.toString());
                if (material != null) {
                    ItemStack itemStack = new ItemStack(material, amount);
                    ItemMeta meta = itemStack.getItemMeta();
                    if (meta == null) {
                        meta = Bukkit.getItemFactory().getItemMeta(material);
                    }
                    List<String> loreList = getConfig().getStringList("join-reward.lore");
                    if (loreList != null && !loreList.isEmpty()) {
                        meta.setLore(loreList);
                    }
                    meta.setDisplayName(Utils.color(displayName));
                    itemStack.setItemMeta(meta);
                    player.getInventory().addItem(itemStack);
                    player.sendMessage("Girişte item başarıyla verildi!");
                } else {
                    getLogger().warning("Config dosyasındaki malzeme geçerli değil: " + itemMaterialString);
                }
            } else {
                getLogger().warning("Config dosyası hatalı");
            }
        }

config.yml:

join-reward:
  item: DIAMOND
  amount: "1"
  display-name: "Join Reward"
  lore:
    - "Line 1"
    - "Line 2"```
Error: Material cannot be null
#

how can i solve this

young knoll
river oracle
twin venture
quiet ice
#

If it is compile-time, just slap an assert material != null; in it

#

(or do proper null checking :P)

river oracle
#

Me passing AIR to make the plugin explode

green plaza
#

Material material = (Material.matchMaterial(itemMaterialString) == null ? Material.AIR : Material.matchMaterial(itemMaterialString));

#

XDDD

shell robin
quiet ice
#

Ah no, it has to do with you Sysout @shell robin , material.toString() means that material now cannot be null

clever lantern
#

how to check if entity is a dropped item

river oracle
quiet ice
#

And thus your if-statement is superfluous, which is why your IDE complains about it

clever lantern
rotund ravine
#

Item

quiet ice
#

No.

river oracle
#

ItemStacka aren't entities

shell robin
#

should it work right now?

quiet ice
#

I wouldn't delete the if-statement per-se but rather the system.out.println

#

Or use Objects.toString(material) instead of material.toString()

green plaza
#

@river oracle is there any diffrence if i create new PDC using

new CraftPersistantDataContainer()

or using PDC context?

quiet ice
#

Or not use .toString() at all in which case it will default to a behaviour similar to Objects.toString(object)

shell robin
#

im fixing all

#

give me a second

quiet ice
quiet ice
#

What you are doing is highly alarming and is most likely wrong.

eternal night
#

I feel like you are using internals when you should not have them

green plaza
quiet ice
#

Like, what do you need the CraftPersistentDataContainer for? Can't you get it from somewhere else?

eternal night
#

literally the API

#

you are using internals for 0 reasons

#

why are you even depending on internals ?

quiet ice
green plaza
#

I just asked a question? If there is diffrence between doing it from PDC context or using internals

It is simple answear Yes\No
or more complex answaer Yes because...\No because..

quiet ice
#

Well it is dangerous to say the least

eternal night
#

yes, using internals is a braind dead move and the internal type might be renamed next release

#

use the API and the pdc context instead

quiet ice
#

You might for example overwrite other entries that already exist for one reason or another (other plugins?)

green plaza
#

You answaer should insead of this

What you are doing is highly alarming and is most likely wrong.

be this

You should use PDC context. Don't use Internals when you can do something without them

Simple as that

quiet ice
#

Well I don't know the context. All solutions have a proper problem. But a problem cannot be solved with any solution willy-nilly

green plaza
#

So you don't even know what i am asking about and you are answearing me. So please tell me if you don't know PDC Context how can i create new PersistantDataContainer instance without using internals?

quiet ice
#

What I am saying is that I don't have enough context

green plaza
#

Ohh okay that way mb

velvet cove
#

Is there someone here who could help with a small kotlin app?

quiet ice
#

What do you need the PDC instance for? Why the hell do you even consider using internals (conscious bias!)? etc. these are all questions that result in me not being able to give a definitive answer for these questions

green plaza
river oracle
#

?jd-s

undone axleBOT
green plaza
young knoll
quiet ice
green plaza
green plaza
quiet ice
#

That's a new one

green plaza
#

Wdym new one?

quiet ice
#

Well generally you fork paper and claim to be a spigot fork

#

Which isn't wrong, but eh

green plaza
#

I didn't fork paper

eternal night
#

I mean, if you are using PDC, just implement a custom data type honestly

#

makes this whole ordeal a tad easier

river oracle
#

💪 fr serialize to bytes baby

#

spigot api pending ™️ finals really fucking me up rn

eternal night
#

I mean, you can serialise to a PDC

#

like

green plaza
eternal night
#

you can 100% implement a data type that converts some POJO into a PDC and stores it

quiet ice
#

Well, paper has the only good serialize to bytes method right now as it uses DFU

green plaza
eternal night
#

You just implement it

river oracle
quiet ice
#

Well, perhaps not for PDC but for itemstacks in general

eternal night
#

the javadocs have an example

torn shuttle
#

@vagrant stratus I have a really weird request for a removal of a review on a review section that involves me but isn't for my plugin

quiet ice
green plaza
young knoll
torn shuttle
#

you or any other resource staff lurking right now?

river oracle
# young knoll Finals faster smh

this week is my last week of actual classes then I have 4 of my finals in the first 2 days of the week of the 11th then I'll pretty much be okay to start doing stuff again

half arrow
#

Can anyone tell me why my enchantment wont work java mc 1.20.2?

https://hastebin.com/share/fozezuheyo.typescript
registered in onEnabled like so;
NamespacedKey key = new NamespacedKey(this, "vein");
VeinEnchantment veinEnchantment = new VeinEnchantment(key);

#

no errors showing

quiet ice
#

This in in itself shouldn't do anything

chrome beacon
#

so how are you using your enchantment

eternal night
#

implementing enchantments in the API is not supported

#

while potentially workable rn, there is an open PR to completely clap API only enchantment additions

quiet ice
#

A lot of people still do it that way, somehow.

eternal night
#

not for much longer

quiet ice
#

Well thankfully EnchantmentPlus won't be affected by such a PR

#

The last major breakage was when spigot started to purge superfluous color codes from lores

torn shuttle
#

@worldly ingot are you lurking ? I need help with some, uh, forum drama

quiet ice
#

must be some really spicy drama if you ping pretty much everyone

half arrow
#

didn;'t work

torn shuttle
#

yeah it's causing me to start shit and get pinged across different discords servers and it should not have happened in the first place

quiet ice
#

Your enchantment is semi-invisible to other plugins

#

That is as long as you don't insert it into internal registries, they will only partially know of it's existence.

torn shuttle
#

@red mauve last ping try, do we have forums / resource staff lurking?

echo basalt
#

bros desperate

glossy venture
#

damn

torn shuttle
#

do I just report the user and link to the review?

#

because i can't report the review itself

eternal oxide
#

yes you report the user and link

#

getting reviews removed is hard to do but it can be done if the user is abusing other, posting things which are not reviews or making accusation which are clear lies.

torn shuttle
#

I reported it

#

I was already typing it out

rotund ravine
#

Anything good?

half arrow
torn shuttle
#

I think it's a reasonable ask, I sort of would've liked to get a direct answer to the query is all

#

yeah that's sort of why I wanted to talk about it, because I'm not sure it breaks the rules per se but it's not something I want my fanboys to start doing at all either

rotund ravine
#

Is it cause epic called u a nerd? 🤪

quiet ice
# half arrow Ok, so any guidance?

I am afraid I cannot really help you much here. I personally don't bother extending Enchantment at the cost of not supporting other plugins (well I still do through bytecode transformation whereever applicable)

torn shuttle
#

foncused could you just give me an idea of whether my ask is reasonable ?

#

based on the report I just filed

quiet ice
#

However, cross-plugin support isn't viable anyways

torn shuttle
#

if not I'll try to find out who did it, problem is that's clearly a random username and I'm not sure I'll be able to find them

hushed spindle
#

if i were to add a plugin to another plugin's dependencies and set the scope of that dependency as compile would it essentially be two plugins in one or how does that work

#

is there any way i can achieve that or is that against the rules

hushed spindle
#

spill the tea

half arrow
hushed spindle
#

i just put the custom enchantments in the item's persistent data container and display them with lore

#

does the job

half arrow
#

I’ve seen that before, but really I wasn’t to do it the “proper” way

hushed spindle
#

unfortunately the "proper" way is kind of shit

rotund ravine
#

The pdc is the proper way though

half arrow
#

Pdc? Sorry

hushed spindle
#

persistent data container

half arrow
#

Oh my bad

rotund ravine
#

Why is this guy blcoked on my side did he do smth dumb

hushed spindle
#

i just put a string like this
ench:level;ench:level;ench:level
and to read them i split on ; to get each enchantment and then : to get the level

frigid rock
#

Hello i'm getting this error while getting a value from a mysql database. java.sql.SQLException: Column 'PLAYTIME' not found. I dont get why it isn't finding the PLAYTIME column. It is present on the database. This is the code: java try{ PreparedStatement statement = plugin.getDb().getConnection().prepareStatement("SELECT ID, RANK, BALANCE, KILLS, DEATHS, FIRSTJOINED FROM playerprofiles WHERE UUID = ?;"); statement.setString(1, uuid.toString()); ResultSet rs = statement.executeQuery(); if(rs.next()){ id = rs.getString("ID"); rank = rs.getString("RANK"); balance = rs.getInt("BALANCE"); kills = rs.getInt("KILLS"); deaths = rs.getInt("DEATHS"); firstJoined = rs.getTimestamp("FIRSTJOINED"); playtime = rs.getTime("PLAYTIME"); }

rotund ravine
#

How did you make ur table and show us a database viewer of it

frigid rock
#

sure

#

This is the db structure:

#

This is how i put the values in the table: java PreparedStatement statement1 = TWCore.getInstance().getDb().getConnection().prepareStatement("INSERT INTO playerprofiles (ID, UUID, RANK, BALANCE, KILLS, DEATHS, FIRSTJOINED, PLAYTIME) VALUES (" + "'" + id + "'," + "'" + uuid + "'," + "'" + rank + "'," + "'" + balance + "'," + "'" + kills + "'," + "'" + deaths+ "'," + "'" + firstJoined+ "'," + "'" + playtime + "');"); statement1.executeUpdate();

half arrow
hushed spindle
half arrow
#

The lore

hushed spindle
#

but in terms of mechanics that really depends on how you program your enchantments

#

oh the lore isnt a big deal

#

i just match on the enchantment name and replace that line or remove it or whatever

frigid rock
#

@rotund ravine So did you find any errors?

hushed spindle
#

if there's plugins that wanna add lore that's the same as one of my enchantment's names thats just a skill issue on their part

#

if you want to look at the source code on how i did it look at enchantssquared

half arrow
#

Okay can you link sorry I’m out atm on mobile

river oracle
hushed spindle
#

yeah it wont affect functionality

#

unless you define your enchantments based on the actual lore, which you shouldnt do

half arrow
#

Thanks for the info, it just feel really hacky? I thought spigot would’ve supported it properly

hushed spindle
#

i think minecraft just doesnt support it well

half arrow
#

Ah okay

hushed spindle
#

spigot just does what bukkit does and bukkit does what minecraft does

river oracle
#

spigot does what it wants bukkit is dead as hell 💪

#

guh

#

embed fail 😭

hushed spindle
remote swallow
#

y2k have you heard

river oracle
hushed spindle
#

the what

river oracle
#

its a hack some plugins use to inject into Bukkit's Registry

#

and EnchantmentWrapper is getting murdered soon

hushed spindle
#

ah no no

#

just pdc

river oracle
remote swallow
#

surfin bird and peter grifin in fortnite

river oracle
#

I don't get what that means

#

I think I'm out of touch or somethnig

remote swallow
#

YOU DONT KNOW WHAT SURFIN BIRD IS ?!?!?!

hushed spindle
#

yeah whats surfin bird

remote swallow
#

uncultured swine

river oracle
#

this thing

#

maybe

remote swallow
#

no

#

smh

ivory sleet
#

now this is a bit too off topic

remote swallow
#

this is totally the right place for this

river oracle
#

shhh staff are here hide

hushed spindle
#

oh that one

vast raven
#

I'm wondering why chunks in my server doesn't unload properly

#

8 tps with 130 on

#

And the problem are the chunks

sacred mountain
#

hello I'm stuck on how to create an evaluation bar in swing for my chess project:

I can easily use a determinate value and just .setValue(), but it ends up jumping all over the place when my engine hasn't reached a sufficient depth. I'm not sure how to include an animation that will constantly update to the values being generated:

For instance, if there is a short period where the engine evaluates a +5.00 position, and then back to +0.00, it should have little movement, sort of balancing out.

And lastly if the values being outputted are similar, the bar will hover around that area

#

i was thinking something like taking the average of the last 10 values or something

#

not too sure how to implement it as a constant animation though

quiet ice
#

Hm, I can only think of bezier curves

#

But not sure if you can do it in a fluid fashion

devout kite
#

Hey,

is it possible to do in a switch(slots) this case:
case 23|24|25:
so if it is slot 23 or 24 or 25 do something?

hushed spindle
#

sure

inner mulch
#

just dont break after cases

hushed spindle
#

case 23, 24, 25 in this case

#

depends which switch you're using because in newer java versions there's a different one

inner mulch
#

case 23:
case 24:
case 25:
bla bla
break;

devout kite
#

oh so with , not |

hushed spindle
#

you can do

switch(slot){
  case 23:
  case 24: 
  case 25: {
    ...
  }
}

or

switch(slot){
  case 23, 24, 25 -> {
    ...
  }
}
devout kite
#

nice i will use the 2. it is more smooth

hushed spindle
#

in the second one you also dont need to use break

inner mulch
#

zyrox, are you using this for an invenotryclickevent?

devout kite
#

ya

inner mulch
devout kite
#

ya i see the thing is slot 23,24,25 should do the same so it kinda makes more sence for me if it is case 23, 24, 25

inner mulch
#

???

quaint mantle
#

Is it fine to use the logger from Plugin#getLogger asynchronously?

young knoll
#

Should be

worthy yarrow
#

And that's not to say maybe I'm doing something wrong but saying to just look at the 4 files doesn't really help...

#

Also I tagged the wrong person on that, rotz if you see this it was not inteded for you

frigid rock
#

Hello i'm getting this error while getting a value from a mysql database. java.sql.SQLException: Column 'PLAYTIME' not found. I dont get why it isn't finding the PLAYTIME column. It is present on the database. This is the code: java try{ PreparedStatement statement = plugin.getDb().getConnection().prepareStatement("SELECT ID, RANK, BALANCE, KILLS, DEATHS, FIRSTJOINED FROM playerprofiles WHERE UUID = ?;"); statement.setString(1, uuid.toString()); ResultSet rs = statement.executeQuery(); if(rs.next()){ id = rs.getString("ID"); rank = rs.getString("RANK"); balance = rs.getInt("BALANCE"); kills = rs.getInt("KILLS"); deaths = rs.getInt("DEATHS"); firstJoined = rs.getTimestamp("FIRSTJOINED"); playtime = rs.getTime("PLAYTIME"); }

#

i actually asked this before but no one answered...

worthy yarrow
#

Playtime is a present column in your player profiles?

#

Also did you perhaps misspell it?

#

I'm also pretty sure the column name is case sensitive so there might be an issue there

frigid rock
#

it's correct

#

it's spelled PLAYTIME

#

This is the db structure:

worthy yarrow
#

is getTime returning time from the timestamp?

frigid rock
#

you mean if the datatype is Timestamp?

#

or if it's returning me the actual timestamp

worthy yarrow
#

The timestamp

frigid rock
#

getTime is returning me an error and the error is: ```
java.sql.SQLException: Column 'PLAYTIME' not found.

worthy yarrow
#

So playtime should be getting the time played to present from timestamp right?

frigid rock
#

i'm just setting playtime and trying to get it now

worthy yarrow
#

ah ok

frigid rock
#

playtime is just a value

#

i can explain how it's calculated but i don't think it really is important to solve this error

#

i can show you how it's set tho

#

This is how i put the values in the table: java PreparedStatement statement1 = TWCore.getInstance().getDb().getConnection().prepareStatement("INSERT INTO playerprofiles (ID, UUID, RANK, BALANCE, KILLS, DEATHS, FIRSTJOINED, PLAYTIME) VALUES (" + "'" + id + "'," + "'" + uuid + "'," + "'" + rank + "'," + "'" + balance + "'," + "'" + kills + "'," + "'" + deaths+ "'," + "'" + firstJoined+ "'," + "'" + playtime + "');"); statement1.executeUpdate();

echo basalt
#

And you're sure your entry has a playtime

frigid rock
#

the PLAYTIME column has a value yes

worthy yarrow
#

I wish i worked more with sql so I could help more... but as far as I can see it looks correct...

devout kite
#

Why does this not fill the players inventory slots 9 to 35?

    public static void fillinv(Player player) {
        ItemStack filler = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
        ItemMeta fillermeta = filler.getItemMeta();
        assert fillermeta != null;
        fillermeta.setDisplayName(" ");
        filler.setItemMeta(fillermeta);
        for (int i = 0; i < player.getInventory().getSize(); i++) {
            if(i >= 9 & i <=35) {
                player.getInventory().setItem(i,filler);
            }
        }

    }```
I get no error
frigid rock
glad prawn
#

why not i = 9; i <= 35?

devout kite
#
public static void Charmaker(Player player){
 //fillplayer inv
        fillinv(player);
}```
frigid rock
#

are you sure that the fillinv function runs?

worthy yarrow
#

^ add a print statement

frigid rock
#

exactly

worthy yarrow
#

to verify its being called

crimson scarab
#
    public int[][] getPixelsFromImage() throws IOException {
        File file = new File("C:\\Users\\Charlie\\Downloads\\Server\\plugins\\image.jpg");
        BufferedImage image = ImageIO.read(file);
        int[][] innerPixels = new int[][]{};
        int index = 0;

        
        for (int x = 0; x < image.getWidth(); x++) {
            for (int y = 0; y < image.getHeight(); y++) {
                int colour = image.getRGB(x, y);

                int red =   (colour & 0x00ff0000) >> 16;
                int green = (colour & 0x0000ff00) >> 8;
                int blue =   colour & 0x000000ff;

                innerPixels[x][y] = new int[]{red, green, blue};
                index++;
            }
        }

        return innerPixels;
    }

a little java help here

#

why is this happening on the innerpixels line

river oracle
#

An int isn't an int array

devout kite
# worthy yarrow to verify its being called

i added it player.sendMessage("sasa"); public static void fillinv(Player player) { ItemStack filler = new ItemStack(Material.WHITE_STAINED_GLASS_PANE); ItemMeta fillermeta = filler.getItemMeta(); assert fillermeta != null; fillermeta.setDisplayName(" "); filler.setItemMeta(fillermeta); for (int i = 0; i < player.getInventory().getSize(); i++) { if(i > 8 & i <36) { player.getInventory().setItem(i,filler); } } player.sendMessage("sasa"); } and it still does not work the player gets the message but not the fillers

hushed spindle
#

innerpixels is a two dimensional array, and you're setting a value on the nested array

#

so its an int

#

and not an int[]

crimson scarab
#

how can i make an array of int arrays

hushed spindle
#

int[][]

proud badge
#

Hi I'm wondering what would be the best way to achieve what I'm trying to do: /lockstand command that locks an armour stand and nobody can attack/modify it, and only the player who locked it can unlock the stand again. What I'm specifically wondering is whats the best way to save the player data for the armour stand? Should I make a yml file with all of the armour stands and thier player uuids, or should I somehow use NBT ?

worthy yarrow
#

see if it prints then

crimson scarab
hushed spindle
#

yes but that means you basically got a square of ints

worthy yarrow
#

If not I wonder if the method call isn't in the correct place

hushed spindle
#

you're setting one of those ints to another array

devout kite
# worthy yarrow add the print inside the second if statement

like this?

        ItemStack filler = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
        ItemMeta fillermeta = filler.getItemMeta();
        assert fillermeta != null;
        fillermeta.setDisplayName(" ");
        filler.setItemMeta(fillermeta);
        for (int i = 0; i < player.getInventory().getSize(); i++) {
            if(i > 8 & i <36) {
                player.getInventory().setItem(i,filler);
                player.sendMessage("sasa");
            }
        }
        player.sendMessage("sasa");
    }```
hushed spindle
#

you need a 3 dimensional array if you want to do that

#

int[][][]

worthy yarrow
#

Yeah like that, try this

crimson scarab
worthy yarrow
#

Oh hey

frigid rock
hushed spindle
#

are you dense

worthy yarrow
crimson scarab
#

i tried a 3d array

#

oh it works now

devout kite
hushed spindle
#

i would also recommend you make like a simple Pixel class and make it a Pixel[][] instead of an int[][][]

#

makes it easier to add information to that pixel if needed

worthy yarrow
#

The second if statement should only set it 9-36 though correct?

#

Which I thought was the point

devout kite
worthy yarrow
#

right

#

also instead of <36 just do p.getinvnetory size

#

It's more accurate based on the inventory you are trying to modify... a bit safer if you will

#

Try the add item method instead though, see if that works

#

Because if that does, I have a way you can set things to a specific place in the inventory, its just a bit messy

devout kite
worthy yarrow
#

eh

#

ok

worthy yarrow
devout kite
worthy yarrow
#

No worries... I've always had so much trouble with .setItem especially in player inventory... I usually just use additem and make an if for each slot I don't want filled

#

Or perhaps a switch

quiet hearth
#

Let's say I have a 3d shape sized (2,3,1) following a player, how do I keep its relative size to Player the same at all times

ivory sleet
winter galleon
#

hi, can somehone helps me, how do i check if an armorstand has a specifc item as helmet?
if (armorStand.getHelmet()) i tried this but doesn't work

worthy yarrow
winter galleon
#

?

#

sorry, im a newbie in plugin development

worthy yarrow
#

As in when you are wanting to check for the armor stand having a helmet when it that function called/triggered

devout kite
worthy yarrow
devout kite
#

ya

worthy yarrow
#

try add

#

or have you?

devout kite
#

okey i saw waht happend i got 24 glass and than it cleard my inventory

worthy yarrow
#

....

#

that is probably your issue

winter galleon
#
    public void onArmorStandInteract(PlayerInteractAtEntityEvent event) {
        Player p = (Player) event.getPlayer();
        ItemStack macchinetta = new ItemStack(Material.PURPUR_BLOCK);
        ItemMeta itemMeta = macchinetta.getItemMeta();
        itemMeta.setCustomModelData(16);
        macchinetta.setItemMeta(itemMeta);
        if (p.hasPermission("eternitystaff")) {
            if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
                ArmorStand armorStand = (ArmorStand) event.getRightClicked();
                if (armorStand.getHelmet() == macchinetta){
                    p.sendMessage("Its Working");
                }
            }
        }
    }```

thats the code, without the `if (armorStand.getHelmet() == macchinetta)` works
hazy parrot
devout kite
worthy yarrow
winter galleon
worthy yarrow
#

Probably because that itemstack isnt a helmet? or is it?

devout kite
#

no i launch the createchar void when a character get createt ther is the filler and a MYSQL void. in this myql void there is a player.getInventory().clear(); so this cleared my inventory XD

worthy yarrow
#

I don't think you can put that on your head haha

#

try making the itemstack a diamond helmet or something

winter galleon
#

how? sorry if im asking

worthy yarrow
#

Material.DIAMOND_HELMET

#

where you declare the new itemstack

winter galleon
#
    public void onArmorStandInteract(PlayerInteractAtEntityEvent event) {
        Player p = (Player) event.getPlayer();
        ItemStack macchinetta = new ItemStack(Material.DIAMOND_HELMET);
        //ItemMeta itemMeta = macchinetta.getItemMeta();
        //itemMeta.setCustomModelData(16);
        //macchinetta.setItemMeta(itemMeta);
        if (p.hasPermission("eternitystaff")) {
            if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
                ArmorStand armorStand = (ArmorStand) event.getRightClicked();
                if (armorStand.getHelmet() == macchinetta){
                    p.sendMessage("Its Working");```
#

like this right?

worthy yarrow
#

yes

winter galleon
#

its not working

worthy yarrow
#

It could be because you are trying to cast armorstand to a click event

young knoll
#

don't compare ItemStacks with ==

#

use .isSimilar

winter galleon
#

if (armorStand.getHelmet().isSimilar(macchinetta))

young knoll
#

mhm

#

May need to null check, don't know if getHelmet is nullable

worthy yarrow
#

what about the armorstand check?

#

does that return true if it's any armor stand?

winter galleon
#

yes

#

is "getHelmet() deprecated" a problem?

worthy yarrow
#

Could be if you're writing for whenever it was deprecated +

#

so it may not work if you are running a local host (ie: latest mc version)

#

You can use the javadocs for spigot/bukkit api and see if there is a non deprecated method

young knoll
#

getEquipment.getHelmet

worthy yarrow
young knoll
#

Uhhh

#

about 10 years iirc

worthy yarrow
#

Wish I had your knowledge haha

winter galleon
#

how can i check the name instead?

worthy yarrow
young knoll
#

Don't identify custom items by name

#

use

#

?pdc

winter galleon
#

okay

native bramble
lost matrix
native bramble
#

no

#

problem not in shaders

#

without shaders it working the same

lost matrix
native bramble
#

it is not armorstand

#

item display

remote swallow
young knoll
#

Item display can also become dark if there is a block in its location

#

But you can override their light levels

lost matrix
native bramble
#

i think i find solution

#

wait

#

will check

#

okay, i dont know why, but now it works

#

i thought problem in

ent.setPersistent(true);
ent.setInvulnerable(true);```
because i comment this lines
#

but when i decomment lines it also works

#

also works with shaders

#

is it a way to faster spawn entiry?

#

or another way to spawn entity?

quaint mantle
#

are PDC's mutable or if I edit the PDC do i need to set the itemstack's meta to it again?

glossy venture
#

prob need to set the item meta

#

thats when it is serialized to nbt

young knoll
#

You always need to re set the meta if you change something

river oracle
prime reef
#

does anyone know how well optimized the raycasting is in spigot?

rotund ravine
#

It’s decent enough

prime reef
#

wondering since I'm working on a custom one

rotund ravine
#

?stash

undone axleBOT
rotund ravine
#

Oh i suppose it’s minecraft raytracing being used

prime reef
#

hmm

#

questionable

#

I genuinely don't know how messy Java's is

vast raven
#

I'm in a async context in a vehicle plugin, in a for loop I'm using teleportAsync() sometimes a vehicle has a delay instead of calling the same method in a sync context

#

should I wait the end of the completablefuture?

rotund ravine
#

?whereami

prime reef
#

LMFAO

#

that's such a good reaction

glossy venture
vast raven
#

we can actually forget that and just use the bukkit scheduler to run a sync task instead of using teleportasync but if you're intended to you should be jailed

#

so let's keep using paper

glossy venture
#

if the sole purpose of your async thread is to teleport the vehicle then sure

#

but its prob not

prime reef
#

yeah running gameplay events in async is a great way to desync

vast raven
#

It's a collision manager

#

I don't think it would be a good idea

glossy venture
#

no

prime reef
#

how sophisticated is this

#

like

#

are you building a BVH

glossy venture
#

do u need to wait for the teleportation

prime reef
#

or are you just checking nearby entities

vast raven
#

even using async workarounds I have no big deals, it's just a little delayed

#

but starting a sync task for each teleport, it would be painful instead of making all sync

rotund ravine
#

Is that method even intended to be run async 👀 jkjk

vast raven
#

and this is wrapped in a for loop inside a timer task

river oracle
#

AsyncSuperDuperPlayerTeleport

wet breach
#

you execute a query to create the DB