#help-development

1 messages · Page 1092 of 1

blazing robin
#

opps got it,

viscid carbon
#

what is MessageFormat?

lost matrix
#
public interface MessageFormat {

  String format(String message);

  <T> String formatObject(T object);

}
viscid carbon
#

google!

#

oh

#

lol

#

that it was gonna be a bukkit thing

#

@river oracle why is this bad? i dont understand

viscid carbon
#

@pine crest people dont like kotlin it looks weird xD

pine crest
#

i mean i hate kotlins superfluous semantics

#

u can do things a googol different ways

#

w/o a style guide or something; inconsistency is prone

#

but i dont think it looks weird

#

if u say that its prob cuz u a basic dev who r only used to C langs

viscid carbon
#
fun main(args: Array<String>) {
    println(args.contentToString())
}```
#

f is for friends?

#

xD

pine crest
#

?

#

no doing kotlin wont get u any friends

dawn flower
#

you can't do String[] in kotlin?

pine crest
#

its Array<String>

dawn flower
#

just

#

why

pine crest
#

consistency

#

just look at java

dawn flower
#
}```
pine crest
#

T[] and the java.lang.reflect.Array<T>

#

so does it matter?

#

not really

dawn flower
#

i mean

#

the reflect array makes sense

viscid carbon
#

WAR

dawn flower
#

no

remote swallow
#

if you stab him ill stab you

dawn flower
pine crest
#

but I can stab this fellow as well

lost matrix
#

Just add an infix extension function to array and call it heheXd which prints your array.
Then you can write

arr heheXd ","

And your array will be printed.
Because Kotlin loves standardization and there is no problem in everyone throwing their
arbitrary extern functions on objects. If you say thats an anti-pattern you are lying.

pine crest
#

mind you there's a difference between can and should

#

but yes u can meme kotlin for it

viscid carbon
#

ThrowsThreatException()

lost matrix
#

I liked writing it. I liked how they handled nullability on compile time, but i would not write a bigger project with multiple devs on that language.

pine crest
#

eh I mean would be cool if u could config what features u want

#

cuz kotlin just fkn dumps everything on u fair and square

viscid carbon
#

cant we all agree gradle is garbage tho?

pine crest
#

its the best of the worst

lost matrix
#

Its... complicated. All build tools are garbage honestly.

pine crest
#

anyway its hard impossible to design good build tools

#

u just have to make sure they're not bad

lost matrix
#

Lets just go back to using Ant. Or Makefile. If i have to use Makefile to compile javac stuff again, ill simply look for anothe profession. Farmer or sth.

pine crest
#

lol

#

farmer

#

farming those java beans then

#

or lombok chilis

lost matrix
#

lol

remote swallow
pine crest
#

oh yes

#

i guess ill shank you as well

#

as promised

young knoll
#

Did someone say defenestration

lost matrix
#

Im pretty sure you guys talking about shiving someone

#

Wait, is shanking not a euphemism for having sex?
Whats the difference between shiving and shanking then?

pine crest
river oracle
pine crest
#

yea blud

lost matrix
#

Ah, i was thinking about shag not shank...

pine crest
#

yea well I dont wanna be a sex offender or anything

#

coding is enough

river oracle
#

Fair

viscid carbon
#

@river oracle never answered the question 😦

pine crest
#

he knows i will whopp his ass

river oracle
#

It's personal preference it should be a string util method imho

#

Unless you're doing some advanced parsing and replacement p.sendMessage(color(message)) is much more preferable to me

#

Plus legacy chat sucks :P

pine crest
#

i love legacy chat

worthy yarrow
#

I hate legacy chat because I have to shade all of adventure for my spigot plugins

pine crest
#

yep thats also not very runtime performant

#

but legacy chat is as concise and tight as my pants

#

making it quite nice

worthy yarrow
#

Legacy serializer with the useUnusualXRepeatedCharacterHexFormat

#

Fourteen was having a go with this method name kek

#

Welp spent the whole day with the girl and now it's time to work

pine crest
#

it should be the other way around

worthy yarrow
#

Hey man she needs attention too

pine crest
#

code together

#

coding date

lost matrix
worthy yarrow
#

I've tried but she is completely uninterested

lost matrix
#

Or even worse... someone related

worthy yarrow
#

Don't give me that label smile D:

worthy yarrow
#

Quite worse

lost matrix
worthy yarrow
#

mannn

#

I've been with her for over 4 years

lost matrix
#

I got my last gf to study CS, and she is struggling hard rn

worthy yarrow
#

"last"

#

This is why she is struggling

lost matrix
#

Hm?

pine crest
#

how many gfs does smile have?

worthy yarrow
#

Last implies a previous relationship

#

Hence why she is struggling because she is no longer with you

torn shuttle
#

none of these words are in the bible

pine crest
#

bless you

worthy yarrow
#

Unironically he has the same pfp as my boss

lost matrix
#

Ah, yeah. She started studying and couldnt handle all the attention she got from all the guys there, so she did an oopsie, resulting in me making her a "last" gf.

pine crest
#

i downloaded a default one

worthy yarrow
pine crest
#

i am your boss

#

i command you to make ur gf code

lost matrix
worthy yarrow
torn shuttle
#

alright well I was here to mention how nice the object instantiation in c# is with new() but I guess I'll be back when the feet people are done talking about making gfs or whatever the hell is going on here

worthy yarrow
#

She got some financial backing from fafsa or wtv it is, and I'm quite sure she's going with sonography

lost matrix
#

Sonographer as in medical sonography?

worthy yarrow
#

yes

#

Immigration lawer has some rather personal reasons behind it, I think sonography is really what she wants to do though

pine crest
#

i dont exist there

lost matrix
#

That is so specific

worthy yarrow
#

Well we're both at the start of college age so

#

/ uni kek

pine crest
#

i think 7smile7 needs to coach you guys

lost matrix
#

Youll find out what you want in the middle of your studies. I originally wanted to specialize in quantum computing and cryptography, but now i went the machine learning route.

worthy yarrow
#

Well I'm sure but she seems quite set on sonography so

#

time will tell I suppose

torn shuttle
pine crest
lost matrix
torn shuttle
#

guess we'll just have to talk about TempleOS again then

viscid carbon
#

Weird problem here, config.yml is in resources but not generating in plugins

torn shuttle
#

and HolyC

worthy yarrow
pine crest
#

it doesnt get any simpler

viscid carbon
#

I've never had to do that before?

pine crest
#

thats programming for you

#

congratulations

lost matrix
#

The config.yml doesnt get automatically exported unless you tell your plugin to

viscid carbon
#

strange, thank you.

#

now i gotta look back in old plugins to see xD

#

wasn't using maven before

pine crest
#

tortural

stark quest
#

Hey, I've been running into a gradle problem where I'm trying to install this dependency, but keep getting .class files instead of .java files (Getting XMaterial.class instead of XMaterial.java).

pine crest
#

sounds normal

#

do they provide a sources jar?

#

the dependency

stark quest
#

Yahh

pine crest
#

oh then its not normal

stark quest
#

Should be able to access XMaterial for utility

#

Weird thing is some files are in .java form (like XBlock.java) but others are not

#

My full build.gradle is here https://github.com/CryptoMorin/XSeries but I would guess this is the important part?

repositories {
    mavenCentral()
}

dependencies {
    implementation fileTree(rootProject.archiveFolder.getAbsolutePath())
    implementation project(":API")

    implementation 'com.bgsoftware.common.config:CommentedConfiguration:b1'
    implementation 'com.bgsoftware.common.updater:Updater:b1'
    implementation 'com.bgsoftware.common.reflection:ReflectionUtils:b6'
    implementation 'com.bgsoftware.common.executors:Executors:b3'
    implementation 'com.bgsoftware.common.shopsbridge:ShopsBridge:b11:all@jar'
    implementation 'com.bgsoftware.common.dependencies:DependenciesManager:b2'
    implementation 'com.bgsoftware.common.nmsloader:NMSLoader:b5'

    implementation 'com.zaxxer:HikariCP:4.0.3'
    implementation 'org.slf4j:slf4j-api:2.0.5'
    implementation 'org.bstats:bstats-bukkit:3.0.0'
    implementation 'com.github.cryptomorin:XSeries:11.2.0'

    // Spigot jars
    compileOnly "org.spigotmc:v1_8_R3-Taco:latest"
    compileOnly 'org.spigotmc:v1_16_R3-Tuinity:latest'
}
blazing robin
#

hey guys is there any way to detect item place in inventory?

river oracle
blazing robin
blazing robin
river oracle
#

It'll be null or air forgot which one If the cursor is empty

#

Otherwise it'll contain an item

blazing robin
#
  switch (action) {
            case PLACE_ALL, PLACE_ONE, PLACE_SOME -> System.out.println("hello there ");
            case PICKUP_ALL, PICKUP_SOME, PICKUP_HALF, PICKUP_ONE -> {
                if (slots.contains(slot)) {
                    event.setCancelled(true);
                }
            }
        }

All place actions just not worked

buoyant viper
#

?jd-s

undone axleBOT
buoyant viper
#

drawing a blank here bc im stupid

#

is there an api method i could use to check if a block is like a /normal/ block?

#

like 1x1x1 bounding box type block

#

not something without a full block boundingbox like slabs, fences, doors, etc

eternal oxide
buoyant viper
dense falcon
#

How do I check if the opened GUI is "this one" and no another without checking title? 🤔

tame wolf
#

Assign it a uuid

#

Good on you for not checking inventory titles

dense falcon
tame wolf
#

Great question, hadn't messed with inventories too deeply so I'm not sure, I just know that's what you're supposed to do 😂

dense falcon
#

🥺

buoyant viper
#

does PlayerInteractEvent not fire if the player is holding nothing in 1.21?

chrome beacon
buoyant viper
#

rip

#

kinda defeated what i wanted to do for a plugin

#

im guessing the client just doesnt send a packet, rather than spigot not calling the event

chrome beacon
#

yeah

#

Can always retexture an item to be invisible or smth

buoyant viper
#

ehh ill just pick a random item to be the activator

upper hazel
#

youtube not work(

dense falcon
wraith delta
#

Hi! my plugin runs a block break event, but when another plugin cancels the event my plugin still runs the event. how can I prevent my function from running if another plugin cancels the event?

#

and way to return if its cancelled. or a tag like ignoreCancelled = false?

eternal oxide
#

Run your event late and just check the cancelled state at the start of your event.

rough drift
#

and run it at a priority such as HIGHEST

eternal oxide
#

if a plugin cancels after yrou plugin has run it will never know

rough drift
#

and if you do not need to edit things, you can use MONITOR

chrome beacon
#

ignoreCancelled true should also have that behavior? or am I missunderstanding smth

wraith delta
eternal oxide
#

BUT do NOT make any changes on MONITOR

rough drift
rough drift
#

but the main issue here is priority

#

HIGHEST means it runs later

rough drift
chrome beacon
#

you want ignoreCancelled to true and have a higher priority than gp

eternal oxide
#

^

wraith delta
#

im seeing some other plugins code using ignoreCancelled = true, which didnt make sense because if we read those words it means yes you should ignore cancelled events... therefor still running my code?

eternal oxide
#

no

#

inverse

#

if the event is cancelled the event will be ignored

rough drift
#

ignoreCancelled = false means that your event will run even if it was cancelled

eternal oxide
#

no

#

other way around

rough drift
#

what

#

no

eternal oxide
#

its a confusing label

rough drift
#

oh

#

OH I SEE

#

man that's

#

bs

eternal oxide
#

yep

rough drift
#

eeeeeeeeeeeeeeeeee

#

I now need to change it in all of my project

eternal oxide
#

lol

rough drift
#

find and replace it is

wraith delta
#

🤣 exactly

rough drift
#

I just realized I'm making bukkit v2

#

well the entire API part of it

eternal oxide
#

So BiggerBukkit

rough drift
#

Basically, yes

#

it just looks at Spigot's API

#

looks at various pitfalls

#

improves them

#

repeat

#

i.e. for example

#
for(var res : Helix.scheduler().asyncTimer(SomeGenerator, 5, TimeUnit.SECONDS)) {
  // you will get a new "res" every 5 seconds, blocking, useful if you're doing something async, don't suggest doing it on the main thread
}
#
Helix.scheduler().syncLater(Bukkit::shutdown, 30, TimeUnit.SECONDS);
#

I'll stop with the examples

blazing ocean
#

do you have adventure support 🙏

rough drift
#

I like the scheduler

rough drift
blazing ocean
#

at least components?

rough drift
#

Yeah obv it's all component based

blazing ocean
#

good

summer scroll
eternal oxide
#

Yeah the default is true so most never come across it

rough drift
summer scroll
#

i thought the default is false?

rough drift
#

no the default is true

summer scroll
#

i swear i've read it somewhere

rough drift
#

nvm

#

you're right

eternal oxide
#

ah default is wrong

#

I thought it was true

wraith delta
#

well, not having that being = true cased a dupe bug for me XD. so you guys go check your plugins! claim plugins cancelling the event isnt enough!

summer scroll
#

okay so, ignoreCancelled = false it means the event will not run if it's cancelled?

rough drift
#

no

#

false means it will always be called

eternal oxide
#

false = ignore teh cancelled state and run this code anyway

summer scroll
#

oh yeah, i thought i was wrong

#

wait, yes i was wrong

#

very confusing af

eternal oxide
#

very

wraith delta
#

For the record: @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) solves the issue so that your plugin will not run the code if another plugin such as a claim plugin cancels the event.

eternal oxide
#

yep

#

claim plugins run early (or should) so highest is good

#

High would also do

#

For me I do Permissions (LOWEST), Eco/Protection (LOW), Most Plugins (NORMAL)

summer scroll
#
@EventHandler
PlayerMoveEvent event {
  event.setCancelled(true);
}

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
PlayerMoveEvent event {
  System.out.println("This code will not run")
}

@EventHandler(priority = EventPriority.HIGH)
PlayerMoveEvent event {
  System.out.println("This code will run")
}
eternal oxide
#

correct

blazing ocean
#

the fuck kinda syntax is that

eternal oxide
#

xml by the looks

summer scroll
worthy yarrow
#

You're not actually cancelling player move event are you?

summer scroll
#

no lmao, just an example

worthy yarrow
#

kek

eternal oxide
#

ah I thought he was talking about the highlighting

#

I didn't even notice it was pseudo code

pseudo hazel
#

whats weong with cancelling player move 😳

worthy yarrow
#

Unless it's a /freeze command, everything

pseudo hazel
#

wdym

worthy yarrow
#

yk like those admin utils

pseudo hazel
#

isnt the point of cancelling to freeze the player in place?

worthy yarrow
#

one of them being freeze

pseudo hazel
#

what else can you do with it

worthy yarrow
#

Not anything that's like recommended

pseudo hazel
#

such as

eternal oxide
#

preventing a player moving into or outof a specific area

worthy yarrow
#

why do you always argue

pseudo hazel
#

wdym

#

I just wanna know if I messed up

#

im cancelling it

worthy yarrow
#

for

pseudo hazel
#

but under certain conditions

#

for my minigame

#

at the start

worthy yarrow
#

valid

pseudo hazel
#

but I still allow looking around and falling down

#

like y movement is not restricted

#

only x-z

buoyant viper
#

besides jump boost potion... what would be the easiest way to increase a players jump velocity?

#

not to say its an XY prob bc... well i havent even written any code to test, i more so just want to consider my options to try

eternal night
#

jump_strenght attribute

buoyant viper
#

that actually sounds perfect holy shit

#

oh its for horse :(

hybrid turret
buoyant viper
#

not sure, im not too keen on what classifies as XY or not

eternal night
#

no jump strenght should be usable on players

buoyant viper
#

idk wiki says its horse attribute, can try later ig

eternal night
#

hmm I thought that may have been something changed in 1.20.5

tame wolf
#

Gravity

winter jungle
#

Heyo,

I'm currently fixing a cloud system and came across a method for class reflection with CraftBukkit. Here's an example of the method I'm using:


private Class<?> reflectCraftClazz(String suffix) {
    try {
        String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
        return Class.forName("org.bukkit.craftbukkit." + version + suffix);
    } catch (Exception ex) {
        ex.printStackTrace();
        try {
            return Class.forName("org.bukkit.craftbukkit" + suffix);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
    return null;
}```

It seems like this method was working correctly to get the version, and I found a similar approach in this thread (https://www.spigotmc.org/threads/reflection-nms.407785/). However, it appears that with Minecraft 1.21, getPackage().getName() now returns org.bukkit.craftbukkit without the version part.

Has anyone encountered this issue or found a fix for it? Any suggestions on how to properly extract the version in the newer Minecraft versions?
eternal night
buoyant viper
#

?jd-s

undone axleBOT
tame wolf
winter jungle
nova notch
slender elbow
#

no

buoyant viper
#

i forgot to specify im trying to just increase the players jump, not a horse

slender elbow
#

also jump event isn't a thing

#

gravity attribute 🙏

young knoll
#

There’s a jump power attribute

#

GENERIC_JUMP_STRENGTH

eternal night
#

fam did not read the convo

buoyant viper
#

oh there is a generic jump

young knoll
#

It’s usable on players

#

In 1.21

buoyant viper
#

mc fandom page has like 10 attributes mc wiki has like all of them lol

buoyant viper
young knoll
#

All the new attributes in 1.20.5 and 1.21 are great

eternal night
#

how certain are you with that coll

young knoll
#

I mean I used it

#

So

#

93%

buoyant viper
#

weird that player movement speed attr is 0.1 by default

#

i thought it was 0.2 for some reason

#

and jump being 0.4199999999*

eternal night
#

hmm

buoyant viper
#

is it not just 0.42⁉️

eternal night
#

guess I missed its consumption

tame wolf
buoyant viper
#

wtfff

#

wiki says 0.08....

young knoll
#

Yeah idk game is weird

#

You can check with /attribute @s <attribute> base get

#

Assuming you haven’t messed with the base

eternal night
#

indeed coll is correct lol, I was confused while looking through client code because the auto jump feature still makes use of the specific JUMP_BOOST mob effect

#

for whatever reason

young knoll
#

Mojank

#

I like how Mojang did the equivalent of pushing a major update on a Friday with 1.21

#

And now they are pushing 1.21.1 with “critical exploit fixes”… several weeks later

eternal night
#

tbf that exploit simply wasn't found

young knoll
#

Hey they said plural fixes!

eternal night
#

True lol

#

so when spigot 1.21.1???

young knoll
#

Tbf idk what exploits there were

#

I remember seeing some weird dupe glitch in creative… but that’s creative so who cares

eternal night
#

rough

tardy delta
lost matrix
blazing ocean
#

kek

tardy delta
#

what

lost matrix
#

No update = nothing you need to fix

#

ez

pliant topaz
tardy delta
#

thats one mindset

young knoll
#

Rip items

pseudo hazel
#

be like nintendo, push the final product

tame wolf
tardy delta
lost matrix
tardy delta
young knoll
#

Noooo

#

Don’t hurt vanilla froge :(

nimble oxide
#

tried implementing the wesdj anvil gui api, I have pasted in the repo & dependency into my pom.xml, I can problemfree reload mvn, but whenever I try to compile my plugin it gives me this error?

lost matrix
#

You need a higher java version in your project

young knoll
#

60 - 44 means you need java 16+

nimble oxide
#

can I easily just change it - and where?

lost matrix
#

The java version is defined in your pom

nimble oxide
lost matrix
#

In top you defined a property java.version

nimble oxide
#

wait its on 1.8

#

what should I put it on?

#

im coding for 1.20.6

young knoll
#

Use 17

#

Or wait, was 1.20.6 the one that moved to 21?

nimble oxide
#

still gives me err

lost matrix
#

I cant get excited over 21
The leap from 17 ist just random stuff it feels like

nimble oxide
#

and still gets the eror

nimble oxide
lost matrix
#

did you run a clean first?

nimble oxide
#

nah it so long since I've been doing plugins

#

I forgot where the mvn clean install is located

eternal night
#

latest compiler plugin version is 3.13.0

#

idk if that is related, not a maven expert, but yea

lost matrix
#

Should def go on 3.10+ for java 21

nimble oxide
#

I ran this

#

and after I ran the normal install

#

and I still seem to get the error

lost matrix
#

Update your maven compile plugin to 3.13.0

nimble oxide
#

now I get version 61

#

instead of 60

chrome beacon
#

Update the maven shade plugin

nimble oxide
#

and where do I do that?

chrome beacon
#

You set it to 3.6.0

nimble oxide
#

the guy just said I should put it in 3.13.0?

chrome beacon
#

That's the compiler plugin

blazing ocean
#

That was the compiler plugin

nimble oxide
#

and where do I have to put the 3.6.0?

#

in the java.version or?

lost matrix
#

maven-shade-plugin

acoustic pendant
#

Hey, i'm trying to use nms to change or set blocks because if I use Bukkit API this happens:

tardy delta
#

maybe show code

acoustic pendant
#

1s, i'm developing the question xd

#

I've tried setting the block with nms but I get stuck with BlockState

tardy delta
#

thats not a lot of code buddy

acoustic pendant
#

it is not

tardy delta
#

doubt that those four lines are causing a 4% tick usage

acoustic pendant
#

Oh you mean the non nms code?

#

yea 1s

#
    private boolean isFullyGrownCrop(Block block) {
        if (block.getBlockData() instanceof Ageable ageable) {
            return ageable.getAge() == ageable.getMaximumAge();
        }
        return false;
    }

    private void replenishCrop(Block block) {
        long timeToReplenish = plugin.getConfig().getLong("tools.hoe.time-to-replenish") * 20;

        Material cropType = block.getType();
        Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
            @Override
            public void run() {
                block.setType(cropType);
                Ageable ageable = (Ageable) block.getBlockData();
                ageable.setAge(0);
                block.setBlockData(ageable, false);

                Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
                    @Override
                    public void run() {
                        ageable.setAge(ageable.getMaximumAge());
                        block.setBlockData(ageable, false);
                    }
                }, timeToReplenish);
            }
        }, 1L);
    }```
tardy delta
#

CraftBlock.setType looks scary

acoustic pendant
tardy delta
#

wheres the event handler

young knoll
#

How many tasks are you scheduling

tardy delta
#

those two tasks just seem scary

acoustic pendant
young knoll
#

🙃

tardy delta
#

cant you yield the thread for timeToReplenish in the spawned task

young knoll
#

Have a single task

acoustic pendant
young knoll
#

And use a priority queue

tardy delta
#

holy shit thats a lot of code

young knoll
#

Or just a normal queue if the respawn time is the same for all crops

tardy delta
#

blocking queue maybe?

young knoll
#

Normal queue should be fine

acoustic pendant
tardy delta
#

but doubt you can yield the thread in a task and continue execution afterwards

young knoll
#

Peek first -> check if it’s time to replenish -> poll and replenish -> repeat

#

As soon as you find one that isn’t ready to replenish you break out of the loop

acoustic pendant
#

I didn't understand it

nimble oxide
#

I get this error now

acoustic pendant
#

Isn't that the same?

acoustic pendant
young knoll
#

You could

acoustic pendant
#

Send the packet that the crop is age 0 and when the replenish time is off send again the packet where is fully grown

young knoll
#

Big gens server have packet based crops

acoustic pendant
tardy delta
#

wondering what server arch wynncraft usess

young knoll
#

Windows server

#

Kek

young knoll
#

ProtocolLib/PacketEvents

acoustic pendant
young knoll
#

¯_(ツ)_/¯

#

Idk if anyone has benchmarked it

acoustic pendant
#

Well, thanks i'll check that

tardy delta
acoustic pendant
#

Something like this:

#
private void replenishCrop(Block block) {
        long timeToReplenish = plugin.getConfig().getLong("tools.hoe.time-to-replenish") * 20;

        Material cropType = block.getType();
        Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
            @Override
            public void run() {
                //block.setType(cropType, false);
                Ageable ageable = (Ageable) block.getBlockData();
                ageable.setAge(0);
                //block.setBlockData(ageable, false);
                for (Player player : Bukkit.getOnlinePlayers()) {
                    player.sendBlockChange(block.getLocation(), ageable);
                }

                Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
                    @Override
                    public void run() {
                        ageable.setAge(ageable.getMaximumAge());
                        for (Player player : Bukkit.getOnlinePlayers()) {
                            player.sendBlockChange(block.getLocation(), ageable);
                        }
                        //block.setBlockData(ageable, false);
                    }
                }, timeToReplenish);
            }
        }, 1L);
    }```
echo basalt
#

meh not really

#

also a task per block is a big yike

tardy delta
#

would probably have one dedicated task that polls from a "task" queue

#

but tasks arent preemptive so that goes meh

echo basalt
#

priority queue

lean ermine
#

how would i send a message that doesnt get shown in console? like if i use Bukkit#broadcastMessage sometimes i dont want the output to be displayed in console

#

would i just have to get onlineplayers and send messages individually instead..?

#

the case i have here is that im trying to make auto announcements, however using bukkit#broadcastMessage just clogs console.

royal heath
#

for each Bukkit.getOnlinePlayers .sendMessage

lean ermine
eternal night
#

it does not

viral halo
#

does someone know how to add custom nbt into an item in new 1.21

lean ermine
eternal night
#

pdc as per usual for custom data on items?

eternal night
#

broadcast will indeed print to console

#

but sendMessage on each online player will not

royal heath
eternal night
#

so you are failing somewhere else

lean ermine
#
  for (String line : announcement) {
        for(Player player : Bukkit.getOnlinePlayers()) {
                    player.sendMessage(ChatUtils.processMessage(line));
        }

  }
royal heath
#

What's ChatUtils

lean ermine
#

my own class to translate hex color codes, gradients, and centering messages

royal heath
#

Ah okay, what is it printing to the console

lean ermine
#

the announcement in config.yml

#

however i just fixed it by fully restarting the server and not just plugman reloading lul

eternal night
#

common plugman L

royal heath
#

Ah okay true lol

viral halo
eternal night
#

idk why people are still using that

lean ermine
eternal night
#

as per usual

royal heath
#

Wait is there actually issues with plugman?

lean ermine
ancient plank
royal heath
#

I use it so I don't have to /reload during development

eternal night
#

I mean, reloading plugins itself is braindead

royal heath
#

During development

#

No

eternal night
#

still braindead

royal heath
#

No lmfao what

eternal night
#

you are praying it doesn't break

royal heath
#

Ok and if it does the off chance, restart

eternal night
#

or you just hot reload

ancient plank
#

I've never had something break with reloading :3

eternal night
#

and live a happy life

viral halo
lean ermine
#

yes it is logical to wait a minute for the server to load for 5 seconds of testing just to do it again 3 seconds later

eternal night
#

?pdc

eternal night
#

idk man, hot reloading exists for a reason

royal heath
#

Isn't that exactly what plugman does anyways

eternal night
#

and does not suffer the same downsides a full classloader destruction has

#

no

#

hot reloading is completely different from plugman

tardy delta
eternal night
#

Yea

tardy delta
#

only used it once, then i just made sure my reload impl didnt break lol

eternal night
#

with JBR and some fun flags you can get pretty damn far for what you can hot reload

royal heath
#

Oh okay. True. Still though during dev it doesn't hurt to do that. Worst case scenario you haev to restart once every 20 reloads

eternal night
#

Well until you run into something like this ^

#

where there isn't an obvious error

lean ermine
#

yeah

eternal night
#

but shit just broke because reloading is flawed

lean ermine
#

its java shit regularly breaks with no obvious errors

royal heath
#

True, I've never had that happen to me in my entire life so I can't relate

eternal night
#

no, it is just reloading

#

java is fine, hot reloading would do too

tardy delta
#

just make your reload impl works and you dont need hot reloading uwu

eternal night
runic kraken
#

How can I disable collision between players on Spigot 1.18.2? I need to write such a plugin

royal heath
#

I looked into it, it does look more convenient

lean ermine
eternal night
#

if you use JBR, you can also pass -XX:+AllowEnhancedClassRedefinition -XX:+AllowRedefinitionToAddDeleteMethods for some extra fun

shadow night
#

damn

royal heath
#

You learn something new every day I guess

shadow night
#

Call that "absolute hotswapping"

royal heath
tardy delta
#

ofc?

#

just detect when a reload happens and handle stuff differently

royal heath
#

Oh, well yeah. I thought you meant a ./mycommand reload

tardy delta
#

or a whole server reload

slender elbow
#

i mean, you can detect a server reload, but you can't detect a plugman reload; and even then, case in point, the reload shown above literally didn't work at all and the whole broadcast thing was still from the old plugin xD

ancient plank
#

still interesting to me

#

'cus I've never had that happen in 4 years uwu

lean ermine
#

first time for me

#

really odd

slender elbow
#

hot reloading is far safer than scuffed plugman or server reload solutions

tardy delta
#

just dont use plugman

#

that thing is flawed by design

royal heath
#

Making me restart my server now making sure everything is working fine lol

grizzled lintel
#

"In 1.21, when I added the code 'Objects.requireNonNull(this.getCommand("status")).setExecutor(new command());', I got a NullPointerException error. Is there a workaround for this?

tardy delta
#

register your command in plugin.yml

grizzled lintel
#

I have already added this.

smoky anchor
eternal oxide
#

mvn clean package

#

and do not replace teh jar on a running server

lean ermine
#

does player metadata get purged by default if the plugin that assigned it reloads..?

#

or on a /reload

eternal oxide
#

depends what you mean by metadata

tardy delta
#

Metadatable?

slender elbow
#

ah yes the builtin memory leaks api

royal heath
#

I just set up that hot reload stuff. So useful wtf, especially using the debugger

lost matrix
#

metadata is garbage

lean ermine
#

what should i use instead then? all im doing is this

for(Player player : Bukkit.getOnlinePlayers()) {
    player.setMetadata(FLY_METADATA_KEY, new FixedMetadataValue(this, false));
}

with a check to see if the player can fly or doublejumps

#

is there a better alternative to using metadata?

eternal oxide
#

?pdc

lost matrix
lean ermine
#

what are the downsides of using pdc for something as easy as this

eternal oxide
#

none

#

its just flags you are setting

#

pdc stores in teh player.dat nbt

lean ermine
#

then i just switch to that, i didnt realise you could use that on players

eternal oxide
#

all entities, worlds, chunks and any block with a TileEntity

lean ermine
#

ive just been using it for items so far lul

#

oh well, thank you!

quiet ice
#

Does anyone know a hashtable-based implementation of List<T>?

#

The ordering semantics are irrelevant (though the iterator is still required).

tardy delta
#

like a set but with duplicates?

quiet ice
#

No duplicate entries are allowed

tardy delta
#

huh

royal heath
#

So you're trying to iterate the hashmap? I'm confused

quiet ice
#

ABI compatibility.
Some moron decided it's a good idea to use a List as a Set - even though calling List#remove(Object) on a list of 400k+ elements is obviously an extremely bad idea

tardy delta
#

🍴 time

quiet ice
#

I'm too lazy to write the ASM transformers for that - especially since I need to ensure compatibility and stuff

#

add(int, Object), remove(int), get(int) and all other index-based methods are not called.
The iterator however is being used.

royal heath
#

You could use a LinkedHashMap if you want to iterate over it

#

If I'm understanding what you're asking

quiet ice
#

ABI compatibility doesn't allow me to just alter the type of a field though

#

If I had my way I'd use ConcurrentHashMap#newKeySet(I)

royal heath
#

Oh true. I'm not sure then

quiet ice
#

Well I shall implement it myself then

slender elbow
#

j.l.r.Proxy :copium:

hybrid turret
#

when working with 7's inventory guide, should an inventory be unregistered upon closing it? or when should it be unregistered?
i fsr realized i never used the unregisterInventory-method lol

#

?gui

tardy delta
#

yes

hybrid turret
#

oh oops

tardy delta
#

not removing it when closing will only give memory leaks

hybrid turret
#

yea i that's what i thought lol

#

alright thanks

eternal oxide
#

remove it when you know you are not going to use it anymore

hybrid turret
#

well

#

since it's a clickgui it should be unregistered the moment it is closed, no?

#
  public void handleClose(InventoryCloseEvent event) {
    InventoryHandler handler = this.activeInventories.get(event.getInventory());

    if (handler == null) return;

    handler.onClose(event);

    this.unregisterInventory(event.getInventory());
  }
eternal oxide
#

that depends

#

some implementations create a UI and keep it to use for everyone

hybrid turret
#

what would be the difference there instead of registering it again?

eternal oxide
#

a choice between memory use and performance

lost matrix
tardy delta
#

^

hybrid turret
#

wait what? i was never talking about a Listener o.O

tardy delta
#

i just felt the urge to type ^

hybrid turret
#

also the man himself, flogestankbratwurst 🇩🇪

hybrid turret
#

i'm a bit confused

lost matrix
#

I honestly didnt read the convo

#

So im probably the cause for confusion

hybrid turret
#

it's about the GUIManager#unregisterInventory method

#

to remove the inventory/handler mapping from the map

lost matrix
#

Ah i see

hybrid turret
#

i can't see that it makes much of a difference, does it?

#

and if it did, i can't really comprehend how another player would get the same instance instead of just registering it again since in openGUI it just registers a new one

lost matrix
#

This tutorial is not exhaustive. The openGUI method is really just a helper method. But when used, you should 100% unregister the inventory when its being closed.

#

You can make a distinction for static and dynamic GUIs. A GUI that always looks the same, can be registered once, and then opened for multiple players.
But most GUIs have usages specifically tailored to the viewer. Which means you need to create a new instance, every time someone opens this GUI. And in that case, you should unregister it when its being closed, as its completely unique and wont be reused again.

pseudo hazel
#

yes, a use and yeet kinda deal

#

lol

#

you know you sound like a bot right?

#

anyways yes I am working on my plugin

#

but im actually moving to paper so yeah...

#

im just here when I have spigot related questions

#

(which is probably like a lot of other people ig)

slender elbow
#

is spigot 1.21.1 out ?

#

I NEED IT

pseudo hazel
#

wait is vanilla 1.21.1 out?

blazing ocean
#

been out for 5 days now

#

yea

#

just released

slender elbow
#

no

blazing ocean
#

md just time travelled

slender elbow
#

that was rc1

blazing ocean
pseudo hazel
#

what did they do? rework item meta again?

turbid lion
#

Is spitgot a launcher

pseudo hazel
#

no

#

not even close

blazing ocean
#

spitgot ain't a launcher

cedar saffron
pseudo hazel
#

its a server

eternal oxide
#

well kinda

#

?bootstrap

undone axleBOT
#

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

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

pseudo hazel
#

not being a bot lmao

#

unlike u

cedar saffron
#

something they way you say stuff like that pisses me off

turbid lion
blazing ocean
blazing ocean
#

hey @young knoll probably a selfbot

pseudo hazel
#

mods can someone ban this bot?

cedar saffron
eternal oxide
#

Someone needs to kick that bot

craggy badge
#

Hey im wondering if this is the place where i can ask for help? about minecraft servers

young knoll
#

?kick @rigid siren bot

undone axleBOT
#

Done. That felt good.

pseudo hazel
#

hey bot how about you join my server so its not dead anymore

#

thx

pseudo hazel
thick oracle
#

Hey, I'm trying to make players swim x% faster using the PlayerMoveEvent, but somehow I'm swimming extremely slow. Can someone please help me understand where my issue is?

@EventHandler
public void onMove(PlayerMoveEvent event) {
  Player player = event.getPlayer();
  if (!player.isSwimming()) return;

  Vector velocity = player.getVelocity();
  player.setVelocity(velocity.multiply(1.05)); // supposed to be a 5% increase
}
echo basalt
#

probably because the vel gets applied after the event

#

there's also a lot of client-sided prediction going on with that

thick oracle
#

hmm, do you have any idea on how I can make this work?

thick oracle
echo basalt
#

Something about the new velocity only being applied next tick too 🤔

thick oracle
#

it really shouldn't matter that the velocity is only applied in the next tick
The velocity is greater than what it was without modifications, so I should be moving faster, not slower, no?

grim ice
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

thick oracle
#

I'm already learning java, thank you

craggy badge
#

I’m creating a Minecraft server and I’m having trouble with making the scoreboard balance format look good. Currently, I’m using the vault_eco_balance_format but I’m not really satisfied with it. I’m looking for a placeholder that shows values like “1.25m” instead of “1m.” If anyone knows how to fix this, please help me.

eternal oxide
#

Still the Wrong channel

blazing ocean
halcyon hemlock
#

?kick @blazing ocean

blazing ocean
#

??

halcyon hemlock
#

😔

#

how are you rad

grim ice
#

i didnt mean it for you

#

my friend is learning java

blazing ocean
#

#bot-commands

grim ice
#

so i wanted to send him these resources

thick oracle
#

Oops lmao

grim ice
#

i have it hidden 😭

#

thats my bad

blazing ocean
#

same lol

acoustic pendant
#

Is it possible to send the server a broken block packet?

eternal oxide
#

send the server?

grim ice
#

but this is spigotmc, a server software...

chrome beacon
#

I mean you can do it from the server too

#

just no point

acoustic pendant
#

It is because i'm having a bug

halcyon hemlock
#

whats the bug

#

what the bug

acoustic pendant
#

I'm sending packets to show the player the crop has been broken

halcyon hemlock
#

what the bug!

acoustic pendant
#

but when the crop is not grown

eternal oxide
#

looks to me you are sending block updates/age of teh crop. and yoru code sucks

acoustic pendant
#

The code still says it is grown

lost matrix
acoustic pendant
#
   @Override
    public void replenishCrop(org.bukkit.block.Block block, HarvesterTools plugin) {

        long timeToReplenish = plugin.getConfig().getLong("tools.hoe.time-to-replenish") * 20;

        World world = block.getWorld();
        ServerLevel nmsWorld = ((CraftWorld) world).getHandle();
        BlockPos blockPos = new BlockPos(block.getX(), block.getY(), block.getZ());
        ServerLevel serverLevel = nmsWorld.getLevel();

        final LevelChunk levelChunk = serverLevel.getChunkIfLoaded(block.getX() >> 4, block.getZ() >> 4);
        final BlockState blockState = levelChunk.getSection(levelChunk.getSectionIndex(block.getY())).getBlockState(block.getX() & 15, block.getY() & 15, block.getZ() & 15);

        //BlockState blockState = levelChunk.getBlockState(blockPos);

        BlockState newState = blockState.setValue(BlockStateProperties.AGE_7, 0);

        //nmsWorld.setBlock(blockPos, blockState, 0);

        ClientboundBlockUpdatePacket packet = new ClientboundBlockUpdatePacket(blockPos, newState);

        for (Player player : Bukkit.getOnlinePlayers()) {
            CraftPlayer craftPlayer = (CraftPlayer) player;
            ServerPlayer serverPlayer = craftPlayer.getHandle();

            serverPlayer.connection.send(packet);
        }


        Bukkit.getScheduler().runTaskLater(plugin, () -> {
            //nmsWorld.setBlock(blockPos, grownState, 2);
            blockState.setValue(BlockStateProperties.AGE_7, 7);
            ClientboundBlockUpdatePacket grownPacket = new ClientboundBlockUpdatePacket(blockPos, blockState);

            for (Player player : Bukkit.getOnlinePlayers()) {
                CraftPlayer craftPlayer = (CraftPlayer) player;
                ServerPlayer serverPlayer = craftPlayer.getHandle();
                serverPlayer.connection.send(grownPacket);
            }
        }, timeToReplenish);


    }```
grim ice
acoustic pendant
#
    private boolean isFullyGrownCrop(Block block) {
        if (block.getBlockData() instanceof Ageable ageable) {
            return ageable.getAge() == ageable.getMaximumAge();
        }
        return false;
    }
earnest girder
#

I am comparing two ItemStacks using isSimilar(), and I want it to return true, but it is returning false. These are the two ItemStacks being printed. The second on is the base item from my ItemManager class, and the first is a stack of it from the player's inventory.

ItemStack{POTION x 26, POTION_META:{meta-type=POTION, display-name={"text":"","extra":[{"text":"New Make Scotch","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"red","bold":false}]}, enchants={minecraft:luck_of_the_sea=1}, ItemFlags=[HIDE_ENCHANTS, HIDE_ADDITIONAL_TOOLTIP], max-stack-size=64, custom-color=Color:[argb0xFFC0C0C0], custom-effects=[]}}

ItemStack{POTION x 1, POTION_META:{meta-type=POTION, display-name={"text":"","extra":[{"text":"New Make Scotch","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"red","bold":false}]}, enchants={minecraft:luck_of_the_sea=1}, ItemFlags=[HIDE_ENCHANTS, HIDE_ADDITIONAL_TOOLTIP], max-stack-size=64, custom-color=Color:[argb0xFFC0C0C0]}}

The only differences are the stack size, and that the one in the player's inventory has custom-effects=[] at the end. How can I fix this?

grim ice
#

im pretty sure all the client does is send block breaking progress

#

adnd the server does the rest

grim ice
#

use pdc to recognize your custom items

earnest girder
#

ok

halcyon hemlock
halcyon hemlock
#

#brokies

halcyon hemlock
acoustic pendant
#

otherways the bukkit api is just so laggy

halcyon hemlock
#

cuz it doesnt work properly

earnest girder
#

can you use the same NamespacedKey for all your custom items?

halcyon hemlock
#

bukkit is a bad api

acoustic pendant
#

"help-development"

grim ice
halcyon hemlock
#

i just like complaining

eternal oxide
#

first off, why are you using packets to age a crop?

halcyon hemlock
#

only sigmas would understand

acoustic pendant
eternal oxide
#

its not

acoustic pendant
#

It is

grim ice
grim ice
#

bro.

halcyon hemlock
#

like 'id'

acoustic pendant
#

spark consume was about 7% in 5seconds

grim ice
#

dude what

#

how is the bukkit api "laggy"

halcyon hemlock
#

how is an api laggy

acoustic pendant
#

It does unnecessary checks

halcyon hemlock
#

#relatable

acoustic pendant
#

It consumes a lot

grim ice
#

okay bro

halcyon hemlock
#

java is bad

#

just use asm

grim ice
#

theyre definitely unnecessary.

eternal oxide
#

Your code may show in spark that its laggy, but its yoru code not the API

grim ice
#

and it's not your misunderstanding of what they do

halcyon hemlock
#

🤑🤑🤑

grim ice
#

in any case, you should use the **Ageable **interface to set a crop's age

acoustic pendant
#

Consumed double or triple what is consuming now with packets

acoustic pendant
#

But the consume was really high

grim ice
#

consume?

#

what's a consume

acoustic pendant
#

like

#

server thread

grim ice
#

uhh

#

no?

#

setting a crop's age barely uses any resources

eternal oxide
#

you are changing the state of a single block. the API is not laggy for that

grim ice
#

unless you're doing it for thousands of blocks

acoustic pendant
#

setBlockState was consuming a lot for that

grim ice
#

why do you need to do that..

eternal oxide
#

don;t do it 30 times a second then

acoustic pendant
acoustic pendant
grim ice
#

you're probably doing something wrong if you need to do allat

eternal oxide
#

^

acoustic pendant
eternal oxide
#

which is why yoru packets are also bugged

remote swallow
#

how are you doing something more than there are ticks

acoustic pendant
acoustic pendant
#

Or 4

grim ice
remote swallow
#

its still 20tps

acoustic pendant
grim ice
#

that gave me a lot of information, thanks!

eternal oxide
#

so making the crops grow faster after being harvested?

acoustic pendant
acoustic pendant
grim ice
#

I don't see how can that lag a server

umbral ridge
#

you can create a scheduler for each crop block

lost matrix
#

When changing the blockdata via packets, you have to make absolutely sure the server doesnt screw around and resend the data with a different state.
Because this will happen a lot.

umbral ridge
#

and -n seconds each time is harvested

acoustic pendant
umbral ridge
#

it will grow faster

grim ice
#

just use minecraft gamerules, lol

#

its already in the game

acoustic pendant
lost matrix
#

The proper way would be to have one single task for all your crops and a PriorityQueue to poll from

halcyon hemlock
#

why is this chat so cursed

acoustic pendant
grim ice
#

what?

#

then what do you want to do?

acoustic pendant
#

I'm replanting a crop and making it fully grown after 3 secs

eternal oxide
#

it looks like thats exactly what you are doing

lost matrix
grim ice
#

that's exactly what "making it grow faster" means

acoustic pendant
#

but not whith a gamerule?

grim ice
#

why not?

umbral ridge
#

randomTickSpeed?

eternal oxide
#

So don;t use packets, use the API and actually update teh block

acoustic pendant
eternal oxide
#

you send nothing to the client. just let spigot do it all

acoustic pendant
#

However all this used a lot of server thread

acoustic pendant
eternal oxide
#

sendBlockChange is fake

grim ice
acoustic pendant
#

I just want the age to come from 0 to 7

acoustic pendant
grim ice
#

just make the randomTickSpeed really fast then

acoustic pendant
#

Just like i'm doing rn packets.
I just asked for a way to let the server know the age is 0 but using packets or tghat doesnn't use that much serverThread

lost matrix
acoustic pendant
#

Let me send you a spark profile 1s

grim ice
#

I just achieved what you want to do

#

in 2 seconds

#

with a minecraft command

#

i dont see why this necessitates a plugin, unless other plugins change vanilla behaviour

lost matrix
remote swallow
#

thats not lagging

acoustic pendant
#

Oh nevermind this is not the profile

#

that was bugged

remote swallow
#

its spending most of the time waiting

#

the server is under performing that it spends most of the tick waiting

acoustic pendant
lost matrix
remote swallow
#

.67%

grim ice
#

low quality but still

acoustic pendant
acoustic pendant
umbral ridge
#

in a few years spark will be .. deprecated.. and then someone will think of spark Plus or some crap and then users will be warned that spark is no longer supported BLAHBLAH XD

acoustic pendant
#

The crop was planted again automatically

grim ice
acoustic pendant
#

and cannot use the gamerule you said because many custom maps break when you don't have randomTickSpeed 0

#

so just not

#

I'll try to figure it out myself

earnest girder
#

is Entity#getUniqueID persistent between server restarts?

#

or does it change?

grim ice
halcyon hemlock
#

no reason for it to be changed

acoustic pendant
halcyon hemlock
#

pretty sure chunks save entities

grim ice
#

you don't want it to run instantly, yes?

#

use a bukkit scheduler?

lost matrix
# acoustic pendant and cannot use the gamerule you said because many custom maps break when you don...

Here is my proposal if you want to actually restore blocks on your server:

  record RestoreData(Block block, BlockData data, long time) implements Comparable<RestoreData> {
    @Override
    public int compareTo(RestoreData o) {
      return Long.compare(time, o.time);
    }

    public void restore() {
      block.setBlockData(data);
    }
  }
public class BlockRestoreTask implements Runnable {

  private final Queue<RestoreData> restoreQueue = new PriorityQueue<>();

  @Override
  public void run() {
    long currentTime = System.currentTimeMillis();
    while (!restoreQueue.isEmpty() && restoreQueue.peek().time() <= currentTime) {
      restoreQueue.poll().restore();
    }
  }

}

You create one restore task and simply throw blocks you want to restore in there

earnest girder
# halcyon hemlock probably persistent

if I'm storing it as a string in a config file and getting it when the server starts to check for an entity and it is returning null, is the problem that it isnt persistent?

acoustic pendant
#

using*

halcyon hemlock
acoustic pendant
#

which is more consuming that using packets

halcyon hemlock
#

why do you care about performance so much lmao

#

you're using java dude. java.

#

(real)

acoustic pendant
#

because if you fire that event many times can become laggy

lost matrix
grim ice
#

the api uses packets too though

acoustic pendant
#

Man, 2Hex just stop

grim ice
#

okay bro sure ☠️

halcyon hemlock
eternal oxide
#

also you sending packets will seriouly mess up if there is any interaction with the block while you are sending update packets

acoustic pendant
#

I came asking a way to solve that

eternal oxide
#

don't do it

halcyon hemlock
#

save the state yourself then

eternal oxide
#

use teh API

lost matrix
#

What happens if you leave the chunk and come back? The server will send the entire chunk data. You need to be prepared for that.
If a player right clicks a broken crop, it will also be sent by the server again.
You will have to write a lot of code if you want to handle this with packets.

eternal oxide
#

you can not get around interacting with the block during you sending packets

#

just update the block via the API and leave Spigot to update the client. There is no better way

acoustic pendant
#

That's my concern

eternal oxide
#

no they won;t

acoustic pendant
#

why?

lost matrix
eternal oxide
#

water flowing will be a heavier load than that

halcyon hemlock
#

5 people is crazy

acoustic pendant
eternal oxide
#

depending on teh server, 25 players all breaking multiple blocks at once MAY be noticable... slightly

acoustic pendant
eternal oxide
#

then don't

acoustic pendant
#

Math, retrieving from PDC etc

acoustic pendant
eternal oxide
#

so far all you have shown is growing crops faster

acoustic pendant
#

Because that is what i'm doing rn

zenith bobcat
#

Hey can someone tell me why not all classes are contained in the remapped-mojang jar which are present in the acual server jar

lost matrix
#

?bootstrap

undone axleBOT
#

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

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

acoustic pendant
#

I'll send full code of what I have rn (It may not be optimized or pretty as i'm working on it)

grim ice
#

if you look at CraftBlock.java

#

then the checks aren't for nothing (obviously)

#

what here could cause any issues?

#

tile entity cleanup?

#

there's no way IBlockData#hasBlockEntity makes that much of a difference

pine crest
#

white theme

grim ice
#

default theme*

acoustic pendant
#

I've just solved it with nmsWorld.setBlock()

#

bruh

pine crest
acoustic pendant
#

it doesn't use any server thread

lost matrix
acoustic pendant
#

Yeah, as I said it was because I'm working on it, had in mind to change the code to make it more readable, sorry

lost matrix
#

But one thing that can be improved right away:

        e.setCancelled(true);

        if (!ToolUtils.isTool(itemStack)) {
            if (plugin.getConfig().getStringList("farming-worlds").contains(world)) {
                e.setCancelled(true);
                MessageManager.miniMessageSender(player, plugin.messages.getConfig().getString("wrong-tool"));
            }
            return;
        }

Dont double cancel the event and dont read from configs on rumtime.
Also calling contains on a List is not optimal.

lost matrix
undone axleBOT
#

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

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

acoustic pendant
zenith bobcat
grim ice
acoustic pendant
#

And i'll change the config

grim ice
#

instead of this

lost matrix
acoustic pendant
lost matrix
#

Reduce your nesting. I usually dont go deeper than 2 nests.

zenith bobcat
acoustic pendant
grim ice
#

and you probably shouldn't be directly accessing your config

zenith bobcat
acoustic pendant
#

Thanks

zenith bobcat
#

and use this dependency <groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<scope>provided</scope>
<version>${remapped.version}</version>
<classifier>remapped-mojang</classifier>

chrome beacon
#

if it's not working send your entire pom

#

?paste

undone axleBOT
lost matrix
#

Does your IDE not resolve the classes? Do you get runtime exceptions?

zenith bobcat
chrome beacon
#

Are you making NPCs

zenith bobcat
chrome beacon
#

That isn't a mapping problem

lost matrix
#

^

#

You need to add a dummy connection on your ServerPlayer

chrome beacon
#

That's a your code problem ^^

zenith bobcat
lost matrix
#

Next time just tell us your actual problem 😅

zenith bobcat
#

i think that can only be done by using reflection right?

chrome beacon
#

The issue is that the server can't send packets to a player that doesn't exist

zenith bobcat
lost matrix
lost matrix
lost matrix
zenith bobcat