#help-development

1 messages ยท Page 949 of 1

echo basalt
#

And then get the egg's item

#

And get the pdc from the egg's item

#

You're still getting the pdc from the egg entity

worthy yarrow
#

I think it's the same for eggs, after testing it proceeds to remove the spider and send the player the message

echo basalt
#

o_o

worthy yarrow
#

So then perhaps it's the same for all projectiles ๐Ÿ˜„

flint coyote
#

In fact I was talking about ender eyes, not ender pearls but same thing. I did notice it because it was still on there after picking up the eye again once it dropped

fleet kraken
#

With protocol lib i can do for example just some players see an specfic effect?

agile anvil
#

What do you mean by an effect?

fleet kraken
#

Like the glow effect

#

I can just show it to specific players?

#

Using protocol lib?

agile anvil
#

There are multiple ways of making it, and yes you can do it with protocol lib

glacial peak
#

Does anyone know if the KauriVPN plugin blocks CloudFlare WAP?

fleet kraken
agile anvil
fleet kraken
#

How hard is this? I mean the time to do it

#

Like minutes, hours?

agile anvil
#

It really depends on how familiar you are with it. If you're used to nms few minutes should do the trick

#

it's not possible to predict ahah

#

It might be easier with protocollib if you never done nms

#

Especially if it's for multiple versions

fleet kraken
#

I will take a look, thanks!

agile anvil
#

Your welcome, feel free to ask help ๐Ÿ™‚

worthy yarrow
#

https://gyazo.com/5d44116cd7817ec0c5e3fda3872a993f
@agile anvil check this out haha

pets:
  26a2e08c-5140-4270-8b8f-92514a3d9c54:
    petType: WOLF
    petName: Unnamed
    petOwner: 7f9769f6-aa37-49a7-a0f3-d2a5295c29e5
    location:
      world: world
    health: 20.0
  7d986161-86bd-4ad8-8c23-751b52835b59:
    petType: WOLF
    petName: Bobbert
    petOwner: 7f9769f6-aa37-49a7-a0f3-d2a5295c29e5
    location:
      world: world
    health: 20.0
  ea72a875-62bf-4cd5-8176-322a4771f11d:
    petType: WOLF
    petName: Bobbert
    petOwner: 7f9769f6-aa37-49a7-a0f3-d2a5295c29e5
    location:
      world: world
    health: 20.0
valid burrow
#

for the love of god

#

use a database

worthy yarrow
#

Maybe later

valid burrow
#

its not that hard ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ

worthy yarrow
#

Maybe later

valid burrow
agile anvil
worthy yarrow
#

pdc

#

well

#

its in the works

#

currently just flat file

agile anvil
#

Alright ๐Ÿ™‚

#

You'll notice that it's even easier !

coral flower
#

How do I set the durability of an Item? The API says ItemStack.setDurability is deprecated and now inside ItemMeta but ItemMeta has no method for durability

tender shard
#

check if ItemMeta is instanceof Damageable, then cast it

coral flower
#

ahh okay

warm mica
worthy yarrow
#

Why thank you I thought it fit nice

orchid trout
#

is there any way to make a plugincommand without defining anything in the plugin.yml?

shadow night
smoky anchor
shadow night
#

Yeah it's normal

orchid trout
#

i tried registering a command and then doing Plugin#getCommand() but it returned null

shadow night
#

getCommand just gets you a command from the command map

#

Iirc

cobalt flame
#

Is there a way to change data in the spigot.yml config. I know you can get the values but when i try to change them and save them it doesn't work

#

Before i spam the channel with my code i would like to know if its possible so i don't waste anyones time

proud badge
#

How fast is Bukkit.getOfflinePlayer(UUID)?

native nexus
proud badge
#

ik im asking how fast

shadow night
shadow night
proud badge
#

Ok thanks

ivory sleet
#

dw

#

and what raydan described regards getOfflinePlayer(name)

#

not the uuid one

lost matrix
grim hound
#

hmm

#

I'm creating 16384 ByteBufs async

#

but the server crashes nonetheless

#

Ofc, all of those are written with a lot of data

lost matrix
#

Why... are you creating 16k byte buffers

grim hound
#

particle images

#

my dream

lost matrix
#

You mean one bytebuffer with 16k bytes i hope then?

grim hound
#

cuz

#

each minecraft packet needs to be sent

lost matrix
grim hound
#

you know

#

seperately

#

I'd really like this to be just one biggggg buffer

#

but dunno

lost matrix
#

!?

grim hound
#

I just send 16k bytebufs

#

but the thing is

#

that the server crashes while creating those

#

xD

lost matrix
#

With what exception

grim hound
#

none

#

it just doesn't respond

#

only some async threads do for some reason

lost matrix
#

Sounds like you are blocking the main thread to me...

grim hound
#

hmmm

#
this.asyncExecutor = new ForkJoinPool(parallelisms, ForkJoinPool.defaultForkJoinWorkerThreadFactory, (t, e) -> AlixCommonUtils.logException(e), false);
#

and then just doing executor.execute(this) on my own Future object

lost matrix
#

What type of parallelisms are you using?

grim hound
#

min of 2 or equal to Runtime available processors

ivory sleet
#

not sure what would it make it so slow

lost matrix
ivory sleet
#

only getOfflinePlayer(name) has to fetch mojang services due to a uuid by name lokup

#

name is nullable, uuid is not

#

but yeah, there could be some potential file io stuff going on

#

idr much of source tbh

grim hound
ivory sleet
#

been there for quite some time, no?

lost matrix
grim hound
#

it's probably getting all offline players and searching by the getName method

ivory sleet
#

I assume they load the cache eagerly in some sort of multimap

#

i mean thatd be the logical way more or less

tardy delta
#

now what kind of animal is a Consphlere

upper hazel
#

does Open sources plugin have copyright? Nothing will happen if I make my own plugin based on another one, taking an idea and pointing it out?

shadow night
#

there are licenses

lilac dagger
#

it has licenses that you have to respect

alpine urchin
#

yes

upper hazel
#

License has protection or just information?

#

i mean for what this need in open source

alpine urchin
#

protection for the copyright holder and some for the end users

upper hazel
#

if someone can chance code or smth

alpine urchin
#

yeah

#

GPL for example says that you as an end user should be able to get the source code of whatever program you use that is GPL

#

thatโ€™s an example of protecting the user

#

some licenses require you to credit the author

#

thatโ€™s protecting the author

upper hazel
#

hm what if you just took the idea?

#

or similar class names code

alpine urchin
#

you canโ€™t copyright an idea itself, but generally speaking the less code you take, the harder it is to prove for plagiarism

#

name a concrete example and we can tell you how to follow the license

upper hazel
#

well I'm just improving the API placeholder plugin

#

so idk what will be if i post

next plume
#

During the PlayerJoinEvent, will the player show up in the list of players from getOnlinePlayers() ?
And the same question about the PlayerQuitEvent.

wet breach
#

same for them leaving

next plume
#

Ah, that's what I thought. Was hoping it worked the opposite way.

wet breach
#

mainly because putting them in the list is like one of the last things that gets executed same when they leave

next plume
#

OK, thanks.

outer tendon
#

Hey, thank you so much. I didn't take the time to understand this until now. I have a few questions, if you don't mind.

Firstly, what do you mean by polling for displaying? Do you mean polling for things to be displayed to the user?

Also, when I poll actions, are you implying that those that are polled will only be past actions because they take place prior to the current check interval and after the penultimate check interval?

Also, speaking of intervals, how would I go about determining a good interval? How fast would these intervals be able to be practically? A few hundred milliseconds, a second or a couple of seconds, maybe more than that? Some of the actions, like updating a timer shown to the user, take place at one second intervals, so would it be reasonable to have such an interval?

Whatever you can answer, Id greatly appreciate. :D.

twin venture
#

Hi , thinking about making a skyblock plugin , any idea how the data would looks like?
the tables in the database?

#

island_id , uuid , name

island_id , x , y ,z , yaw , pitch , other data for the specfic island?

wet breach
#

location should be a single column

twin venture
#

what kind of data a island would have?

wet breach
#

anything you want, ideally you just need to have 3 things though

twin venture
#

name of theme?
like if i have a gui with multi island theme?

wet breach
#

well, maybe 4

twin venture
#

alr thanks

wet breach
#

island_id, location of its center, owner, which island schematic is used(for regen purposes)

#

this is like the minimum that comes to mind, if you want to add more you can

#

if I were to add another column it would be a separate table that holds a blob column

#

and that would be to put the schematics

#

blob = binary large object

#

you can literally just stuff random binary stuff into mysql tables XD

shadow night
quaint mantle
#

can anyone tell me how can I get into my server's shell once im out of it?

wet breach
#

then you would have another table for your players, and have the players table and the islands table be linked together

wet breach
#

surely you could just go back the way you came right? o.o

wet breach
#

you can stream binary data so it would make sense

wet breach
#

if not then there is no getting back to the MC console

quaint mantle
wet breach
#

that is the type of connection you are using to access the terminal

#

screen is a program that allows command line programs to continue running and get back to them

shadow night
#

I personally use tmux, idk why

wet breach
#

if you don't use something like that, then when you exit from the application there isn't a way to get back to said applicatio without force killing it

quaint mantle
#

idk if im making any sense

wet breach
#

so, either use screen or tmux and there is a third I think there was but can't think of its name

quaint mantle
#

wait

wet breach
#

try them out, find the one you like and use those to run the mc console inside of so you can get back to it later ๐Ÿ™‚

quaint mantle
#

I cant post pictures here aaa

wet breach
#

not necessary

#

literally telling you the solution

#

you are not the first to learn the hard way of this

#

at least you came to the right place however to be pointed in the right direction ๐Ÿ˜„

native gale
#

I came up with some weird ass idea, and not sure if it is even possible. To make it work I need to somehow make Spigot listen to two ports simultaneously

wet breach
#

but do go on

native gale
wet breach
#

well it listens on the UDP port if you allow it

#

also listens for telnet as well, forget which port that is

native gale
#

Ehh... I don't get it

wet breach
#

well the telnet thing is for remote commands

#

mainly implemented in MC if I am not mistaken though, same goes with the UDP port which is used to query the server

native gale
#

Why UDP and telnet, theoretically I want player to be able to join both via IP:port1 and IP:port2

wet breach
#

thats doable

native gale
#

Yeah, how?

wet breach
#

spigot can listen on more then one ip

#

just add another ip

#

to the file

#

multiple listen= lines

#

you can even put ipv6

umbral ridge
#

yesss

hazy parrot
#

Why do you need spigot specifically to listen on multiple ports

#

Your plugin can bind to any port, regardless of spigot

wet breach
#

also can just share the port too

#

since it is the same application

#

and thus is not considered a new connection

#

might have to inject into the netty thought because it might swat those packets away ๐Ÿ˜›

#

but still lol

native gale
wet breach
#

why don't you use port redirection?

native gale
#

And be able to pick it up from inside the plugin, wether they joined via the main one or additional one

wet breach
#

you do know you can redirect random ports of your choosing to just get routed to another port

native gale
#

Yeah, but spigot will see these connection as if they come from the same port

wet breach
#

most likely yes, also bungee has the ability to use multiple domains btw

#

and do what you are wanting without the need for multiple ports

#

bungee will even inform you which domain or subdomain they joined from

#

thus removing the need for multiple ips and ports

#

just have to create relevant subdomains

native gale
#

Hmm

#

Do I really need bungee for that? Can't spigot fugire out what domain made a request by itself?

#

But yeah, that's interesting idea

wet breach
#

nor does it care about where a connection came from

#

I am pretty sure you could probably create a plugin to implement that functionality

#

but you will most likely have to inject into netty stuff to accomplish it

#

since you need to read the host connection info stuff

native gale
#

Hm, that sucks actually

quaint mantle
#

how can I autorestart the server if power goes down?

#

is there any way to do that?

#

or do I have to start it again from the console

grim hound
#

does anyone here know how to use quaternions?

wet breach
grim hound
#

ye

#

but I'm still in middle school

wet breach
grim hound
#

haven'`t had that

wet breach
#

I have one you can use to reference to make your own

native gale
quaint mantle
wet breach
grim hound
wet breach
native gale
#

Damn, chill

wet breach
#

generally that is one of the main uses of it

#

doesn't explain your issue though

native gale
#

How to think about this 4d number system in our 3d space.
Part 2: https://youtu.be/zjMuIxRvygQ
Interactive version of these visuals: https://eater.net/quaternions
Help fund future projects: https://www.patreon.com/3blue1brown
An equally valuable form of support is to simply share some of the videos.
Special thanks to these supporters: http://3b1...

โ–ถ Play video
grim hound
#

am back

native gale
#

Probably the best math channel out there, I think his explanation in this video is very clear

grim hound
#

I skidded some code for particle image generation

#

and I tried changing the values for rotation but nothing really changes

native gale
grim hound
#

basically the code

grim hound
#

am just explaining my issue

native gale
#

You do not need quaternions to rotate 2d image

grim hound
#

3d

#

I mean

#

2d images on a 3d space

wet breach
#

thats a lot better lmao

#

quarternions are only needed when you want to rotate based on some other thing. Bit hard to explain

#

but in most cases for rotating stuff, you don't need it. An example would be like if you wanted a model to jump in space, rotate around another model while dodging another object

#

you have to account for all those vectors which have velocities and directions etc

#

and that is where quarternions come in for that

native gale
#

Yeah, but for simpler cases some linear algebra and trigonometry will suffice

wet breach
#

^

native gale
#

Also, in your code

#

You rotate and scale the image (in minecraft, I suspect?), but it does not guarantee that these pixels will align with the minecrafts block grid, you need to do rasterization in order for this to work

next plume
#

Is there a way to tell if an OfflinePlayer is permbanned, but not tempbanned?

chrome beacon
#

Hook in to whatever is temp banning

#

and use their api

next plume
#

Blah. Was hoping I could tell from OfflinePlayer, given that the ban method has expiration/duration parameters.

#

What about BanEntry#getExpiration() and comparing it to null?

wet breach
#

getExpiration will be null if they are perm banned

orchid trout
#

BaseCommand extends Command, PluginCommand#setExecutor() throws a npe

vast ledge
#

?paste

undone axleBOT
vast ledge
#

Send stacktrace

#

(Error)

orchid trout
smoky anchor
#

I assume you're trying to create commands without registering them in plugin.yml

vast ledge
#

Get command is returning null, check your get command function

vast ledge
#

Why not use a framework like aikar

#

Aikars**

grim hound
#
private static Map<String, Command> getKnownCommands() {
        try {
            Method m = getCommandMap().getClass().getMethod("getKnownCommands");
            return (Map<String, Command>) m.invoke(commandMap);
        } catch (Exception e) {
            throw new ExceptionInInitializerError(e);
        }
    }

    private static CommandMap getCommandMap() {
        Server s = Bukkit.getServer();
        Field f = getFieldFromTypeAssignable(s.getClass(), CommandMap.class);
        try {
            return (CommandMap) f.get(s);
        } catch (Exception e) {
            throw new ExceptionInInitializerError(e);
        }
    }
    public static Field getFieldFromTypeAssignable(Class<?> from, Class<?> fieldType) {
        for (Field field : from.getDeclaredFields()) {
            field.setAccessible(true);
            if (fieldType.isAssignableFrom(field.getType())) return field;
        }
        //AlixUtils.debug(from.getDeclaredFields());
        throw new ExceptionInInitializerError("getFieldFromType with class " + from.getSimpleName() + " and field type " + fieldType.getSimpleName()
                + " had no declared fields!");
    }
#

create a ```java
public static final Map<String, Command> serverKnownCommands = getKnownCommands();

#

and just modify the map as you please

orchid trout
#

i need to give the command a commandexecutor

grim hound
#

and if you want this to be shown to players invoke this ```java
public static void reloadCommands() {
Server s = Bukkit.getServer();
try {
Method method = s.getClass().getDeclaredMethod("syncCommands");
method.setAccessible(true);
method.invoke(s);
} catch (Exception e) {
throw new InternalError(e);
}
}

grim hound
#

this is what I do

#

does everything work @orchid trout ?

orchid trout
#

im making it in my own

#

way

#

but itll probabyl work

grim hound
orchid trout
#

i already had most of it in my project

sterile sapphire
#

Trying to use tab plugin for my cross platform mc server (both java and bedrock) based on java tho. And for the scoreboard nothing appears for bedrock players

#

But things to show for the java players

orchid trout
#

any way to avoid this?

#

1 command 3 ways to execute

acoustic pendant
#

is there a way of checking if the item is an armor without using craftbukkit? I'm seeing people using nms for that

grim hound
lost matrix
lost matrix
worthy star
#

hi

#

why ```java
public void linkPlayer(Player player, Member member) {
String path = "linking." + String.valueOf(player.getUniqueId());
String dc = String.valueOf(member.getIdLong());
String code = Common.getMapKey(linking, player).toString();
FileConfiguration config = getConfig();

    linking.remove(code);


    config.set(path, dc);
    Bukkit.getLogger().info(player.getName() + " has been linked with " + member.getEffectiveName());
    try {
        config.save(getFile());
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    Bukkit.getLogger().info("Saved the linking.yml file");


    player.sendMessage(Common.colorize("&7Your &aMinecraft &7account has been linked to discord"));
    player.sendMessage(Common.colorize("&7Account: &3" + member.getEffectiveName()));``` doesn't seem to be saving correctly, it logs the saved and linked things
#

but it doesn't do the file things

orchid trout
#

my plugin is named bitenet

#

that happens with all commands

lost matrix
junior cradle
#

I am writing a command ./verify Binvix
And it writes to me -> Command not found.

#

Why is it already verified on the forum

orchid trout
#

basecommand extends command

lost matrix
orchid trout
junior cradle
lost matrix
#

?verify

junior cradle
lost matrix
#

ugh

#

Go into thje bot commands channel i suppose

proud badge
shadow night
#

Only if it's serializable iirc

proud badge
#

hm? how do I know if my object is serializable

shadow night
#

When it implements Serializable, usually

proud badge
#

Rip mine doesnt

icy beacon
shadow night
#

I'm unsure, but last time I did something like that it worked like this

proud badge
#

done, do I need anything else?

shadow night
#

should just work now

proud badge
#

33

icy beacon
proud badge
shadow night
#

ยฏ_(ใƒ„)_/ยฏ

proud badge
#

ok ill just convert it to b64 and back

worthy star
worthy star
#

wait wtf

#

it decided to work somehow

young knoll
#

You can convert an ItemStack into a byte[]

#

In several ways

#

Easiest is BukkitObjectOutputStream

proud badge
#
chest.getBlockInventory().removeItem(shop.getProduct());
player.getInventory().addItem(shop.getProduct());
player.getInventory().removeItem(shop.getCost());
chest.update();``` Anyone know why the chest contents dont update at all?
#

this is what chest is equal to btw public static Chest getShopChest(Block block) { if(block.getRelative(((WallSign) block.getBlockData()).getFacing().getOppositeFace()).getState() instanceof Chest chest) { return chest; } return null; }

worthy star
#

hi, so for a weird reason i can't figure out,

// This does not work
    public Member getLinkedMember(UUID uuid) {
        String path = "linking." + uuid.toString();
        FileConfiguration config = getConfig(uuid);
        return BotManager.getGuildById(BotManager.guildId).getMemberById(Long.parseLong(Objects.requireNonNull(config.getString(path))));
    }

// This works
    public String getWarningReason(UUID uuid, int id) {
        FileConfiguration config = getPlayerConfig(uuid);
        String path = "warnings." + id + ".reason";
        return config.getString(path);
    }```
#

each one is in a different class, both classes got very same logic

#

just changed the methods to fit with it

#

the first method stops working when server restarts, it starts returning null always, the second one got no problems

merry cove
worthy star
#

wait wait

#

i think

#

the problem is from JDA

#

because i made it return the id instead of member and it works

#

bro finally

#

i've been suffering of that for days, i tried 100 ways for that

worthy star
#

hi

#

is JDA broken with spigot or what? why the getMemberById() method breaks if i restart my server

merry cove
#

I don't have that problem, but I use User over Member in my plugin

worthy star
#

hmm

#

may use it

#

i'll test it

#

um

#

there is no getuser method

#

should i get a member and cast it?

glacial moth
#

anyone know of a method to create a custom event based on when a player enters or exits your render distance? I was thinking on tracking player movement, join and quit and mapping out players who are relevant to each other

worthy yarrow
pseudo hazel
#

render distance itself is a client setting and the server knows nothing about that afaik

worthy yarrow
#

^

alpine urchin
pseudo hazel
#

interesting

worthy yarrow
#

If you wanna get dirty with packets for sure, otherwise if you track player locations I mean it should still be applicable in that way

orchid furnace
#

I've been trying to code simple line when a player for example hits a pig then the plugin just kills the player but for some reason that I can't really find the solution to it gives me this message.

public class whenHit extends JavaPlugin{
    
    public class pigHit implements Listener{
        
        @EventHandler
        public void wheAttack(EntityDamageByEntityEvent event) {
            Player player = (Player)event.getPlayer();
            
            if(event.getEntity().equals(EntityType.PIG)) {
                if(player != null) {
                    player.setHealth(0);
                }
            
            
            }
            
                
            
            
        }
        
        
        
    }

}

#

oh i cant post images

#

;/

echo basalt
#

Learnjava moment

orchid furnace
#

Player player = (Player)event.getPlayer();

echo basalt
#

Let's start by uh

#

Not making a class inside a class

alpine urchin
#

๐Ÿคก april fools

orchid furnace
#

alr I git rid off the addicional class but i'm trying to fix The method getPlayer() is undefined for the type EntityDamageByEntityEvent

#

I cant really understand this one

tender shard
#

getEntity()

blazing plank
merry cove
#

show the code again?

glacial moth
blazing plank
#

From @orchid furnace

worthy star
# merry cove show the code again?
    public User getLinkedMember(UUID uuid) {
        String path = "linking." + uuid.toString();
//        return Long.parseLong(Objects.requireNonNull(config.getString(path)));
        return (User) BotManager.getGuildById(BotManager.guildId).getMemberById(config.getString(path));
    }```
worthy star
#

i get this error now

blazing plank
merry cove
worthy star
#

could it be because of the BotManager.guildId?

merry cove
#

why not just do public User getUser(String userID) { return jda.getUserById(userID); }

orchid furnace
minor junco
merry cove
#
       try {
            jda = JDABuilder.createDefault(token)
                    .setActivity(Activity.watching("Your behaviour"))
                    .enableIntents(Arrays.asList(GatewayIntent.values()))
                    .build()
                    .awaitReady();
        } catch (InterruptedException e) {
            disable("Could not summon the discord bot because: " + e.getMessage());
        }```
minor junco
worthy star
#

oh

bold oriole
#

org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener

i tried to use protocollib in my plugin but i get this error if i tried to load my plugin

eternal oxide
#

ProtocolLib not on your server

worthy star
remote swallow
bold oriole
merry cove
lament tree
#

Hello, how do servers have cutscenes, do they constantly teleport a player and restrict all movement?

remote swallow
#

they spectate an entity

lament tree
#

Interesting

#

Could you possibly elaborate?

remote swallow
#

@young knoll wake up nerd

worthy yarrow
#

Perhaps display entities that are forcibly spectated when the scene needs to be played

worthy star
#

after like 5 days of suffering

merry cove
worthy star
#

but i still don't get why it did that

alpine urchin
#

on it

#

in your plugin.yml

#

add

#

depend:
- ProtocolLib

#

so that your plugin loads after protocollib

young knoll
remote swallow
#

read up

blazing ocean
#

how do I get the value of an attribute

#

Registry.ATTRIBUTE.get()

#

nvm

#

Player#getAttribute

pliant topaz
#

I got a performance question:
So, when I have a list containg an enum (the enum has many entries), the list most of the time only consisting of one element, would it be faster to do it with a for-loop and switch-statements or just go with an if-statement for each check instead? I'd guess for-loop and switch but I'm not sure

echo basalt
#

uh

#

list.contains ?

pliant topaz
#

that would be with the if-statements, as i need to execute different pieces of code indivdual to what enum constant there is

young knoll
#

I mean for a cutscene you can just move the player along a line

#

If you want to stop movement then stick them in spectator mode and attach them to an entity

worthy yarrow
#

In the sense of mapping a players movements and relaying it anytime the scene needs to be played

young knoll
#

I'd probably just record keyframes and then interpolate between them

worthy yarrow
#

Does that take head movements into consideration?

young knoll
#

It does if you make it

worthy yarrow
#

ah gotcha

blazing ocean
#

honestly i would create a helper tool to create a cutscene which then exports it to those movements

young knoll
#

mhm

bold oriole
dapper flower
#

If an item has no meta data it also means it has no nbt data?

pseudo hazel
#

it probably has nbt data about itself

#

but idk for sure

bold oriole
#

why the leather armor doesn't turn green? must i set a packet?

        ProtocolManager protocolManager  = ProtocolLibrary.getProtocolManager();
        protocolManager.addPacketListener(new PacketAdapter(this,
                PacketType.Play.Server.ENTITY_EQUIPMENT) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                if(packet.getItemModifier().size()==0){return;}
                ItemStack stack = packet.getItemModifier().read(0);

                if (stack != null && stack.getType().name().contains("LEATHER")) {

                    packet = event.getPacket().deepClone();
                    event.setPacket(packet);
                    stack = packet.getItemModifier().read(0);

                    // Color that depends on the player's name
                    String recieverName = event.getPlayer().getName();

                    // Update the color
                    LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
                    meta.setColor(Color.fromRGB(0,255,0));
                    stack.setItemMeta(meta);
                }
            }
        });
lilac dagger
#

some level of nbt is required otherwise the server wouldn't know how to process it

young knoll
#

Items are just all NBT data

#

Grab a basic item and run /data get entity @s SelectedItem

lilac dagger
#

i think air is an exception

young knoll
#

Well yes because that isn't a real item

lilac dagger
#

yeah

#

it's mostly treated as null

bold oriole
#

is the error important?

  java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.updater.Updater.isChecking()" because "this.updater" is null
      at com.comphenix.protocol.ProtocolLib.checkUpdates(ProtocolLib.java:540)
vast ledge
#

Maybe you didn't init ProtocolLib correctly

lilac dagger
#

i don't think protocollib is a library to have nullpointers like these

eternal oxide
#

ProtocolLib is a Plugin. Don;t shade it

lilac dagger
#

oh yeah, don't shade protocollib

#

is this worth extracting?

#

i considered making the for loop and the check a method but then checking on null makes it look the same

#

TogglerView togglerView = getTogglerView(id);
if (togglerView != null

#

i guess it does make the code more inline

#

anyway, this looks so much better than what i had

#

probably changed name

#

a cool way is to look into which class uses ClientboundBlockUpdatePacket

#

then look in 1.20.4 in the class that used to use that and see what it does instead

#

if the arguments are very different it's not the same

young knoll
#

ClientboundBlockUpdatePacket still exists

lilac dagger
#

just confirm by doing a check as i said earlier

#

if it exists then i dunno?

young knoll
#

net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket

lilac dagger
#

intellij has some issues sometimes

#

try putting it manually and see if it's red

#

try invalidating cache

#

or rebuild in buildtools

young knoll
#

I can import it fine ยฏ_(ใƒ„)_/ยฏ

#

And the mappings website shows it

lilac dagger
#

?mappings

undone axleBOT
lilac dagger
#

ye

#

oh wow

#

can you look in the intellij to see if your jar is complete?

#

yeah in your dependency tree

#

this is for me

#

not sure if for the unmapped version it's the same

#

it might have the spigot naming

#

amazing

#

prapare for slower buildtimes

bold oriole
#

correct

#

is there a documentation?

#
depend:
  - ProtocolLib
      <dependency>
          <groupId>com.comphenix.protocol</groupId>
          <artifactId>ProtocolLib</artifactId>
          <version>4.8.0</version>
          <scope>provided</scope>
      </dependency>
crystal goblet
#

how to create tab list in 1.19.2?

peak jetty
#

how do i wait 5 seconds before doing the broadcast?

@EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        String name = event.getPlayer().getDisplayName();
        Bukkit.getServer().broadcastMessage("welcome " + name + "!");
    }```
tall dragon
#

?scheduling

undone axleBOT
peak jetty
young knoll
#

Neither

#

Just use the one that takes a runnable

lilac dagger
#

Bukkit.getScheduler().runTaskLater(plugin, () -> {//yourcode here}, ticksTillExecute);

#

oh it's here

quaint mantle
#

Just use threads to max out performance

#

(Jk)

tall dragon
lilac dagger
#

if i'm asked nicely sure

tall dragon
#

fair

peak jetty
lilac dagger
#

yes

young knoll
#

(An instance of the main class)

#

See

#

?di

undone axleBOT
lilac dagger
#

an instance more precisely as coll said

young knoll
#

If you want to be even more precise

#

the instance

lilac dagger
#

oh yeah

#

don't do new MainClass()

alpine urchin
#

new MainClass();

river oracle
lilac dagger
#

well, if i can't the bugs will

#

so..

alpine urchin
#

old MainClass();

river oracle
#

Nah bugs are my friends

#

They would never

tall dragon
young knoll
#

You don't even get bugs

#

You just get told no

junior cradle
#

Can you tell me how to give pvp mode when archery?

inner mulch
#

?

alpine urchin
#

i cant take a clown seriously

inner mulch
#

Where are the discord lootboxes

#

I want too

lilac dagger
#

they're gone

valid burrow
#

i got scammed by the lootboxes

#

i opend them and got my clown thingy but

#

it disapeared

#

instantly

#

lรถol

eternal oxide
#

I ignored teh lootbox

#

just adding gambling addiction to entice people to pay

grave laurel
#

I have binded it in in the default.json as a unicode "\uE03B"

#

and the .json is valid..

proud badge
#

is kotlin good

ivory sleet
#

yes and no

#

I mean it has a lot of ergonomical features

#

but eh, whenever I read kotlin code I always have a harder time understanding what is actually happening

#

you have stuff like first class higher ordered functions, and then operator overloading and infix inline extension functions etc

valid burrow
#

@ivory sleet wanna come eat pizza with us

warm mica
#

I find it annoying when people wildly mix java and kotlin within the same project

young knoll
#

What if you throw in some scala too

chrome beacon
#

Don't forget Groovy

terse tangle
#

and maybe some clojure?

silent slate
#

i wanna save how many players ever played a gamemode. How could i track that the best? Create a long list? Wouldnt that take up large amounts of memory/create Lag

lost matrix
silent slate
#

well thats the thing

#

i want this to be scaleable in the future. If possible make this safe until 10k players max. I cant really say how many players this server will get, depends on how much hype its gonna enjoy

lost matrix
#

A UUID is 16bytes + 8 bytes obj header.
So 10k players would in result in 240kb in object size. Thats <0.25MB.

For that estimate i would literally just throw them in a Set<UUID> played = new HashSet<>(); and call it a day.

silent slate
#

why a hashset, not a list?

lost matrix
# silent slate why a hashset, not a list?

Because .contains() on a List will scale with O(n) and on a HashSet it scales O(1)
Meaning a list would take 1ms for 100 players, then 10ms for 1000 players and 100ms for 10k players.
A Set takes 1ms for 10, 100 or a million players.

#

And you dont even have to check with .contains() on a Set.
Just always add the UUID. If its a duplicate entry then it wont be added anyways.

silent slate
#

do u recommend any resources to learn that, because ive only been familiar with lists and hashmaps xD

silent slate
#

k thanks

#

And the other thing

#

how do i save the hashset when the server gets off?

alpine urchin
#

i haven't read any context

#

but i'll answer

#

in the config

#

@silent slate

silent slate
#

what config xD

#

how do i save and load a hashset out of config?

echo basalt
#

it's still like 2mb of ram but eh

alpine urchin
#

ez

lost matrix
echo basalt
#

I'm not talking about the object header itself

#

I'm talking about the map node object

silent slate
#

So Hashset to list -> List to String -> String to textfile

echo basalt
#

And all the map buckets

#

Given that the map doubles in size after the load factor

lost matrix
#

Yy

#

Still doesnt matter. 10k players is a high estimate. 99.9% of servers never see that in their lifetime.

silent slate
#

just want to futureproof

#

i know that i will be incredible lucky to ever archieve that

echo basalt
#

IDeally under infinite load you want to minimize the pressure points

lost matrix
#

If you want it futureproof then you should use a database and store your data there

silent slate
#

what kind of database

echo basalt
#

Something that you can cluster

#

which is pretty much all the modern ones

silent slate
#

we have a gameserver rn and want to upgrade to a vps once we have enough players to afford it

silent slate
#

agree

ivory sleet
lilac dagger
#

it's only missing O(sqrt(n)) in the graph

#

but it's not really found in algorithms anyway

proud badge
#

if I hit a mob that has isInvulnerable, is the EntitytDamageEvent considered cancelled?

lilac dagger
#

you can test it

#

not sure, doubt the event will be called

lost matrix
#

Events are only cancelled by plugins

proud badge
#

Rip

echo basalt
#

uh yes and no

#

While events only get cancelled by plugins, there are certain events that still fire even if the expected outcome doesn't happen

#

For example, InventoryClickEvent gets fired on beacons even if you aren't holding an item accepted by the slot

alpine urchin
#

O(2) when

lilac dagger
#

it's still constant ๐Ÿ˜„

#

plus there is no (2) in O notation

alpine urchin
#

ik

#

you missed the joke

#

O(infinity) is constant?

lilac dagger
#

i don't know math enough to answer

#

isn't that just O(n)?

sullen canyon
alpine urchin
#

that's the question

#

if infinity is a constant

rapid vigil
#

How much should the JUMP potion effect's amplifier be so that you can't jump?

alpine urchin
#

ok math says

#

its not a constant

#

O(n)

#

hmmm

lilac dagger
#

yeah, infinity is an idea or something

#

not sure what's the proper definition

lost matrix
#

infinity is not a number. Its a concept. You cant evaluate an expression with it.

rapid vigil
#

-1 is making it infinite but i need it to make them not be able to jump

lilac dagger
#

the amplifier should be able to do that i think?

alpine urchin
lost matrix
#

-.-

rapid vigil
alpine urchin
#

@lost matrix smile

#

it's in your name

lost matrix
silent slate
#

his name in german is bratwurst xD

rapid vigil
# lost matrix 256

ah i tried it but i can still jump, heres my code:

    @CatchUnknown
    public void onFreeze(Player p, OnlinePlayer targetPlayer) {
        Player target = targetPlayer.getPlayer();

        target.setWalkSpeed(0);
        target.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, -1, 256));

        target.sendMessage("You have been frozen");
    }```
lost matrix
rapid vigil
lost matrix
#

Wait... isnt the first parameter the amplifier?

#

nvm

rapid vigil
#

xd

#

I set the amplifier to 99999999 and i still can jump

lilac dagger
#

wait, i have a piece of code that works somewhere ^

sand spire
#

idk why but that works for me in 1.20

rapid vigil
#

eyy it works, thank you :>

lilac dagger
#

player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 210, 250, false, false, false));

#

nice ๐Ÿ˜„

#

i was too slow

rapid vigil
#

i actually got tired of canceling their move event if they're in a Set because thats probably not good, so i came up with the idea of setting their move speed to 0 and giving them a specific jump amplifier so they cant jump

lilac dagger
#

client cheats will be able to bypass this ^

rapid vigil
#

haha yeah but if someone froze you and you just bypass it infront of them you're getting insta banned

lilac dagger
#

not wrong

rapid vigil
lilac dagger
#

yeah

#

and also the icons

young knoll
#

All of hypixels servers keep a cache of millions of UUID in memory

#

(real)

lilac dagger
#

why is that for?

alpine urchin
#

selling our data

coarse light
#

can someone Help me my Server isnt Starting with my Plugin and i dont Know how i should fix it

alpine urchin
#

they can extrapolate our personality based on our minecraft skin

coarse light
# alpine urchin oh no

import org.bukkit.plugin.java.JavaPlugin;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class UltraLicens extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();
String key = getConfig().getString("Key");
try {
if (validateKey(key)) {
getLogger().info("Enabled");
} else {
getLogger().info("Invalid Key");
getServer().getPluginManager().disablePlugin(this);
}
} catch (Exception e) {
e.printStackTrace();
}
}

private boolean validateKey(String key) throws Exception {
    URL url = new URL("." + key);
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("GET");

    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuilder content = new StringBuilder();
    while ((inputLine = in.readLine()) != null) {
        content.append(inputLine);
    }
    in.close();
    con.disconnect();

    return "true".equals(content.toString());
}

}

lilac dagger
#

set a timeout on your url

#

it might be dead or something

alpine urchin
#

yeah use

#

?paste

undone axleBOT
young knoll
coarse light
lilac dagger
#

URLConnection connection;
connection.setConnectTimeout(1000);
connection.setReadTimeout(1000);

valid burrow
proud badge
#

if(!mob.hasAI()) any1 know why this returns true that the mob has AI, despite the fact that it doesnt

#

I made a spawner with nerf-mob-spawners: true and spawned some chickens

young knoll
#

that doesn't disable their AI in that way

proud badge
#

Rip, what does it do then

young knoll
#

I think it just removes certain AI goals

proud badge
#

Rip

young knoll
#

You can make a proper NoAI spawner tho

worthy star
#

whats the most proper way to execute commands from console

carmine mica
#

type them in yourself ๐Ÿ’ฏ

#

but for reals, what kind of commands?

lilac dagger
worthy star
lilac dagger
#

yeah

worthy star
#

ight

eternal oxide
#

Will only work on teh local machine. will not go through bungee

worthy star
#

i don't use bungee

#

wait

#

let me try something

lilac dagger
#

this looks ugly somehow

drowsy helm
#

i mean you could do it programmatically but that is most readable tbh

lilac dagger
#

i don't think it's worth using a loop right?

drowsy helm
#

nah not really

#

unless you want past top 10

worthy star
#

nvm

worthy star
#

i use this code to reward the playerjava public void reward(Player player) { int size = RelaxDc.getInstance().getConfig().getConfigurationSection("linking-rewards").getKeys(false).size(); for(int i = 1; i <= size; i++) { String cmd = RelaxDc.getInstance().getConfig().getString("linking-rewards." + i); cmd = PlaceholderAPI.setPlaceholders(player, cmd); CommandUtils.execute(cmd); } }

#

i have a linking-rewards configuration section with 1: 'cmd', 2: 'cmd'..

worthy star
young knoll
#

You can't run it async

#

Use the scheduler to run it sync

worthy star
#

the for loop?

young knoll
#

Sure

#

Technically just the execute needs to be sync

worthy star
#

ok

#

so i use a bukkit runnable

#

or scheduler

young knoll
#

Bukkit.getScheduler.runTask

worthy star
#

ok thx

#

so this java ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.runTask(RelaxDc.getInstance(), () -> { Bukkit.dispatchCommand(console, cmd); });

worthy star
#

ayy

echo basalt
worthy star
#

it worked tysm

lilac dagger
echo basalt
lilac dagger
#

that's nice

alpine urchin
glad dome
#

@alpine urchin hi

#

can u help with paket events

chrome beacon
#

?ask

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!

unborn breach
#

Looking for a minecraft project leader that wants to help Victora Kingdoms to the next level.
You will take charge over the settings, Plugins and balancing of the server.
Ofc you will get paid each month.
Let me know if u have interessed

young knoll
#

?services

undone axleBOT
unborn breach
#

thx

steel dirge
#

Working with protocollib, looking to see if anyone would help. mostly @echo basalt i saw ur post here: https://gist.github.com/IllusionTheDev/8b0761be3b699fcfc0c082b753e6f063

Im trying to work with Text Displays.
I got this:

 PacketContainer metaData = Holograms.plugin.protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
            metaData.getIntegers().write(0, entityId);

            List<WrappedDataValue> dataValues = List.of(
                new WrappedDataValue(23, WrappedDataWatcher.Registry.getChatComponentSerializer(), WrappedChatComponent.fromText("test"))
            );

            metaData.getDataValueCollectionModifier().write(0, dataValues);

TextComponent is called for index 23. Not sure if im doing that right?
I get
class com.comphenix.protocol.wrappers.WrappedChatComponent cannot be cast to class net.minecraft.network.chat.IChatBaseComponent

Any help is appreciated.

#

my verified tag not here still ๐Ÿ˜ 

echo basalt
#

uh

#

call getHandle()

steel dirge
#

thank you

#

going on an hour with that xD

echo basalt
#

I've seen it countless times don't worry about it

#

ProtocolLib should wrap this but sometimes things are flaky

steel dirge
#

ye, the versions i use as well also is funky

#

i use a dev build from 2 weeks ago, cant spawn entities

#

i use a latest one. works

young knoll
#

Plib is kinda dying

steel dirge
#

is packetevents the new and improved

#

i should be using it, as im an admin in the vulcan discord ๐Ÿ’€

#

the disrespect is real

#

isnt that right @alpine urchin

young knoll
#

I would call it improved

#

Not that new anymore tho

quiet ice
steel dirge
#

verify will not work ๐Ÿ—ฏ๏ธ

remote swallow
#

rejoin

steel dirge
#

i did twice ๐Ÿ˜ฟ

remote swallow
#

email suport

#

?support

undone axleBOT
brave lynx
#

Are you able to save multiple lists (of different types) to the items PDC?

inner mulch
#

i think there is a plugin that lets u add lists to pdc

worldly ingot
#

There's API for it

brave lynx
#

wdym

worldly ingot
#

Bukkit API for it

brave lynx
#

yeah

brave lynx
#

but that doesnt rly answer my question

#

im asking a yes or no question

#

with the same key, can i save multiple lists?

worldly ingot
#

No

#

That doesn't even make any sense

inner mulch
#

1 key can only have 1 value

brave lynx
#

OHHH

worldly ingot
#

You would have to store a container type which contains two lists with their own individual keys

brave lynx
#

i didnt know the key was the container

#

thank you @inner mulch

#

!!

worldly ingot
#

"key": [listvalue1, listvalue2, listvalue3]

#

:p

brave lynx
#

tysm

#

this whole time i thought 1 key can store infinite values

#

๐Ÿ˜ญ

#

i gotta rewrite my stats system now

inner mulch
#

it can, you can have a List<List<?>>

worldly ingot
#

Nah. Think of it like an overglorified Map

#

I don't think NBT supports lists of lists

#

Does it?

inner mulch
#

im not sure

brave lynx
#

i think so

#

lemme try

worldly ingot
#

I feel like I've never seen one in vanilla, but maybe I'm wrong

#

ยฏ_(ใƒ„)_/ยฏ

brave lynx
#

cuz itll save me

#

sm time

inner mulch
#

but dont do it like that Lists in Lists arent generally a good idea

worldly ingot
#

Right. Generally indicates a design flaw

brave lynx
#

why not?

#

what issue does it create?

inner mulch
#

your lists are supposed to have different values right?

brave lynx
#

yeah

#

one with strings one with doubles

inner mulch
#

if so your list would be List<List<?>> the ? means you dont know what the value is therefore you gonna work with object and need to cast

brave lynx
#

but i do know what ? will be

#

wont i?

inner mulch
#

you know but at some point you add something that isnt expected your code breaks and you need to recode the casting

brave lynx
#

if i only add strings into the ?, there wont be an issue right?

inner mulch
#

if you know it will always be string you dont need the list to be ?

#

it can be String then

#

in this case i guess its fine

brave lynx
#

alright, thank you so so so much <33

inner mulch
#

np

brave lynx
#

hey quick question

#

when saving List<List<String>>

#

is there any reason not to just use List<String> instead because its basically the same thing?

vital void
#

Thatโ€™s a a list of a list of a list of strings

brave lynx
#

but you wouldnt be able to save multiple list<string> in a list right?

vital void
#

Uh you can I think

#

What are you trying to do?

brave lynx
#

im trying to have a list that has two lists, one with a list of doubles and one with strings

#

but right now im just trying to figure out how two lists in a list look like

vital void
#

Does the string correlate to the double

brave lynx
#

uhhh i guess

#

like; "Power" = 0.01

vital void
#

Have you tried a hashmap?

brave lynx
#

you cant save hashmaps in PDC

#

so im stuck with lists

vital void
#

What is pdc

brave lynx
#

PersistentDataContainer

rough ibex
#

?pdc

vital void
#

I see.

#

Your trying to save tags on an item I am assuming ?

brave lynx
#

yup

vital void
#

Okay.

#

I have always used an api for that as itโ€™s just way simpler

brave lynx
#

which one?

vital void
#

Rtag

#

1.8-1.20.4 support

#

Supports items, entites and more

rough ibex
#

I don't think that's very necessary right now

brave lynx
#

ah i gotcha
i'd like to keep all of my code made by myself though

vital void
#

Yeha Iโ€™m sure there is someone here who can help you

rough ibex
#

explain what you're trying to do

#

and why you're doing it your way

vital void
#

Im not familiar with PDC syntax

worthy yarrow
#

Pdc is spigot api so imo itโ€™d be easier to just use pdc

brave lynx
#

I am trying to save data (or item stats) to an item. For example; ["Power" = 0.3],["FishingSpeed" = 100.0]. I am using personal data containers because saving every piece of data outside Minecraft will prove difficult, if not costly. To save such data, I have to turn all my data into lists since PDC do not support any sory of arrays other than Lists. To do this, I am trying to figure out if I can store multiple types of Lists in one single list. (list list<list<string>, list<double>>)

vital void
#

Correct, can be very difficult to do when making a plugin across different versions of spigot

worthy yarrow
#

I mean unless youโ€™re going pre 1.14 itโ€™s not hard

vital void
#

in my case I was

worthy yarrow
#

Since Iโ€™m pretty sure 1.14 is when pdc was introduced

vital void
#

1.14 to 1.20 would be fine

#

Yeah it was 1.14 I think

#

Or 1.13 idk

worthy yarrow
#

Somewhere between 1.13 and 1.14 idk

brave lynx
#

wait, do you guys reckon I can just make a custom PersistentDataType so I can use that isntead of the given list option?

worthy yarrow
#

Mhm

#

Thatโ€™s the point of pdc lol

brave lynx
#

ugh u should have said that in the first placeeeee ๐Ÿ˜ก

worthy yarrow
#

I just got here

brave lynx
#

nu uh

worthy yarrow
#

The pdc link has an example of a class implementing persistent data type, in order to store non primitive data

brave lynx
#

yup, im trying it out rn

#

ill let you know if i have questions about that

#

(i will)

rough ibex
#

as in

#

very stupid mockup

[pluginPDCKey]["Power"] = (PDC.FLOAT) 0.3```
#

so youre storing your data under your plugin's PDC map

brave lynx
#

im not gonna lie

#

i have no clue on how to make a map data type for PDC

glad prawn
#

serialization

brave lynx
vital void
#

If you can do it on your own Iโ€™d be looking into an api but makes it simple

brave lynx
#

i literally have no clue what 50% of the stuff on the example does or means

dawn flower
#

can u send item lore update to the player (PLAYER ONLY)

#

that reverts when the player rejoins

keen valve
#

Can anyone help me figure out where I went wrong because it gives the effects even though there is no gold block under the beacon

@EventHandler
    public void onPlace(BlockPlaceEvent event){
        Player player = event.getPlayer();
        Block block = event.getBlockPlaced();
        Location location = block.getLocation();

        if (event.getBlockPlaced().getType() == Material.BEACON && event.getBlockPlaced().getRelative(BlockFace.DOWN).getType() == Material.GOLD_BLOCK) {
            location.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, location.getBlockX() + 0.5, location.getBlockY() + 0.5, location.getBlockZ() + 0.5, 50);
            location.getWorld().playSound(location, Sound.ENTITY_GHAST_SHOOT, 100, 2);
        }
    }
vital void
#

@brave lynx you want me to do it for you or show you?

brave lynx
#

either or could work, as long as I end up understanding how making persistentdatatypes works

agile anvil
# dawn flower can u send item lore update to the player (PLAYER ONLY)

Two choices:

  • listen to packet when the item packet is send to the player and change the lore there
  • listen to every event (PlayerJoin, drop, inventory..) and change accordingly here). Please note that for this case if the player put it in a public chest players will all see the lore or the player won't see it.

The first is the easier I think. You have to wrap the packets

dawn flower
#

alr

agile anvil
glad prawn
keen valve
# agile anvil Can you try making some debug messages to check the relative block down etc?

I tried this way but it doesn't send me messages

@EventHandler
    public void onPlace(BlockPlaceEvent event){
        Player player = event.getPlayer();
        Block block = event.getBlockPlaced();
        Location location = block.getLocation();

        if (event.getBlockPlaced().getType() == Material.BEACON && event.getBlockPlaced().getRelative(BlockFace.DOWN).getType() == Material.GOLD_BLOCK) {
            location.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, location.getBlockX() + 0.5, location.getBlockY() + 0.5, location.getBlockZ() + 0.5, 50);
            location.getWorld().playSound(location, Sound.ENTITY_GHAST_SHOOT, 100, 2);
        }

        if (event.getBlockPlaced().getRelative(BlockFace.DOWN).getType() == Material.GOLD_BLOCK) {
            player.sendMessage(MessagesUtils.getColorMessage("&cBlock is gold!"));
        } else {
            player.sendMessage(MessagesUtils.getColorMessage("&cBlock is not gold!"));
        }
    }```
vital void
#

Do this

#

Player.sendMessage(event.getBlockPlaced().getRelative(BlockFace.DOWN).getType().name());

#

Put it before the first if statement

#

Let us know how you go with that

drowsy helm
grave vigil
#

I'm trying to make a plugin that can be boiled down into a player clicking on a something, it disappearing, and then reappearing a few seconds later.

So, my question is: Would it be inefficient to use bukkit runnables to control how long the object the player clicked on takes to come back? More so if there can be hundreds of objects gone at one time?

eternal oxide
#

If it's hundreds going on and off use a single task. Add each to a queue with it's respawn delay.

grave vigil
eternal oxide
#

one task repeating is better than 100 tasks being created then destroyed.

alpine urchin
alpine urchin
vital void
#

@grave vigil use a single runnable

grave vigil
vital void
#

Constantly run 1 task

#

And check what you need with timestamps

grave vigil
candid plover
#

I'm creating an inventory, but when another player opens it, items can be picked up from the menu that was open, how do I fix it?


    public void openInventory(Player player) {
        inventory = Bukkit.createInventory(null, 27, "Editor de estilo");

createItems(player);
player.openInventory(inventory);
 }```
vital void
#

@candid plover how are you stopping players from taking items

grave vigil
tall dragon
#

?gui

tall dragon
#

this is an excellent way to get started ^

wraith imp
#

Hello, is there any way of making custom packets with nms (i would like it to not be dependant on protocol lib)?
The client will have the packet registered via fabric mod.

grave vigil
#

thats what I was told when I started

tall dragon
#

i feel like ur best off learning how to do it right. straight away

grave vigil
# tall dragon i feel like ur best off learning how to do it right. straight away

idk if I fully agree with that, personally. I like gradual learning. Learn the simplest way to do something, and then learn the more complicated ways of doing it. Understand the use cases of both. It can feel overwhelming to just start learning something, and be swarmed with a whole bunch of vocab that you've never heard of; being thrown into the deep end.

tall dragon
vital void
#

@tall dragon why not check against name?

tall dragon
#

because its bad practise, for example people can rename chests and pass your name check

vital void
#

Thatโ€™s very watchable

#

Patchable

#

Wonโ€™t a map take up unnecessary space?

#

Not arguing; just genuinely curious

tall dragon
#

oh cmon its 2024

#

thats not unnecessary at all

grave vigil
#

Just use color codes. Normal players can't rename chests with color codes, so it's normally not an issue.

grave vigil
tall dragon
#

but why torture urself when u can implement an actual proper system.

vital void
#

Your listening to more events

#

Your doing the same job in more code

#

Not less

#

Opposite of optimisation

tall dragon
#

?????????

#

okay lmfao

grave vigil
#

but honestly at that point just use an inventory framework

tall dragon
vast ledge
#

Ever heard of making your own inventory holder

#

Screw names

tall dragon
#

you shoulnt do that either

#

thats bad practise as well

vast ledge
#

It's literally designed to identify inventories

tall dragon
#

no its not

vital void
#

I understand what you are saying

vast ledge
#

Yes it is?

tall dragon
#

it was never designed to be used by plugins

vital void
#

But in the case you a making a single gui

#

It is not โ€œbad practiceโ€

#

It is not required

vast ledge
#

.getInventoryHolder()

#

Is a part of the inventory class

tall dragon
#

so?

vast ledge
#

On create of your inventory, it asks for an inventory holder

tall dragon
#

doesnt mean its intended to be used to identify inventories

vast ledge
#

Why not use it

tall dragon
#

it just results in your code being extremely messy

#

and hard to maintain

#

/ update

vast ledge
grave vigil
#

it's not really that messy if it's just one GUI. I've used a quick inventory name check for a simple confirm GUI. Nothing really that crazy tbh

grave vigil
tall dragon
#

^

tall dragon
grave vigil
#

but checking name is only bad practice because people may, depending on the server, be able to replicate the inventory through a chest. This can be gotten around by using color codes and disallowing players to add color codes to items (which is most servers, I rarely see the feature).

vast ledge