#help-development

1 messages ยท Page 489 of 1

orchid trout
#

easy

hardy crystal
#

so?

eternal oxide
#

all times in Spigot are ticks

hardy crystal
#

@chrome beacon ?

rotund ravine
#

?jd-s

undone axleBOT
summer scroll
#

How do you get all blocks from ChunkSnapshot?

chrome beacon
hardy crystal
chrome beacon
#

or a non-bundled version of git

eternal oxide
#

read teh javadoc

#

it tells you

chrome beacon
#

ticks

orchid trout
#

how do i make a method that accepts code in the constructor?

eternal oxide
#

a consumer

#

or runnable

#

or function

#

or a future

rotund ravine
hardy crystal
orchid trout
eternal oxide
#

same answer

orchid trout
#

yeah just wanted to clarify

#

caus ei rememreb

eternal oxide
#

public void yourMethod(Runnable codeToRun) { codeToRun.run(); }

regal scaffold
#

How are vector values stored and obtained using FileConfiguration?

viscid ginkgo
#

any reason why getAsString wouldnt be working ๐Ÿ˜ญ

regal scaffold
#

Or better, lets say I want to be able to store something like

configElement: x, y, z
configElement2: x,y,z

#

Is just doing string* the best idea?

eternal oxide
#

Bukkits vector class is ConfigurationSerializable

regal scaffold
#

I want the user to be able to edit it

#

So yeah

eternal oxide
#

config.set("vector", vector)

regal scaffold
#

But how does it look in the file?

eternal oxide
#

?tas

undone axleBOT
regal scaffold
#

Dream

eternal oxide
#
config.save();```
regal scaffold
#

Interesting

#

So

#
new Vector(0,20,0)
#
      lower-corner: !!org.bukkit.util.Vector {
        }
#

No data

undone axleBOT
regal scaffold
#

What am I looking for in the stash?

eternal oxide
#

it should have data

regal scaffold
#

wym

#

So even if there's nothing in the {}

#

It still has the data?

eternal oxide
#

no

#

your data should be there

regal scaffold
#

It's not

#

I'm showing you

#

I regen it 3 times

eternal oxide
#

yep, no idea what to tell you, it should have its data there

#

I'm currently in kenshi so can;t test it myself

regal scaffold
#

Hmmm

viscid ginkgo
#

getasstring in item mata works so well (def isnt red! )

regal scaffold
#

Yes but then why no data

#
        this.addDefault("autoLink.south.region.lower-corner", new Vector(0,20,0));
        this.addDefault("autoLink.south.region.upper-corner", new Vector(0,20,0));
eternal oxide
#

addDefault

#

set

regal scaffold
#

Why would addDefault not work if nothing is there

chrome beacon
#

No, but you can use a shulker for a block outline

eternal oxide
#

if you addDefault you need to copydefaults(true)

regal scaffold
#

The argument is still a object

#

Yes, it's copying

#

Set overrides, I will try

#
autoLink:
  south:
    region:
      lower-corner: !!org.bukkit.util.Vector {
        }
      upper-corner: !!org.bukkit.util.Vector {
        }
#

Empty

#

With a set

#

And yes, I'm deleting the lines every time

#

Just in case

eternal oxide
#

you have some fuckery going on

regal scaffold
#

I have a config with

#

800 lines

#

And nothing like this

viscid ginkgo
#

kms anyone good with nbt api?

chrome beacon
#

If you want to outline a block you can spawn a shulker in it and give that the glow

chrome beacon
regal scaffold
#

Ok so

#

This is crazy

#
      lower-corner: !!org.bukkit.util.Vector {
        }
      upper-corner: !!org.bukkit.util.Vector {
        }
#

But if I do

#
this.get("autoLink.south.region.lower-corner")
#
10.0,20.0,1.0
#

How is the data possibly stored but not visible

eternal oxide
#

its not

#

you must have it somewhere else in yoru config

regal scaffold
#

I don't. but he's right. Prob in memory

#

Doesn't work still

eternal oxide
#

I'd test it myself but kenshi will kill my PC if I blow too hard

regal scaffold
#

I think zack is

#

But I mean, idk why he would get diff result

#

It's 3 lines

#

19.3

hardy crystal
#

com.mojang.authlib.ProfileLookupCallback error with builds on maven

#

i runned buildtools

#

for my nms veriosn

regal scaffold
#

Use maven authlib lib

hardy crystal
regal scaffold
#

Don't need buildtools

hardy crystal
#

?paste

undone axleBOT
hardy crystal
eternal oxide
#

java -Xms1G -Xmx1G -Dlog4j2.formatMsgNoLookups=true -jar -DIReallyKnowWhatIAmDoingISwear "%p%" nogui

regal scaffold
#

Any luck zack

#

oh lol

#

np!

round finch
#

-XX:ParallelGCThreads=5

#

for more Threads

regal scaffold
#

Nice so

#

Mine doesn't

#

And yours does

#

I actually just remembered server is using pufferfishPlys

eternal oxide
#

yours looks odd. It looks liek yours does not know the Vector class

regal scaffold
#

I'm gonna ask them directly

eternal oxide
#

I was going ot ask if it was json or something not yaml

regal scaffold
#

Running PFP

#

This server is running Pufferfish+ version git-PufferfishPlus-41 (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT) (Git: 6dbab15 on HEAD)

#

Yeah asking them directly

#

Ok so different question anyways

#

What's another way to store x y z

#

In 1 line

#

Cause I can't have 5 lines per vector

#

String and split?

eternal oxide
#

yes

chrome beacon
#

Yeah I've done that before

regal scaffold
#

Well without parsing I don't think there's another option

chrome beacon
#

You can use teams to give the shulkers color too

trail crater
#

with luckperms it uses {prefix} and replaces it with the prefix
how would i reference that in another plugin

remote swallow
#

placeholder api

eternal oxide
#

interface with Vault so you support all permission plugins

remote swallow
#

or that

trail crater
remote swallow
#

/papi ecloud download Luckperms

#

then you can use %luckperms_prefix% in a papi supporting plugin

naive bolt
#

How can I get a list of users advancments ?

trail crater
remote swallow
ocean hollow
#

why does it return 0 if I break with a netherite pickaxe?

sullen canyon
#

damagers:
netherite:
axe: 10

remote swallow
#

thats not a config section so damagers.netherite wont work

sullen canyon
#

try it without -

remote swallow
#

the -makes it a list, can either make it config sections or read it as a list

ocean hollow
#

okay

summer scroll
#

I'm trying to loop all chunk's blocks and I wanted to get spawner spawned type, how can I do that? I'm looping through ChunkSnapshot so there is only BlockData.

eternal oxide
#

you only need check tilestates

summer scroll
#

Do I need to use the Chunk object? Because I don't see any methods like that on ChunkSnapshot

eternal oxide
#
    public List<CreatureSpawner> getAllSpawners(Chunk chunk) {

        return Arrays.stream(chunk.getTileEntities()).filter(CreatureSpawner.class::isInstance).map(CreatureSpawner.class::cast).collect(Collectors.toList()); //newer Java .toList();
    }```
ocean hollow
#

how can I get random number from it, like '1' or '2'?

summer scroll
sullen canyon
eternal oxide
#

yes, entities are in Chunk

ocean hollow
summer scroll
ocean hollow
ocean hollow
remote swallow
#

getKeys(false).size

hushed heath
#

so im new to java programming and i wanted to make a "/heal' command like "/heal Player_Name" but i have no idea how to work with args

#

damn

#

let me test it

#

so args.+1?

#

for some reason
override fun onCommand(p0: CommandSender, p1: command, p2: String, p3: Array<out String>)
and not override fun onCommand(sender: CommandSender, Command: command, String: String, args: Array<out String>)

remote swallow
#
if (args.length == 1) {
    Player player = Bukkit.getPlayer(args[0]);
    if (player == null) sender.sendMessage("Player not online");
    return true;

    // use player
}
hushed heath
#

fuck all the toturials ๐Ÿ˜ญ

#

p3.length dosent exist

#

๐Ÿ’€

#

but if i do p3.get(0).length it exists

#

i love you kotlin

#

๐Ÿ˜ญ

remote swallow
#

thats getting the 1st entry most likely

old cloud
remote swallow
#

not the length of the array

hushed heath
#

i hate my life

#

hmmmm

#

i want it to be like

#

val targetplayer = something idk how to do that ๐Ÿ’€

#

and then

remote swallow
#

Bukkit.getPlayer(args[0])

#

then null check

#

im good

hushed heath
#

if(!args.get(0).isNullOrEmpty){

targetplayer.health = 20.0

}else {

sender.sendMessage("not enough args")|
}

remote swallow
#

do if (args.size ==1)

echo basalt
#

isNullOrEmpty

#

grr

remote swallow
#

or even better

#

usejava

eternal oxide
#

god no args.get(0).isNullOrEmpty <- never

undone axleBOT
hushed heath
#

what does args.size == 1 do?

#

alr

#
  if(sender is Player) {
        if(p3.size == 1) {
            sender.health = 20.0
        }
    }

note: p3 is args

#

is this the code?

remote swallow
#

got i hate kotlin

#

but probably

#

you are probably gonna do better coding in java then using kotlin when you know how to convert java code

hushed heath
#

i want that "p3.size == 1 that 1 to be in an variable and then do if(p3.size == variable) {
variable.health = 20.0}

#

my internet

#

help

#

my messages arent sending

#

oh nvm

hushed heath
#

val targetedplayer = Bukkit.getPlayer()

remote swallow
#

you just need to convert it to kotlin

hushed heath
#

val targetedPlayer = Bukkit.getPlayer(); it has a red line under getPlayer()

remote swallow
#

it takes an arg

hushed heath
#

so

remote swallow
#

getPlayer(String)

hushed heath
remote swallow
#

where does it say name

hushed heath
#

do i have to write something in there

#

or not

remote swallow
#

you need to pass args[0] if the size is 1

#

another case of you will be better using java not kotlin

hushed heath
#

if(sender is Player) {
val targetedPlayer = Bukkit.getPlayer("");
if(p3.size == targetedPlayer) {
sender.health = 20.0
}
}

remote swallow
#

no

#

that wont do anything

#

hold on ill get chatgpt to make the code kotlin

hushed heath
#

ight

#

it erros

#

the if(p3.size == targetedPlayer) is yello

#

w

#

args are the hardest thing to learn(for me)

hazy parrot
#

what is the issue

remote swallow
#
        @Override
    public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
        if (args.length == 1) {
                    Player player = Bukkit.getPlayer(args[0]);  
                    if (player == null) {
                          sender.sendMessage("That is not an online player");
                          return true
                    }

                    player.setHealth(20.0);
                    player.sendMessage("You have been healed!");
                    return true;
                }
                if (sender instanceof Player player) {
                      player.setHealth(20.0);
                      player.sendMessage("You have been healed!");   
                      return true;
                }
                return true;
    }
#

thats the java code

#

i could prob make it better but i cba to open an ide

#

kotlin is ```kotlin
override fun onCommand(sender: CommandSender, command: Command, alias: String, args: Array<String>): Boolean {
if (args.size == 1) {
val player = Bukkit.getPlayer(args[0])
if (player == null) {
sender.sendMessage("That is not an online player")
return true
}

    player.health = 20.0
    player.sendMessage("You have been healed!")
    return true
}
if (sender is Player) {
    sender.health = 20.0
    sender.sendMessage("You have been healed!")
    return true
}
return true

}

tardy delta
#

thats some verbose code

#

<insert command framework here>

hushed heath
#

i- i have to learn args ๐Ÿ˜ญ

#

its 12 am in the morning

#

ima save this for now and take a break like holy shti

#

shit

tardy delta
#

be happy its not 12pm yet

quaint mantle
#

my plugins saves locations in this file how can i tp a player there now

remote swallow
#

config.getLocation

quaint mantle
#

this is what i tried but it didnt work

tardy delta
#

why are you creating a new ConfigUtil every time

#

as the name says utility classes should not be instantiating, looks like you might want to change that name

remote swallow
#

bc thats not a config section

#

that is just a locatiojn

#

config.getConfig().getLocation("hub");

eternal oxide
#

If you store locations in your config you must be 100% certain you never touch your config (via code) before onEnable

#

no static access

quaint mantle
tardy delta
#
BukkitWiki

The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...

quaint mantle
eternal oxide
#

any config which stores locations

quaint mantle
#

any1 can help pls

ivory sleet
#

u need to shade kotlin stuff in

quaint mantle
#

ok ill try

#

?paste

undone axleBOT
quaint mantle
#

how do i fix

tardy delta
#

by ignoring warnings

quaint mantle
#

huh ?

eager jacinth
#

Guys, does anyone know how to update DISPLAY_NAME with the name above the player's head? I tried 'EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME', but it only updates on the tab

    public PacketContainer updateDisplayName(Player player, String newName) {
        PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
        packet.getPlayerInfoActions().write(0, EnumSet.of(EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME));

        WrappedGameProfile gameProfile = new WrappedGameProfile(player.getUniqueId(), newName);
        packet.getPlayerInfoDataLists().write(1, Collections.singletonList(new PlayerInfoData(
                gameProfile,
                player.getPing(),
                EnumWrappers.NativeGameMode.fromBukkit(player.getGameMode()),
                WrappedChatComponent.fromText(newName)
        )));

        return packet;
    }

quaint mantle
#

try this
public void updateDisplayName(Player player, String newName) {
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
DataWatcher dataWatcher = entityPlayer.getDataWatcher();
dataWatcher.set(new DataWatcherObject<>(2, DataWatcherRegistry.c), Optional.of(WrappedChatComponent.fromText(newName).getHandle()));
PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entityPlayer.getId(), dataWatcher, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(metadataPacket);
}

echo basalt
#

that's nms

#

with plib it's a bit more annoying

viscid ginkgo
#

im just trynna grab an nbt

#

trynna jcheck if the item has an nbt

tardy delta
#

atleast smth works

chrome beacon
#

You shouldn't have to interact with nbt directly

quaint mantle
viscid ginkgo
#

my plugin is a spawner stacker

#

but we base everything on nbts

#

so for example

#

i right click a pig spawner on a pig spawn

#

to make sure its a pig spawner

#

it checks the nbt

chrome beacon
#

Ah I see

#

The Spigot spawner API is quite bad

viscid ginkgo
#

we used to usegetAsString

#

but that disappeared

viscid ginkgo
#

lemme show u

quaint mantle
viscid ginkgo
#
        Preconditions.checkArgument(item.getType() == Material.SPAWNER,"item type must be a spawner!");
        try {
            ItemMeta meta = item.getItemMeta();
            String nbt = meta.getAsString();
            nbt = nbt.split("ShopGui:\\{EntityId:\"")[1]
                    .split("\"")[0]
                    .toUpperCase();
            return EntityType.valueOf(nbt);
        }
        catch (Exception ex) {
            BlockStateMeta state = (BlockStateMeta) item.getItemMeta();
            SpawnerExtractor extractor = SpawnerExtractor.of((CreatureSpawner) state.getBlockState());
            return EntityType.valueOf(extractor.getType().toUpperCase());
        }
    }```
remote swallow
viscid ginkgo
#

also i didnt want to add another dependency

#

as it worked perfectly before idk why it shouldnt work now

quaint mantle
viscid ginkgo
#

i try to keep it super user friendly

remote swallow
#

theres one you can shade in

quaint mantle
viscid ginkgo
#

mm

#

not to sure how that works lol

quaint mantle
#

Are you using maven?

#

Or gradle

viscid ginkgo
#

gradle

#

just moved to it

quaint mantle
#

Agh, I can't help you in gradle

viscid ginkgo
#

dammit

#

lmao

remote swallow
#

all the docs are on the github

viscid ginkgo
#

i just move to gradle to ๐Ÿ˜ญ

#

i mean theres gotta be another way besides using nbtapi

eternal oxide
#

why not just use pdc?

quaint mantle
chrome beacon
#

I would use reflection or directly use nms

viscid ginkgo
#

mm

viscid ginkgo
quaint mantle
#

But stills a choice

quaint mantle
#

Spigot doesn't recommend the use of nms nor reflection unless completely necessary

#

Plus I think it's against mojang TOS

hazy parrot
#

its not ?

chrome beacon
#

Yet you recommended NBT API

chrome beacon
eternal oxide
chrome beacon
#

Ah I was looking for that

quaint mantle
eternal oxide
#

That BlockState then casts to CreatureSpawner

#

and you have acces to getSpawnedType()

chrome beacon
quaint mantle
#

Anyway, even if it's not against mojang TOS, using nms or reflection should be the last choice always

chrome beacon
#

nms and reflection would be faster than NBT API

#

But yeah use the API as Elgarl said

viscid ginkgo
#

lmao

quaint mantle
viscid ginkgo
#

i wonder why getAsString isnt working

#

maybe because importing org.bukkit.Bukkit isnt working ๐Ÿ‘

#

no cap

#

all bukkit

chrome beacon
viscid ginkgo
#

โ˜ ๏ธ

quaint mantle
chrome beacon
#

Yeah I was talking about NBT API not spigot

quaint mantle
#

Or if you use another API that relies on spigot API

chrome beacon
#

NBT API relies on reflection

quaint mantle
#

And I don't say that NBT API won't break, but I mean, nms or reflection should be the last option

chrome beacon
#

Yeah I'm aware

quaint mantle
#

Uh im not sure if i should ask it here but i didnt find anywhere else to do so: So i made a plugin its a free plugin and i want people to download it the problem is idk how to really advertise plugins well Any help?

chrome beacon
#

You can always pay a youtuber to showcase it

#

Though really the best way is to have a good spigot page and activly pushing updates

#

Oh and have patience

tall furnace
tall furnace
# quaint mantle Uh im not sure if i should ask it here but i didnt find anywhere else to do so: ...

So I have a plugin with 98,000 downloads, and another with 75,000 downloads. The key is patience. If you are looking for instant popularity, you won't find it making ordinary spigot plugins. But if you make something high-quality that is user-friendly and configurable, people will use it. When it gets used enough, hosting services will start displaying it in their plugin options. That gives your content a real boost.

tall furnace
#

Best thing you can do is keep it up-to-date and bug-free.

quaint mantle
#

its bug-free and up to date and user friendly so i hope to see it growing

#

its my first release

tall furnace
#

It may be worth noting: My 98k plugin is from 2016. My 75k plugin is from 2021 (IIRC). Find a need, fulfill the need. Instant win.

tall furnace
# quaint mantle its my first release

Nice! If you ever come across a tough spot, always feel free to reach out. I for one have been at this for over 11 years. We're always happy to help.

quaint mantle
#

well i have 10 years of java exprience im just fairly new to releasing any of my content

#

i do enjoy using the spigot api to make cool things

#

thanks for the help tho

tall furnace
#

Nice. Well good luck! DM me a link to your profile, I'll take a look at your plugin and maybe give it a test run in my server if it's something I can use.

quaint mantle
#

ok

humble tulip
#

@tall furnace what areur plugins?

weak meteor
#

Hmm can someone help me?

#

exact line:

tall furnace
weak meteor
#

look a the error

#

jump into the message

tall furnace
#

I see the red dot... but I do not see a written error.

tall furnace
#

Oh nvm

#

Yeah

#

I think I'd need to see more code to properly diagnose.

weak meteor
#

k

#

// World Edit Wand
                    ItemStack wand = new ItemStack(Material.WOODEN_AXE);
                    ItemMeta wandMeta = wand.getItemMeta();
                    String wandName = staffConfig.getString("items.wand.name");
                    wandMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', wandName));
                    List<String> wandLore;
                    wandLore = staffConfig.getStringList("items.wand.lore");
                    for (int i = 0; i < wandLore.size(); i++){
                        String wa = ChatColor.translateAlternateColorCodes('&', wandLore.get(i));
                        wandLore.set(i, wa);
                    }
                    wandMeta.setLore(wandLore);
                    wand.setItemMeta(wandMeta);
                    player.getInventory().setItem(staffConfig.getInt("items.wand.slot"), wand);
tall furnace
#

Give me onJoinEvent method with line numbers, if you can

weak meteor
#

this is in a method thats called in onJoinEvent

tall furnace
#

Screenshot is ok

#

Oh ok

weak meteor
#

event.getPlayer().performCommand("staff");

#

Just a command

#

lol

tall furnace
#

Which line is line 65?

weak meteor
#

its weird right?

#

bc the code is ok

#

and im doing the same with all the items in the inventory

#

and only getting error in that single item

tall furnace
#

Only that item, not the others?

weak meteor
#

yes

#

im making like 7 items

#

and only in that one

tall furnace
#

Why is it even trying to invoke CharSequence.length? I'm not seeing anything of that sort here

weak meteor
#

well idk

#

is from bukkit

#

ig ill just put a normal axe without name

tall furnace
#

Well, a "this.text" is what's causing the NPE that creates this issue

weak meteor
#

maybe that will not work with world edit

tall furnace
#

That wouldn't create an NPE though. W/E just uses a normal, everyday wooden axe.

#

Can you pastebin or hastebin the entire class?

weak meteor
#

?Paste

#

how it was?

#

?paste

undone axleBOT
weak meteor
#

there

#

and the command doesnt work lol

tall furnace
#

OOOHHH I found it I think

#

You imported org.bukkit.ChatColor. Wrong ChatColor for the ChatColor.translateAlternateColorCode method. You have to use the bungee api chat color class.

#

Delete the import and reimport the bungee one or use the full namespace for the ChatColor class reference.

weak meteor
#

thanks

tall furnace
#

Np np

weak meteor
#

wait what

#

no

#

i didnt

river oracle
#

IMHO org.bukkit.ChatColor should be deprecated

#

Idk why it's not

weak meteor
tall furnace
#

Yep. Don't use the bukkit one.

#

Use the bungee one.

weak meteor
#

okay

tall furnace
#

Now for public plugins, I get using the ampersand, because some people don't know how to type the section symbol.

river oracle
weak meteor
#

lets see

tall furnace
weak meteor
#

damn

#

no error

river oracle
weak meteor
#

Now i got another error

#

LOL

river oracle
#

And if you do have the unicode value memorized your taking extra steps

weak meteor
#

omg it was a sout

tall furnace
#

[alt+0167]

river oracle
#

Yeah most people don't have the unicode memorized

#

As well as that just being extra work

weak meteor
#

idk

#

whats happening

#

with my config files

tall furnace
weak meteor
#

its literally working in one but no in the another

remote swallow
wary topaz
somber night
#

how can i set the player, including their armor, invisible?

wary topaz
#

yea

#

idk what "separator" is

tall furnace
wary topaz
#

is it like Bungeecoord:main?

tall furnace
#

In the playerScoreboardEvent

hazy parrot
tall furnace
#

Good luck guys I gtg for a while

wary topaz
#

didnt work

flint carbon
#

Does anyone know a tutorial where it teaches you how to set up a Kotlin project forcreating minecraft plugins?

wary topaz
#

?google

undone axleBOT
wary topaz
#

?bing

undone axleBOT
flint carbon
#

I tried lol

orchid gazelle
#

Don't use Kotlin

flint carbon
#

There's one YouTube video and a spigot post, but I'd like to know if there's a better way

wary topaz
#

explain, better.

orchid gazelle
#

Simple solution

#

The "better way" is actually using Java

wary topaz
#

agreed

orchid gazelle
#

I can bet that you will have a lot of issues because you cannot find a lot of documentation and/or personal support

#

Ideas?

hazy parrot
#

its literally same setup

#

dk why would you need different documentation

humble tulip
#

Same documentation just kotlin syntax

river oracle
#

If one of those aren't true they are in for a rough time

orchid gazelle
#

And also, support

livid dove
#

Also the real talk

#

What's even the benefit of kotlin for our work?

#

Noone has ever explained that well to me imo

#

Just seems like an alternative language with no specific "this is why it's better to use"

weak meteor
#

can someone evaluate my code?

#

I think something is wrong

river oracle
#

And extension functions but that's it

weak meteor
#
public abstract class Config extends YamlConfiguration {
    private final File file = new File(Nao.getInstance().getDataFolder(), getFileName());
    private static YamlConfiguration config;

    public YamlConfiguration getConfig() {
        if (config == null) {
            config = this;
        }
        return config;
    }

    public void loadConfig() throws Exception {
        if (!file.exists()) {
            Nao.getInstance().saveResource(file.getName(), false);
        }
        this.reload();
    }

    public abstract String getFileName();

    public void reload() throws Exception {
        super.load(file);
        super.save(file);
    }

    public void save() throws Exception     {
        super.save(file);
    }

}

This is a abstract class that im extending to files i need to create, scoreboard.yml, messages.yml and stuff and everytime i access something like that its giving me an NPE
Such as: [18:10:53 ERROR]: Could not pass event PlayerJoinEvent to Nao v1.0
java.lang.NullPointerException: Cannot invoke "String.contains(java.lang.CharSequence)" because "message" is null
at me.nao.placeholders.ReplacePH.replaceAllPlaceholders(ReplacePH.java:15) ~[Nao-1.0.jar:?]
at me.nao.listeners.OnJoinEvent.PlayerScoreboardEvent(OnJoinEvent.java:65) ~[Nao-1.0.jar:?]

("message" is from a config file made with that abstract file)

livid dove
river oracle
livid dove
#

Wow

#

Well worth going to a brand new language

#

๐Ÿคฃ

weak meteor
#

but theres no keywords like extends or implements its just a :

#

i got a full hcf core in kotlin

#

but i dont understand anything

#

lol

livid dove
#

Lol

hazy parrot
livid dove
#

U don't but while new tool kit cause of there being a new shiny hammer that comes with it lol

#

*don't buy a new

regal scaffold
#

What's a datatype that can only hold unique values but not in pairs

#

Like a hashmap

regal scaffold
#

That's what it was

#

ty

humble tulip
#

To be fair

#

A HashSet is a hashmap

regal scaffold
#

How can I delete leftover packet holograms

#

jesus

weak meteor
#

Yes, it is

ivory sleet
weak meteor
#

Just providing the necessary ig

ivory sleet
#

what comes to my mind

weak meteor
#

damnn

ivory sleet
#

But there are other things apart from that also

#

Well

regal scaffold
#

How can I delete leftover packet holograms

ivory sleet
#

J21 provides virtual threads

tall dragon
#

?paste

undone axleBOT
ivory sleet
#

And structured concurrency also

#

Which is gonna be as powerful as coroutines

weak meteor
#

There

hazy parrot
#

i remember someone from jetbrains said kotlin coroutines will also benefit from loom

#

gonna be fun to see how

ivory sleet
#

Well there were some jvm adjustments, maybe thatโ€™s what they referred to

hazy parrot
#

maybe

oak gorge
flint carbon
weak meteor
flint carbon
#

i can't find modern ways to use kotlin to create these plugins besides a really small lib with 100 github stars

weak meteor
#

idk

#

i dont use kotlin

flint carbon
#

do you use java

remote swallow
#

its the exact same setup, you just use kotlin instead

ivory sleet
#

Yea

#

U need to like in principle use gradle

weak meteor
ivory sleet
#

To like set the jvm compiler optipn etc

flint carbon
#

do you guys use jdk 19?

weak meteor
#

but i make plugins with c++

#

:)

ivory sleet
#

and then u shade kotlin standard library

weak meteor
#

1.8

#

or

ivory sleet
#

17

remote swallow
weak meteor
#

18 if i need newer versions

ivory sleet
#

17 is goated rn

flint carbon
#

what's the alternative for coroutines in java?

ivory sleet
#

1.8 ๐Ÿ’€

#

Netty

flint carbon
#

cuz i know virtual threads are java 19

ivory sleet
#

Or sth

#

No its not 19

#

Its 21

remote swallow
ivory sleet
#

19 provided them as preview

#

or sth

#

Not actual release

#

No its not futures

#

Futures are a java lib thing

remote swallow
#

i borked chat pgt

weak meteor
#

what

#

LOL

flint carbon
#

would you guys say that spigotis a framework?

ivory sleet
#

Yes

#

Well no

weak meteor
hazy parrot
#

It's more of an abstraction layer

weak meteor
#

bc is just interacting with the server

remote swallow
#

why is it so hard to add a custom accent to a letter for power toys

flint carbon
#

how reliable is chatgpt for learning about it?

weak meteor
#

0%

#

i used chatgpt like 2 months ago when i was starting

#

its code was shit

#

i learned alone

#

and now i dont use it for coding

flint carbon
#

imma send something and u tell me how good/bad it is

weak meteor
#

just easy to check on javadocs

flint carbon
ivory sleet
#

Dvd, its not the classic type of framework, but I mean you could say it is one in a broad sense Ig

weak meteor
ivory sleet
weak meteor
#

but the methods and stuff it writes

#

are super basic

ivory sleet
#

Try to understand what gpt gives u

echo basalt
#

I wonder if we've spoken before

flint carbon
#

but i am also proficient in kotlin

weak meteor
#

i normally check on events

flint carbon
#

and the support isn't that great

weak meteor
#

but then i just write it myself

ivory sleet
#

Well if uโ€™re proficent in kotlin uโ€™re proficient in java and c# and vice versa id say

#

But ye nice nice

ivory sleet
#

Occasionally gets on my nerves fs lol

flint carbon
#

System.out.println() -> println()

ivory sleet
#

So thats why its good to think critically

quaint mantle
weak meteor
#

at least is not

flint carbon
#
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MyPlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        // Register events
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        // Open the GUI when the player right-clicks an item
        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.STICK) {
                openGUI(event.getPlayer());
            }
        }
    }

    public void openGUI(Player player) {
        // Create a new GUI frame
        JFrame frame = new JFrame("My GUI");
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.setSize(400, 300);

        // Create GUI components
        JPanel panel = new JPanel();
        JButton button = new JButton("Click me!");

        // Add components to panel
        panel.add(button);
        frame.add(panel);

        // Register button click event
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // Perform some action when the button is clicked
                player.sendMessage("You clicked the button!");
            }
        });

        // Show the GUI
        frame.setVisible(true);
    }
}

this is some chatgpt java based code for a menu, is it ideal?

echo basalt
#

lmfao

weak meteor
#

int main(){
std::cout << "Hello World" \n;
}

ivory sleet
#

What did u ask to get that code?

flint carbon
ivory sleet
#

Ah

flint carbon
#

obviously i could've used a better prompt, but i'd assume it'd give like the most ideal way at the time

ivory sleet
#

Yeah, I just hope there isnt an actual source code project where they used awt shit for minecraft guis

quaint mantle
ivory sleet
#

I assume youโ€™re the compiler, interpreter and runner of that language

quaint mantle
weak meteor
weak meteor
#

7smile7

#

is

#

just

#

beautiful

#

his

#

gui

#

mdoel

echo basalt
#

this

#

can still be worked on

quaint mantle
echo basalt
#

but is a decent start

ivory sleet
#

Yea its a decent way to architecture it

weak meteor
#

got excited :(

quaint mantle
#

No sorry, $69 paypal now

flint carbon
#

do you guys prefer maven?

ivory sleet
#

Nope

weak meteor
ivory sleet
#

I like gradle, probably since I use it a lot for my micro applications

weak meteor
#

0.07 dollars

#

i got scammed and my buddy paypal doesnt want to refund me

ivory sleet
#

but in theory maven is pretty nice especially since the new version release

quaint mantle
quaint mantle
weak meteor
#

and then i couldnt log in

#

yesterday

#

and well

ivory sleet
#

Why?

weak meteor
#

idk

quaint mantle
ivory sleet
#

U wanted to smurf or just have some cool skins?

weak meteor
#

cool skins

ivory sleet
#

Ah

#

Whats ur rank btw

humble tulip
#

Send a packet to despawn entity

ivory sleet
#

(Peak)

weak meteor
weak meteor
#

3

ivory sleet
#

Oo

#

EU ?

quaint mantle
weak meteor
#

LAN

quaint mantle
#

Got their feet pics

weak meteor
#

so the stuff is

#

i gotta rank from silver 1 to gold 3 at least

#

without 20 dollars

#

:(

ivory sleet
#

Ah

weak meteor
#

yes

#

latin america north

ivory sleet
#

Im 10rr from diamond 3 btw :3

#

Ag

weak meteor
#

i dont know

#

what the fuck

humble tulip
ivory sleet
weak meteor
#

is happening with my code

#

well, its not mine

quaint mantle
weak meteor
#

froma spigot post

remote swallow
#

i can finally type ยง easily

ivory sleet
weak meteor
quaint mantle
#

It is

remote swallow
#

lan means lois and ned

#

lois from family, ned from the shrimpsons

quaint mantle
#

Did you know lolis are not legal? ๐Ÿ’€

ivory sleet
quaint mantle
#

Even though they might have like +500 years

weak meteor
#

there any api for scoreboards?

quaint mantle
#

Everything is WAN

weak meteor
#

i dont wanna make one my own

#

๐Ÿ’€

ivory sleet
#

Or just nms ig if u prefer that

#

(I do but most dont)

weak meteor
#

no

#

a made

#

like

#

addLine

#

method

#

or stuff like that

remote swallow
#

fast board iiiiiiiirc

weak meteor
#

dont wanna make hard work ๐Ÿ’ช

ivory sleet
#

TAB has a decent api

remote swallow
#

love tab

weak meteor
#

hate

remote swallow
#

fuck the owner tho

weak meteor
#

bing

#

i hate it

quaint mantle
#

lol

ivory sleet
#

?bing

undone axleBOT
quaint mantle
#

Must be you

weak meteor
quaint mantle
#

You broke bing ๐Ÿ’€

weak meteor
#

i broke bing

quaint mantle
#

Ask ms support

ivory sleet
#

Isnโ€™t bing based on previous searches etc

quaint mantle
#

With a bit of luck they will only take like 3 years

ivory sleet
#

like most search engines

weak meteor
quaint mantle
ivory sleet
#

Shame ms

quaint mantle
#

Microsoft intentionally placed that error for you there, so you can call them and they know your phone number

#

I've would done the same ๐Ÿ’€

ivory sleet
quaint mantle
remote swallow
#

mclogs

#

๐Ÿ˜†

#

fric

#

i dont have nitro

quaint mantle
regal scaffold
humble tulip
#

Send a packet to destroy the entity

#

With the same entity id as the one u used to spawn

ivory sleet
#

[CODE REVIEW] Post Code or Review Others

remote swallow
#

sus

#

thats gonna disappear in like 3 days

quaint mantle
#

Not if someone sends shitpost every day

ivory sleet
#

No epic

ivory sleet
#

I can change it

remote swallow
#

its gonna disappear in 2 weeks

quaint mantle
#

The same exact post, every week

weak meteor
#

someone knows JScoreboards?

wary topaz
#

?

regal scaffold
humble tulip
#

Yep

regal scaffold
#

Then how lol

humble tulip
#

How do u spawn the entity?

regal scaffold
#

Itโ€™s a leftover hologram

#

I have no record of it

#

It was a bug

humble tulip
regal scaffold
#

A packet hologram

#

That didnโ€™t despawn

#

And is long gone

eternal oxide
#

then restart the client

humble tulip
#

Well relogging will work

regal scaffold
#

If it stays after client restart

#

What would that mean

humble tulip
#

It's not a packet hologram

eternal oxide
#

its not a packet hologram

humble tulip
#

Or the thing spawning it is still spawning it

regal scaffold
#

Ok

#

I shall investigate

#

Ty

humble tulip
#

You can tell if it's a packet hologram by using the kill command

#

If it gets removed by killing, it's not a packet hologram

#

/kill @e[type=armorstand,r=5]

#

To kill within 5 blocks

#

Might need to use minecraft:kill if a plugin overrides the kill command

remote swallow
#

shouldnt it be ..5 for 5 locks

wet breach
remote swallow
#

i meant blocks

#

my brain works

#

:kekw:

#

oh

#

i forgot again lmao

wet breach
#

But i suppose it would depend if you want a straight line or not

#

R is for radius and will do 5 blocks in all directions

remote swallow
#

ah

#

its ..5 for distance

wet breach
#

Yeah but in a single direction

ivory sleet
#

Just testing

#

?codereview

undone axleBOT
ivory sleet
#

Nice

#

Time to go to sleep :)

late sonnet
#

this can be a forum

quaint mantle
late sonnet
humble tulip
#

Should i open soirce it?

#

I was gonna release a plugin that connects to tiktok

#

But i dont really care to do so anymore

river oracle
#

nah keep that shit away from java we don't need any TikTok programs ruining our ecosystem

glad prawn
#

uwu ๐Ÿ‘

barren peak
slim wigeon
#

Farm rods project complete, moved to portable chests but one issue. PlayerPickupItemEvent is deprecated. Any fixes?

vocal cloud
#

Check the docs?

#

What does the docs say music

slim wigeon
#

I just seen the event is deprecated but I seen this. InventoryPickupItemEvent which can be used for hoppers and stuff. Which will be useful when I get to the hopper plugin. Lets see what I can do with this

vocal cloud
slim wigeon
#

EntityPickupItemEvent??

rotund ravine
#

Yes

#

Use that then

slim wigeon
#

Thanks

vocal cloud
#

Teach a man to fish ๐ŸŽฃ

vocal cloud
#

Average Paper user

frail gale
#

Is there a way to edit .class files just for easier readability?

#

I think I have saw in some tutorials some guys being able to edit the .class files again for easier readability

#

Also all this is for IntelliJ IDEA

slim wigeon
#

I got another issue. What causes a itemstack to go back in inventory after attempting to drop it on the ground?

rough ibex
#

are you sure you know what you saw

#

are you talking about decompiling to source in IDEA?

#

you're not supposed to edit .class yourself

slim wigeon
#

I tried everything

slim wigeon
#

I looked thru the events and I did not see the cause, it only happens when I have the Portable Chest GUI open

#

You might be right about the event

ivory sleet
frail gale
twilit roost
#

Can BungeeCord detect player using spigot command?

rotund ravine
#

Yes

polar atlas
#

ive a question regarding World.rayTrace. is raySize parameter sort of like accuracy? and whats the default value of it

vocal cloud
polar atlas
vocal cloud
#

There you go

polar atlas
#

but i dont know the default value

vocal cloud
#

It's whatever the entities bounding box is + whatever you enter

young knoll
#

The default value is 0

buoyant viper
#

will getLastDeathLocation return the players current death location when accessed from a PlayerDeathEvent?

eternal oxide
#

unknown but likely as it can't be canceled

buoyant viper
#

will T&S ig :P

topaz atlas
#

Why isnt spigot recognized as a importable object

#

org.bukkit aint importing

buoyant viper
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

vocal cloud
#

light mode eclipse is my weakness

buoyant viper
#

you should really be using Maven or Gradle and then import the org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT dependency from the spigot repo

eternal oxide
#

?maven

undone axleBOT
buoyant viper
#

boy i love components

topaz atlas
#

diffrent error

buoyant viper
#

what error

topaz atlas
#

the type org.bukkit is not accessable

buoyant viper
#

how did u import that jar

#

that doesnt look like a maven or gradle project

topaz atlas
#

I added it using external jars in classpath

topaz atlas
buoyant viper
#

no

eternal oxide
#

looks like the wrong jar

eternal oxide
#

jar looks ok

buoyant viper
eternal oxide
#

good to know

topaz atlas
#

So

#

what could be the cause

eternal oxide
#

so uncancelable but not yet upto date

buoyant viper
#

ye

eternal oxide
#

run a clean on your project

topaz atlas
eternal oxide
#

Eclipse

topaz atlas
eternal oxide
#

Project menu -> clean

topaz atlas
topaz atlas
#

now what>

eternal oxide
#

does it work?

topaz atlas
#

no

eternal oxide
#

then no idea

#

Use Maven

#

it handles all the dependencies for you. no manual importing jars

topaz atlas
eternal oxide
#

no, its included with Eclipse

#

you start a Maven project instead of a Java project

topaz atlas
eternal oxide
#

if you don;t have a domain me.spiderunderyourbed or whatever name you use and artifact use the plugin name, all lower case

topaz atlas
#

for group id

#

Wait

#

Heh

topaz atlas
#

so for domain it should be me.USER or com.USER

eternal oxide
#

artifact will be your plugin name, all lowercase

topaz atlas
eternal oxide
#

I have told you both of these TWICE now

topaz atlas
#

for both option

eternal oxide
#

no, READ what I write

#

I'm not telling you again

#

read back what I already told you more than once.

topaz atlas
topaz atlas
#

since thats what you said I think

eternal oxide
#

no I did not

#

groupid is me.whatever
artifact is your plugin name but all lowercase

topaz atlas
#

oh ok

#

me.spiderunderurbed
onutillities

topaz atlas
eternal oxide
#

?maven

undone axleBOT
topaz atlas
#

Nvm

#

no i do not

eternal oxide
#

fill the pom.xml in as that link tells you

#

from now on never manually import ANY jar

topaz atlas
eternal oxide
#

so change it to 1.17 or whatever version you want

topaz atlas
#

I can just request that from plugin.yml

#

right?

#

if its like 1.18 I can add to plugin.yml i want api version 17

wet breach
#

Maven is just a build system. It is similar to using the ide built one which that is typically the ant build system. Reason it may not feel the same is because your ide was taking care of making the build file for ant for you where as with maven it is mostly your job to do that

#

As far as programming goes it is the same

wet breach
topaz atlas
wet breach
#

Oh just create a directory called resources inside the src directory

#

And then toss the plugin.yml in there. maven will automatically put it in the root of the jar

topaz atlas
#

So i know what to do with the resources

#

Why am i getting these errors

wet breach
#

That is the incorrect location. And modelversion refers to the pom.xml

topaz atlas
wet breach
#

Do you not have the maven plugin for eclipse?

topaz atlas
wet breach
#

Well i dont use eclipse so cant say if there is additional plugins for maven for that ide

#

I personally use netbeans

topaz atlas
#

When i create the project there was the test directories

topaz atlas
#

for my project

wet breach
#

Yeah you dont need the test directory unless you intend to make some testing stuff for the project. Its safe to delete it.

topaz atlas
#

And ill put the yml in the resources directory

wet breach
#

Modelversion refers to the top line that outlines what xml version standard it is using

topaz atlas
#

do I use the one I circled?

wet breach
#

Can probably look at some random maven project to see what it is suppose to be

topaz atlas
#

^ example maven config

#

is what i copied

wet breach
#

Src main is where everything should be at. Sorry i misled you on that. Forgot there was that dorectory

topaz atlas
#

which is confusing

wet breach
#

So it should be src/main/resources. Everything in resources will go to the root of the jar. Src/main/java. Is where your java class files will reside

topaz atlas
wet breach
#

Well one might have been in the test directory

#

Give me a few minutes. Clocking out from work

topaz atlas
#

Ok, ping me when ur back

orchid gazelle
#

Anyone?

wet breach
#

I am back now.

topaz atlas
wet breach
#

Correct