#help-development

1 messages Ā· Page 947 of 1

echo basalt
#

why is your name not pink

river oracle
#

I ran put of nitro and discord just wouldn't take my money lol

#

Literally tried to add my PayPal amd it was just like no

echo basalt
#

what about

#

you send me 10$ and I get you nitro

river oracle
#

Meh I'll try again tonight

sour bluff
#

absolutely šŸ’Æ

lusty flax
#

heya, whats the best way of setting all the blocks between two locations to a type? tysm

im using this atm, but its not working and im not sure why

        for (int x = edgeMin.getBlockX(); x <= edgeMax.getBlockX(); x++) {
            for (int y = edgeMin.getBlockY(); y <= edgeMax.getBlockY(); y++) {
                for (int z = edgeMin.getBlockZ(); z <= edgeMax.getBlockZ(); z++) {
                    edgeMax.getWorld().getBlockAt(x, y, z).setType(getblocktype());
sullen marlin
#

are edgeMin and edgeMax set correctly

#

are there any errors

#

is getblocktype returning the right type

alpine urchin
#

are you using the version you recently compiled

#

how do you know its not working

lusty flax
#

no errors, and yea it looks right, i cant send a screenshot for some reason tho, and it should be returning the right type but it dosent even run, everything else in the code works but i made it send me a message in chat when it gets anything from the code at all and i didnt get that message, so it looks like everything after the first for statement isnt working

junior cradle
#

I will ask a question tomorrow, I will be glad if someone can explain it to me and give me an answer 😭

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

echo basalt
#

don't build up hype for a minecraft question

lusty flax
echo basalt
#

uH

#

Could be

lusty flax
#

yea, do you know what the most efficent way to set blocks is tho? cus it really lags when its doing only like 1-5k ish

echo basalt
#

?workdistro

lusty flax
#

tysm ill give it a go

kind hatch
#

I'm finally getting somewhere. :3

lusty flax
kind hatch
#

LET'S GOOOOO

lusty flax
#

gg!

glad prawn
#

ff

hollow reef
#

Any chance of accessing entities that store block data (e.g ItemFrame) in another thread?

junior geyser
#

Hey guys where does the R# come from in the craftbukkit package names?

rose tundra
#

Hello, does anyone know how you can make spawners with, for example: Zombies with a yellow helmet? I'm trying it with CreatureSpawner, but it's not working out well.
Version: 1.20

sour bluff
echo basalt
#

hm I wonder how I'd go about integrating a web server into my plugin

#

without using a mysql database as a middleman

sour bluff
#

mariadb my beloved šŸ—£ļø

vocal cloud
sour bluff
#

for directional particles is it possible to make them curve or do they only go in straight lines

kind hatch
#

Hmmm, should I worry about an update threshold?
Or should every time there's an available update with spigot, throw the 20sec startup delay?

acoustic shuttle
#

How do I set custom NBT tags on items

sullen marlin
#

?pdc

acoustic shuttle
#

I want actual NBT tags though

sullen marlin
#

?xy

undone axleBOT
flint warren
#

any idea on how to turn this yml

entries:
  - "ROTTEN_FLESH"
  - "GOLD_INGOT"

into something like this (i dont know if syntax is right)

entries:
  - "ROTTEN_FLESH"
    chance: 50
    min: 1
    max: 3
  - "GOLD_INGOT"
    chance: 20
    min: 1
    max: 2
File f = new File(path() + "/loottables/" + file + ".yml");

if (f.exists()){
  FileConfiguration cfg = YamlConfiguration.loadConfiguration(f);
  
  List<String> entries = cfg.getStringList("entries");

  System.out.println(entries);
  // this prints "[ROTTEN_FLESH, GOLD_INGOT]"
  // how would i go about implementing the chance and min max values into it?
}
echo basalt
#

You want to go from a stringlist to a map list

flint warren
#

okay ty

short raptor
#

Would an effect like this be done with an armor stand holding a remodeled item, or some other way?

worldly ingot
#

Really hard to tell, low quality images, but the textures look stretched slightly so it leans more towards block display entities

short raptor
#

Yeah sorry I don't have any better picture

#

There is no collision but it looks like real block

#

I looked at display entities and I think you're right

worldly ingot
#

Yeah, display entities don't have collision

acoustic shuttle
# sullen marlin ?xy

okay I used it but is there a way to change it from I can't send screenshots
pluginName:NBTtag
to just
nbttag

buoyant viper
#

would probably need NMS since i believe the spigot api will require a plugin namespace

acoustic shuttle
#

how would I do that everytime I try too import what I need for NMS intelliJ gives me an error with the imports

coral flower
#

is there a resource how to add a loot table to a custom enemy class?

rough ibex
#

why do you want to do this

acoustic shuttle
# rough ibex again why

well it isn't really necessary but I want some parts of my server too be plugins and some of it to be with skript and it's easier to use the nbt tags with skript without all the extra stuff it's not necessary just easier and I don't see why not?

polar forge
#

Hey Guys I need help in creating a plugin. I would love to make a plugin called Hourly Gifts, it gives to every player online a random block (there will be a list of blocks, but I would also like to implement some custom named blocks, renamed ones) every hour, can anyone help? It seems easy but a little bit tricky

rough ibex
#

and just access PublicBukkitValues

acoustic shuttle
acoustic shuttle
#

or made a new one

rough ibex
#

mhm?

acoustic shuttle
#

the nbt would stay?

rough ibex
#

it would

#

I'm pretty sure

acoustic shuttle
#

alr

chrome ferry
#

Why does Team#removeEntry kinda lag players for a split second

#

Client sided

sullen marlin
#

Sounds like the client sucks

chrome ferry
#

Im doing this on leave & join and when loads of people leave at once. My game just stops responding, for some players it’s fine and responds but lag spikes occur. And it’s only on these two methods

drowsy helm
#

is it a new entry for every player?

chrome ferry
#

Yes

#

All entries are unique

dreamy sleet
#

I'm trying to code a gui that opens a gui when a certain slot is clicked on the other gui though I'm not sure how I would do it. Could someone give me a tip

if (ChatColor.translateAlternateColorCodes('&', e.getView().getTitle()).equals(ChatColor.YELLOW + "Shop Menu")
&& e.getCurrentItem() != null) {

        switch (e.getRawSlot()){

            // Shop menu items

            //Building blocks
            case 10:
                e


                break;

                // weapons
            case 11:
                if e.getRawSlot(10) {
                    e.closeInventory(inv)
                            e.openInventory(inv)
            }
                break;
echo basalt
#

?gui

quaint mantle
#
    private void spawnFallingBlock(Player p, Material material, Location loc){
        System.out.println(material.toString());
        ServerPlayer serverPlayer = ((CraftPlayer) p).getHandle();
        CraftFallingBlock nmsBlock = (CraftFallingBlock) p.getWorld().createEntity(loc, FallingBlock.class);
        nmsBlock.setBlockData(material.createBlockData());
        int id = nmsBlock.getEntityId();
        ClientboundAddEntityPacket nmsBlockPacket = new ClientboundAddEntityPacket(nmsBlock.getHandle());
        ClientboundSetEntityDataPacket nmsBlockMaterialPacket = new ClientboundSetEntityDataPacket(id , Objects.requireNonNull(nmsBlock.getHandle().getEntityData().packDirty()));``` am i missing any packet? cause the blocks were invisible.
echo basalt
#

since when is createEntity a thing

quaint mantle
#

it worked with armorstand o:

#

i mean it did spawn the block..it was just invisible

#

do u want to see a clip?

echo basalt
#

uH

#

sure

echo basalt
#

Interesting

#

I'd prob call getNonDefaultValues instead of packDirty just for safety

quaint mantle
#

alright

#

lemme try

echo basalt
#

uh huh wtf

quaint mantle
#

still the same

quaint mantle
torn shuttle
#

oh... oh no

#

what the hell mojang

#

I just discovered a new way to get clients to desync entity locations from what the server is doing

quaint mantle
#

i just wanna spawn a packet falling block ;-;

torn shuttle
#

ok so entity.moveTo can actually cause client desyncing

#

what the hell

#

how am I supposed to fix that?

solemn meteor
#

How do I make my config.yml save comments

#
public static void initializeConfigs() {
        instance.saveDefaultConfig();
        File file = new File(DelightMain.getInstance().getDataFolder(), "config.yml");
        instance.getConfig().options().copyDefaults(true).parseComments(true);
        instance.saveConfig();
    }
#

current code

sullen marlin
#

comments are saved by default in versions which support them

solemn meteor
sullen marlin
#

it is

solemn meteor
#

then I must be doing something wrong

sullen marlin
#

what does your config look like; why are you mixing instance and DelightMain; and why are you saving the config immediately anyway

quaint mantle
torn shuttle
#

ok so if you use moveTo to make an entity move real quick between points repeatedly the client will attempt to smooth the motion on its own and that will override the actual intended location of where things are getting moved to

#

what is mojang smoking

fleet kraken
#

<Player>.hidePlayer reset on death/spectator etc? Or just when player join/leave?

sullen marlin
#

join/leave

fleet kraken
#

thx

sullen marlin
quaint mantle
#

okay i will try that

solemn meteor
torn shuttle
#

I... actually don't think this is fixable

#

teleport is just a moveTo with more conditions

kind hatch
#

Time to go modded

sullen marlin
torn shuttle
#

I don't really know how forge does it but I suspect the only way this would work is if i create my own modded client and server to change how movement fundamentally works

#

or at least inject an alternative to it

quaint mantle
#

why do fallingblocks not go thru the blocks?

sullen marlin
#

why would they

quaint mantle
#

is there a way to make them go thru blocks?

kind hatch
#

Maybe if you made them ride an armorstand?

#

Don't quote me on that though

quaint mantle
#

are armorstands able to go thru blocks?

#

eh i got a idea

sullen marlin
kind hatch
#

Unrelated, I just found out that all of the messages pre server startup don't get logged. 😢

solemn meteor
#

instance.getConfig().options().parseComments(true).copyDefaults(true); didn't work

sullen marlin
#

not clear why you need copyDefaults at all given you're saving the default before

solemn meteor
#

I thought it was future proofing, like a user accidentally deleting a line on the config or a future update adding a line

#

I'm trying to stick to whatever is standard in spigot, because the last time I did config on my own was a mess

sullen marlin
#

open a bug report then I guess

quaint mantle
#

how can i make the fallingblock go thru the ground though?

coral flower
#

I try to add a loot table to a customZombie like this: ```java
public class CustomZombie extends Zombie {
public CustomZombie(Location spawnLocation, int id) {
super(EntityType.ZOMBIE, ((CraftWorld) Bukkit.getWorld("roguelike")).getHandle());
Level level = ((CraftWorld) Bukkit.getWorld("roguelike")).getHandle();
this.setPos(spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ());
this.setId(id);
ResourceLocation lootTable = new ResourceLocation("name","normal.json");
this.lootTable = lootTable;

    level.addFreshEntity(this);
}

}```
here is my loot table:https://pastebin.com/wsFwuBFd
But the zombie is always dropping nothing so I assume I saved the loot table at the wrong place. I saved it in the resource folder in my Plugin directory

torn shuttle
#

oh wait

#

actually I think I just might've accidentally figured out why modelengine does line of sight packet sending

#

if you keep resetting the packets you sure won't figure out that this desyncs

torn shuttle
#

ok well yeah turns out I have to reset the entity every few seconds or it will drift

#

lame

#

fortunately it's really a blink it and you'll miss it update, I wonder if there's a more elegant solution

autumn ingot
#

is there any way to get TAS (tool assisted speedrun) working on a spigot server? assuming stuff like tick rate is also changed etc.

EDIT: if anyone from the future reads this, it turns out /tick rate automatically changes player speed (like, your literal movements are slower client-side). i didnt realize this because i was using /tick freeze, which doesnt slow you down at all. so no mod or plugin is necessary, dont overcomplicate it

torn shuttle
#

if you want to teleport a player to the ender dragon and instakill it within the same tick that is possible

autumn ingot
# torn shuttle what would that even mean, because the server can just do whatever it wants

well in TAS runs usually you have a mod to slow down your movements, but i don’t understand how/if that would work on a server. to my knowledge, TAS mods in single player slow down the entire speed of the world and the speed of your client-side inputs. but mods obviously can’t control what happens on a multiplayer server, so for example when you tried to move really slowly to place a block, (i’m assuming) the server can’t register that. i’m wondering if there’s a way to somehow make those sorts of TAS mods with client-side input work with the server itself, e.g. through a plugin which changes the /tick rate

torn shuttle
#

is it impossible to code semi-convincing player movement and interactions and create an ai that can beat minecraft? no, not necessarily impossible, but it's completely fake

#

it is harder to make a player move in this instance than to just kill the dragon, and it's harder to fake a player hitting an enemy than it is to just delete it

#

and ultimately it's all just faking anyway

autumn ingot
torn shuttle
#

and not in the tool-assisted sense of it, in the "you have to fake the entire interaction" type of way

#

afaik there isn't even a way to tell a client that it is doing something as basic as hitting a block in spigot

#

it may be possible if you send packets but it is completely artificial

#

you'd have to hook that up to an actual behavior

torn shuttle
#

well, mostly not possible

autumn ingot
#

alright thank you for your help

upper hazel
#

will there be data loss if you convert the number type to double for comparison?

#

and how critical is it

ivory sleet
#

which number type?

upper hazel
ivory sleet
#

yea u can lose precision

#

but thats about it

#

long -> double

upper hazel
#

how critical is it

lost matrix
solemn meteor
#

How do I rename my config.yml (for backup purposes)

File oldConfig = new File(instance.getDataFolder(), "old-config.yml");
if (!file.renameTo(oldConfig)) DelightConsole.sendWithPrefix("lol didnt work");
instance.saveDefaultConfig();
worthy star
#

how can i make it remove the SNAPSHOT from the name of the built jar with intellij?

solemn meteor
#

just remove the SNAPSHOT in the version

#

<version>1.0</version>

worthy star
#

ty

solemn meteor
lost matrix
solemn meteor
worthy star
#

if i delete the ones with -SNAPSHOT will that cause problems?

umbral ridge
#

no you can remove all of it and it'll regenerate once you recompile

solemn meteor
#

I know a way to do this but its by scanning and pasting the values onto the new file, but I think theres an even more efficient way for it

lost matrix
solemn meteor
#

It only does it correctly when I do instance.saveDefaultConfig(); (which means the file isnt created yet)

#

but if it already was created, it wont carry over the comments

eternal oxide
# solemn meteor .

if that code is stripping comments you are not using Spigot, or not a new version.

solemn meteor
#

I know I'm 100% doing something wrong

lost matrix
#

I meant just copying the entire file. Skipping loading it into a FileConfiguration.
If you simply create a byte-by-byte copy of the file, then the content (like comments) is irrelevant.

solemn meteor
#

but idk what part is wrong

eternal oxide
#

also, you never use file.

solemn meteor
eternal oxide
#

you create the local variable file but never use it

#

don't copyDefaults(true) unless you actually added some defauls and want to save them

#

and parseComments is by default true

solemn meteor
eternal oxide
#

both the file line and the options line do nothing in your code

#

I can only guess you are not using spigot then

#

loading/saving config with comments works just fine

#

in Spigot

solemn meteor
#

I just havent wrote it since I'm stuck with this part of the code

#

also I'm using 1.20.4 spigot, if thats relevant

#
public static void initializeConfigs() {
        instance.saveDefaultConfig();
        //File file = new File(DelightMain.getInstance().getDataFolder(), "config.yml"); TODO
        instance.getConfig().options().copyDefaults(true);
        instance.saveConfig();
    }
``` here
eternal oxide
#

no code you have posted (using Spigot) can do what you are saying it does.

#

remove the options line

#

nothing there will remove comments

#

are you perhaps not showing all the code as you are attempting to merge the packaged config to the saved config to add new values?

solemn meteor
#

This is the config.yml it generated (the file exists already but is empty, this is what it wrote)

test:
  testing: 123
  # Test Comment
  bro: 123
foo: bar
#

this is what the config.yml in my resource folder has

#
# Plugin Header

test:
  testing: 123
  # Test Comment
  bro: 123

# Uhh another
foo: "bar"
solemn meteor
eternal oxide
#

I doubt that was produced by the code you posted.

#

you have an empty config?

solemn meteor
#

yes

eternal oxide
#

why?

solemn meteor
# eternal oxide why?

I'm trying to future proof things, so that if I we're to add a new option in the config, it will just paste the default without any error

#

it works correctly when the file doesnt exist

#

since yk, saveDefaultConfig

eternal oxide
#

the only way to do that is to load the config from the jar, load the file config and manually copy all values from teh file to memory, then save

#

ie loop all key/values

#

its the only way to preserve comments

solemn meteor
#

shit

#

alright alright

#

I see what to do now

eternal oxide
#

setDefaults will only set teh values for missing keys. It will not transfer comments

solemn meteor
#

then what does parseComments do

eternal oxide
#

preserves comments in an existing file

solemn meteor
#

it didnt save my header but some comments got thru

#

hmm

#

I see

eternal oxide
#

I wonder if setDefaults will override an existing value if copyDefaults is already set true

#

I've never tried it

sullen marlin
#

It isn't, but as I said above copyDefaults(true) doesn't copy commentt

#

You're welcome to open a bug report

eternal oxide
#

I wouldn;t expect it to copy comments

#

I was just thinking if copyDefaults was already set true then setting a default might (in thoery) overwrite an existing value.

sullen marlin
#

I don't know what to expect tbh

eternal oxide
#

My though process was, load a config from the Jar. set copyDefaults(true), then setDefaults and point to the existing config file.

#

in that situation I would expect the defaults to overwrite teh existing values.

sullen marlin
#

I think that's what already happens to the default config

#

copyDefaults just doesn't handle comments

eternal oxide
#

That "should" take the values from the config.yml and insert them into a commented FileConfiguration

#

yep I'd only expect it to copy the values

#

But I've not tested anything. It's just thoughts

eternal oxide
worthy star
#

hi
so i have a code for a custom config file named linking.yml, and when i add some values to it using a command, and i send the value from config it works
but if i reload the linking.yml file it returns null, but i doesn't reset the file info

#

like this

#

it has this value, but if i send it after reloading it it returns null

#

(it works but breaks after reloading)

lilac dagger
#

did you save the file changes?

worthy star
#

yes

#

it doesn't reset the file

#

but for some reason the return becomes null

vast ledge
#

How are you getting the file?

worthy star
#

i have a manager class for it

#
    public void load() {
        file = new File(RelaxDc.getInstance().getDataFolder(), "linking.yml");

        if(!file.exists())
            RelaxDc.getInstance().saveResource("linking.yml", false);

        config = new YamlConfiguration();
        config.options().parseComments(true);

        try {
            config.load(file);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if(!config.contains("linking"))
            config.createSection("linking");

        save();
    }``` i use this to load it
vast ledge
#

Where are you getting YamlConfiguration from?

worthy star
#

what?

vast ledge
#

It's not from spigot

worthy star
#

import org.bukkit.configuration.file.YamlConfiguration; this is the import

vast ledge
#

'config = new YamlConfiguration();'

worthy star
#

?paste

undone axleBOT
worthy star
vast ledge
#

Can you paste the whole class

worthy star
#

here is whole class

vast ledge
#

So the issue is, it's, after restarting, not finding the file?

worthy star
#

the file exists, but it returns null for its values

#

i check file if it has them and it does

#

but it doesn't read them

vast ledge
#

Okay, try debugging then

#

On the load

#

Read all the contents from file

#

See if you are even getting the right fike

#

File*

worthy star
#

in the load method or onEnable in main class

vast ledge
#

Load method of your config manager

worthy star
#

ok

#

so for some reason it doesn't log any section or key

#

i added

        for(String s : config.getConfigurationSection("linking").getKeys(false)) {
            Bukkit.getLogger().info("Section: " + s);
            Bukkit.getLogger().info("key: " + config.get(s));
        }``` to code but it doesn't log them
#

no warnings or errors

eternal oxide
#

Your getInstance() in LInkingManager returns the wrong instance

#

it shoudl return this and scrap your instance Field

#

or as its a static getter you have to set it correctly, not just new LinkingManager

worthy star
#

how should i fix? and is that the problem?

vast ledge
#

Create a private static instance

#

Init that in the constructor

#

Then return that in the getinstance

worthy star
#

ok

quaint mantle
#

lets say i have a center coordinate.
and 1 another coordinate
how can i move that coordinate 1 unit towards the center coordinate? (dont mind the circles i was testing something)

worthy star
quaint mantle
#

like shift it by 1

quaint mantle
#

1m? since 1 block is 1meter

worthy star
#

ight thx

#

but will that fix the problem? xd

vast ledge
vast ledge
quaint mantle
#

yes

worthy star
lilac dagger
vast ledge
lilac dagger
#

is the main coord still in the middle?

quaint mantle
#

did u look at the image?

#

i have center and the border coordinate

#

i need the coordinate 1 block inward

lilac dagger
#

it looks like you're just reducing the radius

#

oh

#

just substract

wet breach
#

unless you need a new radius, the circle is not relevant in moving inwards

quaint mantle
#

i said ignore circle cause i was trying something..

#

i will explain once more..

#

I have the center coordinate..(the circle's center)...
I have the corner coordinate (the blue one at the end of the radius r)
i need it 1 block inward

vast ledge
#

Center 10, 5, 6
Point 10, 7 6
He wants the Point to move on inward while maintaining the diagonal Position

lilac dagger
#

oh i see

quaint mantle
#

yes

#

i thinnk atleast

lilac dagger
#

i think it's just what i said about vector

#

with substract

#

normalize will make it 1 block

vast ledge
#

Wouldn't that get the center between vector 1 and 2?

lilac dagger
#

so if you apply the vector to a location it'll go 1 block inward

lilac dagger
#

it'll be 1 block length

vast ledge
#

Oh I see

wet breach
lilac dagger
#

you can increase the magnitude if you want more than 1 block

#

i used to make floating player baloons using this

wet breach
#

if you wanted the middle of two end points, you use the midpoint formula. Where you add both x's and both z's together and divide them both by 2

umbral ridge
#

frostalf the smart

wet breach
#

well that is just some basic algebra

quaint mantle
#

what should i do though ;-;

wet breach
#

I thought Fr33styler answered it o.O

lilac dagger
#

Vector direction = middle.substract(firstdot).toVector().normalize();

wet breach
#

my answer was in regards to someone asking if what they gave for the answer would give the mid point

lilac dagger
#

Location second dot = firstdot.clone .addVector(direction)

quaint mantle
#

do u need to calculate middle then get it as vec?

lilac dagger
#

i assumed you had it

#

you kinda need the middle if you want to move it 1 block closer to it

quaint mantle
#

alr

vast ledge
#

You have the middle location right?

quaint mantle
#

i can calculate it using mid point theorem

#

i have the dark blue locs and need light blue

#

k lemme try rq

lilac dagger
#

that's exactly what i wrote to you earlier

#

you do have the blue dot

#

that's your middle

#

the edge blue dot is firstpoint

quaint mantle
#

oh

lilac dagger
#

and the light blue is second dot

quaint mantle
#

xD i thought middle as the point between them my bad

lilac dagger
#

no

#

middle as in your circle

quaint mantle
#

i would need middle as vector right?

lilac dagger
#

it's all in the api

#

the second line must be done in 3 lines

#

i think it's just add and not addVector

quaint mantle
#
        //loc1 i am standing so first dot
        //loc2 is middle
        Location loc1 = p.getLocation().getBlock().getLocation().subtract(0,1,0);
        Location loc2 = p.getTargetBlockExact(40).getLocation();
        Vector direction = loc2.toVector().subtract(loc1.toVector().normalize());
        Location second_dot = loc1.clone().add(direction);```
#

based off my understanding

lilac dagger
#

ye

quaint mantle
#

lemme test

lilac dagger
#

wait no

#

direction

#

loc2.substract(loc1).toVector().normalize

quaint mantle
#

ah alr

lilac dagger
#

you only normalized the first location

quaint mantle
#

yea but direction is a vector

#

the thing u said will give location

lilac dagger
#

yes, but you can do toVector after substracting

#

oh wait

#

substract on 2 locations needs to be on one extra line

#

since it returns void unlike vectors

quaint mantle
#

alr

#

wait

#

i am confused

#

you are using 1 location and 1 vector..

quaint mantle
lilac dagger
#

loc 1 loc 2 are locations

quaint mantle
#

yes but u converted loc2 to vector

lilac dagger
#

yes, it's a vector

#

that you will apply normalize on

#

to cut it to length 1

quaint mantle
#

so u are saying

slender elbow
#

it returns a Location?

quaint mantle
#

to subtract first..then vector it..then normalize it

lilac dagger
#

it does?

slender elbow
#

yeah

lilac dagger
#

oh that's nice

slender elbow
#

it is

quaint mantle
#

Vector direction = loc2.subtract(loc1).toVector().normalize(); u ment this

lilac dagger
#

yes

quaint mantle
#

alr

#

lemme compile and test

#

bottom one is loc1

#

top one is loc2

#

the inbetwen is our block

#
    private Location getdablock2(Player p){
        //loc1 i am standing so first dot
        //loc2 is middle
        Location loc1 = p.getLocation().getBlock().getLocation().subtract(0,1,0);
        Location loc2 = p.getTargetBlockExact(40).getLocation();
        Vector direction = loc2.subtract(loc1).toVector().normalize();
        Location second_dot = loc1.clone().add(direction);
        return second_dot;
    }```
#

it works in straight line.

lilac dagger
#

hmm

quaint mantle
#

worked in slanting line once

#

alr i think it works

lilac dagger
#

cap the loc 1 to be 0.5 for x and z

quaint mantle
#

wym and why

lilac dagger
#

0 being the location's x and z

#

the vector will go from the middle of the block

#

and not from a corner

#

so it will look straight even in diagonals

quaint mantle
#

vector is alr going from middle

lilac dagger
#

vector is fine

#

the second location might not be, it depends

#

bottom one

quaint mantle
#

alr

#

hmm this is not setting velocity

#
        Location loc = p.getLocation().getBlock().getLocation().subtract(0,1,0);
        Location veloloc = shift(loc, p.getTargetBlockExact(40).getLocation().getBlock().getLocation());
        BlockDisplay display = p.getWorld().spawn(loc, BlockDisplay.class, pre -> {
            pre.setBlock(material.createBlockData());
            pre.setVelocity(veloloc.toVector());
        });
        Bukkit.getScheduler().runTaskLater(GyrokineticWand.instance, display::remove, 200L);
    }

    private Location shift(Location loc1, Location loc2){
        Vector direction = loc2.subtract(loc1).toVector().normalize();
        Location second_dot = loc1.clone().add(direction);
        return second_dot;
    }```
worthy star
#

it says the instance is null

lilac dagger
#

use this:

Vector direction = loc2.subtract(loc1).toVector().normalize();

#

for your velocity

#

not the shift

lilac dagger
#

do this:
private static final LinkingManager INSTANCE = new LinkingManager();

#

private LinkingManager() {}

umbral ridge
#

ew static

lilac dagger
#

public static LinkingManager getInstance() {
return INSTANCE;
}

worthy star
lilac dagger
#

it's a singleton, at least it's alright

shadow night
shadow night
worthy star
#

ElgarL

shadow night
#

Hmm

shadow night
quaint mantle
# lilac dagger use this: Vector direction = loc2.subtract(loc1).toVector().normalize();
    private void spawnFallingBlock(Player p, Material material) {
        Location loc1 = p.getLocation().getBlock().getLocation().subtract(0,1,0);
        Location loc2 = p.getTargetBlockExact(40).getLocation().getBlock().getLocation();
        BlockDisplay display = p.getWorld().spawn(loc1, BlockDisplay.class, pre -> {
            pre.setBlock(material.createBlockData());
            pre.setVelocity(loc2.subtract(loc1).toVector().normalize());
        });
        Bukkit.getScheduler().runTaskLater(GyrokineticWand.instance, display::remove, 200L);
    }``` it doesnt do anything
#

like it doesnt even move an inch

lilac dagger
#

maybe it's because you do it before spawn?

quaint mantle
#

maybee

lilac dagger
#

try it outside

quaint mantle
#

also is it possible to remove Y coordinate from calculation in vector

lilac dagger
#

of course

#

just set both y to 0

wet breach
#

beat me to it

quaint mantle
#

hmm weird

#

it still doesnt move

#

does it have a problem w me or something

shadow night
#

Hmm, is it theoretically possible to handle events off the main thread?

#

Like, not to improve performance

lilac dagger
#

try with another entity

shadow night
young knoll
#

Display entities do not tick velocity

chrome beacon
#

^^

quaint mantle
#

yea i tried with other entity

#

called me

#

and it worked

#

hmm

#

i have an idea

wet breach
#

you can offload the calculations in most cases off thread

#

and then send those results back to main thread

worthy star
quaint mantle
#
        Location loc1 = p.getLocation().getBlock().getLocation().subtract(0,1,0);
        double y = loc1.getY();
        Location loc2 = p.getTargetBlockExact(40).getLocation().getBlock().getLocation();
            loc1.setY(0);
            loc2.setY(0);
p.teleport(loc2.subtract(loc1).toVector().normalize().toLocation(p.getWorld()).add(0,y,0));``` is there somethig i am missing cause it returns coords of near 0 80 0
lilac dagger
#

yes

#

don't do to location

#

p.getlocation.add vector

#

and remove double y

quaint mantle
#

o

lilac dagger
#

as you said, you want to remove y from calculation

#

assuming it's the player you want to move

twin edge
#

anyone here develop for cb 1060

quaint mantle
#

nah i wanna teleport the display block but i used player once cause i couldnt find where the display was going

#

yea works

#

ty

astral pilot
#

yo how do you check if the Inventory opened is the chest gui that i made

icy beacon
worthy star
#

ok mb

next plume
#

"noone" ?

icy beacon
#

So what's the problem?

next plume
#

<rolls eyes>

solemn meteor
#

what does the FileConfiguration getKeys(bool) do if I set the bool to true?

#

the docs isn't that clear with its wording

glad prawn
tall dragon
#
some_key:
  foo:
    bar: "idk"
  bar:

getKeys("some_key", true) would return everything inside some_key,
getKeys("some_key", false) would return foo & bar

#

pretty simple

solemn meteor
#

my first thought was correct

tall dragon
#

it ussually is ;d

solemn meteor
#

or do I have to manually code it

tall dragon
#

what is ur end goal

solemn meteor
# tall dragon what is ur end goal

get the keys, and print them (for testing)

so I can make something like

foo1:
  bar1:
    test: 15
  bar2: 
    test: 16
foo2
  bar1:
    test: 15
  bar2: 
    test: 16

I get the keys and make it

foo1.bar1.test
foo1.bar2.test
foo2.bar1.test
foo2.bar2.test
#

no short way of doing it?

#

cuz so far, #getKeys only did

foo1
foo1.bar1
foo1.bar2
foo2
foo2.bar1
foo2.bar2
tall dragon
#

you'd probably have to make a method to parse it yourself yea

solemn meteor
#

alright

#

thanks

next plume
#

Are you doing getKeys(true) ?

slender elbow
#

what does to "nms a chat message" mean?

vital ridge
#

What is the point of using persisentdata containers when I can just serialize my objects to byte arrays, throw them into nbttags as byte arrays and just deserialize them later in order to access the data?

slender elbow
#

it's supported api

slender elbow
#

nbt isn't

vital ridge
#

the thing is when you start working with custom persistent data you need to implement your own serialization methods anyways if you want to store classes that aren't serializable by default

slender elbow
#

not to mention that items will stop having nbt field in the next update of minecraft, and pdc works on entities and chunks etc

slender elbow
vital ridge
#

Its what I did

vital ridge
#

Sht like itemstack and much other needed types aint serializable

#

So for that you need your own serialization methods

slender elbow
#

yes

#

you can add your own type adapters

vital ridge
#

I just made my custom classes implement ConfigurationSerializable

#

And bukkitoutputstream accepts types that implement that

#

Aswell as bukkitinputstream

slender elbow
#

yes

#

you can then take that same byte array and shove it into the pdc

#

and vice versa

vital ridge
#

Yeah I'm doing that, I created my own PDC Datatype and I'm overriding the basic PDC methods in order to be able to serialize my data correctly.

vital ridge
#

Is it because of compatibility? Just wondering

slender elbow
#

mojang is reworking how items are handled internally

#

they are serialized to nbt, but in memory it will be different

#

this is why you stick to the API :d

vital ridge
#

Gotchu

#

Well its pretty much my first time working with serialization etc

#

But it aint that complicated after all

astral pilot
river oracle
#

no biggy tho should only take a few minutes since components are unbelievably based

#

why tho lol

#

API has most stuff you need chat wise

#

even spigot has components for chat

#

then wait till you actually need to use it

#

there are plenty of valid uses for NMS and chat is definitely not one of them

#

actually pretty helpful I'm simply encouraging you not to make a stupid mistake

#

if you come to me with a valid reason to use NMS and ask how do I do this you're bound to get some form of help

inner mulch
#

can i somehow discourage anonymous use of a class?

river oracle
#

you can anonamously use any class

inner mulch
#

because some classes are supposed to be extended

river oracle
#

there isn't really a way to prevent or discourage it. I'd say by defaults its a discouraged practice that would need to be actively encouraged

sand spire
#

How do I listen for a dropped item moving? - Custom Hopper

river oracle
#

?stash

undone axleBOT
slender elbow
#

why can't you just use sendMessage lol

river oracle
#

what a shitty way to learn NMS kek

#

chat requires like 2 braincells and is just more annoying than anything

dull sparrow
#

Hey, what is this Bukkit.getPluginManager().registerInterface(); method for ? šŸ˜„

solemn meteor
#
// Adding comments
        for (Map.Entry<String, List<String>> comment : comments.entrySet()){
            if (comment.getKey().equals("header")) config.options().setHeader(comment.getValue());
            else config.setComments(comment.getKey(), comment.getValue());
        }

why does #setComments only work when the config file already exists (first start adds the default values without comments, restart the server and it adds the comments). I tried saving it beforehand, then saving it again, I enabled #copyDefaults, I'm so confused

public static void initializeConfig() {
        instance.saveDefaultConfig();

        File file = new File(instance.getDataFolder(), "config.yml");
        FileConfiguration config = instance.getConfig();
        setDefaults();
        setComments();

        config.addDefaults(defaults);
        config.options().copyDefaults(true);
        instance.saveConfig(); //saving it first as a test, didnt work, also doesnt work without

        // Adding comments
        for (Map.Entry<String, List<String>> comment : comments.entrySet()){
            if (comment.getKey().equals("header")) config.options().setHeader(comment.getValue());
            else config.setComments(comment.getKey(), comment.getValue());
        }

        // Saving
        instance.saveConfig();
    }
kind hatch
frosty geyser
#

Hi, I was trying to setup BuildTools and I am receiving an error.

Currently running JDK 1.8.0_201 & tried JRE 1.8.0_201

Here is my BuildTools Debug:

BuildTools Version: git-BuildTools-a50d932-181
Java Version: Java 8
Current Path: C:\Users\pizza\Desktop\Temp folder\Spigot BuildTools
Flags Used: --nogui --rev 1.8.8

Operating System
Windows 10 (amd64)
Kernel Version: 10.0

Computer Information
Memory Usage: 51.2 MB / 5.3 GB
Java Versions Installed:
- JDK 21 at C:\Program Files\Java\jdk-21\bin\java.exe
- JDK 17 at C:\Program Files\Java\jdk-17\bin\java.exe
- JRE 8 at C:\Program Files\Java\jre-1.8\bin\java.exe
- JDK 8 at C:\Program Files\Java\jdk1.8.0_201\bin\java.exe
* JRE 8 at C:\Program Files\Java\jdk1.8.0_201\jre\bin\java.exe```

Thanks in advance

here are my logs: https://pastebin.com/BV5ggYue & the message.txt below
kind hatch
#

Did you run BuildTools in an empty directory?

frosty geyser
#

I did

#

the folder is also not under OneDrive or anything like that

true oak
#

Hi guys.
I have problems while trying to create my gitlab CI (regarding a multi-version spigot plugin).
My CI uses buildtools (--remaped) to save NMS in the runner's cache (in $CI_PROJECT_DIR/.m2/repository folder).

Then my plugin build fails because it can't find this:

[ERROR] Failed to execute goal net.md-5:specialsource-maven-plugin:2.0.2:remap (remap-obf) on project LE-NMS-v1_18_R1: Error creating remapped jar: The following artifacts could not be resolved: org.spigotmc:minecraft-server:txt:maps-mojang:1.18-R0.1-SNAPSHOT (absent): Could not find artifact org.spigotmc:minecraft-server:txt:maps-mojang:1.18-R0.1-SNAPSHOT in enginehub-maven (https://maven.enginehub.org/repo/)

I posted the help request with more details here: https://www.spigotmc.org/threads/build-nms-in-gitlab-ci-multi-version-plugin.642411/

Any help would be appreciated !

river oracle
#

1.8.8 is almost 9 years old and not supported

frosty geyser
#

Fair enough

kind hatch
#

I keep forgetting about that. lol
It should be able to build any version though.

#

Yea, ez

river oracle
#

even issues on jira are ignored for 1.8.8

solemn meteor
kind hatch
#

Fair, but this seems like an envrionment issue.
I wonder if it's because they are using java 8_201 and not the 401 version (aka latest).

#

Also makes me wonder if we need to check for that in BT. šŸ¤”

river oracle
#

the moment we check for java 8 minor versions is the moment we've failed

#

please no

kind hatch
#

Well, I wonder if it's because of certain changes that were made in those releases. Compared to what we are developing against.
I'm not saying we have to do it, but it does make me curious as to whether that is the underlying issue.

#

Or you know, maybe it's time to go scorched earth and only let buildtools compile the latest version. :p

frosty geyser
#

currently trying it with 1.8.0_391 to see if that fixes it, hopefully it does lol

kind hatch
#

The logs did say that it was using 391 correct?

#

Cause there may or may not currently be a bug with java version overrides.

frosty geyser
#

it did

kind hatch
#

Cool

true oak
kind hatch
# frosty geyser

You could maybe try deleting the work and Spigot folders created by BT and try again.

frosty geyser
#

worth a shot

true oak
#

Why does it build locally and not on this CI 😢 !

kind hatch
#

What does $CI_PROJECT_DIR resolve to?

#

And does it actually contain the /.m2 directory?

#

Cause usually that lives under the user's home directory.

frosty geyser
#

yea it caused the same issue

true oak
#

$CI_PROJECT_DIR is my runner's build folder that also contains my project. Yes it contains the .m2 folder (retrieved using cache from the previous stage which builds nms).
I added a ls $CI_PROJECT_DIR/.m2/repository/org/spigotmc/minecraft-server/*' command to check this.
The logs ( https://gitlab.com/lasersenigma/lasersenigma/-/jobs/6516970981#L86 L.86) proves it does contain the expected files.

kind hatch
true oak
#

So I really don't know why I get this error

[ERROR] Failed to execute goal net.md-5:specialsource-maven-plugin:2.0.2:remap (remap-obf) on project LE-NMS-v1_18_R1: Error creating remapped jar: The following artifacts could not be resolved: org.spigotmc:minecraft-server:txt:maps-mojang:1.18-R0.1-SNAPSHOT (absent): Could not find artifact org.spigotmc:minecraft-server:txt:maps-mojang:1.18-R0.1-SNAPSHOT in enginehub-maven (https://maven.enginehub.org/repo/)

It's probably a stupid mistake but I just have no idea why ^^

kind hatch
#

I think the issue stems from maven trying to grab specialsource from the enginehub repo instead of the spigot repo.
Which doesn't seem to be present in your pom.

<repository>
  <id>spigot-repo</id>
  <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
true oak
#

I defined it in the main pom.xml (and not in the submodule pom) ? Aren't repositories inherited from parent to child pom ?

#

And even if they are not inherited, shouldn't maven find it locally first ?

river oracle
#

they're working with NMS so that doesn't even make sense

kind hatch
#

I think that submodules have their own rules for compiling. Yes they can pull dependencies from the parent, but they can also just use their own.

river oracle
#

clearly something is off with their maven local because of the weird setup

true oak
kind hatch
#

Are we up to version 2.0.2 in specialsource now?

true oak
#

Hmmm I will check that version too. It's in the spigot hub i suppose

stoic cosmos
#

Does anyone know how to use a none base potion for tipped arrows (so without using setBasePotionData)

quiet ice
true oak
#

Again let's remember that it builds locally so both the lact of the repo definition and special source version should not be and issue.

true oak
quiet ice
#

Well nuke your mavenLocal and see if it builds

river oracle
#

I'm not sure what the classifier is though?

#

never seen that one before

#

unless they're manually mapping themselves

#

?nms

true oak
quiet ice
#

?bt

undone axleBOT
frosty geyser
#

yea 1.20.4 works, just 1.8.8

quiet ice
#

Could MD please turn off 2FA? It's the worst thing ever

#

Like cool for those that like 2FA, but not for the average geolykt

river oracle
#

it was turned on for a reason

frosty geyser
river oracle
#

kek 1.8 moment

kind hatch
frosty geyser
#

yea seems quite weird, thank you for helping me though

kind hatch
#

Guess it actually is time to make BT compile latest regardless of user choice. :kek:

river oracle
#

1.8.8 users will rage if they see the latest jar

#

EWW combat with actual depth 😭

kind hatch
#

As a wise man once said. "Fuck em"

river oracle
#

are you that wise old man?

kind hatch
#

No comment

stoic cosmos
#

how to use upgraded tipped arrows for itemstack

quiet ice
#

The alternative could of course be that the remapper plugin inverts version and extension even though that is bogus (and probably should be something that happens outside the CI pipeline)

sand spire
#

and I'm p sure you can then use potionMeta.setBasePotionType(PotionType.X);

stoic cosmos
#

but thats base potion

river oracle
#
ItemMeta meta;
if (!(meta instanceof PotionMeta pmeta)) {
  return;
}

should work fine

stoic cosmos
#

as in lowest effect

quiet ice
#

Another probable cause is that the local maven repository isn't being declared as a local repository but rather as a remote repository, at which point the artifacts become unaddressable and thus cannot be resolved. But that too is unlikely

quiet ice
sand spire
true oak
#

but again, ty for trying to help. I think I have a clue of my problem's origin. I'm currently searching if it's what I think. Will let you know

quiet ice
#

What I'm going at is that how snapshot versions are stored differ between local repositories and remote repositories (which imo is annoying but what can one do?)

wet breach
quiet ice
#

but if the problem is something else entirely I'd not be surprised

quiet ice
true oak
wet breach
#

well, I didn't see where they showed what their repo looked like

#

but it needs to be a txt file

quiet ice
true oak
#

Not solved yet but at least I know what to do now šŸ˜„

quiet ice
#

well I mean it is pretty obvious what the problem is

wet breach
#

well the repo it is trying to look in

#

is enginehub

true oak
#

yeah because it can't find it locally

#

which comes from 1.18 instead of 1.18.1 ^^

wet breach
#

does it exist in there for 1.18?

true oak
#

no that's the problem. I'm currently modifying every nms/*/pom.xml to change 1.X to 1.X.Y in both <srgIn> and <remappedDependencies>

storm crystal
#

a question not really about programming itself, but do maps save across worlds? Let's say we have a server with two worlds (1 and 2), I make map of world 1 and move myself to world 2

#

would that map still show the same thing?

#

I essentially want to make separate world for such maps that would contain 'custom' imagery

true oak
true oak
storm crystal
#

Im not too sure

#

okay

#

what if I had world 1 and world 2 on my server

#

and I wanted to spawn map that contains world 1 in world 2

#

would that be possible?

wet breach
wet breach
storm crystal
#

is it possible to freely spawn maps that are filled and linked to X place?

echo basalt
#

Hm why did I block dusk hmm

wet breach
#

to do so with in game mechanics alone, you would need to have discovered all the places the map is for

#

a plugin can do it easily

true oak
#

programmatically ? So you want to save world 1. Then copy world 1 to world 2. Then load world 2 ?

wet breach
storm crystal
#

yes map item

true oak
#

oh sry. Ty for explaining.

storm crystal
#

I mean I can just make a part of the world to be for custom images

#

I suspect its just some special metadata that's available to set up from spigot API documentation?

pliant topaz
#

Could anyone recommend some sources for learning NMS? I know what it is and all, I just don't really know how to use it and bind it into my existing projects (I'm probably just dumb and used the wrong sources but yea)
Thx in advance

wet breach
storm crystal
#

okay cool

echo basalt
#

You basically learn it out of necessity

pliant topaz
#

I need it, that's tht thing, but apparently I'm too dumb to bind it to my projects lmao

echo basalt
#

The main entry point for everything nms related starts with the craft wrapper

#

Let's say you have a player

#

And you want to get the nms player or something

#

You cast your player to its craft implementation (CraftPlayer) and then call getHandle

#

And this works for most things

#

And if it doesn't it's probably in CraftMagicNumbers or CraftItemStack or similar things

pliant topaz
#

I see

#

and how would I specify it as a dependency, or better, what do I use as the dependency. Do I have to decompile the server jar and there lays the nms stuff? And would I then need to specify the jar as the dependency?

echo basalt
#

?switchmappings

pliant topaz
#

ty :)

sand spire
trail oriole
#

just got back to spigot plugin development, apparently createInventory is deprecated for GUI's, what should I use instead ?

echo basalt
#

That just means you're using paper lmao

#

Or a dev build

#

If you're using a dev build there's MenuType

#

?paper

#

mf

#

?whereami

echo basalt
#

Second, it'll still work

#

But they expect you to pass a component

trail oriole
#

i use paper indeed

#

sorry for that

vital storm
#

Does anyone know how to enable both premium and cracked players, who may possess identical usernames, to join the server simultaneously.

For example: the user Intexor can join with cracked and premium at the same time.

if anyone knows a solution for this issue please let me know.
My discord is Intexor

echo basalt
#

I swear I saw a post on builtbybit for this

#

and you already copypasted the same exact message twice

vital storm
#

Yea

echo basalt
#

In short - The usernames need to be different

#

You can either prefix cracked players or prefix premium users

#

The UUIDs are already different by nature (uuidv3 vs uuidv4) so that's not a problem

#

Just use the same measures that fastlogin uses to detect premium players and do shit

vital storm
#

Should I just use fast login?

echo basalt
#

Up to you

#

I don't support software piracy so I'm not going to pursue further

vital storm
#

Damn man

#

That’s the issue

#

No one is helping because of that :/

eternal oxide
#

yep

echo basalt
#

Go figure you're reaching out to developers who risk having their shit pirated all the time and asking how to allow piracy

vital storm
#

I understand that, I guess you’re right.

#

My bad.

#

I ain’t trynna do anything wrong

#

It’s just that it’s been so long and I can’t solve this so that’s why I tried to seek for help here

torn shuttle
echo basalt
#

advertising your plugins I see

torn shuttle
#

nah, mine are free

lilac dagger
torn shuttle
#

you monster

#

I'll see you in court

lilac dagger
#

catch me if you can :>

junior cradle
#

How to properly make a menu for players?
When the player writes a command to constantly create a new menu object for each of his own?
When starting the server, create 1 instance and open it for everyone?
Then how do I make it so that a certain item is displayed for each player depending on the permission, or that the api placeholder works?

#

And how to implement the update of this menu?

rough ibex
#

?gui

junior cradle
rough ibex
#

its up to you how you do it

junior cradle
#

I have never done this, I can create a menu, I just don't understand how I should handle the fillers and should I create a new object for each player or use one for all, I don't understand

rough ibex
#

you can dynamically display it

#

you store the 'base'

#

and then when showing, determine what each part looks like

junior cradle
#

I have a code, I created it, I can create a menu very easily, but I don't know how to update and display in the placeholders certain data for each player
I would show you the code, but you can't do that here

tall dragon
#

they probably want to display data specific to each player

#

which is easily possible with the system in that link

#

if they read all of it

junior cradle
#

Placeholder API use to item lore

junior cradle
junior cradle
#

Could you watch on the broadcast how I did it and how it can be improved for dynamically Placehplder API

rough ibex
#

you understand how placeholder API works yes

silent slate
rough ibex
#

you have the value

junior cradle
# silent slate how do i get this custom head as an ItemStack in spigot? https://minecraft-head...
public @NotNull ItemStackBuilder setSkull(@NotNull String url) {
        final SkullMeta itemMeta = (SkullMeta) this.itemStack.getItemMeta();
        final PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID());
        final PlayerTextures textures = profile.getTextures();
        try {textures.setSkin(new URL("https://textures.minecraft.net/texture/" + url));}
        catch (MalformedURLException e) {Anarchy.getInstance().getSLF4JLogger().error("Invalid skull URL, exception.");}
        profile.setTextures(textures);
        itemMeta.setPlayerProfile(profile);
        this.itemStack.setItemMeta(itemMeta);
        return this;
    }
tender shard
# silent slate how do i get this custom head as an ItemStack in spigot? https://minecraft-head...

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

rough ibex
#

thank you I was looking for that

junior cradle
silent slate
#

huh

#

im getting errors

#

cannot find some things

junior cradle
#

You need this


// Url texture: 212a03a4c11b4d472472e7e4593d2e126a6259e33cc81f44eb05cf042d076967
public void setSkull(@NotNull String url) {
    final ItemStack = itemStack = new ItemStack(Material.PLAYER_HEAD)
    final SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
    final PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID());
    final PlayerTextures textures = profile.getTextures();
    try {textures.setSkin(new URL("https://textures.minecraft.net/texture/" + url));}
    catch (MalformedURLException e) {Anarchy.getInstance().getSLF4JLogger().error("Invalid skull URL, exception.");}
    profile.setTextures(textures);
    itemMeta.setPlayerProfile(profile);
    itemStack.setItemMeta(itemMeta);
}
junior cradle
#

I submitted the code for version 1.16.5 + if I'm not mistaken

tender shard
#

PlayerProfile is 1.18.1+

silent slate
#

ok got everything

junior cradle
junior cradle
quaint mantle
#

nuh uh

junior cradle
#

@rough ibex But I don't know how to use only 1 inventory object but display different data for different players

#
public abstract class AbstractGui implements InventoryHolder {
    private final Map<Integer, Consumer<InventoryClickEvent>> itemHandlers = new HashMap<>();
    private final Inventory inventory;

    protected AbstractGui(@NotNull String title, @NotNull Integer size) {
        this.inventory = Bukkit.getServer().createInventory(
                this, size * 9, Utils.parseColor(title)
        ); this.onInitialize();
    }
    protected AbstractGui(@NotNull String title, @NotNull InventoryType type) {
        this.inventory = Bukkit.createInventory(
                this, type, Utils.parseColor(title)
        ); this.onInitialize();
    }

    protected abstract void onInitialize();

    public void handleClick(@NotNull InventoryClickEvent event) {
        final Consumer<InventoryClickEvent> clickConsumer = this.itemHandlers
                .get(event.getRawSlot());
        if (clickConsumer != null) clickConsumer.accept(event);
    }
    public @NotNull AbstractGui setItem(@NotNull ItemStackBuilder builder, @NotNull Integer slot, @Nullable Consumer<InventoryClickEvent>  callFunctions) {
            builder.setItemId(MainConstants.ITEM_MENU_ID); this.inventory.setItem(slot, builder.build());
            if (callFunctions != null) this.itemHandlers.put(slot, callFunctions);
            else this.itemHandlers.remove(slot);
            return this;
        }
public @NotNull AbstractGui removeItem(@NotNull Integer slot) {
        this.inventory.clear(slot); this.itemHandlers.remove(slot);
        return this;
    }

    public void open(@NotNull Player player) {
        player.openInventory(this.inventory);
    }

    @Override
    public @NotNull Inventory getInventory() {
        return this.inventory;
    }
#
public class InventoryListener implements Listener {
    @EventHandler(priority = EventPriority.LOWEST)
    public void onClickEvent(@NotNull InventoryClickEvent event) {
        if (event.getInventory().getHolder() instanceof AbstractGui gui) {
            event.setCancelled(true);
            gui.handleClick(event);
        }
    }
}
tall dragon
#

you do it by following the design pattern in the link

#

?gui

tall dragon
junior cradle
#
public class DonateMenu extends AbstractGui {
    private final Player player;
    public DonateMenu(@NotNull Player player) {
        super("Donat Menu", 6);
        this.player = player;
    }

    public void open() {
    }

    @Override
    protected void onInitialize() {
        // Decor items.
        super.setItems(new ItemStackBuilder(Material.BLACK_STAINED_GLASS_PANE).setDisplayName("&8#"),
                0, 1, 2, 3, 4, 5, 6, 7, 8, 36, 37, 38, 39, 40, 41, 42, 43, 44, 10, 19, 28, 16, 25, 34, 47, 51);
        super.setItems(new ItemStackBuilder(Material.ORANGE_STAINED_GLASS_PANE).setDisplayName("&6#"),
                9, 11, 12, 14, 15, 17, 18, 26, 27, 29, 31, 33, 35, 45, 46, 52, 53);

        // Donat items.
        super.setItem(new ItemStackBuilder(Material.LEATHER_CHESTPLATE)
                .setDisplayName("&4&lGUARDION &f{player} &7- &4&l2578&r  Ń€ŃƒŠ±Š»ŠµŠ¹ &7(&oWWW.RAGESWORD.RU)")
                        .addItemLore(
                                "&4ā—Ž &f - &4/ban", )
                .addItemFlag(ItemFlag.HIDE_DYE, ItemFlag.HIDE_ATTRIBUTES)
                .setArmorColor(Color.RED)
                .setAmount(8),
                13, event -> {}
        );
        super.setItem(new ItemStackBuilder(Material.LEATHER_CHESTPLATE)
                        .setDisplayName("&6&lSHULKER &f{player} &7- &6&l1538&r  Ń€ŃƒŠ±Š»ŠµŠ¹ &7(&oWWW.RAGESWORD.RU)")
                        .addItemLore("Lore")
                        .addItemFlag(
                                ItemFlag.HIDE_DYE,
                                ItemFlag.HIDE_ATTRIBUTES
                        )
                        .setArmorColor(Color.ORANGE)
                        .setAmount(7),
                24, event -> {}
        );
}
}
tall dragon
#

you can use that player object there to populate the gui with items specific to him

junior cradle
tall dragon
#

well the example is right there.

#

change it

#

add a Player parameter to onInitialize

#

then use Placeholder api to translate the strings

junior cradle
tall dragon
#

i can see that

#

but your design is just flawed

#

you shoulnt store the player like this

junior cradle
#

And I constantly create a new object when I open the menu, is it necessary? is it necessary to create only 1 time and then display them differently for everyone?
Should I keep it in the map? Why is it so difficult to understand everything with these gui?

 if (args[0].equalsIgnoreCase("kit")) {
            new KitsMenu().open(player);
        }

        if (args[0].equalsIgnoreCase("menu")) {
//            new DonateMenu().open(player);
        }

        if (args[0].equalsIgnoreCase("donat")) {
            new DonateMenu(player).open();
        }
tall dragon
#

there is nothing wrong with creating a new class to open a menu

junior cradle
tall dragon
#

like you do here. i assume

junior cradle
tall dragon
#

you also should not use InventoryHolders to determine your custom menu

junior cradle
# tall dragon like you do here. i assume

No, it was my very first version

public class KitsMenu extends AbstractGui {
    public KitsMenu() {
        super("&9Test Menu", 6);
    }

    public void open(@NotNull Player player) {
        super.open(player);
    }

    @Override
    protected void onInitialize() {
        // Decor items.
        super.setItems(new ItemStackBuilder(Material.BLACK_STAINED_GLASS_PANE).setDisplayName("&8#"),
                0, 1, 2, 3, 4, 5, 6, 7, 8, 36, 37, 38, 39, 40, 41, 42, 43, 44, 10, 19, 28, 16, 25, 34, 47, 51);
        super.setItems(new ItemStackBuilder(Material.ORANGE_STAINED_GLASS_PANE).setDisplayName("&6#"),
                9, 11, 13, 15, 17, 18, 26, 27, 29, 33, 35, 45, 46, 52, 53);

tall dragon
#

why do you even have the onInitialize

#

just create the items inside open

junior cradle
#

What do I need in order to make a method that will load the player with the necessary items, and in onInitialize() there are default items that do not change?

tall dragon
#

i dont understand why u would need to seperate that

#

for dynamic items simply replace the placeholders and for static items dont

junior cradle
tall dragon
#

dont

junior cradle
#

And in order to restore the fillers, I will need to create pressure and constantly veto items in the inventory?

#

Do I need to create a new inventory for the player every time or not? can the new object type be stored somehow?

#

heavily

fallow dragon
#

@junior cradle in case you're curious why you want to do this in the open method instead of oninitialize, think about debugging in the future. Imagine you have a bug about displaying the items in your GUI. If you set up your code in the open method (which i'm assuming gets called right before the player opens the gui), you'll know for sure that's probably the only place you have to look. Oninitialize, on the other hand, is possibly done far before the menu is opened, so at any point if that menu gets messed with, it could mess up the item arrangement and be extra confusing to debug.

junior cradle
#

wow

silent slate
#

nuh uh

fallow dragon
#

Just think about it as basic getters and setters. dont worry about efficiency since there's no expensive calls here

junior cradle
fallow dragon
#

Yep, it sounds like the job of the open method in your case is going to be to set all the items in the GUI--not the job of oninitialize according to Shurkennen

junior cradle
tall dragon
#

as long as you dont store the Player object in there

fallow dragon
#

Feel free to fact check me, but im pretty sure opening an inventory is not an expensive API call. So you shouldn't need to worry about that

tame plume
#

this is a documenation...

#

:))

junior cradle
tall dragon
#

yea dont do that

#

and dont use InventoryHolders to determine if an inventory is your custom inventory

#

its bad practise

buoyant kernel
#

im new to spigot
how can i make a chest gui?

tall dragon
#

?gui

tall dragon
#

šŸ˜„

tame plume
#

We know what you mean šŸ˜„

#

dont hate him, he is just joking šŸ˜„

junior cradle
# tall dragon its bad practise

Weather practice? And why should I just take the player that is already in the ``open'' method and transfer it to other methods

tall dragon
#

what other methods

junior cradle
fallow dragon
#

Yep one sec

#

https://www.spigotmc.org/threads/entity-metadata-packet-format-and-protocollib.522133/#post-4424970 I made a guide a few years ago although IIRC the API has changed a bit. But I think I have the updated code somewhere in an old discord pm ill see if I can find it

echo basalt
#

It's pretty simple

#

What version are you on?

#

Then yeah you have a list of wrapped data values

#

uH

fallow dragon
#

@iron wraith

    private PacketContainer createArmorStandMetadata(int armorStandId) {
        PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
        packet.getIntegers().write(0, armorStandId);

        List< WrappedDataValue> metadata = new ArrayList<>();
        Optional<?> name = Optional.of(WrappedChatComponent.fromChatMessage("Armor Standd")[0].getHandle());

        WrappedDataValue customName = new WrappedDataValue(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true), name);
        WrappedDataValue customNameVisible = new WrappedDataValue(3, WrappedDataWatcher.Registry.get(Boolean.class), true);

        metadata.add(customName);
        metadata.add(customNameVisible);

        packet.getDataValueCollectionModifier().write(0, metadata);

        return packet;
    }

This should get you to the finish line. its creatin ga custom armor stand with a custom name

#

I wrote it a while ago, but i tested it and confirmed it worked

#

I think as long as the packet has a custom name and customname visible is true the client will do the rest

echo basalt
#

uh for players custom names are weird

muted otter
#

I just used the BuildTools program in order to create the spigot-1.20.4.jar file. Now how do I decompile this to get the NMS code?

fallow dragon
#

Customnamevisible isn't to hide a nametag, its probably for showing the custom name or the normal name. If players are rendering names differently than other entities however like imillusion suggested, you might need to search for a different packet

#

But you could try this to confirm:

return new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.ENTITY_METADATA) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packet = event.getPacket().deepClone();
                Integer entityId = packet.getIntegers().read(0);
                Player target = getPlayer(entityId);

                if(target != null) {
                    List<WrappedDataValue> metadata = new ArrayList<>();
                    Optional<?> name = Optional.of(WrappedChatComponent.fromChatMessage("TEST")[0].getHandle());
                    WrappedDataValue customName = new WrappedDataValue(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true), name);
                    WrappedDataValue customNameVisible = new WrappedDataValue(3, WrappedDataWatcher.Registry.get(Boolean.class), true);
                    metadata.add(customName);
                    metadata.add(customNameVisible);

                    packet.getDataValueCollectionModifier().write(0, metadata);
                    event.setPacket(packet);
                }
            }
        };
#

As for the outer skin layer--that's also part of the entity metadata packet. Probably need to make sure we aren't overwriting that

P.S. you can throw debugger breakpoints in here and get an up close look at the packet if u r curious šŸ™‚

#

(re: outer skin layer missing) Oh, you don't want metadata null:

List<WrappedDataValue> metadata = new ArrayList<>();

I think would be?:

List<WrappedDataValue> metadata = packet.getDataValueCollectionModifier().read(0);
wooden hearth
#

Hey is it possible to replace the loading plugin message and enabling message

sullen marlin
#

Why

wooden hearth
#

I wanted to add color to make it look nicer

sullen marlin
#

Focus on your plugin rather than an informative message that no one will look at if your plugin is working?

wooden hearth
#

true that's a fair point

nova notch
#

Idk I find that the color actually helps to make plugins stand out from each other so I can tell at a glance that everything works

sullen marlin
#

And what happens when every plugin decides to use colours

#

Suddenly your console is a rainbow and nothing stands out

nova notch
#

Then so be it

tall dragon
#

these custom loading messages are mostly just annoying imo

#

u find out fast enough if it does not work

#

by either a big tracktrace or ur plugin showing up red in /pl

vocal cloud
#

I hate it when people use ASCII art. It makes me think a stack trace just exploded into existence

wooden hearth
#

I just thougt it would look nice tbh

young knoll
#

Doesn't LP still have a big ascii banner

nova notch
#

So is someone gonna help this dude or just say "no don't do that because it annoys me personally"

sullen marlin
#

I mean you can add your own spammy message all you like

#

But you can't edit the default message

#

Which functions, amongst other things, to alert you to what executable code is running on your server

storm crystal
#

Can I place list as value in those special tags that you apply on entities or items?

#

I forgot it's name

#

or is it strictly used for more primitive ones such as string and numeric values?

tall dragon
#

you can use a list of primitive types

#

alternatively you can make your own type

sullen marlin
#

?pdc

sullen marlin
#

Yeah it has lists now

#

And has always had arrays which are basically lists

young knoll
#

^ You can turn any type into a list type

umbral ridge
#

^ You can pet your cat now

pliant topaz
#

So, I got a custom head item with a custom texture. How would I place it as a block and keep the custom texture?

#

This is the current code:

BlockDataMeta meta = (BlockDataMeta) treasureItem.getItemMeta();
block.setBlockData(meta.getBlockData(treasureItem.getType()));```
tender shard
# pliant topaz So, I got a custom head item with a custom texture. How would I place it as a bl...

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

deep herald
#

what does this require in kotlin?

tender shard
#

a string, not an array of an array of strings

deep herald
#

we have multiple tho

tender shard
#

aliases already is an array

#

you're creating an array of an array

deep herald
#

oh

tender shard
#

it's a vararg method so the error msg is a bit confusing / wrong

deep herald
#

so then that

deep herald
tender shard
#

oh wait, BungeeCommand is your own class

deep herald
#

ye

#

im making it easier

#

to do

tender shard
#

well you declared 3 constructors,
String
String, String
and
String, String, String

#

but you're passing 4 strings

deep herald
#

we need a list at the end

#

we need a list at the end

tender shard
#

a list or vararg?

deep herald
#

list

#

my friend is coding this btw and i dont know kt only java

#

so im asking for him

tender shard
#

then change your constructor to sth like this

class MyClass(name: String, permission: String, aliases: List<String>)
deep herald
#

hes nopt in the discord

sour bluff
#

does his name happen to start with a z

sour bluff
#

target entity exists in skript so surely

deep herald
#

to string?

tender shard
deep herald
#

this is in bungee cmd

tender shard
tender shard
deep herald
#

this is kt

tender shard
#

I know

deep herald
#

:

tender shard
#
class MyClass(name: String, permission: String, aliases: List<String>) : Command(name , permission, *aliases.toTypedArray()) {
#

*aliases.toTypedArray() turns your list into an array to be used with the varargs method

river oracle
# deep herald

yo is this the clown from CosmicReach who didn't recognize me

#

what a loserrrr

echo basalt
#

CLOWN

deep herald
#

frfr

long elm
#

hello i search a way to create a api endpoint into a plugin to receive some information there send from a website

young knoll
#

The heck is CosmicReach

long elm
#

thanks!

quiet ice
#

com.sun
Off to a great start

tender shard
#

what's wrong with it

wooden hearth
#

Hey if I was storing player warps do you think it should be under the playerData or global data?

quiet ice
#

Which is in layman's terms means: The JDK people reserve the rights to break everything at will

#

They've already butchered my beloved sun.misc.Unsafe, so I'd not be surprised that the "there is already public API out there trolololol"-Virus halts there

young knoll
#

Fork spigot and CTRL F every private to public and every final to nothing

#

Boom no more unsafe needed

quiet ice
#

Well usage of the unsafe goes a bit beyond that

#

I personally don't use it for anything beyond static final field manipulation, but some of the libraries I use use it for some impressive things

young knoll
#

We should just ban Mojang from static final immutable collections

#

Use a registry smh my head

tender shard
#

we should just ban mojang in general

#

they still haven't added baboons

#

what even are they doing all day, if not adding baboons

young knoll
#

Letting me annihilate the wither with a big cube on a stick

tall dragon
sullen marlin
#

Baboon mod when

#

Do people even make mods anymore

young knoll
#

Yes

sullen marlin
#

Like big mods

#

Industrialcraft and stuff

tall dragon
#

well, create is relatively new and massive

sullen marlin
#

Stuff that adds like 50 blocks and entities