#help-development

1 messages Β· Page 791 of 1

sterile token
#

thanks!! PaimonPat

valid burrow
#

wtf is gpt dong

#

it doesnt make sense

#

its stupid

sterile token
valid burrow
sterile token
#

getOptions()

#

wait wait

valid burrow
#

where

sterile token
#

that not a serializer

valid burrow
#

i know

sterile token
#

serializers looks like

valid burrow
#

serializer is in a differnt class

#

i just told it to make my class work with the sirializer and it gave me this

sterile token
#
// example in pseudo code
class CustomItem implements ConfigurationSerialization {

  public CustomItem(Map<String, Object> data) {

  }

  public Map<String, Object> serialize() {
    Map<String, Object> data = Maps.newHashMap<>();
    
    return data;
  }

}
#
List<CustomItem> items = Lists.newArrayList<>(); // Items repository, can you either Lists or Maps
// pd: If you working with map, you should either saves the keySet() or values() 

void reload() {
  for (CustomItem item : (CustomItem) getConfig().getList("any-path", new ArrayList<>())) items.add(items);
}

void save() {
  getConfig().set("any-path", this.items);
  getConfig().save8);
}
#

Thats what i use i have implemented in my kit preview

#

If you dont add the default in the getList(), them if your any-path list is empty will be an NPE

#

@valid burrow i hope it helps you, if need something let me know please

storm crystal
#

whats the main difference in:
make db connection -> do stuff once -> close connection <= and repeat for each one thing/action
make db connection on start -> do stuff continuously -> close connection on disable <= only once per plugin disable/enable

young knoll
#

You don’t make and open a new connection constantly

sterile token
#

yeah

#

you just maintain the connetion opened

#

Because connection re-opening is an intensive operation

storm crystal
#

interesting

#

so guy from yt tutorial made huge mistake then

sterile token
#

yeah seems weird but has its fundaments

storm crystal
#

cuz he told to keep making new connections and closing them

sterile token
storm crystal
#

so if I want to open and close it on server enable/disable i dont really need to make any utility methods for disabling / enabling in db manager utility class, yeah?

sterile token
#

atleast minecraft ones

storm crystal
#

lets say I want to make utility class for db management

#

I dont really need to make methods for making and closing connection if Im gonna do it just once on plugin enable or disable

sterile token
#

well, in my case i do a class manager for the db where i declare my mongo collections, opening and closing connection. And also catching exceptions

storm crystal
#

do I get that right?

#

declare mongo collections is what? making dbs?

sterile token
#

Then each repository manager which hand a specific data collection

sterile token
storm crystal
#

I will most likely

sterile token
#

Collections is the same as tables from sql

#

they are for agrouping data things, they allow to separate the things

storm crystal
#

well at first I want to add them by hand for stuff like custom items

sterile token
#

because you dont mess player data with mini game data for example, there you use different tables or collections depending the db engine you use

storm crystal
#

stuff like player stats would be changed or created on player's first join automatically

sterile token
#

yeay what i do is the next

#

For big problems i use a mix of persistent db (Mongo or Mysql) + cache database (Most of time, i use Redis here), because each data loading all time is recursively intesive too

#

But for smalls plugins, you can catch data using caffeine for exampke

storm crystal
#

may I ask what catching data is

sterile token
#

Player joins:

Ask to cache if the data exists, if not exists in cache ask to database. If database, doesnt have any data you create the player data in the cache and finally inser the player data to database

wet breach
sterile token
wet breach
#

ah

sterile token
#

sorry if i sound inexpert there

storm crystal
#

why should I do cache

#

like cant I just read stuff from db

sterile token
storm crystal
#

I assume you need to make your own cache maker methods by hand?

sterile token
#

because each data asked and returned from db is more than intensive than a connection opening or closing at the same time

eternal oxide
#

db access is VERY slow

sterile token
#

But proper caches is for example Caffeine and there some more

storm crystal
#

okay what if I want to edit db

#

do I just edit cache

eternal oxide
#

cache is anything that holds the data in memory, a Map

sterile token
#

also when always using db every data fetch must be done async. Because mc has only 1 thread, so it blokcs the server operations until the data is retuned from db

storm crystal
#

okay im confused

#

about

#

db and cache relation

sterile token
#

were you confused i can help you

#

right give 1m i explain

eternal oxide
#

Any data you have in memory is "cached data"

sterile token
#

Cache is temporal data in memory, what ever you store tho

#

A variable is cached data, because its keep inside the memory (RAM talking about pcs)

#

So what a cache does, is mantain data in memory, but what happen if server goes down? Well data is losted

wet breach
eternal oxide
#

yes it is

sterile token
wet breach
eternal oxide
#

even if on the same host it's a magnitude slower than accessing memory

wet breach
#

yes but redis is not memory only

storm crystal
#

okay so cache is like screenshot of current data state yeah?

wet breach
#

you still have to communicate with redis

#

also mysql just like redis can store in pure memory too

slender elbow
#

oh my god frostalf is actually speaking truths this time around

#

so good

eternal oxide
#

mostly

storm crystal
#

okay so I have cached data and db, how do I edit stuff now?

#

since I get how to read it, from cache

eternal oxide
#

you edit cache

wet breach
#

so, to say DB access is slow is not true especially when MySQL is quite capable of handling literally millions of accesses without you noticing any slow downs. Most people who notice issues is because they actually don't know how to setup a DB like mysql IE, their configs are not using ideal values

storm crystal
#

and when I close server cache gets updated to database?

#

I mean I should make it like that?

sterile token
#

@storm crystal

Basically to summarize:

Cached data refers to any type of data that is stored in memory to be used at some point in time. This cached data is of a non-persistent type, that is to say that if you close your program it will be lost.

On the other hand, databases are known to be persistent storage. That is to say, they always store the data that you send or delete, if you ask them to do so.

Is it more or less clear?

#

sorry, it didnt copy paste

eternal oxide
#

you push your cache data to your db

wet breach
storm crystal
#

that I want to store this into a database

#

how would I cache this?

#

Map of arraylists that would have maps?

wet breach
#

easiest way in Java without external applications, is to create an objectt map

#

you would turn that data there, into an object

#

and keep that object in a map

#

ideally it would at some point save back to the persistent storage if there is changes to it

storm crystal
#

is it very bad of an idea to make method that would save cache into db during server uptime?

wet breach
#

there is various ways of implementing when you want to save the ddata

#

you can save it only when it changes, you can do periodically

#

or even at shutdown

#

or do all of those

sterile token
#

@storm crystal

What is done is to do the following, when a user connects, his information is searched in cache.

If it exists in cache, it proceeds with the rest of the logic. For example show a message in the chat that such a player with x rank entered the server.

Otherwise (if it does not exist in cache), it will query the database to see if its record exists. If it exists, it will put it in the cache until he disconnects or is kicked.

If it does not exist in any of the sides, it proceeds to create its cache and proceeds with the other actions. Asynchronously, its insertion in the database is generated.

Once the player is disconnected or expelled, the cache sends this information to the database. And leave that information a while longer in case he reconnects.

In case of updating, it works on the cache information in case it is a very important change, it sends it to the db immediately. Of course, from time to time the cache requests to the database the information to keep the information updated.

#

I think i more or less explained the base i could be wrong ofc. If someone else disagrees let me know please so we all learn more πŸ’ͺ πŸ’ͺ

storm crystal
sterile token
#

in case it doesnt exists in the db, the rank or player data will be created in the cache

#

But yeah you more or less getting the idea

storm crystal
#

like taken from standard template of a newly joined player?

sterile token
#

i cant understand that last message

#

i cant translate it sorry tho ahhhhhhhhhhhhhhh

storm crystal
#

like if I had formatting style in chat of "[Lvl] <Player>: Message" and if player joins and there is no Lvl of that player in both cache and db query then it would just create default equivalent which would be Lvl.1 under that player's UUID to use

sterile token
#

sorry for not answering fast but im wrriting an essay while helping for school hhehe

storm crystal
#

fair im patient

sterile token
#

Let me explain as a user and custom options right?

#

DuskTaler conenct the server for firs ttime, data is asked to cache doesnt exists? true, will ask to database. Exists? no well so create a custom object for the player in the cache

Player chats, does he has on join chat disabled by default? We check it in his object created before, so far it will be true because its a new player. In case he has already played before it wont be true, it will be the value returned from cached data

#

Do you understand more or less?

storm crystal
#

so that how would an example method to grab data look like?

sterile token
#

seen from the top yes

#

will have some modifications more fully accurate

storm crystal
#

well yeah operations on Maps and Objects but that's kinda semantics

sterile token
#

Data will be first returned to cache, then grabbed from there data you will use

#

But fully accurate your example you fullly understand it hehehe

storm crystal
sterile token
#

practice makes you better

sterile token
storm crystal
#

so on player leave I'd take this player and return his currently edited data to main cache that'd get saved to plugin to ensure that it wouldnt be lost?

#

like in case of heavy traffic or something

sterile token
#

1m i wil ltranslate that

storm crystal
#

okay

#

is English not your primary language?

sterile token
#

yeah, i talk spanish nativly in case you dont understand me thats the reason

#

I try to do my best for getting understand haha

storm crystal
#

No problemo xd

sterile token
#

Not sure what you tried to asked on top, but what i understand. Is that if the user disconenct the cached data is saved to the db and stays in the cache for some time. Why still in cache? Because player can reconnect usually went your conenction goes down for some seconds

storm crystal
#

well save player data to cache when they leave to ensure that less data will be lost ye?

sterile token
storm crystal
#

oh okay

sterile token
#

because cache contains temporal data

#

database is what persist them, for not loosing them when the mc server or app goes down

storm crystal
#

so it would be:
player leaves -> his cache is added to database -> cache is reloaded

#

?

storm crystal
#

temporal is something else

sterile token
#

oh right

#

yeah im no the best but you get it heheh

#

also the cached data is saved to database every x time

storm crystal
#

well they are kinda synonyms I get what you mean

#

Id use temporary when I want to say that something is not permament

#

because temporal is in relation to eternity which is kinda abstract

#

and not many people know temporal

sterile token
#

perfect, i had to go but more or less you understand the logic

#

If you want them i can help you more about this

storm crystal
sterile token
#

Remember this

#

always when working with dbs calls ASYNC operations

storm crystal
#

ill work with it tommorow cuz its 2 am rn

#

but ill make notes on theory

storm crystal
sterile token
#

its perfect best wishes and good night my mate. Just tag me for any other help

sterile token
molten hearth
#

mhh im having a bit of an issue, i need a custom block placement system but of course if i just set a block at a location it might include the player, but this has many variables so is there like idk a utility method that checks if a player shouldnt be able to place a block at a location because it intersects with the player

young knoll
#

You can easily check if the bounds of a block intersect the player

#

Or any entity for that matter

#

Create a bounding box for the block and then check if it intersects the players bounding box

molten hearth
#

yeah im doing that

#

but its returning false

#

lol

#

when the player is standing right in it

#
Block block = event.getClickedBlock();
BlockFace clickedDirection = event.getBlockFace();


Location newBlockLocation = block.getLocation().clone().add(clickedDirection.getDirection());
Block newBlock = block.getWorld().getBlockAt(newBlockLocation);
BoundingBox blockBoundingBox = newBlock.getBoundingBox();
if(blockBoundingBox.overlaps(event.getPlayer().getBoundingBox()) || event.getPlayer().getBoundingBox().overlaps(blockBoundingBox)) { // always false
                    return;
}```
quaint mantle
#

someone help me

remote swallow
#

?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!

quaint mantle
#

i need help with setting up a server setup

young knoll
#

Air probably returns a box with 0 size

#

Use BoundingBox.of(block)

crimson mason
#

can someone rq just help with a custom recipie plugin, i got the code but i dont know how to actually give the player the custom item.

quaint mantle
#

can someone help me with luck perms

drowsy helm
#

if its registered they should be able to craft it without any additional code

quaint mantle
#

What is mirroring my console output? So many commands they duplicate, a player types one command it duplicates in the console and is very hard to keep up with.

warm pine
#

How do i make my plugin support multiple minecraft versions?

quaint mantle
#

What is mirroring my console?

grand flint
grand flint
#

did u restart

quaint mantle
rotund ravine
#

Try removing plugins

quaint mantle
#

What processes exist on a server

#

ok

#

I will

grand flint
#

ur server

#

is a process

quaint mantle
#

Even BuycraftX fetches twice.

grand flint
#

ok?

#

delete ur plugins till it doesnt happen

quaint mantle
#

Delete em?!

grand flint
#

u literally just said ok to that

quaint mantle
#

oh and messages send twice

#

what plugin would do that

grand flint
#

BRO

#

HOW CAN WE KNOW??

#

did u restart ur server

#

remove ur plugins one by one till it stops

quaint mantle
#

oh you were talking restart my server?

grand flint
#

???????????

quaint mantle
#

no you just use plugmanx

#

you disable them slowly

grand flint
#

ok

#

if u know

#

why are u asking

warm pine
quaint mantle
grand flint
#

so ur telling me u have 0 plugins?

#

go ask minehut idk

#

did you restart ur server yet?

#

probs some minehut misconfiguration shit

quaint mantle
#

wtf

#

jk

warm pine
grand flint
#

idek what the api version is for lmao wait for someone else

bitter rune
#

whats a better program than vs code for c sharp?

#

im having a lot of issues; after an hour messing with chocolatey, then finding out i need to patch it to have old commands back to install scriptcs ... now its just bad

near night
#

just base vs

#

vs code is pain for c#

#

vs code is pain for java

#

vs code is pain.

bitter rune
#

just c worked great

near night
#

yeah for c, c++, js/ts, and go it works

quiet ice
#

Isn't that just future-proofing?

wet breach
shadow night
#

Isn't that what python doesn't have

wet breach
#

It just means to an extent it should work in later versions

quiet ice
#

So future-proofing basically

molten hearth
#

what is the modern fancy way of achieving custom breaking times for blocks in 1.20+

quiet ice
#

But that basically also implies backwards compatibility

#

So basically either term in nonsense

molten hearth
#

(disregarding compatibility for older clients)

shadow night
wet breach
#

Which is obviously not the case

quiet ice
#

Yup

shadow night
#

I personally support versions down to beta 1.7.3!

#

Jk

wet breach
#

That would be impressive

quiet ice
#

Whatever

shadow night
wet breach
#

It isnt impossible per say, just your jar size would be a bit hefty with mostly compatibility code more then anything lol

shadow night
#

Beta 1.7.3 bukkit even does events differently than modern bukkit

#

The classic class with empty methods

wet breach
#

Doesnt mean you cant have two different classes for events depending on version

shadow night
#

Yeah

#

I never did that so idk how

#

You'd also have to register them in seperate ways, soo

wet breach
#

Easiest way is with an enum manager

shadow night
#

A what

wet breach
#

You use enums to invoke the appropriate class needed. You can make enums hold the value of classes

#

So its called an enum manager

shadow night
#

Hmm

wet breach
#

I used to have a good example of it

#

Maybe i can create a new one

shadow night
#

Bukkit changed so much

wet breach
shadow night
#

Hmm

wet breach
#

That is one way here is another

#
   Y_TYPE(1, Y.class), Z_TYPE(2, Z.class);
   int id;
   Class c;
   public Type(int id, Class c) { this.id = id; this.c = c; }
   public static X createInstance() throws Exception {
      return c.newInstance();
   }```
#

The first way is more ideal as no exceptions

#

But as you can see enums can hold classes as a value lol

shadow night
#

I did not know that lol

#

That's actually pretty promising

molten hearth
#

right so actually another issue im having is detecting when a client is breaking a block during a PlayerInteractEvent

wet breach
#

There is a break event

#

Or start break animation thing

molten hearth
wet breach
#

Ah

molten hearth
#

which is where im having an issue lol, I need to cancel the interact because i implement custom logic when the block is left clicked (which conflicts with vanilla mechanics), but also i need to keep vanilla breaking mechanics

wet breach
#

Might have to use reflection

#

To get the data that isnt given via api

molten hearth
#

could be but im not sure what data im exactly looking for or from which classes tbh

wet breach
#

Well the client reports when player starts breaking a block

#

So that means where interact is called the data for such should also be present

wet breach
wet breach
#

So you could just have enum of version, each version contains the appropriate class values

shadow night
#

I gotta do that fr

tacit thistle
#

you can also just use a Supplier instead of overriding a method for each entry

wet breach
#

Depends which way you want to do it but yeah. Here is example of using supplier method


enum Type {
    Y_TYPE(1, X::new), Z_TYPE(2, Y::new);

    private int id;
    private Supplier<X> supplier;

    private Type(int id, Supplier<X> supplier) {
        this.id = id;
        this.supplier = supplier;
    }

    public X createInstance() {
        return supplier.get();
    }
}```
ivory sleet
#

Its a shame we can’t have generic type params on enums

wet breach
ivory sleet
#

enum SomeEnum<T>

#

T would be illegal

wet breach
#

Oh right would have to change it to have a normal class for that

#

Instead of enum it would be
public Type(int id, Class<? extends X> c) { this.id = id; this.c = c; }

ivory sleet
#

Yeah, I suppose one could use a sealed class or sth right, to make it enumish

#

But yeaa :)

slate tinsel
#

Can I make a spigotmc resource private? So I can only see it?

candid galleon
#

why would you post it then

wet breach
slate tinsel
# wet breach Sure, report it to have it removed lol

So meant like making a "tiktok" private. In this case I want to delete a resource but I also want to save it for myself in case I want to build on it in the future or something instead of deleting it completely

wary harness
#

is it possible to save whole HashSet to yml file

#

I got HashSet which contanis few locations per chunk

#

and now trying to save it but file ends up empty

wet breach
#

I have a defunct resource currently that i havent touched for a few years now

chrome beacon
#

same

wet breach
#

I am free to update it at anytime and for the mc versions it still works for those people can still download it if they want

#

There is no advantage or different features you obtain if it could be private

#

Just ignore the resource and leave it there. Come back to it when ever

wet breach
#

You have no obligation to respond to comments on it either lol

slate tinsel
#

sorry πŸ˜”

bitter rune
#

You're trying to save every single block in every single chunk in a .yml file? If that's the intention I suggest a database that's way to much information for a .yml

drowsy helm
ivory sleet
#

Probably yeah lol

#

I mean there are enum semantics where its allowed in other languages

drowsy helm
#

Well ig an enum is just a fancy class lol cant see many usecases where a generic would be useful though?

ivory sleet
#

I mean it depends on the approach u’re taking

#

Like in the case of rust’s Option and Result enum, having type constructors is absolutely life saving

inner mulch
#

Is it possible to change the nametag of a player to a color gradient via packets?

#

(or other methods?)

ivory sleet
#

Nametag?

#

Like the name above their head?

#

Or in tab?

#

(Or both?)

inner mulch
#

Above head

#

@ivory sleet sorry for my late response

drowsy helm
#

Dont think overhead nametag can be coloured

#

You can do a team name though

#

Definitely ways to spoof it

inner mulch
#

Ive Seen Other servers with this Feature, but i dont know how they do it

wet breach
#

Could also use an armor stand as well

opal saffron
#

Hi
I want to display several unicode characters, but some of them (those whose charcount is 2) are displayed separately.
e.g. \u26CF which is pick emoji displays correct, as ⛏ but
\uD83D\uDD25 which is fire emoji displays as οΏ½οΏ½.
How could I make it display as πŸ”₯?

knotty aspen
#

they simply might not be part of the font the client uses

#

so you would need a resourcepack with your own font that includes them

opal saffron
#

but not from plugin

opal saffron
wet breach
#

Not sure why intellij will report anything with unicode characters lmao

#

There isnt really a wrong character code except if you go outside the bounds

opal saffron
slender elbow
opal saffron
#

α½’ is \u1F52 and 5 just stays

slender elbow
#

it'll be \u1f52 as a single escape and separately the character '5'

wet breach
#

Weird it does that since that is the official unicode point

slender elbow
#

what happens if you just.. stick the fire emoji in there

slender elbow
#

jls only allows up to 4 hex digits after \u

opal saffron
wet breach
#

Hmm wonder if you just shoved the raw byte in there instead

hazy parrot
#

Is your encoding set correctly?

opal saffron
#

i have utf-8

slender elbow
#

alt enter

#

not that it should be any different but, you never know i suppose

wet breach
#

UTF-8 Encoding:
0xF0 0x9F 0x94 0xA5

The raw encoding of that emoji if you want to try some other methods

wet breach
#

And then have that method just stick in the string its needed in

slender elbow
#

StringBuilder.appendCodePoint(int) :^)

wet breach
#

Try this Character.toString(0x1F525)

#

@opal saffron

opal saffron
wet breach
#

Ok i have another

#

new String(Character.toChars(0x0001F525))

opal saffron
wet breach
#

Java sure is being stubborn -.-

#

Character.toString(0xF09F94A5)

#

If that dont work i will be home in an hour and can find more solutions lol

opal saffron
#

java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF09F94A5

#

-_-

wet breach
#

Lol

slender elbow
#

make sure you are compiling with utf-8 encoding, in gradle it's options.encoding = "UTF-8" in the compileJava task, idk where you'd specify that on maven

slender elbow
#

proof or it didn't happen

opal saffron
slender elbow
#

compile with utf-8

#

not the running server vm

opal saffron
slender elbow
#

i mean the server should run with that too, that's great, but that's only half the story

opal saffron
#

everywhere i have utf-8

slender elbow
#

how are you compiling your project exactly? what do you click or run to build?

opal saffron
#

running maven package

slender elbow
#

you need to tell maven in the pom.xml about the encoding

#

google "maven compile with utf-8"

opal saffron
slender elbow
#

no

#

no

#

please google

opal saffron
#

i have all of that

opal saffron
slender elbow
#

do you have the compiler and resources plugins applied?

opal saffron
#

yes

slender elbow
#

yeah so

#

i believe the kids these days call this a skill issue

#

runs

opal saffron
#

ehhh

arctic shuttle
#

how would I disable putting an item in ANY CONTAINERS AT ALL? like I know how to disable from taking out but not putting in

young knoll
#

Cancel click event if clicked inventory is a container inv

arctic shuttle
young knoll
#

Click event is fired for both

arctic shuttle
eternal oxide
#

you will never account for every way to prevent transfering

young knoll
#

If the clicked inventory is not a player inventory, cancel it

eternal oxide
#

so many ways, hotkey presses, mouse click, item on cursor clicks, pressing q

young knoll
#

Also if the event is a shift click and the top inventory is not a player inventory, cancel it

young knoll
#

True

#

You would have to prevent dropping or hopper pickup for the item

eternal oxide
#

if you mouse over an empty slot in an inventory and press a hotkey for one of your item slot it will swop the slots but you won;t get an item click for your protected item

river oracle
#

Which are also weird

young knoll
#

There should be a pickup event for both

eternal oxide
#

The click event will fire in my example, but it's really hard to recognize it's trying to move your specific item

#

you would also have to detect in the drag event too

native bramble
rotund ravine
#

Does it throw concurrentmodificationexception?

native bramble
#

i cant uderstand, because i dont know, how to register this eventhandler

slate mortar
smoky anchor
native bramble
#

im new in programming so i dont really now all what im doing

#

so i dont need static in my class

smoky anchor
#

!learnjava

#

what is the command

#

?learnjava

undone axleBOT
native bramble
#

im learning by developing plugins

#

i learn java for myself, not for job

dull mango
native bramble
smoky anchor
#

?main

smoky anchor
#

I am struggling to understand what you tried to do

#

Do you just want to overrite all skeletons ?

native bramble
#

i want to make class or interface or maybe smth else, which will be have and events handlers and my custom mob class

#

because i will have at least 5 more skeletions, so i dont want to write 5 different classes for every skeleton

#

where event handlers will be different only in one parameter

#

so i want to create class which will be have event handler

#

like i have biomeList, which is biomes in which skeleton will spawn

dull mango
smoky anchor
native bramble
#

now i have interface

dull mango
#

Auf cause

native bramble
#

SkeletonHandler

#

which extend Listener

smoky anchor
#

I don't see why you'd need interface

rotund ravine
#

To interface duuh

dull mango
native bramble
#

interface is like template

#

smth like this

#
public interface SkeletonHandler extends Listener {

    void spawnSkeleton(Location location);

    boolean isSkeleton(Entity entity);

    @EventHandler
    void onArrowHit(EntityShootBowEvent e);

    @EventHandler
    void onEntitySpawn(EntitySpawnEvent e);
}
rotund ravine
#

Lol

dull mango
#

Thats false

smoky anchor
#

Don't think this is how you would do the events.

dull mango
#

And ur code is also not working

#

Why does ur interface extends Listener

native bramble
#

ohh

smoky anchor
rotund ravine
#

But

native bramble
#

listen pls

rotund ravine
#

No

native bramble
#

i have two skeletons: desert and overgrown(only for now, in future it will be more than 5 skeletons)

#

and i want to create the same events for first and for second, which will be different only in one List<>

dull mango
#

Use abstracts

native bramble
#

abstract class?

smoky anchor
#

I think what you would want is: have a map of your abstract skeletons - the skeleton type in PDC -> AbstractSkeleton instance
then have one listener class and you would delegate the events to each skeleton based on the type
So you register the listeners only once and can actually use the variables in the skeleton classes

rotund ravine
#

Default interface methods Kappa

native bramble
#

not registering million of classes in main class

smoky anchor
#

No need to use static anywhere too

#

Also, rename your Main class

native bramble
#

okay, i will read about what is static and when use it

#

ok

#

its ok to rename in project name?

rotund ravine
#

?static

rotund ravine
smoky anchor
smoky anchor
native bramble
#

ty

#

so i need to create abstract class?

dull mango
#

Yes

smoky anchor
#

But anyways, I think you're doing good job already, seeing you have guard clauses
Def. better than some ppl who come here and

river oracle
#

Arrow pattern best pattern

dull mango
native bramble
#

but then i will have two classes: OvergrownSkeleton and DesertSkeleton, yes?

dull mango
#

yes, that was just an example

native bramble
#

and i need to register this two classes?

rotund ravine
# rotund ravine What did bing change

Illusion Search Index - Static (aboose)

Static is a keyword in Java that modifies the behavior of variables and methods. To understand static, we need to review some basic concepts of object-oriented programming.

Classes and Objects

A class is a blueprint that defines the structure and behavior of an object. A class specifies what fields (variables) and methods (functions) an object will have, and how they will interact with each other.

An object is an instance of a class, created with the new keyword and a constructor. A constructor is a special method that initializes the object with some initial values or logic. For example, we can use a constructor to inject some dependencies into the object.

An object is a bundle of data and behavior that follows the structure defined by the class. We can think of an object as a box or a package that contains some information and actions. The information is stored in the fields, and the actions are performed by the methods.

When we pass an object as a parameter to a method, we are actually passing a reference to the object, not the object itself. A reference is a pointer that indicates where the object is located in memory. This way, we can avoid copying the whole object, which would be inefficient and wasteful. This is also known as "pass by reference".

Static Variables and Methods

Static is a keyword that indicates that a variable or a method belongs to the class, not to a specific object. A static variable or method is allocated in memory only once, and can be accessed by any object of the class, or even without an object.

A static variable is also known as a class variable, because it is shared by all instances of the class. A static variable is initialized when the class is loaded, and remains in memory until the program ends. A static variable is not affected by the garbage collector, which is a mechanism that frees up memory by deleting unused objects.

A static method is also known as a class method, because it can be invoked by the class name, without creating an object. A static method can only access static variables and other static methods, because it does not have a reference to a specific object. A static method is useful for performing general operations that do not depend on the state of an object.

Static variables and methods are designed for constants and utility classes, which are classes that provide some common functionality without creating objects. Static variables and methods should be used sparingly, because they can cause problems such as memory leaks, concurrency issues, and tight coupling.

The only exception to this rule is the singleton pattern, which is a way of ensuring that only one instance of a class exists in the program. A singleton class uses a private constructor and a static variable to store the unique instance, and a static method to return it. A singleton class is useful for managing global resources or state, but it should be used with caution, because it can introduce hidden dependencies and make testing difficult.

TL;DR - Valid usage of static in:

  • Constants
  • Utility classes
  • Singletons (when dependency injection is impossible)
#

Examples

Here is an example of a utility class, with a constant:

public final class MyUtilityClass { // final to prevent inheritance

    private static final int NUMBER_OFFSET = 100; // constant value, permanent
    
    private MyUtilityClass() { // Private constructor to prevent initialization
    
    }
    
    public static int offsetNumber(int original) {
        return NUMBER_OFFSET + original; // static method accessing static variable
    }
}

Here is an example of a lazy singleton (lazy means it is only initialized when needed):

public class MySingleton {

    private static MySingleton INSTANCE = null; // static variable to store the instance
    
    public static MySingleton getInstance() { // static method to return the instance
        if(INSTANCE == null) { // check if the instance is null
            INSTANCE = new MySingleton(); // create a new instance if null
        }
        
        return INSTANCE; // return the existing or new instance
    }
    
    private MySingleton() { // private constructor to prevent external initialization
        // optional: check for duplicate instances
        if(INSTANCE != null) {
            throw new IllegalStateException("Duplicate instance");
        }
    }
    
    private int currentNumber = 0; // non-static variable to store some state
    
    public int getOffsetNumber() {
        return MyUtilityClass.offsetNumber(currentNumber++); // non-static method accessing static method and non-static variable
    }
}

Here is what NOT to do (unless you're a clown):

public class Circus {

    private static PlayerManager playerManager; // static variable to store a non-constant object
    private static SomeOtherManager someOtherManager; // static variable to store another non-constant object
    private static String status = "broke"; // static variable to store a mutable state
    private static int money = -1; // static variable to store another mutable state
    
    public static PlayerManager getPlayerManager() { // static method to return a non-static object
        return playerManager;
    }
    
    public static int getMoney() { // static method to return a non-static state
        return money;
    }
    
    public static String getStatus() { // static method to return another non-static state
        return status;
    }
    
    public static SomeOtherManager getSomeOtherManager() { // static method to return another non-static object
        return someOtherManager;
    }
}
smoky anchor
#

Ye, you would register just one listener
And create your 5 skeleton instances, each with different parameters

#

WHY are you reposting this

#

I think Illusion will be mad

rotund ravine
#

It’s not a repost

proud badge
#

How do I like save a variable of a block, like so the variable wont change even after the block changes

proud badge
#

Because my event is delayed and sometimes it shows wrong info

rotund ravine
#

??

smoky anchor
proud badge
#

For example if someone quickly breaks and placed a block it will show the placed block (onblockbreak event)

rotund ravine
rotund ravine
#

Get the stuff from the event

proud badge
#

Ok my friend is tripping then idk, ill check logs when im home

slender elbow
rotund ravine
#

Is illusions?

slender elbow
#

where

rotund ravine
# slender elbow ur singleton creation is not thread safe :kappa:

Here u go. - Bing:

One possible way to make a singleton in Java is to use a static nested class that holds the instance of the singleton class. This way, the instance is created only when the nested class is loaded, which is lazy initialization. The nested class is also thread-safe because the class loading mechanism ensures that only one thread can load a class at a time. Here is an example of how to implement this approach:

public class Singleton {

    // private constructor to prevent instantiation
    private Singleton() {}

    // static nested class that holds the instance
    private static class SingletonHolder {
        // create the instance as a final static field
        private static final Singleton INSTANCE = new Singleton();
    }

    // public static method to get the instance
    public static Singleton getInstance() {
        // return the instance from the nested class
        return SingletonHolder.INSTANCE;
    }
}

This is one of the shortest and thread-safe ways to make a singleton in Java. There are other ways as

slender elbow
#

that is thread safe yeah

rotund ravine
#

Even better

rotund ravine
# slender elbow that is thread safe yeah

One of the shortest possible and thread-safe ways to make a singleton in Java is to use an enum. This approach has serialization and thread-safety guaranteed by the enum implementation itself, which ensures internally that only the single instance is available, correcting the problems pointed out in the class-based implementationΒΉ. Here is an example of how to use an enum to create a singleton:

public enum Singleton {
    INSTANCE;
    // other fields and methods
}

To access the singleton instance, you can simply use Singleton.INSTANCE. This is also the recommended way of implementing singletons by Joshua Bloch, the author of Effective JavaΒ².

Source: Conversation with Bing, 15/11/2023
(1) Singletons in Java | Baeldung. https://www.baeldung.com/java-singleton.
(2) Singleton Design Patterns - Javatpoint. https://www.javatpoint.com/singleton-design-pattern-in-java.
(3) Java Singleton Design Pattern Best Practices with Examples. https://www.digitalocean.com/community/tutorials/java-singleton-design-pattern-best-practices-examples.

Baeldung

See how to implement the Singleton Design Pattern in plain Java.

slender elbow
#

for extra points you can do

public class Singleton {
    private Singleton() {}
    public static Singleton getInstance() {
        class SingletonHolder {
            static final Singleton INSTANCE = new Singleton();
        }
        return SingletonHolder.INSTANCE;
    }
}

:^)

rotund ravine
#

Can’t disable previews on phone

slender elbow
rotund ravine
#

Not putting in that effort

slender elbow
#

fair

wet breach
#

should bring up an x

wet breach
#

you are not zoomed in are you?

#

that happened once on my phone where it zoomed in slightly

rotund ravine
#

I am not

#

Blame ios easy

wet breach
#

ah iphone

glad prawn
#

why does it look so pale?

wet breach
#

figures

smoky anchor
wet breach
#

that is why

smoky anchor
#

same for the other loop onArrowHit

rotund ravine
#

Does spawn entity trigger the Spawn Event?

smoky anchor
#

I beleive it does

native bramble
#

i will check

smoky anchor
#

just put a check to see if what is spawning is not your custom skeleton

#

Anyways, this won't work 'cause you ignore the skeleton types.
Best would be a map "string" -> "type insatnce"
For every event, you'd just get the skeleton type from the entity, get the skeleton instance from the map and use that to do your custom thingies

#

wait, that is what you're doing

#

it will work, just can be more efficient

shadow night
# rotund ravine

I had the same issue before, but instead of closing that menu it closed the keyboard making me unable to type

grim hound
#

damn

#

never used those I have no idea on how they behave

#

anyway, how can I make a gif show itself on a spigot resource that's hosted by imgur?

rotund ravine
#

Try really hard

shadow night
#

100% success rate

grim hound
#

how do others do it then?

rotund ravine
#

Just insert image and put in the direct link?

grim hound
#

it's a gif

rotund ravine
#

What is the link?

worldly ingot
rotund ravine
#

Just gotta end in gif which imgur doesn’t

grim hound
rotund ravine
#

Idk i am not at full volume haha

grim hound
#

what do I do?

#

why the v tho

#

oh wait

wet breach
grim hound
#

This imgur stuff is sickkkk

wet breach
grim hound
#

do they auto-delete them?

wet breach
#

at some point yes

#

its really inconsistent on how long they will last XD

grim hound
#

it

#

ain't playing

wet breach
#

does spigot even allow gifs?

grim hound
#

I've seen other plugins do it

grim hound
rotund ravine
#

Just cause u can doesn’t mean ur allowed to πŸ€ͺ

grim hound
#

how did you

rotund ravine
#

Image

grim hound
#

insert it as media?

rotund ravine
#

A gif is an image

grim hound
wet breach
#

you are using the correct editor in spigot right?

grim hound
#

the gif doesn't play

grim hound
rotund ravine
#

Wha tlink shadow?

grim hound
wet breach
#

one is the fancy one

grim hound
wet breach
#

the other is the manual one

grim hound
#

it ain't playing normally as well

rotund ravine
#

Blame imgur

wet breach
rotund ravine
#

No frostalf

#

That won’t give him the gif

wet breach
#

I was just testing it

rotund ravine
#

Ahh k

native bramble
grim hound
#

hmm

rotund ravine
#

Use smth else

grim hound
#

bruuuh

wet breach
#

so I went to the link

#

and imgur is giving it to me as a jpg

grim hound
#

I just removed the v at the end

rotund ravine
grim hound
#

bruh it works

wet breach
#

I see the issue

grim hound
#

XD

wet breach
#

or the issue before

#

there was an extra character in the url

grim hound
wet breach
grim hound
#

I don't get it

wet breach
#

not sure why the extra character gets added

grim hound
#

it works in the spigot

#

edit page

#

but not on the website itself

wet breach
#

did you clear caches? or tried to

grim hound
#

and the page just crashed

wet breach
#

do a force refresh

grim hound
#

what the fuck

#

spigot

#

you son of a-

wet breach
#

just use the manual editor

grim hound
wet breach
#

probably because the preview is javascript

#

which works from your system and not the server

grim hound
#

ain't tis

#

a manual editor?

young knoll
#

There is a rich editor and a bb code editor

grim hound
#

how do I access it?

young knoll
#

Wrench in the top right of the input box

grim hound
#

uhh

worldly ingot
#

gifs tend to exceed that limit very often

grim hound
wet breach
#

if you use no compression XD

worldly ingot
#

Doesn't matter. Content is proxied

grim hound
worldly ingot
#

Just a tad large

wet breach
#

157mb?

grim hound
#

yep

wet breach
#

compress it -.-

#

also reduce some of the images in it

grim hound
#

blasphemy

#

amma be real with you

#

I have no idea how to compress a gif

young knoll
#

Oh external stuff is proxied

#

F

rotund ravine
#

Makes sense

arctic shuttle
#

does anyone know how to send action bars my method isn't working

rotund ravine
#

Show

grim hound
#

and ACTION_BAR for the type

#

or smthg like that

arctic shuttle
#

yeah thats what I was doing

#

but I have another idea

rotund ravine
#

Don’t

wet breach
#

o.o

rotund ravine
grim hound
wet breach
grim hound
grim hound
rotund ravine
#

Looks fine

grim hound
#

needless to say, the video editor wasn't very helpful

#

I selected a lower frame rate bruh

wet breach
grim hound
#

5 times

whole lintel
#

Hello

#

I have a PlayerInteractEntityEvent listener

grim hound
whole lintel
#

that prints out "Entity captured"

#

and a playerinteract event

grim hound
# grim hound

ah wait, it converted it into a mp4 for some reason

whole lintel
#

( if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;)

#

with that

#

that prints "Entity spawned"

#

But when i right click an entity

#

i get both

#

messages

#

How is the PlayerInteractEvent running

#

(with a check for the action) as i said)

rotund ravine
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
whole lintel
#

Ok? @rotund ravine

#

so what

rotund ravine
#

It says right there

whole lintel
#

read what i just said lil bro

grim hound
#

with that attitude

rotund ravine
#

I’ll respond in kind

#

?jd-s

undone axleBOT
rotund ravine
#

And

whole lintel
rotund ravine
#

?learnjava

undone axleBOT
whole lintel
#

ive been using java for years

grim hound
grim hound
#

nice

rotund ravine
#

Comparing enums with equals haha

whole lintel
#

before you made your discord server

#

at least

rotund ravine
#

Works but looks sad

whole lintel
rotund ravine
#

?paste

undone axleBOT
whole lintel
#

it's completely normal

rotund ravine
#

The test of the code

grim hound
whole lintel
#

We've had a discussion here about it

#

like a year ago

rotund ravine
#

Still looks sad

whole lintel
#

wdym sad

#

😭

#

do you know anything about what you're talking about

rotund ravine
#

Of course

grim hound
rotund ravine
#

Now

rotund ravine
#

?paste

undone axleBOT
grim hound
#

learn to read

#

bitch

rotund ravine
#

He was asking about the action

whole lintel
rotund ravine
#

Not only hand

whole lintel
#

that is not my issue at all.

rotund ravine
#

?paste

undone axleBOT
rotund ravine
#

Thank you

whole lintel
#

alr 1s

wet breach
#

for the block

#

if they did, don't do anything

whole lintel
#

oh wait

#

OH

#

lemme try that

wet breach
#

I guess that fixed their problem

rotund ravine
#

Yes i suppose so

wet breach
#

they should have been checking for air to begin with

#

newb mistake

quaint mantle
#

πŸ˜„
'

whole lintel
rotund ravine
#

?paste

undone axleBOT
wet breach
whole lintel
wet breach
#

o.O

whole lintel
#

in the other PlayerInteractEntity event

#

that i have

#

so maybe i know the issue

#

it's probably because playerinteractevent is called after playerinteractentity

#

in spigot's code

#

Not sure though, just a guess

glossy venture
#

which is the old behavior

ivory sleet
#

Yeah or well β€œplatform thread”, u’re completely right

glossy venture
#

ig thats a more appropriate name

#

is that the official

#

name in java

#

official terminology

ivory sleet
#

I wanna say yes cuz I touched those 2 days ago, but unsure lol

glossy venture
#

lmao

#

native thread also works

ivory sleet
#

Yea

arctic shuttle
#

does anyone know why this isn't working?

public class FireDash implements Listener {

    @EventHandler
    public void onPlayerItemHeld(PlayerItemHeldEvent event) {
        Player p = event.getPlayer();
        int i = event.getNewSlot();
        ItemStack item = event.getPlayer().getInventory().getItem(i);
        if (item != null) {
            Objects.requireNonNull(item.getItemMeta()).getDisplayName();
            if (item.getType() == Material.DIAMOND_SWORD {
                if (item.getItemMeta().getDisplayName().contains("Β§6Β§lORANGE Β§bΒ§lΙ’SWORD"))
                    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Β§eFIRE DASH!"));
            }
        }
    }
}
eternal oxide
#

The event is cancellable so the item has likely not yet moved

#

Fetch it from the getPreviousSlot()

arctic shuttle
#

alr

rotund ravine
#

Also don’t do requirenonnull

upper hazel
#

i try create custom block with armorstand but why does it darken if it is inside blocks, how can I change this?

eternal oxide
#

Lastly identify items via PDC tags not their name

arctic shuttle
upper hazel
#

don't pay attention to the lack of texture I was too lazy to make 3d textures for testing

#

?paste

undone axleBOT
rotund ravine
#

Lighting

upper hazel
rotund ravine
#

Disable gravity and turn em upside down or smth

upper hazel
#

this will not be possible everywhere

#

i will generate in world

#

this blocks

rotund ravine
#

Well gl then

upper hazel
#

Is it true that you can make model 3d ItemStack?

#

i mean like this

#

but with "textures"

#

to make it look like a real block

#

not player head lol

quiet ice
arctic shuttle
rotund ravine
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

rotund ravine
#

Post new code too

clever lantern
#

how do i disable animals spawn

#

through a command

sterile token
#

lmao i just realize this chat turned into a discussion. Why people dont like to first learn java?? instead of trying to code without any knowledge and then getting mad because they are told to learn java first

clever lantern
#

but you have to do it

upper hazel
#

The problem here is not even in java. Before creating any programs, people need to develop the mindset to β€œeasily” switch from java to api

#

otherwise the api will become "language 2"

sterile token
#

yeah thats totally true too

#

its what happen to me, i dont have huge knownlgedges about the api itself. But i have more knowledges in plain Java, like good practices, organization, conventions and many others things

upper hazel
#

I personally studied both Java and bukkit api
although I later regretted the decision to make the rtp plugin for half a yearπŸ₯Ά

#

I did it for 5 months

#

after 2 years refactoring

#

and now again

sterile token
#

Im in a point where i dont regret about learnt to code plugins. Because i was forced to learnt a coding language, so there i seen i was capable for creatings things on my own. And now im working hard on personal proyects not even related to minecraft itself, mainly market place products. Which they are sell in the real economy of programming and software

whole lintel
#

i think i found a bug

#

PlayerInteractEvent runs with PlayerInteractEntityEvent if i remove the entity on PlayerInteractEntityEvent

upper hazel
#

demm this tranlation

#

not can do normal

sterile token
upper hazel
#

The translator mistranslated it, I meant I wish I had learned Java first and then only the bukkit api. That's the reason why it took me 6 months to make my first plugin.

sterile token
#

@whole lintel forget wha ti have said, i was wrongly

#

can you re-explain what issue you are experimenting?

whole lintel
#

i basically

#

remove an entity

#

when a player clicks it

#

then i print something when the player right clicks a block

#

and something gets printed when a player right clicks an entity and also when they right click a block

sterile token
#

well, i would have to check the docs

#

Give me 5 i will check those events and we will realize if its a bug or not

#

?jd-s

undone axleBOT
sterile token
#

sorry i couldnt check i was distracted from the chatting in general chat

old cloud
#

I'm using git inside eclipse. Anyone know if its possible to remove that project name before /src/main/...? Because on github it created everything inside that directory (nobody wants that)

rotund ravine
#

?stash

undone axleBOT
arctic shuttle
# rotund ravine Post new code too
public class Orange Sword implements Listener {

    @EventHandler
    public void onPlayerItemHeld(PlayerItemHeldEvent event) {
        Player p = event.getPlayer();
        int i = event.getPreviousSlot();
        ItemStack item = event.getPlayer().getInventory().getItem(i);
        if (item != null) {
            ItemMeta meta = item.getItemMeta();
            if (meta != null) {
                String displayName = meta.getDisplayName();
                if (item.getType() == Material.DIAMOND_SWORD && displayName.contains("ORANGE SWORD")) {
                    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("FIRE BLAST!"));
                }
            }
        }
    }
}
river oracle
#

can you explain what isn't working exactly

arctic shuttle
river oracle
#

wait

arctic shuttle
river oracle
#

there is a space in your class name

arctic shuttle
#

no way

river oracle
#

how did that compile

onyx fjord
#

@arctic shuttle what editor are you using

arctic shuttle
#

inteillj

#

Idea

#

community

onyx fjord
#

lol

river oracle
#

how did that compile

arctic shuttle
#

how

river oracle
#

the space in the clsas name

onyx fjord
#

it should give you like million warnings

arctic shuttle
#

loll

river oracle
#

it shouldn't compile either

#

idk what black magic you used to turn that into a jar

rotund ravine
#

He probably didn’t

arctic shuttle
#

ok lemme try now

#

this time no space

onyx fjord
#

btw avoid nesting

#

just return early

arctic shuttle
#

ok

onyx fjord
#

by reversing your if statements

slender elbow
#

it makes your code 99% faster if you return early

#

aye, little white lies never hurt anyone

young knoll
#

It's actualy 100%

arctic shuttle
#

hmm still isn't working

smoky anchor
#

You somehow seemingly managed to compile with a space in a class name, I think your problem is somewhere else tbh

unkempt peak
#

Hey guys, so I've been working on a video player project and I have come up with an optimized block placing method with the help of this blog: https://www.spigotmc.org/threads/methods-for-changing-a-massive-amount-of-blocks-up-to-14m-blocks-s.395868/

The only problem I'm having now is the client can't seem to render the blocks fast enough. When playing the video it only renders the center of the screen most of the time and the rest is just a mess of squares of outdated blocks.

I am using the second method from the blog by updating the block directly from the chunk. I am using nmsWorld.sendBlockUpdated(blockPos, blockState, blockState, 2); to send block updates to the player. Is there a way to send all the blocks at once? Or is there something I can do with the client to get it to render the blocks faster?

Here is the full method for reference: https://paste.md-5.net/bojejisacu.cpp

smoky anchor
#

you can't manipulate how fast the client updates the chunks

quaint mantle
#
public BukkitTask playAnimation(List<TeleportData> teleportDataList, Entity entity) {
        currentIndex = 0;
        int delay = 50;

        BukkitRunnable runnable = new BukkitRunnable() {
            @Override
            public void run() {
                if (currentIndex < teleportDataList.size()) {
                    TeleportData teleportData = teleportDataList.get(currentIndex);
                    entity.teleport(teleportData.toLocation());
                    currentIndex++;

                    // Check if more iterations are needed
                    if (currentIndex >= teleportDataList.size()) {
                        // Animation is complete, cancel the task
                        this.cancel();
                    }
                }
            }
        };

    // Schedule the BukkitRunnable to run repeatedly at the specified interval, then return the runnable
    return runnable.runTaskTimer(FabledCore, delay, 1);
    }```

This playAnimation function sstarts a bukkit runnable, and in another class i need to run the playAnimation method a number of times in a for loop. How can i ensure the for loops awaits for the bukkit runnable to end before proceeding with the next iteration ?
unkempt peak
celest venture
#

Hey all, I'm dipping my toes for the first time into plugin development. I'm trying to upgrade an existing abandoned package. However, when I try to run the plugin, the console gives back the following error: JavaPlugin requires org.bukkit.plugin.java.PluginClassLoader

I've been Googling all over, and it seems there can be multiple causes for it. I'm using IntelliJ IDEA with Maven to package the .jar file.

quaint mantle
smoky anchor
celest venture
# unkempt peak Can you send your pom?

It might be the use of PaperMC:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

--snip--

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>papermc</id>
            <url>https://repo.papermc.io/repository/maven-public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.19-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.tealcube.se.ranzdo.bukkit</groupId>
            <artifactId>methodcommand</artifactId>
            <version>0.1.0</version>
        </dependency>
    </dependencies>
</project>
unkempt peak
river oracle
#

further paper plugins tend to be incompatable with spigot so running a paper plugin on spigot may cause issues

pseudo hazel
#

you should prefer just creating plugins for paper, perhaps using like the paper lib that some person made

unkempt peak
#

Why are you making a paper plugin instead of spigot?

pseudo hazel
#

so it would still work on spigot servers, but you can get some of teh paper features

celest venture
river oracle
#
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.19-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```
#

paper builds ontop of craftbukkit and spigot

river oracle
#

certain org.bukkit things may be exclusive to paper

pseudo hazel
#

see if its fixed if you switch to spigot

celest venture
#

Thanks all!

pseudo hazel
#

why not just use a timer task

quaint mantle
pseudo hazel
#

well you could just have some kinda timer task that stops after some amount of iterations

quaint mantle
#

how could i implement that ?

#
public void playCinematic(Player p, String cinematicName) {
        ArmorStand armorStand = p.getWorld().spawn(p.getLocation(), ArmorStand.class);
        armorStand.setVisible(false);
        armorStand.setGravity(false);

        p.setGameMode(GameMode.SPECTATOR);

        List<TeleportData>[] cinematicMotionDefinition = cinematicsBundler.getCinematicMotionDefinition(cinematicName);
        if (cinematicMotionDefinition != null) {
            for (int i = 0; i < cinematicMotionDefinition.length; i++) {
                List<TeleportData> keyframeMotions = cinematicMotionDefinition[i];

                if (i == 0) {
                    if (!keyframeMotions.isEmpty()) {
                        TeleportData firstTeleportData = keyframeMotions.get(0);
                        Location firstLocation = firstTeleportData.toLocation();
                        armorStand.teleport(firstLocation);
                        p.teleport(firstLocation);
                        p.setSpectatorTarget(armorStand);
                    }
                }

                // Play the animation for the current keyframe motion
                BukkitTask animationTask = motionProcessor.playAnimation(keyframeMotions, armorStand);

                try {
                    animationTask.getTaskId();
                } catch (InterruptedException | ExecutionException e) {
                    e.printStackTrace();
                }
            }
        }
    }```

this is the method with said for loop
left pine
#

Hello, I wanted to know how I could create a custom block

dull mango
#

what do you mean with custom block?

left pine
dull mango
#

u create a listener for the PlayerInteractEvent. Check if the player is interacting with a block, then check if the player is interacting with your custom block -> add your custom code

grim hound
#

is this how you get the newly held item?

rotund ravine
#

No

#

?jd-s

undone axleBOT
rotund ravine
#

Wait yes

#

Sry i thought about the other event

grim hound
#

good to know

#

thanks

dull mango
rotund ravine
#

Hmm

grim hound
#

mmmmmmmmmmm

rotund ravine
grim hound
#

why is the limit a mere 4.5 mb

rotund ravine
#

Cause

river oracle
#

just not PDC

#

though metadata doesn't persist

dull mango
river oracle
#

?blockdata

rotund ravine
river oracle
#

where is mfnalex's library

rotund ravine
#

?custombloxks

river oracle
rotund ravine
#

Not sure

#

?customblocks

#

?blockpdc

undone axleBOT
river oracle
#

if so ^

dull mango
rotund ravine
#

No

dull mango
#

with FixedMetadataValue

rotund ravine
#

No

dull mango
#

The metadata is only deleted when the block is placed and destroyed again

rotund ravine
#

Or the server reloads or restarts

#

Or the chunk unloads and loads probably

grim hound
#

Fuck you spigot

#

it's 1.5 mb

#

and it's already shit

lost matrix
grim hound
rotund ravine
#

Proxydoxy

knotty aspen
#

I recall the metadata API having some memory leak issues, at least with entity metadata. Would just stick to PDC tbh

lost matrix
grim hound
#

I'm mad because I've been trying for way too long to do something so easy

young knoll
#

Just use a video

lost matrix
#

Yeah it do be like that sometimes

#

Just make multiple posts and tell the user to flip between tabs

serene sigil
#

how do i get the import com.mojang.authlib.GameProfile;

#

is it in nms

rotund ravine
#

Use PlayerProfile