#help-development

1 messages · Page 552 of 1

grand magnet
pseudo hazel
#

just pay attention when you do or dont write pointless documentation

quaint mantle
#

why would the key not be set

#

Think for the person who needs to use your code but doesn't understand your design pattern

remote swallow
#

you havent added the key yet

pseudo hazel
#

thats why we use design patterns that a lot of people know

quaint mantle
#

wdym it saves at the end

quaint mantle
pseudo hazel
#

like I said, if its for complex thing, you would want some docs as to how to use the code

#

im not arguing against that

#

anyways im spamming the chat again with useless conversation xD

quaint mantle
#

No, it's okay. I shared my opinion since I had struggled multiple times because documentation was scarce.

pseudo hazel
#

yes that is true

tribal narwhal
#

is there a new event for brushing sus sand?

pseudo hazel
#

you can probably use an existing event

#

like playerInteractEvent

#

which is like used for everything at this point

#

why do you want an event?

tribal narwhal
#

I want to get its drop for my AutoPickup plugin

chrome beacon
#

is triggered

#

and then check if the block data is brushable

tribal narwhal
#

Good Idea!

#

nope

rough plover
#

Does anybody know how to use varints in protocollib? I'm trying to make smooth recoil using packets, and so far I have this:

                    Location lookatloc = p.getEyeLocation().clone();
                    lookatloc.setPitch(p.getEyeLocation().getPitch()-recoil);
                    lookatloc.add(lookatloc.getDirection());
                    
                    ProtocolManager pm = ProtocolLibrary.getProtocolManager();
                    PacketContainer packet = pm.createPacket(PacketType.Play.Client.POSITION_LOOK);

                    packet.getIntegers().write(0, 1);
                    packet.getDoubles()
                            .write(0, lookatloc.getX())
                            .write(1, lookatloc.getY())
                            .write(2, lookatloc.getZ());
                    packet.getBooleans().write(0, false);

                    try {pm.sendServerPacket(p, packet);} catch (InvocationTargetException e) {throw new RuntimeException(e);}```
tribal narwhal
#

In theory it should be under that event.

rough plover
#

Then I get this error, indicating that that setting integers isn't the way to do it.

com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
        at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:316) ~[ProtocolLib.jar:?]
        at com.lynxdeer.lynxsguns.weapons.guns.AK47$1.run(AK47.java:114) ~[rwb.jar:?]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-524]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.4.jar:git-Paper-524]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1483) ~[paper-1.19.4.jar:git-Paper-524]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.19.4.jar:git-Paper-524]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.4.jar:git-Paper-524]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1174) ~[paper-1.19.4.jar:git-Paper-524]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-524]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]```
chrome beacon
#

Yeah that's Protocollib

#

Which packet is it though?

rough plover
#

The Look at Packet

chrome beacon
#

I didn't see the code you sent

rough plover
#

I'd send an image of how it is on wiki.vg but I can't send images

chrome beacon
#

Is there a reason you're using packets for that?

rough plover
#

I don't think theres another way to do it smoothly without teleporting the player

#

Teleporting the player is a problem because that screws with movement which doesn't feel good

#

It looks like this on wiki.vg, I just need to know how to set the VarInt field

chrome beacon
warm mica
#

There's a setRotation method

rough plover
chrome beacon
#

That doesn't work on players in Spigot

#

Might work on Paper though

warm mica
# rough plover Thank you!

I'd recommend to look at the second solution because you are able to use relative positions and not the absolute ones, which would improve the feeling make of the recoil

#

Also note that Mojang has started to ban servers recently that have guns

eternal oxide
#

Not a good idea to recommend Paper in the Spigot discord

rough plover
#

I'll look into that, I'm already using paper.

rough plover
#

If that was the case, then hypixel would also be removing cops and crims

#

using setRotation works fine, but I will be looking into the second method to make it a bit smoother

quaint mantle
#

block physics

#

block form ?

#

block dry ?

silent steeple
#

BlockChange

#

I think

quaint mantle
silent steeple
#

Np

silent steeple
rough plover
silent steeple
#

The recoil follows the crosshair

rough plover
#

Should it not?

silent steeple
#

No

echo basalt
#

That's how protocollib works

rough plover
echo basalt
#

Modern recoil is always a pattern

#

Here lemme open up a random game

silent steeple
#

Yeah but the crosshair doesnt follow it

echo basalt
#

yeah it returns to the original position

silent steeple
#

Exactly

echo basalt
#

also aiming recoil is separate from hip fire recoil but we all know that

#

and recoil is usually just a function(bulletsFired) -> Point which is the rotation offset

#

So a weapon with no recoil will return an offset of 0, 0

#

A weapon that's just straight up will return an offset of 0, 1

#

A weapon that's zigzag will be like

#

-1, 1
1, 1
-1, 1
1, 1

#

Game devs hardcode these sometimes

#

But yeah you add those to your camera and after a certain amount you remove them

lilac dagger
#

so it's a pattern

echo basalt
#

and that amount is usually just like a second after the last bullet fires

#

Yeah it's a pattern

#

modern recoil is always a pattern

lilac dagger
#

noted for when i update my cops and crims plugin

echo basalt
lilac dagger
#

it makes sense

#

i had a system with roundsperyse and rounds per pitch

#

but it's limited to what i can do with it

pseudo hazel
#

which version of bukkit.getPlayers actually searches through the database and stuff? I just want the version that tries to get a player from within the current server

quaint mantle
#

spigot api has a Tag for concrete blocks ?

lilac dagger
#

assuming you want all the players including the offline ones

pseudo hazel
#

from my memory there was a method that did that

chrome beacon
pseudo hazel
#

and I dont want to pick that one xD

hazy parrot
#

What database are you talking about

pseudo hazel
#

like the one with all players in minecraft

#

mojangs

chrome beacon
pseudo hazel
#

anyways Bukkit.getplayer just looks through online players in the server right?

hazy parrot
#

getOfflinePlayer might make web request yeah

pseudo hazel
#

okay perfect

quaint mantle
#

spigot api have Tags for concrete blocks ?

pseudo hazel
#

not that I know

#

I just created an enum for colored blocks

#

since I was mad at some point

#

and just pooped out an enum for colored things in the game

#

so if there is a better way, do also let me know xD

tall dragon
#

pretty sure there is some complicated way to get the same color a map would use for a particular block

#

no idea how tho

gleaming grove
#

Why does resources are not included to the jar output? There is no plugin.yml

copper basin
#

Is the armor trim "Silence" in spigot yet for 1.20?

chrome beacon
chrome beacon
chrome beacon
#

package command?

gleaming grove
#

lol after restarting Inteliji it works again

quaint mantle
#

hi guys i have a problem i do custom block drops

#

but when player break blocks on worldguard region

#

block not breaking but drop items

eternal oxide
#

add another listener at MONITOR

#

only drop your drops if the event is not canceled

quaint mantle
#

ah yes i was think this

#

in wc

#

and i was coming for delete my question

eternal oxide
#

what version of spigot?

quaint mantle
#

1.16.5

eternal oxide
#

Just use the BlockDropItemEvent if current.

#

I thought you were on 1.12

#

yeah use the block drop items instead of break

quaint mantle
#

alright

quaint mantle
eternal oxide
#

no

quaint mantle
#

they was said no

#

yes i need create enum ?

eternal oxide
#

depends

#

depends on what you need to do and how often

#

Not looked

quaint mantle
#

How do I make a plugin that when the player clicks Q

#

Then it drops their item that they are holding

inland siren
#

the vanilla minecraft mechanic?

eternal oxide
#

there is no method to detect pressing Q

#

you can catch teh drop event but no way of knowing ifd it was due to pressing Q

quaint mantle
#

You cant drop items in minecraft

inland siren
#

wha t

quaint mantle
#

How would I make that elgarl

tribal quarry
#

hey theree

cedar laurel
#

Does anyone know the link to the documentation for doing this tag style in the tab using texture?

tribal quarry
#

EventPriority.java:

    /**
     * Event is listened to purely for monitoring the outcome of an event.
     * No modifications to the event should be made under this priority
     */
    MONITOR(5);

i want to know, what does it mean no modifications to the event should be done under this priority? what about cancelling the event? does it affect that?

eternal oxide
#

no changes

tribal quarry
quaint mantle
#

Keyed enums

cedar laurel
#

Strange, when I logged into the server, the tab looked like this, without any Chinese symbol

#

this was before the texture could load

quaint mantle
#

As far I understood, some enums will stay

inland siren
#

they’re on experimental branch

#

moved to registry backed instances

#

not in live 1.20

eternal oxide
tribal quarry
#

bruh

hazy parrot
#

do you know what monitor means ?

eternal oxide
#

No, do NOT make ANY changes. None at all. Not one single change.

cedar laurel
#

I have decomposed their texture and it is organized like this, with all the roles in one image

tribal quarry
quaint mantle
#

You can still work with the classes. What seems to change are features that are specific to enum classes.

subtle folio
#

nothing more

#

read the docs next time

quaint mantle
#

They will implement methods that are currently used but the features that cannot be added are the ones you don’t want to use in your code

#

Like, Material#values if you ask me should still work since adding such method is not impossible 🤷🏻

silent steeple
#

Whats the method to delete a hologram in HolographicDisplays

#

I'm on the javadoc and I can't find anything

#

nvm

silent steeple
#

Got it

silent steeple
#

i have this method but how do i make a delete along with it

#



public void createHologram(@NotNull ConfigurationSection crateName, @NotNull Location location) {
        HolographicDisplaysAPI api = HolographicDisplaysAPI.get(main);
        Hologram hd = api.createHologram(location);

        List<String> hologramLines = getCrateHologram(crateName); // Assuming getCrateHologram is your method returning a list of strings

        for (String line : hologramLines) {
            TextHologramLine textLine = hd.getLines().appendText(line);
        }
    }
inland siren
#

it shouldn’t be an api break

#

yet

ocean hollow
#

guys, how to change the scale of the ItemDisplay? I know it has Transformation, but Transformation doesn't have a scale setting method

quaint mantle
#

this is custom fonts with resourcepacks

#

Can I get the broken block in event as an itemstack?

hybrid pulsar
silent steeple
#

yeah i got it

fossil coral
#
[21:01:57] [Server thread/ERROR]: Could not load 'plugins\oink.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.2
        at org.bukkit.craftbukkit.v1_20_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:319) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[spigot-api-1.20-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.20-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.20-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.loadPlugins(CraftServer.java:430) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:973) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]```
hybrid pulsar
#

org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.2

eternal oxide
#

api-version: '1.20'

fossil coral
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
eternal oxide
#

plugin.yml

fossil coral
#
name: oink
version: '${project.version}'
main: xyz.oinkyscosmetics.Oink
api-version: 1.20
authors: [Oinky]
description: Oink!!!```
eternal oxide
#

put '' around the 1.20

fossil coral
#

alr

eternal oxide
#

you do due to the way SnakeYAML reads entries

#

it reads it as a float so it ends up 1.2

#

I've seen it often when using numbers as keys

chrome beacon
#

Yes

#

Yes

#

1.20 uses new SnakeYaml

eternal oxide
#

this would also happen on older but we've never had a trailing zero before

fossil coral
#

oh

zenith gate
#

I need some help trying to debug this, I'm at like a complete total lost on what to do. I've already tested the ItemStack, the item does come out with everything that it's suppose to be, but the actual recipe doesnt work, it returns just an original netherite helmet, im not sure what it is.

public static void CrackedNetheriteHelmetRecipe() {
        SmithingRecipe recipe = new SmithingRecipe(new NamespacedKey(plugin, "cracked_netherite_helmet"), CrackedNetheriteHelmet(), new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET), new RecipeChoice.ExactChoice(CrackedResources.CrackedNetherite()));
        Bukkit.addRecipe(recipe);
    }
chrome beacon
fossil coral
#

thx it works now

#

that's just really weird

#

why did it read it as a float

hybrid pulsar
#

SnakeYAML 2.0 for ya

chrome beacon
#

Because it looks like a float

eternal oxide
#

its just the way yaml tries to guess the type of the entry

livid dove
#

Sanity check time. Getting inventory holder for a shulker box loads the tile entity and in turn all the items in the inventory... if thats the case, is this the same for all types of inventory?

Or is it just for shulkers.

Follow on question: Is it just the get holder method that causes the whole inventory to load verbatim?

chrome beacon
celest sonnet
#

Oh

quaint mantle
#

can i do this code shorter ?```java
@EventHandler
public void drop(BlockDropItemEvent e) {
if (e.getBlock().getType() == Material.WHITE_CONCRETE) {
ItemStack item = new ItemStack(Material.WHITE_CONCRETE);
ItemMeta meta = item.getItemMeta();
if (e.getBlock().getLocation().getWorld() !=null && meta != null) {
meta.setDisplayName(ChatColor.WHITE + "Granite Bricks");
item.setItemMeta(meta);
e.getBlock().getLocation().getWorld().dropItemNaturally(e.getBlock().getLocation(), item);
e.setCancelled(true);
}

    }```
chrome beacon
#

Use guard clauses 🙂

#

block should be a variable

#

and location

tardy delta
#

when you think your code is working fine but your ide doesnt show the errors

eternal oxide
eternal oxide
#

no need to create a new ItemStack

quaint mantle
eternal oxide
#

just use the one in getDrops

#

or items, whichever it is

dusk lake
#

Does anybody know how to change the Item within Suspisous Sand? I've tried using BlockState casted to BrushableBlock and i did not work

quaint mantle
#

but can i drop item with custom name with geti tem ?

eternal oxide
#

yes

quaint mantle
#

i will try

eternal oxide
#

you can modify the item and don't need to drop it yourself

#

Which would also allow your plugin to handle multi block drops caused by other plugins

quaint mantle
hard socket
#

can somebody help me with the math?

eternal oxide
#

getItems is a collection

#

getItems().forEach(

hard socket
#

I want the if statments return true when the current health drops by 10%

#

wich I did in healthPercentage

lilac dagger
#

currenthealth / maxhealth <= 0.9

#

@hard socket

#

you can remove the = sign

#

if you want it to be exclusive

quaint mantle
#

but how i give to name

eternal oxide
#

what?

quaint mantle
#

can i set drop with getitems ?

#

so u said getitems is collection

#

and i can set 0st index of item

eternal oxide
#

yes

#

well a List

quaint mantle
#

but ho wcan i add name to drop

#

i mean i wanna drop item with custom name

eternal oxide
#

modify the itemstack in each dropped item

quaint mantle
#

alrigt

dusk lake
#

Does anybody know how to change the Item within Suspisous Sand? I've tried using BlockState casted to BrushableBlock and i did not work

quaint mantle
hard socket
eternal oxide
eternal oxide
#

you can remove or modify, but not add

lilac dagger
#

@hard socket exactly

quaint mantle
eternal oxide
#

you are trying to add to the List

#

event.getItems().forEach(item -> {

hard socket
#

@lilac dagger you made if only for the first 20

lilac dagger
#

uhm?

hard socket
#

I wanted it to be everytime he loses 20

lilac dagger
#

20 percent?

hard socket
#

no 10% of 200 is 20

#

like every 10%

lilac dagger
#

oh every 10% percent

#

hmm

hard socket
#

yes

lilac dagger
#

but then you'd need another value

#

previous health

hard socket
#

yeah I tried that but my brain isnt mathing

lilac dagger
#

well get the previous health and divide currenthealth/previoushealth

#

so everytime the difference is greater than 10% it'll trigger what you wanna trigger

#

currenthealth/previoushealth < 0.9

#

is the same just replace max with previous

hard socket
#

yup it works tysm ❤️

lilac dagger
#

👍

quaint mantle
#

java.lang.IllegalArgumentException: Plugin already initialized!

#

what

#

did i do wrong

#
        Bukkit.getPluginManager().registerEvents(new JoinListener(), this);
        Bukkit.getPluginManager().registerEvents(new onChairListener(), this);
    }```
eternal oxide
#

do not use new Main()

quaint mantle
#

did i register it wrong

#

oh

#

then what

eternal oxide
#

only one class extends JavaPlugin

quaint mantle
#

so what do i do

eternal oxide
#

?di

undone axleBOT
quaint mantle
#

oh so i dont need to register it in my main class, i need to do it in the class?

eternal oxide
#

you have more then one class extending JavaPlugin

#

because you don;t yet understand dependency injection

quaint mantle
#

i use javaplugin in my kick command

#

does it have to affect with my other

#

yk

#

class

eternal oxide
#

only your plugins main class can extend JavaPlugin

quaint mantle
#

oh

lilac dagger
#

@quaint mantle swap the event with this too

#

assuming 'this' is your main plugin and event is implementing Listener

silent steeple
#

how do i make an armor stand completely invisible

#

like you can still place blocks even when they are there

quaint mantle
#

oh nvm, got it

#

just need to know how to mount a invisible armor stand now

#

👍

lilac dagger
#

addPassenger(player)
setVisible(false)

quaint mantle
#

this

#
        armorStand.setVisible(false);
        armorStand.setGravity(false);
        armorStand.setSmall(true);
        armorStand.setMarker(true);```
lilac dagger
#

you just miss addPassenger

quaint mantle
#

im aware..

tardy delta
#

probably worst hashmap insertion impl ive ever written

river oracle
#

How would I copy resources in my project to a folder in my plugin datafolder
I have a .schem file in a schematics folder in my resources folder and I want it in my plugin datafolder

tardy delta
#

resources included in your jar?

river oracle
tardy delta
#

plugin.saveResouce

lilac dagger
tardy delta
#

its not java

river oracle
lilac dagger
#

looks like kotlin

river oracle
#

its C++

#

which has no map defaul iirc

#

unless this is C

#

I can never fucking tell

tardy delta
#

c++ does have maps

river oracle
#

oh so its C

tardy delta
#

odin

quaint mantle
#
error: cannot find symbol
            player.addPassenger(armorStand);
                  ^
  symbol:   method addPassenger(org.bukkit.entity.ArmorStand)
  location: variable player of type org.bukkit.entity.Player
#

why does this happen wtf

tardy delta
#

looks very much like c but better

river oracle
wise mesa
#

or arrows

tardy delta
#

well "better", less overhead of allocating memory myself

wise mesa
#

or encapsulation

river oracle
#

shut

tardy delta
#

C has arrows

wise mesa
#

oh it does but not in that spot

#

not like a lambda type thing

tardy delta
#

lemme not write an example bruh, i dont want to write memory allocation code :(

wise mesa
#

just for dereferencing

quaint mantle
#

can anyone help

tardy delta
#

ye

lilac dagger
#

i could never code containers for c or c++, looks like a headache and probably it'll have memory leaks

tardy delta
quaint mantle
lilac dagger
#

i can succesfully code in java containers but in c++? no way

quaint mantle
#

its a listener

wise mesa
#

no

tardy delta
#

wait didnt even read that last line

quaint mantle
#

nvm

#

i did it

#

wrong

tardy delta
#

i went up in the skill tree, no more assembly

lilac dagger
#

not sure

quaint mantle
#

can anyone tell me the vector to sit on the lower stair part

chrome beacon
quaint mantle
tardy delta
#

took me 2 hours to write this single method 💀 always fun when there are no docs

river oracle
#

I need to check if while A player is walking they enter a specific area? Is there a more efficent way of doing this than just looping over each area every time PlayerMoveEvent is triggered? I feel like doing possible 20 or so checks every player move event for hundreds of people would not be ideal

tardy delta
#

how are you storing your areas?

quaint mantle
#

does spigot automatically override plugin commands over minecraft commands

tardy delta
#

essentials is able to override /give but it probably injects its command directly into the command map

#

no clue actually

quaint mantle
#

hm, i wanted to override the /kick command

#

cuz i dont want to do /coreplugin:kick

tardy delta
#

its definitly possible, PlayerCommandPreProcessEvent or smth is smth too

#

should have to try out

eternal oxide
#

the last plugin to register a command gets it

silent steeple
#

anyone else does

 private final VoidCrates main;

    public Manager(VoidCrates main) {
        this.main = main;
    }

for dependency injection??

tardy delta
silent steeple
#

becuase i used to do it all the time and would be able to access main from outside the constructor but now all i get is because "this.main" is null

eternal oxide
#

unknown

river oracle
tardy delta
#

in an unsorted list?

river oracle
#

essentially I have a Map<String, ZoneData>

String would be name of the zone, ZoneData contains all the zone data bounding boxes etc

tardy delta
#

id say mapping areas to chunks would be a lil better atleast

#

but im too tired too come up with anything better

quaint mantle
#

yep, plugin overrides minecraft plugins

#

thank you guys

#

anyone know how to cancel the "%username% has joined the game" ?

#

like that yellow text

tardy delta
#

PlayerJoinEvent#setJoinmessage(null)

#

should've checked docs or atleast googled

river oracle
tardy delta
#

ah wait zonedata contains another map?

river oracle
#

no

#

I'll show you

#
    private String name;
    private String schematicName;
    private XZBoundingBox area;
    private Location flagLocation;
    private XZBoundingBox flagArea;

    private ZoneData(String name, String schematicName, XZBoundingBox area, Location flagLocation,
            XZBoundingBox flagArea) {
        this.name = name;
        this.schematicName = schematicName;
        this.area = area;
        this.flagLocation = flagLocation;
        this.flagArea = flagArea;
    }
#

XZBoundingBox is just a bounding box

tardy delta
#

are you just looping over your map.values()

river oracle
tardy delta
#

:(

river oracle
#

but I really don't want to

sick ermine
#

How can I run a code block every day at 8 o'clock with a timer?

quaint mantle
tardy delta
quaint mantle
river oracle
#

still doesn't solve my looping issue though

tardy delta
#

best i can came up with is a Map<String, Map<Chunk, List<ZoneThing>>> where it stores all the chunks of that area :/

#

it gives some idea

quaint mantle
#

how do i check if a player clicked right click on a stair

tardy delta
#

have you even googled?

silent steeple
quaint mantle
#

sorry

silent steeple
#

is there a method to save the server

#

like Bukkit.getServer().save?

storm scaffold
#

Theoretically, could you run any Java program within a plugin? Like how you can use jda within a plugin, can you also use any .jar programs?

quaint mantle
silent steeple
#

yeah thats different

quaint mantle
#

lol

tardy delta
#

you can trigger java -jar x.jar within your plugin

#

actually just use a dependency lol

ember estuary
#

When I do git config --global user.name it says my name is "BuildTools". And my user.email was set to "unconfigured@null.spigotmc.org". Why is that? Does running BuildTools change my globally set github credentials??

river oracle
tardy delta
#

oh ye running buildtools fucks up stuff

ember estuary
#

any way to make it not do that? cuz that sucks

tardy delta
#

or there may even be multiple ig

tardy delta
#

so instead you just do a map lookup based on the chunk, so thats O(1)

#

would still require to put all the covering chunks from that area in that map tho

river oracle
#

it'd also require all borders to be on chunk borders too

#

but it makes it much more performant

chrome beacon
ember estuary
#

and it wont be reset, the next time i run buildtools?

chrome beacon
#

Yeah

ember estuary
#

ok good, ty

tardy delta
silent steeple
#

hologram.setCollidable(false), whats the way to do this in 1.8

quaint mantle
#

grim's reach detection is actually so smart

#

i just realized that

#

its a prediction reach check

#

and actually accurate

silent steeple
#

ArmorStand#setCollidable(false), whats the way to do this in 1.8

#

anyone know

quaint mantle
#

nvm

#

uh

#

i dont

#

think there is

river oracle
#

shoulda done this from the beginning tbh

#

do you know any good programs for visualizing this shit

noble lantern
#

is there a copypasta somewhere for a Material PDC?

#

wait i wonder if gpt could do it

quaint mantle
#

no it cant

livid dove
#

Okay

#

So

#

PSA / sanity check.

Did ya'll know that getting an inventoryHolder in an OnClick event is dog tier bad idea?

#

Because I was today years old when i found out

chrome beacon
#

hm how so?

livid dove
#

Tl;dr: Due to how Bukkit logic works, if you call the inventory holder and its a chest, shulker , basically any storage based tile entity... yeah its going to reconstruct the inventory from scratch every click

chrome beacon
#

oh

livid dove
#

I just removed some checks in a plugin that use get holder...

#

i went from 2% thread usage... to 0.1%

quaint mantle
#

just get better server hosting

#

smh

noble lantern
#

idk because getHolder() only returns a stored variable so uh

livid dove
#

All that did this was a check that involved event.getInventory.getHolder().

#

replaced with event.getInventory.getType()

quaint mantle
livid dove
#

it goes down to 0.1%

river oracle
quaint mantle
#

What part of NMS do I look into

river oracle
#

idk

#

its NMS that is kinda a you issue now, its undoccumented and obfuscated

quaint mantle
#

Damn Thas crazy

river oracle
#

so you'll have to look around until you find it

quaint mantle
#

Real

#

Whatever bro who even plays versions higher then 1.8

chrome beacon
#

Almost everyone

white root
#

~90% of servers

quaint mantle
flint coyote
#

no

quaint mantle
# flint coyote no

i will change dead coralts to new ores, and there will be more than that
can u explain me why no lag ?

chrome beacon
#

As long as you don't write bad code it won't lag

last sleet
#

question, how can I add a library I created into my plugin?

quaint mantle
#

buildpath

#

file/projectstructure/library

#

:)

eternal oxide
#

preferably use maven and add it as a dependency

last sleet
#

I'm not sure I understand, sorry im new to this

quaint mantle
last sleet
eternal oxide
#

its your own library?

last sleet
#

I just made a "plugin" that has some code I frequently use so I can use that instead of always copy/pasting the same code

eternal oxide
#

ah ok

last sleet
#

and I was wondering if there was a way of using that plugin's methods in another project

eternal oxide
#

if you built this other plugin just run mvn install

#

it will then be available to maven

#

and you can access it using Bukkit.getPlugin("pluginName");

#

add it to your plugin.yml in a depend: [pluginName]

last sleet
eternal oxide
#

what ide do you use?

last sleet
#

instellij

eternal oxide
#

there is a maven command tab in IJ

#

no clue where though

#

be sure you have the correct project selected before you run mvn install

last sleet
#

yep that works

#

doesn't recognize it though

eternal oxide
#

scope shoudl be provided, but you likely need to refresh/update maven

last sleet
#

I did

eternal oxide
#

you can't have correctly ran mvn install then

last sleet
#

hm

eternal oxide
#

make sure you had this other project selected when you ran the mvn install

last sleet
#

oh true, it was 1.0-SNAPSHOT

#

thanks

quaint mantle
#

example i wanna disable sand fall physics

livid dove
#

So did a bit more investigating.

Yeah InventoryGetClickEvent.getHolder is 100% the reason most servers with custom items with gradient lines are laggy

#

If even one plugin has it on ur server as an event check

#

ur cooked

eternal oxide
#

preventing ALl falling sand will not be simple

#

oh sec, there is a new event for it

#

I think

quaint mantle
#

i don't need actually

#

i will prevent sand fall with placeblock and settype with no physics

#

and prevent too blockphysics

livid dove
#

Actually guys im gonna say it one more time because this is actually huge

#

Dont put getHolders in click events...

#

Might be common sense to some, but i found it today in a pretty decently popular plugin

#

And its the sole reason its a TPS drain

hybrid spoke
livid dove
#

getHolder takes a SNAPSHOT of the holder

#

So you be dumb and put that check in your onclickevent...

#

And have a load of gradient lore lined items in ur inventory

obsidian plinth
#

is their a region flag in world guardf to block crafting and spawning in snow golems and iron

opal carbon
#

why not ask this in the world guard discord lol

#

either way i dont see any on their documentation

hybrid spoke
livid dove
hybrid spoke
#

what profiler do you use

livid dove
#

On further investigation i found out its exactly what happens

#

and its hwy

#

paper added a boolean clause

#

to prevent it

hybrid spoke
#

where did you investigate

#

since the NMS impl doesnt do any of that

noble lantern
#

have you tried on the latest version by chance?

#

just seems odd something like that would go for 12+ years unnoticed by anyone feels like something else

livid dove
#

It took us 2000 years to try spinning the cylinder of an archemidies screw rather than the screw

#

Humans

#

are

#

by nature

#

morons

eternal oxide
#

Its not suprising. Some bugs hide for many years before discovery

livid dove
#

Do i get shit wrong half the time? Absoloutly

#

earlier today when i was a full goof

#

But thing is , as papi said, gotta stop holding in farts just cause ur scared of shitting urself

hybrid spoke
#

whats the code that causes this

noble lantern
livid dove
noble lantern
#

oh wait forgot you have to be viewing spigot code to see sources since its all impls

hybrid spoke
#

nah dont tell me you are using 1.14

noble lantern
#

1.19.1 from that profiler

livid dove
#

The maker of this plugin did some questional stuff with his legacy implementations lol

noble lantern
#

you could use reflection to get the holder tbf

hybrid spoke
#

or just dont get it three times

noble lantern
#

oh shit yeah

livid dove
#

My brother in christ its not the 3 times thats the issue either way

noble lantern
#

lmao

livid dove
#

There is another event that uses 1 single method and its still 1% thread on the profiler

hybrid spoke
#

then your server is garbaage

livid dove
#

foir just me on my own

noble lantern
#

well if the call is constructing something, 3 -> 1 is a gigantic help thats 300% increase

obsidian plinth
opal carbon
#

lmao

hybrid spoke
#

be aware that the "profiler" sprinkle percentages here and there

livid dove
#

I think its time to accept this one is correct

noble lantern
#

maybe ask choco about this when hes back, or make a bug report on spigot jira thing too

#

see what they gotta say about it

hybrid spoke
livid dove
#

Quite a decently popular plugin too

hybrid spoke
#

i really dont care

livid dove
#

lets just leave it at "this is a cool find and shows that any click event that uses onholder is likely a contributor to this issue"

livid dove
# hybrid spoke i really dont care

Aight i'll be real as ive tried to be cordial about it. Wtf is actually your problem?

You have gone out of your way to be an ass ngl chief

hybrid spoke
#

get used to it, you're welcome

livid dove
#

I pointed out an interesting find, folk were talking about it, you come in, say it aint right, say it doesnt work like that, says the profiler might be inaccurate, says my server is garbage and then, to top it all off, when everything is disproved or elaborated on, you just are like "I don't care".

Its a bad look my guy ngl

hybrid spoke
#

interesting. you've changed every of my statements

#

ah nvm the server is garbage part is true

opal carbon
#

yo whats goin on

opal carbon
#

2% is huge tps drain

#

got it

#

like cmon if ur gonna say huge at least have it be double digits

#

or at least like 5 or smthn idk

eternal oxide
#

Its enough

opal carbon
#

less then 2?

hybrid spoke
#

0.3 tps for an inventory click is a lot

opal carbon
#

oh for sure its a lot

#

but "huge tps drain"

noble lantern
#

spam clicking...

hybrid spoke
#

but the case on this is unclear. did he spam the click? is it a single click? whats in the inventory? and so on. but right now he's bullshitting at me for collecting facts

noble lantern
#

multiple players

hybrid spoke
#

he's not making friends right now

livid dove
#

*This wasnt even spam clicking, it was moving all the custom items from a shulker to a chest

noble lantern
#

wait

opal carbon
#

all im saying is less then 2% isnt exactly going to be the only factor

noble lantern
#

are you by chance

livid dove
noble lantern
#

looping every item and getting holder on every iteration

opal carbon
#

oh is that one person?

livid dove
opal carbon
#

if its 1 person on its still for sure

noble lantern
#

when you make a mock plugin does it do this?

#

i would seperate the issue

livid dove
hybrid spoke
#

it would be interesting to know what the exact method is that causes this

hybrid spoke
#

nah, you sent the onInventoryClick. onInventoryClickBSealer is causing it

#

whatever that method name is

livid dove
#

Oh yeah mb i sent the wrong one, there are 3 events with get holder one sec

noble lantern
#

oh good find

#

i never noticed that

#

lmao watch it be that

livid dove
noble lantern
#

oh hum

livid dove
#

Yeah...

#

Its the on holder chaps

#

I hold heartedly encourage you all to give it a test try with a load of gradient items in ur inventories

#

*gradient lore

obsidian plinth
livid dove
obsidian plinth
#

o thats what spark is

#

lol

#

i just assumed it was something to make sure the server runs better

noble lantern
#

meh spigot needs to give us pdc for inventories anyways

noble lantern
#

i think that would require inventories needing MetaData

#

and no thank you on that part

livid dove
#

Welp

#

I think that pretty much puts it to bed

#

2nd plugin

#

same problem

eternal oxide
#

?jira

undone axleBOT
low ridge
#

why am i getting this error in my console? 08.06 18:57:17 [Server] [INFO] [ChunkerDunkers] disconnected with: DecoderException : java.lang.IndexOutOfBoundsException: readerIndex(1) + length(1) exceeds writerIndex(1): PooledSlicedByteBuf(ridx: 1, widx: 1, cap: 1/1, unwrapped: PooledUnsafeDirectByteBuf(ridx: 61, widx: 1530, cap: 16384)) @ io.netty.handler.codec.MessageToMessageDecoder:98

rapid trout
#

For a project I have to use packets, but I can't import them, I saw on forums that it was necessary in the pom.xml to put in dependency spigot and not spigot-api but I have an error when I do it do (I'm in 1.8.8)

quaint mantle
#

run build tools for your version

#

?bt

undone axleBOT
sullen marlin
#

How can any other type of inventory be persistent?

obsidian plinth
#

I need you.

#

UwU

worldly ingot
#

Woah

#

Coming on a little strong there

obsidian plinth
#

How it be sometimes

#

i haventslept in like 39 hours

livid dove
#

With the inventoryholder

river oracle
#
Execution failed for task ':test'.
> No tests found for given includes: [sh.miles.domainsiege.internal.LightChunkTest.testInRange](--tests filter)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
``` I'm so confused what is going on here with IntelliJ its like spazzing out :L about to uninstall again so many issues with things that just work on vsc
eternal oxide
#

Yeah something funky going on with Spigot site. I uploaded a jar to the GroupManager page and changed from external site to direct download 14 hours ago. The update post is there and fine, but it still links to external site not download from spigot.

#

ok seems it was my mistake

#

I didn;t enter a version even though I uploaded the jar so it was ignored

celest sonnet
#

how may i use chatcolors that use color codes ?

#

such as &#ff4141

young knoll
#

ChatColor.of

worldly ingot
#

The ChatColor from the net.md-5 package, to clarify

celest sonnet
#

wait so i cant use it on like names of items?

worldly ingot
#

You can

river oracle
worldly ingot
#

It probably won't be deprecated

celest sonnet
#

'setDisplayName(java.lang.String)' in 'org.bukkit.inventory.meta.ItemMeta' cannot be applied to '(net.md_5.bungee.api.ChatColor)'

river oracle
#

you'd need to do ChatColor.PINK + ""

#

or ChatColor.PINK.toString()

celest sonnet
#

uhh no thats not what i need

#

i need the actual color code

river oracle
#

ok

worldly ingot
#

ChatColor.of(0xRRGGBB) + "Hello world"

#

I'm currently awaiting API to support components in ItemMeta

river oracle
#

use MineDown honestly or something like IridiumChatColorAPI

worldly ingot
#

Also an option but that gets you back a BaseComponent[], which again, we're waiting on API for

river oracle
#

pUwu pwease MD5

#

It works goodly I tested :(

worldly ingot
#

I already promised him fresh baked cookies

noble lantern
noble lantern
river oracle
#

thats a sinnn

noble lantern
#

getHolder() instanceof MyCustomInventory

You cannot stop me

echo basalt
#

us*

river oracle
echo basalt
#

I don't care enough about the getHolder thing

#

remove it and break compatibility

noble lantern
echo basalt
#

if it's that bad

river oracle
#

New spigot update dropped if your username is Burchard37 inventory holders break

noble lantern
#

idk the way they were explaining it sounded like a simple fix

#

just return the cached holder if exists (which, it should in this case)

#

or

#

hack it yourself with reflection lol

tranquil prairie
#

This method doesn't work when a player is near the edge of the block. I couldnt think of a good idea to fix this. Any ideas?

private boolean isOnGround(Player player) {
        double epsilon = 0.01;
        boolean onSolidGround = player.getLocation().subtract(0, epsilon, 0).getBlock().getType().isSolid();
        boolean inLiquid = player.getLocation().getBlock().isLiquid();
        return onSolidGround && !inLiquid;
}```
#

I thought maybe just subtracting a small amount from X or Z and checking if there is a block there but that wouldnt work with the different sizes of blocks

river oracle
noble lantern
#

yeah sucks

#

i got like 30 inventories in a list rn

#

also i suck at math

wise mesa
#

i need some help debugging this exception I'm getting

java.lang.ExceptionInInitializerError: null
...
Caused by: java.lang.NullPointerException
        at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
        at java.util.KeyValueHolder.<init>(KeyValueHolder.java:61) ~[?:?]
        at java.util.Map.entry(Map.java:1709) ~[?:?]
        at co.tantleffbeef.pluggytesty.armor.ArmorEquipListener.<clinit>(ArmorEquipListener.java:39) ~[pluggyTesty-1.0-SNAPSHOT.jar:?]
        ... 13 more

here's the relevant part of code causing it. line 39 is the line that starts with entry

private final static Map<TrimPattern, ArmorEffectType> trimMap = Map.ofEntries(

            entry(TrimPattern.COAST,    ArmorEffectType.CONDUIT_POWER),
...
#

I'll send the full file

#

?paste

undone axleBOT
wise mesa
#

this file was written a few months ago and so I don't remember how it works

#

but it just started causing issues

#

oh is it because my world doesn't have the experimental datapack?

sullen marlin
#

yes, one of those references is null

wise mesa
#

when would they be null?

#

this is 1.19.4, waiting to update until FAWE finishes updating

wise mesa
sullen marlin
#

well TrimPattern would be null when there is no experimental datapack

#

idk what ArmorEffectType is

wise mesa
#

okay that makes sense

wise mesa
#

once again old code couldn't remember

tranquil prairie
wise mesa
tranquil prairie
#

ngl idk what that is

wise mesa
noble lantern
#

Im about to lose my fucking shit

I JUST had this working, so i just deleted the import, jar and everything thinking i didnt need the import anymore (was using an event from this plugin) and now... i try to add it back and it will NOT RE-IMPORT FUCK

I tried

Invalidating my caches, renaming the packages, version and path, renaming the jar file, using the maven install-file command what the FUCK am i doing wrong?????????????

#

no errors.... this is with install-file

Just shows the import in dependencies but cant even view its source (could do it before i removed it) wtf is going on?

#

huh?? restarted my pc and now this? wtf? cant access any of my own classes but other imports are just fine...

burnt grove
#

I have a bit of an odd request that i don't even know if it's possible, but i'll try to summarize in the most comprehensible possible way

I'm developing a Level System plugin, basically what you would find in any RPG, you get XP from doing tasks (killing mobs, gathering wood, mining), you level up and you get skill points to spend in your skill tree

In this project I'm implementing a rank system, that acts as a level cap until you change to a higher rank, but leveling up your rank is different than a normal lvl up

To lvl up the rank the player has to consume a specific item, let's say an item called "Rank Up Apple", obviously it's not a vanilla item, I'm using the ItemAdder plugin to create this item

My question is, from my own plugin, how can i check if the consumed item was indeed the "Rank Up Apple" to then change the player rank? i don't think this is possible using the normal ItemStack interface because it's not a vanilla item, it's a custom item

I'm studying the ItemsAdder API to check if there's anything there that can help me identify custom items from within my plugin, i hope I'm not just losing time

noble lantern
#

?pdc

noble lantern
#

From there you can change the rank on the consumed food event (forgot its name exactly but i assume you know it) with your methods that you have

Considering these are your own custom items your creating with your plugin of course, items adder just has an api that checks for you against theyre own items

burnt grove
#

i'll look into it, thanks a lot

noble lantern
#

guess imma need to find an idea ive been at this for over an hour and nothing

livid dove
#

Holy shit i was right...

Pic 1: The 3 plugins running normally. All with the getHolder method.

Pic 2....

#

the checks replaced with something otehr than getHolder

#

All the bigger , inventory dealing , plugins.... they are supposed to be at like less than 1/10th the execution time...

livid dove
#

Im both extatic and distraught lmao

noble lantern
noble lantern
livid dove
noble lantern
#

slowly starting to lose belief in the jetbrains supremecy now

#

nope

#

even with the flags for maven, thats the only error

#

im at a loss tbh

noble lantern
livid dove
vivid tangle
#

hello there,

how to start to dev with spigot, i know oop base of java, any conseil ?

wise mesa
#

poo base?

vivid tangle
#

oriented objet

wise mesa
#

ah

#

oop

#

that makes sense

vivid tangle
#

yeah sorry 🤣

wise mesa
#

do you have an idea of something you want to make

#

and also what ide are you using

vivid tangle
#

no, i don't have objectifs, i just want to know of this work, personnaly, i used netbeans because school

noble lantern
#

i got it smh

wise mesa
#

others here would disagree with me

noble lantern
#

ctrl + z doesnt fully bring back files when deleted in intellij even though it literally gives you a popup saying to bring it back

Neat...

What an amazing feature intellij 😄

wise mesa
#

here's a tutorial for idea, there's one for netbeans but I don't think it uses maven or gradle so not as great

#

that will just show you how to make a blank plugin

#

which will have an enable message

#

the main part of spigot is events

#

your plugin can listen for events

#

for more information about how to do that read this

vivid tangle
#

ok, so is essentialy a responsive of event

wise mesa
#

yes

vivid tangle
#

they don'T have notion of classe traitement directly, like a specific action

wise mesa
#

the basic idea is that when things happen, events will be broadcasted that you can listen to

#

and react to

#

and even sometimes cancel

#

and there's all sorts of events

#

super common stuff like PlayerMoveEvent and far less frequent things like SheepRegrowWoolEvent

vivid tangle
#

ok

#

i see

#

nothing more

wise mesa
#

that's all of the spigot packages

#

which is a lot

#

and most things you'll want to do you can do purely through the spigot api

#

you might need to add additional dependencies

#

and for almost everything you won't actually need to interact with internal game code

#

hopefully you'll never have to

vivid tangle
#

@wise mesa where i can found that : internal game code

remote swallow
#

?nms

wise mesa
#

mess with the spigot api for some time first

#

if you don't need to mess with the internal code, then don't

#

especially if you're just starting off

#

?ask

undone axleBOT
#

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

wise mesa
#

there's some command for this

#

it doesn't let you upload a pic because you're not verified

#

but you can still send an embed

#

?ss

#

no

#

does anyone know

#

idk the website everyone uses

#

@quaint mantle

#

?img

undone axleBOT
wise mesa
#

i want you to use that

#

so you can ask your question publicly

#

idk man

#

it says error is not very helpful

#

okay fine

#

here's the image they sent me

#

I don't undertstand it's probably just an overlay on their stream

#

it's not on their server

#

it's just part of their stream

#

that they overlayed

remote swallow
#

Tiktok doesn't have a public api you would need to use a 3rd party one and do stuff according to how it works

#

The tnt levels are prob just bigger explosions

livid dove
#

Might be worth doing a big oll annual PSA on why putting kn holder methods into on click events is a really bad idea

flat lark
#

great ui and simple to use.

livid dove
#

It ws never the items

#

It was the fact me moving 20 cobble stacks was reloading the other 10+ custom items in the same inventory... 20 times...

#

Once every click

#

This took my brewery usage usage from 12%... to 0.7%

#

It is, quite literally, THE TPS problem

noble lantern
#

toooo be fair

#

everyone always does say not to use holders

#

people just dont care most of the time :p

#

also there is this basically saying what your experiencing from 2021

#

make a spigot post about it and the correct way to do it = free spigot forum clout

tranquil prairie
#

This method doesn't work when a player is near the edge of the block. I couldnt think of a good idea to fix this. Any ideas?

private boolean isOnGround(Player player) {
        double epsilon = 0.01;
        boolean onSolidGround = player.getLocation().subtract(0, epsilon, 0).getBlock().getType().isSolid();
        boolean inLiquid = player.getLocation().getBlock().isLiquid();
        return onSolidGround && !inLiquid;
}```
jagged bobcat
#

Can't you get players location and check the block face of block below and check if its solid

#

And see if distance between the edge and player is < ~0.01

#

Not edge but block face

tranquil prairie
#

That would still have the same effect

#

Wait wym

#

Check all blockfaces?

#

There deff is lmao just prob not easy

jagged bobcat
#

When I get home I can try to shoe

#

Show*

tranquil prairie
#

Alright

noble lantern
#

i am SO upset

#

ive went through like 3 drop editing blocks

#

andi wanted to add my own auto pickup and for fucks sakes no one uses this event to add drops r_baby_cry

#

im gonna make a rant on the forums about people not using this, its truly a crime

quaint mantle
#

just a small query, how can i enable allow cheats, in server properties there are no option for that.

tranquil prairie
remote swallow
#

you just have to be opped

#

and you can use them

quaint mantle
#

it just saying cheat is not enabled in server

remote swallow
#

where does it say that

quaint mantle
remote swallow
#

yeah, where in game

#

like when running a command?

quaint mantle
remote swallow
#

what command

quaint mantle
#

gamemode

remote swallow
#

are you by chance using geyser and you are on bedrock

leaden spoke
#

Hello, I'm new to building with the build tool. I build Spigot 1.19.4 succesfully with:

export MAVEN_OPTS="-Xmx2G" java -Xmx2G -jar BuildTools.jar

Now I'm trying to build 1.20 with:

export MAVEN_OPTS="-Xmx2G" java -Xmx2G -jar BuildTools.jar --rev 1.20

and it Fails with a timeout.
Exception in thread "main" java.net.ConnectException: Operation timed out
What am I doing wrong?
I'm on MacOs

chrome beacon
#

?paste

undone axleBOT
chrome beacon
leaden spoke
#

Okay 👍

hearty zenith
#

I wanna add koji's skyblock custom items to shop any plugin for that? Like I tried the fancy shop and economy shop fancy shop doesn't work, economy shop adds it but as a normal item and not as a custom item with abilities

#

In royal economy how do I do it?

hearty zenith
#

Ohk

dry forum
#

this makes 0 sense

        String uuid = String.valueOf(player.getUniqueId());

        File file = FileUtil.getFile(uuid + ".yml", "data");
        YamlConfiguration configuration = new YamlConfiguration();
        try {
            configuration.load(file);
        } catch (IOException | InvalidConfigurationException e) {
            throw new RuntimeException(e);
        }

        configuration.getConfigurationSection(name).getConfigurationSection("data").set("slot", 10);
        try {
            configuration.save(file);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }```

player = a valid player
name = "t1"

```t1:
  data:
    slot: 9
    page: 1```

slot stays at 9 it isnt changing from the code i sent, no errors
chrome beacon
dry forum
#

yes

#

there is only 1 file so

#

also its the same player being put into the function

chrome beacon
#

Make sure that FileUtil is reading in the correct folder

dry forum
#

it is "data" is the folder

#

and my plugin folder looks like

PluginName
-> config
-> data
-> my_uuid.yml

tardy delta
#

no need for String.valueOf

chrome beacon
tardy delta
#

and instead of

YamlConfiguration configuration = new YamlConfiguration();
        try {
            configuration.load(file);
        } catch (IOException | InvalidConfigurationException e) {
            throw new RuntimeException(e);
        }```
just do YamlConfiguration.loadConfiguration
dry forum
# chrome beacon Show your FileUtil class
public class FileUtil {

    public static void createResourceFile(String name, String directory) {
        File rf = new File(PlotAddon.getInstance().getDataFolder() + File.separator + directory, name);
        if (!rf.exists()) {
            rf.getParentFile().mkdirs();
            PlotAddon.getInstance().saveResource(directory + File.separator + name, false);
        }
    }

    public static void createResourceFile(String name) {
        File rf = new File(PlotAddon.getInstance().getDataFolder(), name);
        if (!rf.exists()) {
            rf.getParentFile().mkdirs();
            PlotAddon.getInstance().saveResource(name, false);
        }
    }

    //
    // Constructor
    //

    private final File file;
    private YamlConfiguration configuration;

    public FileUtil(File file) {
        this.file = file;
    }

    public YamlConfiguration getConfiguration() {
        YamlConfiguration configuration = new YamlConfiguration();
        try {
            configuration.load(this.file);
        } catch (IOException | InvalidConfigurationException e) {
            e.printStackTrace();
        }
        this.configuration = configuration;
        return configuration;
    }

    public File getFile() {
        return file;
    }

    public void save() {
        try {
            this.configuration.save(this.file);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static File getFile(String name, String directory) {
        return new File(PlotAddon.getInstance().getDataFolder() + File.separator + directory, name);
    }```
tardy delta
#

and instead of getConfigurationSection(name).getConfigurationSection("data"), getConfigSection(name + '.' + data)

#

lol

dry forum
#

ik

#

im trying everything to get this to work

rigid otter
#

I have a problem with memory. Memory is continuously increased. If it is caused by loading a lot of chunks, why unloading worlds doesn't affect? What's wrong with it?

eternal night
#

I mean, your JVM won't need to garbage collect until you are getting close to the max memory configured

mellow edge
#

how can I instead of ClickEvent.Action.RUN_COMMAND just run plain code?

rigid otter
eternal night
#

a server restart obviously restarts the entire process ?

#

beyond that, you don't want to manually garbage collect

#

reduce your maximum memory allocation if you want java to use less memory

hybrid spoke
#

and the gc is a diva

eternal night
mellow edge
#

can I implement my own ClickEvent natively or maybe extend the BaseComponent/TextComponent or smth?

eternal night
#

no

#

run command click event is interpreted by the client

#

the server cannot do more than just, have it run a command

mellow edge
#

OK, then I am going to have to do it in the weird way

#

and thank you

tardy delta
rigid otter
#

What about loading chunks until full memory, it will unload some chunks to load next or it crash the server?

chrome ferry
#

Sign#setEditable is is only strictly on restricted in the event and nothing else?

tardy delta
#

throws an out of memory error if the chunks cant be unloaded due to loaded entities and such

#

how many gigs is it using

rigid otter
#

8GB

#

How can I know if memory is almost full because of chunks and entities?

tardy delta
#

some kind of profiling tool

#

or ask it at Runtime.getRuntime().freeMemory()

#

or use visualvm to inspect memory dumps

#

tells you how much objects of each type are instantiated

steep wave
#

Hello, I have a lot of listeners listening to the same event. Is there a way to ensure certain listeners "listen" in a certain order? i.e. I want to ensure ListenerA is executed after ListenerB.
EventPriority is not enough for my use case as I have 10+ listeners. Is there a library that handles this?

chrome beacon
#

Use a single listener and call you methods in an order?

steep wave
#

Can't, they all do other things

#

generally it would be very bad to have everything in 1 listener anyways

chrome beacon
#

Can't, they all do other things
Why does this matter

tardy delta
#

all your listener will be called for every single event ew

pseudo hazel
#

writing them in order procudurally is the only way to guarantee the order afaik

tardy delta
#

i hope you know damager.getLocation() returns a new location on every invocation

steep wave
steep wave
tardy delta
#

have one base listener that delegates responsability to the modules

steep wave
#

I was just wondering if there is a different solution

pseudo hazel
#

single responsibility is a lie anyways

steep wave
tardy delta
#

it returns a new location object every time you call it

pseudo hazel
#

the responsibility of the listener is to make sure events are passed and handled correctly

tardy delta
#

but the listener also shouldnt handle low level impl details, it should delegate the work

#

variables 💀

#

why: idk

pseudo hazel
#

yes agreed

steep wave
#

Actually says what it does in the code. Basically checks if the projectile hit the head part of the player.

#

So you run the code and it doesn't work?

hybrid spoke
chrome beacon
hazy parrot
#

wow

#

wrong reply

hybrid spoke
hazy parrot
hybrid spoke
#

will do !

pseudo hazel
# hybrid spoke will do !

if only you read up on the subtraction operator on the docs, you wouldnt have to ask such a question

pine forge
#

How would i check if a player traded with a villager for a certain item?

pseudo hazel
#

for that you would probably use an inventoryclick event or something

pine forge
#

Okay

#

I just found that paper has a PlayerTradeEvent

#

i might use that one

steep wave
#

Obv, we have different methods.

#

It's just not appropriate for this use case...

drowsy helm
#

having two separate listeneres is such a negligible performance reduction lol

#

not worth violating a code principle for that

livid dove
#

Hehe listeners having a minimal effect on performance if you don't do a separation check

#

inventoryClickEvent.getInventory.getHolder() called, it wants its incorrect assumptipn back 🤣

steep wave
#

No. Not in this case.
I have 10+ listeners for a particular event across various modules. They all do different things and have different checks.
I just wanted to know if there was an alternative - or an addition - to EventPriority. (except for just ordering the listener in they way I want them executed.)