#help-development

1 messages · Page 399 of 1

hazy parrot
#

If it works doesn't mean its best way to do smth

chrome beacon
#

Just because it works does not mean it's a good way of doing it

regal scaffold
#

Because extending Enchantment and using 2 lines of reflection is too hard

fresh timber
#

you guys didnt say it wasnt the best, you said it is the worst thing u can do

sterile token
#

One of the issues Is that you simple emulate that custom ítem by getting the same ítem and adding Lore

fresh timber
#

wha

regal scaffold
#

With PDC doing custom items has never been easier

fresh timber
#

yea i learned abt that like last week

regal scaffold
#

You can literally use PDC for your entire plugin

#

If you are able to data manage efficiently, that is

fresh timber
#

anyway, ehm, you know what I needa fix?

regal scaffold
dense falcon
#
                    Bukkit.broadcastMessage(ChatColor.WHITE + "[" + ChatColor.DARK_RED + "Loup Garou" + ChatColor.WHITE + "]" + "Le père des loups se réveille !");
                    String config_p = plugin.getConfig().getString("roles.loup-pere");
                    if (config_p != null && !config_p.equals("None")) {
                        Player p = Bukkit.getPlayer(config_p);
                        if (p != null) {GiveTime(p);}
                    }
                    Bukkit.broadcastMessage(ChatColor.WHITE + "[" + ChatColor.DARK_RED + "Loup Garou" + ChatColor.WHITE + "]" + "Le père des loups s'endort !");

Why the second Bukkit sent just after the first Bukkit.broadcastMessage() ?

regal scaffold
#

?paste

undone axleBOT
regal scaffold
dense falcon
regal scaffold
#

Show giveTime

dense falcon
#
    private void GiveTime(Player plr) {
        plr.removePotionEffect(PotionEffectType.BLINDNESS);
        plr.setLevel(16);
        Bukkit.getScheduler().runTaskTimer(plugin, (task) -> {
            if (plr.getLevel() > 0) {
                plr.setLevel(plr.getLevel() - 1);
            }

            if (plr.getLevel() == 0) {
                plr.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Integer.MAX_VALUE, 3));
                task.cancel();
            }
        }, 0L, 20L);
    }

regal scaffold
#

I know why but I don't know how to explain it without messing it something so just wait for someone else to answer

dense falcon
#

I will move the bukkit into this func and ask the arg to give the sentence.

trail lintel
#

Is there an equivalent of persistent data containers for blocks? I want to store some "data" inside a block that I place. Specifically an identifier to say "this is my plugins block".

regal scaffold
#

?blockpdc

undone axleBOT
regal scaffold
#

Enjoy

sterile token
dense falcon
sterile token
#

Idk how people can till code plugins with native Bukkit

regal scaffold
#

What are you talking about

dense falcon
#

?

regal scaffold
#

Dude

#

He means the scheduler

#

Not that hard

hazy parrot
sterile token
#

Oh lmao i thought he was using plain bukkit api

hazy parrot
#

Hence reason why second thing just broadcasts

earnest vapor
regal scaffold
#

Ok

#

Lets read this together

#
[16:29:11] [Server thread/ERROR]: Could not load 'plugins/spawnpl.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: main class `com.arcanhaven.spawnplugin.SpawnPlugin' does not extend JavaPlugin
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
#

Line 2

#

Literally says

main class `com.arcanhaven.spawnplugin.SpawnPlugin' does not extend JavaPlugin

#

So in your SpawnPlugin.java

Make sure it says

public class SpawnPlugin extends JavaPlugin {

//Your stuff here, onEnable(), onDisable()

}
hazy warren
#

Guys for a simple skyblock plugin, is the best way to do it to have every island be on the same world far away, or each island be its own world

regal scaffold
hazy warren
#

My thoughts would be it's more efficient for it so to be on the same world too

regal scaffold
#

Is the most optimized

trail lintel
#

Do the same world if you aren't a psychopath 😉

hazy warren
#

Lool

regal scaffold
#

But if you don't care about optimization and getting as much performance as you want. Just separate them by 500 blocks or so. Empty chunks don't take pretty much any memory

hazy warren
#

True also gotta prepare for future in case more island expansions are wanted

hazy parrot
regal scaffold
#

^

hazy parrot
#

Also, whole class pls

regal scaffold
#

Oh jesus christ

hazy parrot
#

Wow

regal scaffold
#

?paste @earnest vapor

undone axleBOT
regal scaffold
#

Delete that

earnest vapor
regal scaffold
#

My mouse wheel almost broke

#

Show your plugin .yml

hazy warren
regal scaffold
#

That is pretty advanced cause that means storing the island data each time everyone leaves and then loading it back in

#

yes it's the most efficient and defo really cool

#

But for now I would recommend, hard max limit to 500 blocks diameter

#

And call it a day

#

No one ever gonna make bigger than 500 block diameter

hazy warren
#

I was just thinking nbt parser read blocks at offset then shift them

regal scaffold
#

Start at X and upgrade

regal scaffold
#

It's a lot

hazy warren
#

But the real question is: if client never asks for that should I waste my time lol

regal scaffold
#

But you said you want to move them around

#

He client asked for what exactly

hazy warren
#

All they asked for was a skyblock island creation plugin that lets u do /is create

regal scaffold
#

Then hard set the max island limit to 1000 ( never gonna even get near that ) and stack islands 1000 blocks away

hazy warren
#

Lol

eternal oxide
#

Structure API

regal scaffold
#

Isn't it really outdated?

hazy warren
#

Then u just make them spiral out from middle I suppose

eternal oxide
#

no

#

it's in Spigot

regal scaffold
#

Oh that one

regal scaffold
hazy warren
#

Are you saying they made world edit API useless

regal scaffold
#

No

#

(Use FAWE anyways if you need WE )

#

But some really big plugins which do that like PMines use FAWE to paste copies of the PMine around

remote swallow
#

fast async world exception

hazy warren
#

Yeah I just make my own because I like to waste time like that

remote swallow
#

fawe is just a bad idea imo

regal scaffold
#

How

remote swallow
#

it causes world corruption

#

i used it once on a server and it cause large areas of missing land in oceans

regal scaffold
#

So can other 100 things

#

I mean

hazy warren
#

Maybe you just pasted wrong

regal scaffold
#

I see pretty much every server use it way more than WE and you get the typical issues you get when you have such a massively used plugin

remote swallow
#

most servers can support normal worldedit with a bit of lag up to about a million blocks

#

if you have a lower gen server, just get async world edit

sterile token
regal scaffold
#

idk I still see people use fawe more

hazy warren
#

Let's optimize world edit to do 100 million blocks without lag then

remote swallow
regal scaffold
#

Async world edit is so slow

sterile token
#

Thats the perfect example of why things are not updated to newer technologies

hazy warren
#

Fawe should literally just split the workload up over multiple ticks, not actually async

remote swallow
#

not really

regal scaffold
#

It has a queue system

remote swallow
#

i would rather spend longer to do something than have the chance to cause world corruption

hazy warren
#

What if the server crashes mid world edit and now it's all messed up

remote swallow
#

thats an edge case

regal scaffold
#

At the very least

#

everyone gets kicked off

#

Cause running behind ticks error

remote swallow
#

world corruptin can happen with anything that modifies the world, just some plugins or usecases make the change higher

hazy warren
#

Surely that's a common edge case when you're pasting things large enough to actually need fawe

sterile token
#

The problem here its the fucking new versions, they are optimized for a potato, because not ever having a Xeon of 16 cores, 32 threads with 2,50 to 3,0 Ghz you can run a server with decent spawns, plugins and having around 250 players without tps going brr

#

Since 1.12 up they get fucked

#

Also the problem is caused specially to its shity single thread, because i can run it with 124gb of ram (max ram that i can add on me dedicated server) and the issue is the same

hazy warren
#

Did you mean the newer versions require having a god tier PC to run

sterile token
hazy warren
#

Yeah newer versions suck!

dry yacht
sterile token
#

Im not sure if im explaning what i mean

regal scaffold
#

@knotty ember Send your .jar file here

sterile token
#

Mincraft newever versions have beeing destroyed in term of resources

hazy warren
#

Well it's no secret that newer versions go hard on that cpu

#

And ram

sterile token
#

No no, the problem is not the ram

#

The limitations are specially to single threaded

dry yacht
#

Minecraft is getting bloated overall. I mean, look at the new fancy modern launcher. It takes forever to come up and plays this funny animation, while in the good old days it was just instant. Software just gets worse, nobody cares, everything has to be out the door by tomorrow...

hazy warren
#

Yeah but they do go harder on ram than older ones

sterile token
#

As i said i tested with 124gb of ram and 32gb, same machine, and the benchmarks doesnt change in case of ram

hazy warren
#

Like your ram is just perma maxed if you buy a cheap VPS to host modern version server

sterile token
hazy warren
#

Well 4+ GB of RAM is enough but cheap VPS be coming with like 1-2 which is sufficient for 1.12 and lower, not 1.13+

sterile token
hazy warren
#

Yes yes

#

My advice would be use minestom

sterile token
#

I mean that wont really fix a lot

#

The whole issue is related to shity Minecraft design, which works on single threaded

hazy warren
#

Minestom is completely redesigned from scratch to better support multiple cores where it can

sterile token
#

Its a temporary fix let say

hazy warren
#

Best option: create your own insanely optimized Minecraft server in asm

river oracle
#

minestom is not ideal for any normal server. Nor is that the goal of minestom

sterile token
#

Yeah minestone is not designed for production enviroments if im not wrong

river oracle
#

I wouldn't go that far

hazy warren
#

Minestom is production ready 💀

river oracle
#

but its not designed for your every day server

sterile token
#

Thats what im trying to tell him

#

But i dont know how to explain it

hazy warren
#

Lol I know all about minestom, I use it so I already understand this Verano

#

Just hook into spigot server world gen and then code every functionality for the server you need and easy done

river oracle
#

I do like the idea of minestom it seems very useful

hazy warren
#

Yes minestom lets me run 5x more minigames on the same machine

river oracle
#

Minestom def would work well for large networks

#

you just need to do all the impl yourself

#

which can be useful since you can hyper optimize where needed

sterile token
#

oh right

#

I get mixed my bad

#

Minestoms is not good for daily usage unless you have a big network

river oracle
#

what it isn't ideal for is small servers since it would cost a ton to pay developers to implement everything you want

#

unless ofc you are a developer as the owner

#

there is the Vanilla impl, but it isn't complete

hazy warren
#

For minigames it's so ideal, takes less time to implement what you need than disable the 1000 things you don't

river oracle
#

🤷🏽‍♂️ depends what you want

hazy warren
#

For any size server minigames

river oracle
#

for minigames I'd say it works well for everyone involved

sterile token
#

When im talking about im refering benchmarks caring up to 5000 of users

#

Im talking about large networks

river oracle
hazy warren
#

Lol large networks do not put 5000 people on the same server tho

sterile token
#

They split them on many instances

#

😂

hazy warren
#

Which minestom benefits from

#

You can literally run a minestom instance with 50mb of ram

river oracle
#

lobby's would go crazy with minestom

sterile token
river oracle
#

no but you can literally try it yourself

hazy warren
#

Nope just some guy tested it and posted his results

dense falcon
#
    public void onClick(InventoryClickEvent event) {
        Inventory inv = event.getInventory();
        Player p = (Player) event.getWhoClicked();
        ItemStack item_current = event.getCurrentItem();



        if (item_current == null) { return; }
        else if () {

        } else {
            return;
        }
    }
``` How can I check if it's the good inventory? 🤔
sterile token
#

y2k bro, what you think about Velocity? A client insists its better

hazy warren
#

JVM overhead adds more ram usage but the actual instance itself can be as low as 50mb

regal scaffold
#

Cuberite is the move anyways

river oracle
dense falcon
#

?

hazy warren
#

I thought cuberite was stuck in 1.12

river oracle
undone axleBOT
regal scaffold
#

It is

#

XD

hazy warren
#

Ah

river oracle
#

its just another one of paper's things though so I have no specific interest

ivory sleet
#

Velocity is good

hazy warren
#

Also I might be wrong but I'm pretty sure minestom is optimized better than cuberite overall

ivory sleet
#

But I dont like that they enforce guice

sterile token
#

Conclure i need arguments bro, im really interest

#

Because i having problems with a client

ivory sleet
#

Sounds like a hassle

dense falcon
hazy warren
#

Could've sworn cuberite server was taking more memory than minestom when I tested

quaint mantle
sterile token
ivory sleet
#

I mean its pretty bad measurement to do a comparison raw like that, cause given certain jvm flags, you can probably make either two use minimal ram

hazy warren
#

I tested them on my machine

pseudo hazel
#

its more like casting the player is irrelevant to what he was asking is it not?

ivory sleet
#

Like putting serial gc for instance

hazy warren
#

Okay but it's still C++ vs Java

sterile token
dense falcon
#
    @EventHandler
    public void onClick(InventoryClickEvent event) {
        Inventory inv = event.getInventory();
        Player p = (Player) event.getWhoClicked();
        ItemStack item_current = event.getCurrentItem();

        if (item_current == null) { return; }
        else if (item_current.hasItemMeta() && item_current.getItemMeta().getDisplayName().equalsIgnoreCase("")) {
            
        } else {
            return;
        }
    }
``` How can I check the name of the inventory? Like in the constructor of the inventory with `Bukkit.createInventory(null, 9, "Title");`.
river oracle
sterile token
ivory sleet
river oracle
hazy warren
#

Java still has a massive jvm overhead of like 200mb ram too

sterile token
#

Also the JVM have an issue, which im not sure if it has been fixed

river oracle
ivory sleet
pseudo hazel
#

using minestom for minigame servers sounds very nice

ivory sleet
#

For instance enforce total string deduplication, but it makes the jvm slower

hazy warren
#

If needed u can completely remove the overhead but it'll run slower

sterile token
#

I cant know find the amazon link where they explain they issue caused of JVM, how it internally keep pointers references. Because they where having a 20% of machines fasters

hazy warren
ivory sleet
#

Then it technically isnt overhead

river oracle
ivory sleet
#

If it provides beneficence somehow

hazy warren
#

Oh the underscore lo

river oracle
hazy warren
#

I say as long as he's consistent with it

rough ibex
#

consistently bad is still bad

river oracle
#

lol

#

my IDE doesn't even let me do if statements on one line

hazy warren
#

Don't hate on a man who learned python before java

river oracle
#

python was my first lang too :P

ivory sleet
#

generally dont hate at all, preferably :D

hazy warren
#

Lol

river oracle
ivory sleet
#

if its php, it may be overlooked

hazy warren
#

Lol

river oracle
#

PHP should be against the law

hazy warren
#

The worst thinh about minestom is they make you use GitHub discussions for help...

river oracle
#

😭 what

#

why not discord

hazy warren
#

Well the reasoning is that it's easier for others to find your issue and get help in the future

#

Instead of asking the same questions repeatedly on disx

ivory sleet
#

they do have a discord server, no?

weak meteor
#

What build method should i use for maven?

#

i got jar:jar

#

but i get JAR will be empty - no content was marked for inclusion!

ivory sleet
#

clean install

hazy warren
#

Yes they do but not for help

river oracle
hazy warren
#

My technique is to just ask for help repeatedly and someone will eventually help u

weak meteor
sterile token
weak meteor
#

not clean install or smth similar

hazy warren
#

Discord search bar kinda bad tho

regal scaffold
river oracle
#

Search

#

I use it all the time

rough ibex
#

I've used it maybe 5 times.

sterile token
regal scaffold
#

No one ever uses that

#

ever

river oracle
#

I do lol

#

I use it in help channels like this generally

#

helps you find an answer to your question

#

a lot of times if its simple

sterile token
#

Also too see who tagged me

#

Because discord tags get bug some tims

hazy warren
#

If you know exactly what you're looking for its simple

pseudo hazel
#

its only simple once you found it

rough ibex
#

There are a lot of ways to word a question

#

so it can be hard to find

#

but that goes for any search function.

fresh timber
#

I used to use the plugin Skript to basically customize stuff on my server but now I use plugins.. if anyone else has used Skript a lot there is a push <player> <direction> <speed> thing u can use, how would I do that with a plugin

fresh timber
#

yep

#

it was way easier for me

#

I was like 7 years old so I would not have understood java

sterile token
#

In my case i see about it, but moved forward to java

#

Because Java was robust and not a shity scripting lang, i dont enjoy coding script lang

#

Like Lua, etc

fresh timber
#

anyway

#

u know how I can do that?

haughty storm
#

how would I loop through all the items under the uuid when my file looks something like this?

fools:
  6c***1d0-3**5-4fed-8c4e-c9828***c890:
    '0':
      ==: org.bukkit.inventory.ItemStack
      v: 3120
      type: PACKED_MUD
    '1':
      ==: org.bukkit.inventory.ItemStack
      v: 3120
      type: DIRT

I tried this, but it says I can't convert MemorySection to Integer[] but I don't know how to loop through a MemorySection

            for(Integer i : (Integer[]) Objects.requireNonNull(configSaveFoh.get("fools." + s))) {
                Bukkit.getConsoleSender().sendMessage(i + "");
            }
sterile token
remote swallow
#

for (String key : config.getConfiguraitonSection("fools." + uuid.toString()).getKeys(false))

haughty storm
sterile token
glossy venture
#

you can get the keys with getKeys though i don't entirely understand what ur trying to do

dense falcon
glossy venture
#

getKeys(false) in your case

haughty storm
#

ok, thx

sterile token
# haughty storm ok, thx

getKeys(false) -> will return only the paths from the section you are giving
getKeys(true) -> will return all the paths inside the section, including sections inside of sections

**Example:
**

Root:
  key: "value"
  section:
    section-1:
      key: "value" 
    section-2:
      key: "value"

getKeys(false) over Root -> key and section
getKeys(true) over Root -> key, section, section.section-1, section.section-2, section.section-1.key, etc

unreal fable
#

can someone dm me if they can tell me how to make a plugin

sterile token
unreal fable
#

i know python?

#

ish

sterile token
#

lol

#

Python != Java

fresh timber
#

python seems so much easier

unreal fable
#

do u know any easy plugin making platforms

fresh timber
#

I wish minecraft used something like it xd

sterile token
#

Python syntax is really undfriendly

#

its syntax looks like a shity script lang

unreal fable
#

do u know of any easy plugin making platforms

fresh timber
#

i think everything besides java looks like that for u

sterile token
#

So mainly only Java, C# and TypeScript

fresh timber
#

yea

sterile token
#

Then all syntax looks like shity scripting langs

fresh timber
#

ive heard of C# ppl say its a lot easier than java too

unreal fable
fresh timber
#

no

sterile token
#

You wont be able to code plugins on Python

unreal fable
#

an easy plugin making platform

fresh timber
#

wdym? like ide?

sterile token
#

I cant even translate it to my native lang

unreal fable
#

is there not like a easy platform for making plugins and mods

river oracle
#

Yeah java

fresh timber
#

uh just code in intellij

sterile token
#

Java

unreal fable
#

im gonna get bullied for saying this but uis there like a block one

river oracle
#

Visual Bukkit but it sucks ass

river oracle
#

Sorry visual bukkit 😭

sterile token
#

All things based on sivuality sucks a lot

unreal fable
#

i remember when i was like 7 i made one in tinker

tardy delta
#

tinder?

unreal fable
#

tinker#

sterile token
#

oh lmao

#

Tinker is a platform for circuits

#

isnt it?

unreal fable
#

i dont rly remember it

river oracle
#

The easiest usable thing I know of is skript

unreal fable
sterile token
unreal fable
#

its made for litarally 7 year olds

sterile token
#

An online platform for making circuits that why get messed

unreal fable
#

us that link

river oracle
#

That won't work for plugins

unreal fable
#

yeah

river oracle
#

Gotta learn skript prob

unreal fable
#

but i just want smth like that

sterile token
#

Learn Java

molten hearth
#

?learnjava

undone axleBOT
river oracle
#

He asked for easiest

unreal fable
#

i dont wanna learn anything

sterile token
river oracle
#

Then don't make anything

#

Ever

unreal fable
#

apart from a name of an easy plugin maker

river oracle
#

?services

undone axleBOT
molten hearth
river oracle
#

This is all you'll get for plugins

molten hearth
sterile token
#

Because they are not server help nor programing

unreal fable
#

surley there will be some sorta easy platform

river oracle
#

Visual Bukkit but again it may not even work on latest version

unreal fable
#

ok then can one of u guys make a plugin for me

sterile token
molten hearth
#

?services

undone axleBOT
sterile token
#

An none make free things 🤡

unreal fable
#

i dont have any money

river oracle
#

Then learn to code

molten hearth
#

?robabank

sterile token
#

🤔

unreal fable
#

that will take so long

molten hearth
#

Learn to code so you can make money and hire someone to code for you

#

infinite loop

unreal fable
#

i just want a minecraft plugin

sterile token
river oracle
#

Lol

molten hearth
#

WE MUST ESCAPE THE MATRIX

river oracle
#

Ahhh it's a loop

#

Someone save him

sterile token
unreal fable
#

HELP ME

river oracle
#

I already told ypu

#

Abt Visual Bukkit

winged anvil
#

break;

river oracle
#

Vigure it out no one here knows

molten hearth
#

What do you want your plugin to do?

tardy delta
unreal fable
#

where u can exchange diamonds and netherite for money

molten hearth
#

Find a plugin for that?

#

There must be a shop plugin

unreal fable
#

yep

winged anvil
#

yeah so what you need to do first is work at google

river oracle
#

This already exists 🥲 its call a shop plugin

#

?google

undone axleBOT
unreal fable
#

my friend lookes and couldnt find any

river oracle
#

Your friend needs help

#

There are billions of shop plugins

molten hearth
river oracle
#

That has too much config

sterile token
#

😬

unreal fable
#

is there a way i can test a plugin on single player

#

so i can see how it works

fresh timber
#

how would I spawn a tnt entity that is already lit at a specific place and make it blow up but not destroy any blocks

quaint mantle
#

I’ll order a custom-made plugin

sterile token
undone axleBOT
sterile token
#

😂

unreal fable
#

so how do i test it

#

do i have to get a server

river oracle
#

Yes

unreal fable
#

does minehut work

river oracle
#

💀

#

Ima dip

molten hearth
#

plez

cinder spindle
#

Hey just started making plugins, anyone know the problem here?

unreal fable
#

forgot to close a bracket

cinder spindle
#

It doesnt give me error

#

Just not working ig

sterile token
#

Its specified on the docs

river oracle
#

Is it national new spigot people day or sum

sterile token
#

?eventlistening

cinder spindle
sterile token
#

?events-listening

sterile token
molten hearth
#

@EventHandler

river oracle
unreal fable
#

its not indented correctly

river oracle
#

Poor even

molten hearth
#

LMAO

sterile token
molten hearth
#

Poor wven

#

Lmao

cinder spindle
#

oh shoot

sterile token
cinder spindle
sterile token
#

😬

#

First answer tho

cinder spindle
#

I knew that, I just didnt see it

fresh timber
#

how would I spawn a tnt entity that is already lit at a specific place and make it blow up but not destroy any blocks

sterile token
eternal oxide
#

a TNT entity is already primed

fresh timber
#

so primed means its lit?

#

like going to explode

eternal oxide
#

a Block = unlit TNT, an Entity = primed TNT

fresh timber
#

ah alr

fresh timber
eternal oxide
#

in the explosion event don;t cancel it, set the yield to zero

fresh timber
#

uh ok

sterile token
#

Its something new?

eternal oxide
#

its been in many versions

sterile token
#

Which 1.12 up sucks

fresh timber
#

naw

#

I do 1.19.2

sterile token
#

Because newer versions are optimized for a potato

#

idk how people use them, they just getting stealed their money

fresh timber
#

I use newer cus I dont wanna make every plugin for my server and I cant get all the plugins I need in like 1.8 or anything soo

rotund ravine
#

Api wise

fresh timber
#

How can I get all of the players in a certain block radius around a location?

rotund ravine
#

There is different ways

#

Get nearbyentities with a player filter

#

Get all player and match their distance to that location

#

?jd-s

undone axleBOT
fresh timber
#

ah yea

#

I see

#

with getNearbyEntities how do you set the radius

fresh timber
#

alr

#

could I use getNearbyLivingEntities

eternal oxide
#

This "should" workjava world.getNearbyEntities(loc, 10, 10, 19, LivingEntity.class::isInstance);

fresh timber
#

o

#

I just used event.getEntity().getLocation().getNearbyLivingEntities(10.0d)

#

I dont actually need only players rn

eternal oxide
#

both shoudl get all living entities

fresh timber
#

alr ty

tardy delta
#

LivingEntity.class::isInstance uwu

eternal oxide
#

yep

tardy delta
quaint mantle
#
    private static Method getProfileMethod() {
        try {
            Method method = Class.forName("org.bukkit.craftbukkit.v1_19_R2.inventory.CraftMetaSkull")
                    .getDeclaredMethod("setProfile", GameProfile.class);

            method.setAccessible(true);

            return method;
        } catch (ClassNotFoundException | NoSuchMethodException e) {
            e.printStackTrace();
        }

        return null;
    }
``` This can't find `org.bukkit.craftbukkit.v1_19_R2.inventory.CraftMetaSkull#setProfile(GameProfile gameProfile)` for some reason
#

Any ideas why?

tardy delta
#

cant find the class or cant find the method?

quaint mantle
#

Can't find class, my bad

eternal oxide
#

why?

tardy delta
#

you sure about the package?

eternal oxide
#

Why use reflection on a method which I believe is already public

quaint mantle
#

The class isn't public

tardy delta
#

method looks private

#

or im in the wrong class

quaint mantle
#

And yeah it's private

eternal oxide
#

pretty sure that shoudl be accepting a Spigot Profile not an MS game profile

quaint mantle
#

No

worldly ingot
#

You've no reason to be accessing profile methods in skulls. Spigot has API for this now

quaint mantle
#

Huh

worldly ingot
#

I can only assume you're just making skulls with custom textures

eternal oxide
#

you want setOwningProfile

quaint mantle
#

Yeah

worldly ingot
#

Then yeah, there's API for that

#

See above link

eternal oxide
#

public method

quaint mantle
#
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
        gameProfile.getProperties().put("textures", new Property("textures", texture));

        itemMeta.setOwnerProfile(new CraftPlayerProfile(gameProfile));
``` Like this?
eternal oxide
#

accepts profile above ^

worldly ingot
#

Bukkit#createPlayerProfile() iirc to create one

river oracle
#

yep

#

idk why people still use GameProfile

eternal oxide
#

not GameProfile, thats Mojang

quaint mantle
#

How do I set the textures

eternal oxide
#
        PlayerProfile profile = Bukkit.getServer().createPlayerProfile(id, name);

        try {
            profile.getTextures().setSkin(new URL(getURLFromBase64(base64Texture)));
            SkullMeta meta = (SkullMeta) head.getItemMeta();
            meta.setOwnerProfile(profile);
            head.setItemMeta(meta);
            
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }```
worldly ingot
#
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
profile.getTextures().setSkin(URL);
skullMeta.setOwnerProfile(profile);```
quaint mantle
#

Aight, thanks

worldly ingot
#

I think getTextures() returns a copy, Elgar. Unless I'm mistaken

eternal oxide
#

it doesn't

#

at least that method worked last I tested

worldly ingot
#

Oh it doesn't, you're right

quaint mantle
#

I'm using a texture value though

#

eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTQyY2M5MjAzYzkwYjg5YmRhYzFkZjI4NDE2NzI2NmI5NTNkZmViZjNjNDY5MGE3Y2QwYjE1NzkxYTYyZTU4MiJ9fX0=

#

This'll work right?

eternal oxide
#

new String(Base64.getDecoder().decode(base64.getBytes())).replace("{\"textures\":{\"SKIN\":{\"url\":\"", "").replace("\"}}}", "");

#

thats for the snippet I posted above to get a URL

worldly ingot
#

(base64 being that string above)

quaint mantle
#

Ah, alright

#

Thanks

#

So I'm trying to make a skull that gives you potion effects when you wear it. Can't get it to work though. ```java
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
if (!(e.getInventory().getHolder() instanceof Player p)) return;
ItemStack itemStack = e.getCurrentItem();
if (itemStack == null) return;
if (!itemStack.hasItemMeta()) return;

    PersistentDataContainer pdc = itemStack.getItemMeta().getPersistentDataContainer();

    if (!pdc.has(POTION_TYPE_KEY, PersistentDataType.INTEGER_ARRAY)) return;
    if (!pdc.has(POTION_AMP_KEY, PersistentDataType.INTEGER_ARRAY)) return;

    int[] potionType = Objects.requireNonNull(pdc.get(POTION_TYPE_KEY, PersistentDataType.INTEGER_ARRAY));
    int[] potionAmp = Objects.requireNonNull(pdc.get(POTION_AMP_KEY, PersistentDataType.INTEGER_ARRAY));

    if (potionAmp.length != potionType.length)
        return; // PDC is corrupted

    for (int i = 0; i < potionType.length; i++) {
        PotionEffectType type = PotionEffectType.getById(potionType[i]);

        if (type == null)
            continue; // Potion type not valid

        if (e.getSlotType() != InventoryType.SlotType.ARMOR) {
            p.removePotionEffect(type);
            continue;
        }

        p.addPotionEffect(type.createEffect(Integer.MAX_VALUE, potionAmp[i]));
    }
}
#

It just gives you potion effects, and it does remove it. Would making a bukkit runnable that runs each few seconds for this overkill? It just adds more time to the potion effect once it runs out

weak meteor
#

Can some one help me?

#

how to access my string from the main file that contains a string from config.yml in another class?

eternal oxide
#

?di

undone axleBOT
river oracle
#

is it a constant

#

or does it change

#

if it changes do what ElgarL reccomended

#

othgerwise just make a public static constant

weak meteor
#

thanks bro

#

another thing

#

i got this error:
[15:02:53 ERROR]: Error occurred while enabling DTAnvilRPG v1.0 (Is it up to date?) java.lang.NullPointerException: null at cirosanchezb.voltdevelopment.DTAnvilRPG.onEnable(DTAnvilRPG.java:19) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794] at java.lang.Thread.run(Unknown Source) [?:1.8.0_361]

#

And it says .onEnable

#

right

#

so ig is in the main - onEnable

#

and i go to check

#

And its alr

#

see

#

?paste

undone axleBOT
lost matrix
#

?npe

undone axleBOT
#

The NullPointerException, (commonly referred to as NPE), is thrown in the following cases, but not sealed to: 1. null is passed into a method or constructor which does not allow it; 2. When trying to access a field on an object pointing to null; 3. Casting null to a primitive. See https://stackoverflow.com/a/3988794/17047120 for information on how to debug NPEs.

weak meteor
lone storm
#

whats the code for bolding chat color

weak meteor
#

ChatColor.BOLD

lost matrix
weak meteor
#

getServer().getPluginManager().registerEvents(new onAnvilClick(), this);
getCommand("anvilrpg").setExecutor(new mainMenu());

#

someone of them

#

i just put the strings for the messages i mentioned before

lone storm
lost matrix
weak meteor
weak meteor
#

yesss

#

thanks

rough ibex
#

ChatColor is an enum

#

So ChatColor.YELLOW is like, a single thing. ChatColor.BOLD is another

#

You can't combine them like that, you would want ChatColor.BOLD + ChatColor.YELLOW

weak meteor
#

ask to chatgpt idk

#

Hey @lost matrix i got a problem, so i have this permission anvilrpg.guicommand that will open a inventory named AnvilRPG, and ye, so i used LuckPerms to grant myself that permission but i cant execute the command even having the permission in LuckPerms

#

do i need to interact with smth?

#

[15:28:42 INFO]: UrDaddyCiro issued server command: /anvilrpg
[15:28:42 INFO]: [LP] VB > urdaddyciro - anvilrpg.guicommand - true

lost matrix
#

How do you check for permission in your command?

weak meteor
#

yep

#

if (player.hasPermission("anvilrpg.guicommand") || player.hasPermission("anvilrpg.click")){
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);
Inventory inventory = Bukkit.createInventory(player, 54, ChatColor.translateAlternateColorCodes('&', DTAnvilRPG.mainMenuName));
}

#

but i still get this player.playSound

#

but no inv

#

maybe for the Or?

lost matrix
#

Because you didnt open the inventory for the player

weak meteor
#

but im still getting the no permission messagfe

#

thats below in the else

lost matrix
#

Then your logic is flawed

weak meteor
#

Oh nvm

lost matrix
#

Well everything below the if-else will ofc be run regardless of the if-else outcome...

weak meteor
#

a permission was wrong

weak meteor
#

i should use the else if instead ithink

lost matrix
#

What you are missing is player.openInventory(inventory)

weak meteor
#

Yes

#

holder instanceof Block && ((Block) holder).getType().name().contains("ANVIL"))

#

Is this actually checking if the block is a anvil?

#

isnt executing the code of block inside of the if statement

tardy delta
#

what event

safe ibex
#

What would be the easiest way to make like a chest-like thing that people can access anywhere by running a command?

rough ibex
#

Like a GUI?

safe ibex
#

No, I can do that part - I just need like persistent data storage (like world nbt data) but for items

#

Like does that exist?

rotund ravine
#

Lol

#

Pdcs are a thing for items

safe ibex
#

Can I have a link to the docs?

rotund ravine
#

?jd-s

undone axleBOT
rotund ravine
#

?pdc

weak meteor
#

How to remove the damage stuff from the sword?

weak meteor
#

i tried with this; enchanterMeta.removeAttributeModifier(Attribute.GENERIC_ATTACK_SPEED);
enchanterMeta.removeAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE);
but it doesnt work

#

obviously i updated the meta

#

but it still appears

rough ibex
#

Which damage are you talking about

#

Durability?

#

(the green/red bar on the item)

#

Or the attack damage

weak meteor
#

that

#

"4 attack damage"
"1.6 Attack Speed"

#

at the bottom of them

rough ibex
#

If you remove the modifiers, MC will show the default for that item

#

Do you want to set them to 0, or hide them, or both?

weak meteor
#

hide them

#

just that when i hover the sword it doesnt show that stuff

rough ibex
#

You want to add ItemFlag.HIDE_ATTRIBUTES

weak meteor
#

do i have to specify what i wanna remove?

rough ibex
#

No

#

It will hide all attributes.

weak meteor
#

so with

rough ibex
#

Although keep in mind this is only visual

weak meteor
#

itemMeta.removeItemFlags(); its ok?

weak meteor
rough ibex
#

if you wanted to re-show the attributes.

#

the ItemFlag HIDE_ATTRIBUTES, when added will hide the attributes.

#

When you remove the flag, it will show them again.

weak meteor
#

okay

#

disenchanterMeta.removeItemFlags(HIDE_ATTRIBUTES);

#

this should be ok?

#

no what

#

no its not

rough ibex
#

Because you're re-showing the attributes.

weak meteor
#

yes

#

its addItemFlags

#

not remove

rough ibex
#

Removing the HIDE_ATTRIBUTES flag will make the client, well, not hide the attributes.

#

You put removeItemFlags.

#

You want addItemFlags.

weak meteor
#

Yess

#

Thank you bro!

zealous scroll
#

Does anyone know how I can create a filled map that doesn't need to be explored? I'm trying to get a map that is constantly centered on the player and is already pre-explored so the player has the ability to see the whole map

#

I've already centered the view around the player, but cant seem to render the terrain into it

graceful oak
#

So i have seem some things about not using static and im just not completely sure when to use it and if its bad for certain things. I am using it to create and be able to call custom items in spigot as I have seen in youtube tutorials is this good for a custom item or would it be better to not make it static and get the items a different way?

eternal oxide
#

static item constants is fine

prime flint
#

The API to check the version sometimes return Failed to connect to MySQL: (1044) Access denied for user 'sso'@'localhost' to database 'xenforo', are someone else impacted by this ?

eternal oxide
#

sometimes = you probably ran out of connections

terse ore
#

item.getItemMeta().hasDisplayName()

#

what does that function do?

#

like I can't pass any arguments (probably not the usage I need)

chrome beacon
#

It checks if the item meta has a display name set

worldly ingot
#

The name is a bit self-explanatory lol

terse ore
#

I am stupid

terse ore
#

and as argument pass a string to check if that was the displayname

#

yeah self explanatory, I thought all items had a display name

worldly ingot
#

Nah. A display name is more or less a custom display name. e.g. an anvil name

#

The regular ole "Diamond Sword" name isn't a display name

terse ore
#

oooh

#

makes sense now

worldly ingot
#

If you want to compare display names, you can getDisplayName() and check if it's equals() to another

terse ore
#

so getDisplayName() on a "Diamond Sword"

#

would return nothing?

worldly ingot
#

It would be null, yes

#

hasDisplayName() is a pretty null check

#

Internally it literally does return displayName != null

tall dragon
#

can anyone here tell me about kotlin? is it worth learning that to use in plugin development?

#

fair enough

rough ibex
#

pictures are worth a thousand words

#

in this case, one

worldly ingot
#

Paper has a giant sticker for it too and if I had full nitro, I'd use it

chrome beacon
tall dragon
ivory sleet
#

cause gradle

#

:D

chrome beacon
#

I just use groovy

tall dragon
ivory sleet
#

I mean kotlin is def not a perfect java replacement

#

interoperability sucks

worldly ingot
#

If you feel it's worth learning, it's worth learning. I personally don't see any value in learning it because I hate scripting languages with a passion (I know it's not, but it looks a hell of a lot like one), but to each their own.

ivory sleet
#

but its a useful lang

terse ore
worldly ingot
#

Compat

ivory sleet
#

^

worldly ingot
#

Kotlin <--> Java

ivory sleet
#

at compile time ^

tall dragon
#

plugin dev aside

ivory sleet
#

u have kotlin native

terse ore
#

which method should I use for getting the ItemStack of the item the player used to break a block?

#

I am looking through old posts and can't seem to find a good response without using deprecated methods

wet breach
#

unless someone is using the kotlin JVM, kotlin isn't going to magically give you any improvements in what java already does

chrome beacon
tall dragon
rough ibex
terse ore
terse ore
ivory sleet
#

android dev

wet breach
#

otherwise no

terse ore
#

oh

#

i c

chrome beacon
#

I just use Java for android

worldly ingot
#

A player will always use their main hand item to break a block. They can't use the off hand. So player.getInventory().getItemInMainHand() will suffice

tall dragon
#

naaa not into android.

terse ore
#

thanks

safe ibex
#

With world NBT/PDC data, how would I take items from somebodies inventory and put them into a world PDC?

#

Almost like a chest emulation

chrome beacon
#

?morepdc

undone axleBOT
chrome beacon
#

^^ I'd use this library by mfnalex

safe ibex
#

?

#

I just want to store blocks?

chrome beacon
#

It helps with storing itemstacks

safe ibex
#

Oh

#

Right

weak meteor
#

In my class i have a public void MyClass(Player p){
}

and i wanna call it in another class

#

i make

#

MyClass class = new MyClass();

#

where do i put the player p in the external class?

chrome beacon
#

uh that's not a valid class???

weak meteor
#

Its only the method of the class

#

i know

rough ibex
#

constructors don't take void

weak meteor
#

public what

#

this is the method

#

public void enchanterMenu(Player player){

}

}

#

here is where i wanna call it

#

case DIAMOND_SWORD:
HumanEntity h = e.getWhoClicked();
Player p = (Player) h;
enchanterMenu enchanterMenu = new enchanterMenu();

rough ibex
#
public class MyClass {
  private final Player p;
  
  public MyClass(Player p) {
    this.p = p;  
  }
}```
#

a basic class and basic constructor

weak meteor
#

i mean that the Class will then make another GUI and stuff

rough ibex
#

also, please use ```java
code here
```

weak meteor
#

Okay

rough ibex
#

you need to remove void then

weak meteor
#

Okay

rough ibex
#

But to me, it sounds like you don't quite grasp Java.

#

spigot aside

weak meteor
#

what?

#

grasp?

tall dragon
#

"understand"

rough ibex
#

to know

weak meteor
#

oh

#

yeah just im learning oop with this

#

i heard constructor before but idk that i can use that

#

like

rough ibex
#

Well, sorry, but this is a spigot development channel

weak meteor
#

here

rough ibex
#

not a general Java help channel

weak meteor
#

okay, btw

#

if i have that method i created how tf i can execute the rest of the code i was planning to write (creating a gui, putting in some elements, yknow)

tall dragon
#

but it does assume you understand some things

weak meteor
#

Hmm

rough ibex
#

You should start by learning Java.

#

And then come back to Spigot development

weak meteor
#

I think practice is better than only sit and make some code ill never use, but okay, i take ur suggestion

real fable
#

How can I set a custom nbt tag to an Item ?
Serached onn google and found some thongs like CraftCompound etc...
but most infos or tutos don't work with 1.18
What I want in a nutshell is to set a tag like this on an item

ItemStack item = foo;
foo.setTag(<TagName>, <TagValue>);
tall dragon
#

you can use pdc tags

real fable
tall dragon
#

the same thing. but with a proper api

eternal oxide
#

?pdc

real fable
#

Oh, that's with the ItemMeta

#

Thanks a lot !!!

safe ibex
#

Anyone know why with this code, I am getting a java.lang.StackOverflowError: null?

@EventHandler
    fun inventoryClickEvent(event: InventoryClickEvent) {
        val player = event.whoClicked
        val playerUUID = event.whoClicked.uniqueId

        if (event.inventory == TestPluginWMaven.guiMap[playerUUID]) {
            if (event.currentItem == null) return

            when (event.currentItem!!.type) {
                Material.ARROW -> {
                    val itemsToDonate = event.inventory.contents

                    // Put the items in the admin-only accessible NBT storage medium
                    val key = NamespacedKey(TestPluginWMaven.plugin, "donations")
                    val pdc = Bukkit.getWorlds()[0].persistentDataContainer

                    val items = pdc.get(key, DataType.ITEM_STACK_ARRAY)

                    if (items == null) {
                        pdc.set(key, DataType.ITEM_STACK_ARRAY, itemsToDonate)
                    } else {
                        val itemsToStoreInPDC = mutableListOf<ItemStack?>()

                        val inventoryItemsList = itemsToDonate.toCollection(ArrayList())
                        val itemsInWorldPDC = items.toCollection(ArrayList())

                        itemsToStoreInPDC.addAll(itemsInWorldPDC)
                        itemsToStoreInPDC.addAll(inventoryItemsList)

                        pdc.set(key, DataType.ITEM_STACK_ARRAY, itemsToStoreInPDC.toTypedArray())
                    }

                    pdc.set(key, DataType.ITEM_STACK_ARRAY, itemsToDonate)
                }

                else -> {}
            }

            event.isCancelled = true
        }
    }
#

Like am I doing something I shouldn't be?

hazy parrot
#

can you send stacktrace

safe ibex
#

at com.github.deadhash.testpluginwmaven.TestPluginWMaven$Companion.getPlugin(TestPluginWMaven.kt:16) ~[testPluginWMaven.jar:?]

It's just that but loop printed

#

I'd show you a screenshot but I can't send it here unfortunately

hazy parrot
#

?paste

undone axleBOT
hazy parrot
#

also why are you using when for just one value

#

use if

safe ibex
safe ibex
# hazy parrot use `if`

Gonna use more than one value in the future + implement all other features later, but for now I am trying to implement this section.

#

basically the main error other than the StackOverflow is "Could not pass event InventoryClickEvent to testPluginWMaven v1.0-SNAPSHOT"

hazy parrot
safe ibex
#

The class I sent was class InventoryClickListener : Listener

#

(inherits from listener)

hazy parrot
#

send TestPluginWMaven

safe ibex
#
class TestPluginWMaven : JavaPlugin() {
    companion object {
        val guiMap: MutableMap<UUID, Inventory> = mutableMapOf()

        val plugin: TestPluginWMaven
            get() {
                return plugin
            }
    }

    override fun onEnable() {
        // Plugin startup logic
        logger.info("GUI Plugin Started Up Fine!")

        registerCommands()
        registerListeners()
    }

    private fun registerCommands() {
        getCommand("donate-items")!!.setExecutor(Donate())

        logger.info("Registered commands!")
    }

    private fun registerListeners() {
        Bukkit.getServer().pluginManager.registerEvents(InventoryCloseListener(), this)
        Bukkit.getServer().pluginManager.registerEvents(InventoryClickListener(), this)

        logger.info("Registered Listeners!")
    }

    override fun onDisable() {
        // Plugin shutdown logic
    }
}
#

Would it be the plugin companion value that's causing the stack overflow?

ivory sleet
#

bit of a weird companion object

safe ibex
#

Yeah lol

#

I guess

#

But like

#

Mhm

ivory sleet
#

yes

hazy parrot
#

mb, didnt read code

ivory sleet
#

but kotlin strictly advocates not using companion for stateful stuff

safe ibex
#

But basically, I am trying to get a ref to the plugin for the NamespacedKey

hazy parrot
#

looks like plugin is just returning itself

#

resulting infinity loop

safe ibex
#

🤣

#

Ah yes, recursiveness

#

Do you know I can get a ref to the plugin then for the namespaced key?

ivory sleet
#

yea

safe ibex
#

(so I can store NBT stuff)

#

How would I do so?

ivory sleet
#

NamespacedKey(this,"namespace") no?

safe ibex
#

No, I cannot call this as the line is being run in another class called InventoryClickListener : Listener

#

So I cannot use this as then I'd be referring to InventoryCickListener

ivory sleet
#

pass it

safe ibex
#

?

hazy parrot
#

?di

undone axleBOT
safe ibex
#

Mk

ivory sleet
#

idk if there's a kotlin version

hazy parrot
#

just type private val plugin: JavaPlugin in your primary constructor

ivory sleet
#

ignore the poor naming

safe ibex
#

So pass it down like this:

class InventoryClickListener(private val parentPlugin: TestPluginWMaven) : Listener {

And use it like this then?

val key = NamespacedKey(parentPlugin, "donations")
untold stirrup
#

some one help me to create a plugin can show message or api or anythink under the name like this for example

safe ibex
#

And of course pass it in properly

ivory sleet
#

which class is key ib=

safe ibex
#

ib=?

ivory sleet
#

in*

untold stirrup
#

like thats is will work

safe ibex
#

Yeah, literally how I put it

#

Cool 👍

untold stirrup
#

put it on function

safe ibex
#

?

#

On function as well as the class constructor?

untold stirrup
#

nope

safe ibex
#

Yeah well then I'm fine

#

Actually no

#

Still stack errors

hazy parrot
#

show again

safe ibex
#

Error trace:

[23:44:54 ERROR]: Could not pass event InventoryClickEvent to testPluginWMaven v1.0-SNAPSHOT
java.lang.StackOverflowError: null
        at com.github.deadhash.testpluginwmaven.TestPluginWMaven$Companion.getPlugin(TestPluginWMaven.kt:16) ~[testPluginWMaven.jar:?]
        at com.github.deadhash.testpluginwmaven.TestPluginWMaven$Companion.getPlugin(TestPluginWMaven.kt:16) ~[testPluginWMaven.jar:?]
        at com.github.deadhash.testpluginwmaven.TestPluginWMaven$Companion.getPlugin(TestPluginWMaven.kt:16) ~[testPluginWMaven.jar:?]
        at com.github.deadhash.testpluginwmaven.TestPluginWMaven$Companion.getPlugin(TestPluginWMaven.kt:16) ~[testPluginWMaven.jar:?]

Code: https://paste.helpch.at/cedewosedu.kotlin

hazy parrot
#

show TestPluginWMaven

safe ibex
hazy parrot
#

you didnt recompile your code

safe ibex
#

Uhh I ran maven lifestyle > package script again?

#

oh I have a duplicate plugin for some reason in my server files

#

one sec

#

Yeah ok should be fine now...

#

Ok, well no errors!

#

Cool, thanks guys 👍

safe ibex
#

Oh also

#
class TestShow(private val parentPlugin: TestPluginWMaven) : CommandExecutor {
    override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
        // Get items from PDC, then make a temp inventory for the player and stick them in
        val key = NamespacedKey(parentPlugin, "donations")
        val pdc = Bukkit.getWorlds()[0].persistentDataContainer

        val items = pdc.get(key, DataType.ITEM_STACK_ARRAY)

        if (items == null) {
            sender.sendMessage("No chest data found.")
        } else {
            if (sender !is Player) return false

            val inventory = Bukkit.createInventory(sender, 9, Component.text("Donation Window").color(TextColor.color(0, 133, 0)))

            items.map {
                inventory.addItem(it)
            }

            TestPluginWMaven.guiMap[sender.uniqueId] = inventory

            sender.openInventory(inventory)
            return false
        }

        return false
    }
}
#

Can I not do this for another command to show all of the items I put in the item array PDC thingy?

#

@hazy parrot

hazy parrot
#

what is like 29 in TestShow

#

i assume inventory.addItem(it)

safe ibex
#

It's a kotlin map with it as the predicate

hazy parrot
#

some item inside of your map is null

safe ibex
#

So it just loops over the array and gets every item and adds each one to the inventory var

safe ibex
hazy parrot
safe ibex
#

Oh sorry 🤣

#

Thought you were asking what the map was lol

#

So, is there a way to do what I'm trying to do?

#

Like show all of the items in there?

winged anvil
#

before i look into it, can i intercept packets sent to players to see blocks and then change the block they see?

hazy parrot
winged anvil
#

tryna make like a one way mirror

hazy parrot
hazy parrot
#

use foreach, not map

safe ibex
#

lemme replace it with a foreach

#

yeah

#

🤦‍♂️

hazy parrot
#

and filter out null items if there are any

safe ibex
#

will do

#

Nice! It's doing it :D

#

One last thing, how can I make it so that one of the items in that "inventory" is not removable?

hazy parrot
#

listen for InventoryInteractEvent and if its one of the items you don't want to remove, cancel event

safe ibex
#

So like, e.g. item slots up to the last are interactable

safe ibex
#

@hazy parrot

class InventoryInteractEvent : Listener {
    @EventHandler
    fun inventoryInteractEvent(event: InventoryInteractEvent) {
        val playerUUID = event.whoClicked.uniqueId

        if (event.inventory == TestPluginWMaven.guiMap[playerUUID]) {
            if (event.currentItem == null) {
                return
            }
        }
    }
}
#

Why is event.currentItem not working?

#

Like it's "not resolved"?

#

"Unresolved reference: currentItem"

native gale
#

net.md_5.bungee.api.ChatColor.of(color) does not support transparency, right?

rough ibex
#

ChatColors don't have transparency

#

or do you mean something else

dry yacht
native gale
native gale
rough ibex
#

Yeah, no, you can't

#

I mean, not alone

#

You would need a resource pack with core shaders

#

but no pure Vanilla Mojang way to do that, no.

native gale
#

Okay-okay, whatever

dire marsh
#

yep text is rgb not rgba

native gale
#

Then I have a question

rough ibex
#

Shoot

native gale
#

More like, not a question, but want an advice

#

Let's say, I want to make a pixel art made out of these characters

#

In the game they appear as squares

#

I pain them different colors and get a picture

rough ibex
#

yes

hazy parrot
safe ibex
native gale
#

The only problem is that if I have a transparent pixel somewhere (it's just a space in this case) in the middle, they don't align

hazy parrot
#

you dont even have to cast, kotlin autocasts

native gale
delicate lynx
rough ibex
#

Two spaces?

delicate lynx
#

or yeah just add extra spaces until it aligns

native gale
dire marsh
#

they'll never align properly I think

rough ibex
#

try bolding the spaces

dire marsh
#

as characters have different length in pixels

rough ibex
#

or,

#

you'll have to make a new resource pack font that has a character with a custom width

#

using the "spaces" provider

safe ibex
safe ibex
#

This is it right now @hazy parrot

#

Right now I only have the event.isCancelled = true on the arrow if it's clicked

native gale
hazy parrot
#

type event and . and let your ide complete

safe ibex
#

Well I mean I can do event.isCancelled in the inventoryclickevent listener

#

That part works

safe ibex
native gale
#

And these images are dynamic, so it is not possible to visually align them

dry yacht
#

How weird, two spaces seemed to do it for me

#

You cannot type out two spaces in chat tho, have you tried sending two spaces programmatically?

native gale
hazy parrot
dry yacht
safe ibex
#

Ok, well @hazy parrot now how do I make it so that the items are cleared from the PDC when they take them out of the "inventory" GUI menu?

hazy parrot
safe ibex
#

Just an item PDC instantiated like this:

val key = NamespacedKey(parentPlugin, "donations")
                    val pdc = Bukkit.getWorlds()[0].persistentDataContainer

                    val items = pdc.get(key, DataType.ITEM_STACK_ARRAY)
#

It's of persistent data type ITEM_STACK_ARRAY provided in the library by jeff

hazy parrot
#

so you are storing it in world

safe ibex
#

Yeah

hazy parrot
#

i think you would have to remove it from array, then put new array into pdc

safe ibex
#

Yeah ok

rare rover
#
 @Override
    protected void execute(Event event) {
        NMSHologram hologram = this.hologram.getSingle(event);
        Player[] players = this.players.getArray(event);
        List<UUID> hiddenPlayers = hologram.getHiddenPlayers();
        for (int i = 0; i < players.length; i++) {
            if (show) {
                if (!hiddenPlayers.contains(players[i].getUniqueId())) {
                    Core.getNMSVersion().displayHologram(hologram, players[i]);
                }
                continue;
            }
            if (hiddenPlayers.contains(players[i].getUniqueId())) {
                Core.getNMSVersion().hideHologram(hologram, players[i]);
            }
        }
    }``` any way to make this better?
kind hatch
rare rover
#

but i do dislike checking everytime

#

but reduces the amount of duplicated code

#

so

calm robin
#

how might i go about detecting when a players armor changes?

dry yacht
rare rover
# rare rover ```java @Override protected void execute(Event event) { NMSHologram...

edited to this:

@Override
    protected void execute(Event event) {
        NMSHologram hologram = this.hologram.getSingle(event);
        Player[] players = this.players.getArray(event);
        List<UUID> hiddenPlayers = hologram.getHiddenPlayers();
        NMS nms = Core.getNMSVersion();
        for (int i = 0; i < players.length; i++) {
            Player plr = players[i];
            if (show) {
                if (!hiddenPlayers.contains(plr.getUniqueId())) {
                    nms.displayHologram(hologram, plr);
                }
                continue;
            }
            if (hiddenPlayers.contains(plr.getUniqueId())) {
                nms.hideHologram(hologram, plr);
            }
        }
    }``` probably better
native gale
dry yacht
# native gale Although it looks weird, but might work

Three backticks in a row also work. A square is 8 pixels plus one pixel space, so you need to bridge 9 pixels in total. There aren't many possibilities, but spaces cannot work, proven by the fact that they're 3 + 1 space in width and 9 is not evenly divisible by 4.

#

Hope that helps at least in some way, xD

native gale
#

What is that dotWidth array though?