#help-development

1 messages · Page 1164 of 1

hybrid spoke
#

after every „you“ placing a random insult

grave rune
#

I don't know if I'm just too stupid, but when using Spigot 1.21.1 my plugin works and can be started. However, if I don't change anything in the plugin folder and just change the server jar to Spigot 1.21.3, I get the following error when starting the server.

java.lang.NoSuchMethodError: 'void com.fasterxml.jackson.dataformat.yaml.YAMLParser.createChildObjectContext(int, int)'
        at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:520) ~[?:?]
        at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4761) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4667) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3494) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]

What am I missing here or has something been changed in Spigot 1.21.3?

General understanding: I use Jackson for file handling, because I need it for other things where I can't access the internal Spigot stuff

chrome beacon
#

Spigot doesn't bundle Jackson

#

You will need to supply it yourself

#

Adding it as a library in your plugin.yml should fix it

grave rune
chrome beacon
#

Send your startup log

#

?paste

undone axleBOT
grave rune
#
libraries:
  - org.xerial:sqlite-jdbc:3.46.1.0
  - com.github.twitch4j:twitch4j:1.21.0
  - com.squareup.okhttp3:okhttp:4.12.0
  - com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0
  - com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.0

log:
https://paste.md-5.net/ewelaburiy.md

chrome beacon
#

Are you sure the method you're using is present in the version of jackson specified

grave rune
chrome beacon
#

Just wanted you to double check

#

because I've seen people multiple times say they hadn't done any changes

#

while they had

grave rune
# chrome beacon while they had

I check it... only replaced the server jar - started... changed back and again...

From log:
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4761) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]

In 1.21.3 the plugin is getting version 1.13.2 if I am correct.

So my assumption was that this is contained in the spigot jar.... Then the only question would be why exactly this version, since there is already 1.18.3 of it and why between versions 1.21.1 and 1.21.3 (I haven't tested 1.21.2 yet)

chrome beacon
#

Yeah I was about to say that the version in the stacktrace looks off

#

I don't see it being loaded by the library loader neither

#

Could you replicate the issue without any other plugins installed

grave rune
sullen marlin
#

I guess 1.21.3 has its own Jackson now - Mojang added a bunch of libraries

rough drift
#

oh man the funny Australian Man is speaking wisdom

grave rune
rough drift
#

what

grave rune
faint tide
#

hiya,

I can't seem to find anything about this online.
Is it possible to make a helmet glow? you have the glow effect which makes the whole entity glow, but I only want to make the helmet glow (the body is hidden).

But all I see online is to use the enchantment glint, which isn't exactly what I want

chrome beacon
sullen marlin
grave rune
smoky anchor
faint tide
#

yeah so that's the thing. the armorstand gets the glow. that's what i wish to avoid.

basically it is to remove a minigame. once you've entered the minigame i want the game grid to "glow" to show which game you're selecting.

but i find it very ugly to have the full armorstand glowing

smoky anchor
#

That's why you need to make the armorstand invisible ?

#

The armor stays visible and the helmet will have glow effect

faint tide
#

invisible doesnt hide the armorstand tho

smoky anchor
#

make it marker

#

And I apparently remember it wrong, sorry for that

faint tide
#

thanks mate!

smoky anchor
#

Glad the marker worked, np

tawdry echo
#

BlockDisplay have glowing?

smoky anchor
#

I think they do

#

but I thought they wanted to show a helmet
Which you can't do with display entities

tawdry echo
#

Ouh

#

Od thinking about head

faint tide
#

block display could've worked too, but I would've chosen that as option b

smoky anchor
#

If you want to show playerhead, then either display entity can do that

chrome beacon
#

^^

smoky anchor
#

If you only want to show heads, do use display entities.
Much better.

chrome beacon
#

also item displays can be set to show as if the item was on the head

smoky anchor
#

That is true, but that won't render as armor.

#

To my knowledge

faint tide
#

butr item displays are quite new right? are they compatible with 1.18?

smoky anchor
#

no they ain't

worthy yarrow
#

no

#

1.19.4+ iirc

faint tide
#

ah, there's the next issue :3

smoky anchor
#

Why do ppl never start with the version

faint tide
#

but the armorstand marker works fine

chrome beacon
smoky anchor
#

yes

faint tide
tender shard
#

use the correct group id "com.jeff-media" and get it from maven central

smoky anchor
proud badge
tender shard
proud badge
#

I got it working now

#

After using maven central

worthy yarrow
#

https://paste.md-5.net/ariluruxuy.java

I was thinking about it and it may not be the best to be holding a reference to the main in each disc object, though I need a plugin reference to handle the tasks, that being said you guys think it'd be better to delegate this to another method somewhere else ie: a disc manager?

wet breach
slender elbow
worthy yarrow
#

Well that is what I am doing right now

wet breach
#

generally though you should stick with DI, but if DI isn't really needed just use the static way

worthy yarrow
#

It's just that I feel the disc objects should be more independent as they rely on a couple of things right now

wet breach
#

the only disadvantage of using a reference object is that its another object, but it isn't really going to harm anything in regards to main class since as I said its not like it will just go away

worthy yarrow
#

Yeah fair

#

All the discs are the same in terms of implementation with minor differences being like disc base speed etc, so perhaps just passing the disc object somewhere else to manage the actual functionality?

#

It just feels quite bloated

wet breach
#

well if all the discs are basically the same, they should be extending a base disc

worthy yarrow
#

They are

#
public abstract class Disc implements Cloneable {

    private final int speed;
    private final int glide;
    private final double turn;
    private final double fade;
    private final String discName;
    private final DiscType type;

    public Disc(int speed, int glide, double turn, double fade, String discName, DiscType type) {
        this.speed = speed;
        this.glide = glide;
        this.turn = turn;
        this.fade = fade;
        this.discName = discName;
        this.type = type;
    }

    public int getSpeed() {
        return this.speed;
    }

    public int getGlide() {
        return this.glide;
    }

    public double getTurn() {
        return this.turn;
    }

    public double getFade() {
        return this.fade;
    }

    public String getDiscName() {
        return this.discName;
    }

    public DiscType getType() {
        return this.type;
    }

    public Disc clone() throws CloneNotSupportedException {
        return (Disc) super.clone();
    }

    public abstract void handleThrow(Player player, PlayerSkills skills, String technique, BlockFace direction);

    public abstract void applyDiscPhysics(Player player, ItemDisplay discDisplay, Vector initialVelocity, int maxTicks, String technique, BlockFace direction);

}
wet breach
#

and then you should have a manager class for all these discs

#

that keeps track of them, the discs should really be asking the manager for information, not entirely sure what the discs would need from main

worthy yarrow
#

Simply just the reference to invoke the tasks

wet breach
#

o.O

worthy yarrow
#

I mean the only thing that'd end up changing is removing the field reference, and just passing it to the handleThrow/ApplyTechnique methods

#

So really now I'm not sure if this is needed

wet breach
#

you should have a manager that gets created in main and holds the reference, the manager should be handling the tasks or tasks delegated to it

#

and in there you would ideally have a task that runs every so often or when needed to do stuff

worthy yarrow
#

Also it should be mentioned the tasks inside the disc objects are only for visually displaying the throw

#

Honestly not sure if I should be worried about this cleanup right now

#

I still need to get the minigame system fully functional... which is difficult considering I haven't implemented any course stuff yet so the par system won't have much of an effect right now

#

Also I was thinking if switching to a completely event driven system would be better

#

This way I can handle individual's turns better within a round and what not

wet breach
#

you should, its easy to create events

#

I have some examples if you need them

worthy yarrow
#

I mean the event classes are basically just data wrappers no?

#
public class GoalScoreEvent extends Event {

    public static final HandlerList HANDLERS = new HandlerList();

    private final Player player;
    private final int holeNumber;
    private final GameRound round;

    public GoalScoreEvent(Player player, int holeNumber, GameRound round) {
        this.player = player;
        this.holeNumber = holeNumber;
        this.round = round;
    }

    public Player getPlayer() {
        return this.player;
    }

    public int getHoleNumber() {
        return this.holeNumber;
    }

    public GameRound getRound() {
        return this.round;
    }

    @Override
    public HandlerList getHandlers() {
        return HANDLERS;
    }

    public static HandlerList getHandlerList() {
        return HANDLERS;
    }
} ```
#

I'd almost argue that events should just be records

umbral ridge
#

They could be

worthy yarrow
#

Also now that I'm looking at this event, the holeNumber should be a reference in the actual round yeah?

#

Oh actually I think I just did that for testing

quaint mantle
#

it work only one time...

chrome beacon
#

odd

#

but why do you need to run it again already?

quaint mantle
#

because I installed the wrong version

#

i installed 1.21.1 but i wanted 1.21

eternal night
#

1.21 has a known exploit

#

that is fixed in .1

remote swallow
#

1.21.1 has been superceeded by 1.21.1

#

there is no reason to need 1.21

quaint mantle
#

k

young knoll
#

Pretty sure 1.21 was fully replaced

chrome beacon
#

it was

rough drift
#

lmao

cinder peak
#

on 1.21 dosent work TextComponent component = Component.text("Klick mich um die AudioSession zu oeffnen");
component.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org/"));
component.hoverEvent(HoverEvent.showText(Component.text("Klicke um zu oeffnen")));
player.sendMessage(component.content());

#

please help

chrome beacon
#

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

chrome beacon
#

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

cinder peak
#

Yes not working

#

Why is it not clickable or hoverable

chrome beacon
#

Did you convert it back in to a string

#

you need to send the component

#

Take a look at the adventure docs on how to do so

cinder peak
#

Ja aber ich habe schon andere varianten versucht aber ich verstehe nicht warum es nicht geht

#

Yes, but I've tried other variants but I don't understand why it doesn't work

#

sorry

chrome beacon
#

It doesn't work because converting it to a string will remove the data required to make it hoverable/clickable

#

You need to send the component

pseudo hazel
#

yes, but these are adventure components

#

might be better to ask in adventure discord server

hazy parrot
#

oh textcomponent doesn't exist in spigot

#

lol

remote swallow
#

text components do

#

all component stuff is from bungeechat

#

Component.text doesnt afaik

cinder peak
#

how it work?

cinder abyss
#

Hello, how can I make a block emit light in 1.21 ?
Basically, I've got a block who is not emitting light normally, and I want to make it emit light

rough ibex
#

You can put a light block next to it

cinder abyss
#

yeah I thought of that

rough ibex
#

Not sure theres a method to change a blocks light level

cinder abyss
#

but if I can make it be the light, that would be much easier

fickle helm
fickle helm
#

I don't like being forced to use deprecated or experimental APIs

chrome beacon
#

You can use the experimental one

#

The deprecated one should continue to work as well

fickle helm
#

Yeah and I'm not sure why I'm forced to reference the slot group. imo I should be able to provide null to it but it's marked as NotNull

chrome beacon
#

Use the ANY slot group

fickle helm
#

It just doesn't make sense if I'm changing the generic max health that I need to give it an equipment group

chrome beacon
#

You need to tell it when to give the extra health

pseudo hazel
#

can I use a MapRenderer to draw multiple images on top of each other without them erasing the below one? like the image I wanna use has alpha but it just overwrites all pixels on the map regardless

young knoll
#

Maps don’t support transparency

#

And only have a limited selection of colors anyway

pseudo hazel
#

right

#

I know

#

the default renderer is able to draw under my images just fine though

#

but I cant manage to do the same

#

also idk what the limited about of colors have to do with it

young knoll
#

I figured you wanted to overlay the two images and colour merge them

pseudo hazel
#

no I wanted to just say like if the alpha is 0, then dont actually draw a pixel

#

because whats the point

#

but now that I am trying again, I can see that it doesnt render under the images , just around it

#

so I might be halucinating

young knoll
#

You could overlay the items manually ig

pseudo hazel
#

yeah like read the pixels of the top image and only draw the visible ones

#

ig that would work

#

also is there really no way to give the map more pixels?

#

rn im stuck at 128x128

young knoll
#

Nope

pseudo hazel
#

alr

#

thanks for helping anyways

thorn crypt
#

Hello, does someone know how I can get to use the Faction API (Factions plugin from MassiveCraft) in order to retrieve a player's faction?

orchid trout
#

does anyone have archives of the you suck at anticheats series

mighty rampart
blazing ocean
#

you are on the spigot discord server

#

looking at a spigotmc plugin

#

on the spigotmc website

nova notch
#

i like how Java is an option lol

blazing ocean
#

nono you gotta use c++

pliant topaz
#

You wanne use a programming language, Modloader or Pluginloader...

#

Choose your fate!

blazing ocean
#

i wanna use prismlauncher

pliant topaz
#

then do that :3

#

i think i'll go with binary for minimal bloating and peak efficency uwu

pliant topaz
mighty rampart
orchid trout
#

NO YOU WONT

crimson mulch
#

Hi, my buildtools is pissing me off, everything works fine, and then there is just a random error getting out of no where

<3>WSL (11) ERROR: CreateProcessCommon:559: execvpe(/bin/bash) failed: No such file or directory
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [bash, applyPatches.sh]
    at org.spigotmc.builder.Builder.runProcess0(Builder.java:1042)
    at org.spigotmc.builder.Builder.runProcess(Builder.java:967)
    at org.spigotmc.builder.Builder.startBuilder(Builder.java:679)
    at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
river oracle
#

ERROR: CreateProcessCommon unless I'm wrong

#

it'd be helpful to post the entire log

#

?paste

undone axleBOT
river oracle
#

yeah idk this is weird it really seems like it could be a WSL issue

#

I've never seen such a log

#

I mean best you can do is clear caches and try again

crimson mulch
#

ill try to containerize it then :derp:

sonic stratus
#

Hi, I would like to spawn NPCs using NMS, but I don't really understand how it works. Does anyone have something that could help me? I'm using Spigot 1.21.3.

chrome beacon
crimson mulch
sonic stratus
#

on my server

blazing ocean
#

and you'll have approximately a trillion less headaches

sonic stratus
chrome beacon
crimson mulch
#

double click

chrome beacon
#

Not sure why it would use wsl

crimson mulch
#

docker's fine tho

#

actually ...

#

i need in my local repository so that's not fine at all

blazing ocean
#

?1.8 concern

undone axleBOT
crimson mulch
chrome beacon
#

Try running the cli instead of the gui

blazing ocean
#

i believe for 1.8 you need to build a latest version first and then 1.8

crimson mulch
crimson mulch
chrome beacon
#

I meant the BuildToold gui

river oracle
# crimson mulch

part of your issue is that 1.8.8 doesn't build correctly the first try anymore

blazing ocean
#

but again why use an almost 10 year old version

river oracle
#

its been this way for a while

#

and its a not going to fix issue

#

you may have to compile a brand new version first

crimson mulch
river oracle
#

maybe 1.8.8 build finally broke 🥳

#

we can only hope

blazing ocean
#

finally 🙏🙏🙏

river oracle
#

seriously though running spigot on 1.8.8 is really fucking stupid please find a fork

blazing ocean
#

....

river oracle
#

that is not a better fork for 1.8.8

#

in fact that's just as bad

crimson mulch
#

okay but

#

did i ask

blazing ocean
#

i mean

#

why use buildtools if you're using paper

#

lmfaoo

crimson mulch
#

paper support classic spigot for plugin

blazing ocean
#

userdev moment

river oracle
#

I don't think userdev existed in 1.8.8

#

I mean that was 10 years ago

blazing ocean
#

lol common 1.8 L

crimson mulch
#

I love coding in 1.20, but sometimes customer ask for something in old version

blazing ocean
#

imagine using outdated software

#

could literally not be me

#

also miles go review my code

crimson mulch
#

U see, that's one of the reason why i hate to ask for help 👀

river oracle
#

yeah I'd hate to ask for help if I used a rediculously outdated version too

violet blade
#

the three major server softwares rn would not give support for such outdated version

blazing ocean
#

if you use a 10 year old version you gotta know how to fix issues yourself kekw

crimson mulch
crimson mulch
#

and it does that with any version so the version is not the point

river oracle
#

Wonder how many exploits that server will have unpatched

crimson mulch
#

don't worry about that, that's not a playable server 😜

blazing ocean
blazing ocean
#

i love how it's a long

slender elbow
#

this is a two's complement joke

#

only people who understand two's complement will understand it

#

two's complement gang 💪

river oracle
#

That's not good

quaint mantle
crimson mulch
# quaint mantle ?whereami

I use paper, but I have a problem with the BuildTool which is Spigot who created it, so your point is useless

quaint mantle
crimson mulch
#

I can use paper and spigot at the same time ...

quaint mantle
#

oh yeah

#

sorry

#

thought u were askin smth bout paper

crimson mulch
#

dw but just read next time

quaint mantle
#

my bad

#

i'm so sorry

crimson mulch
#

dw

nova notch
#

hit em with the question mark 1.8 instead

quaint mantle
#

?1.8

undone axleBOT
nova notch
#

we getting 1.8.8 decade old before GTA 6

crimson mulch
#

Your grandpa is old and you don't throw it to the trash anyway

nova notch
#

it was a joke bruh chill 😭

crimson mulch
#

?grandpa

#

see it's not that old ig

#

Sometimes old, dreprecated, and stinky things are just so fun to rage with 🤡

I use 1.8.8 at my own risk and I understand it, but don't just trash me cause I'm using this version for some random project.

Just for depencies it's an headache so I guess you are right, it's too old, but that's just fun to have some challenge with the older versions

#

and also i dont have the choice its for a customer

nova notch
#

idk what any of that has to do with my grandpa but aight man

crimson mulch
#

srry 😛

quaint mantle
#

?howold a

undone axleBOT
quaint mantle
#

lol

#

?howold @quaint mantle

undone axleBOT
quaint mantle
river oracle
quaint mantle
#

Lol

obtuse hedge
quaint mantle
quaint mantle
vital sandal
#

any suggestion on improving this singleton design, the main idea is the object with the same value is the same in term of both value and address.

#
import java.util.Map;

public class AssignedSlot {
    private static final Map<String, AssignedSlot> singletonSlot = new HashMap<>();
    private final int slot;
    private final ActivationType action;
    private final boolean isPassive;

    private AssignedSlot(int slot, ActivationType action, boolean isPassive) {
        this.slot = slot;
        this.action = action;
        this.isPassive = isPassive;
    }

    public static AssignedSlot createAssignmentSlot(int slot, ActivationType action, boolean isPassive){
        String key = slot+action.name()+isPassive;
        singletonSlot.putIfAbsent(key, new AssignedSlot(slot, action, isPassive));
        return singletonSlot.get(key);
    }

    public int getSlot() {
        return slot;
    }

    public ActivationType getAction() {
        return action;
    }

    public boolean isPassive() {
        return isPassive;
    }
}```
hazy parrot
#

putIfAbsent + get can be replaced with computeIfAbsent

lilac dagger
#

create instead of createAssignmentSlot

#

it is already referenced by the class name

#

AssignedSlot.createAssignedSlot sounds redudant no?

#

use hash and equals and instead of a map use HashSet

#

you could but then you'd have to create pointless assigned slots, nvm

#

you can have a static reusable assigned slot that you can modify in order to check if it exists in the Set

#

but only if you're not working with multiple threads

near furnace
#

I wanna restart my sendActionBar timer everytime a player hits another player, and restart the inCombat timer, but i don't know how? I've added a restartTimerOnEachHit hashmap but it won't come to my brain how i'm gonna use it

smoky anchor
#

Make it restartTimerOnEachHit a Set<UUID> restartTimerOnEachHit = new HashSet<>();
Add UUID playerUUID = player.getUID(); (or whatever the method is) under refreshTime for example
Add

if (restartTimerOnEachHit.remove(playerUUID) != null)
    secondsLeft = defSecondsLeft;```
in the sendActionBar runnable, as first statement in run()
Then simply add the player UUID to the set when hit

I think
smoky anchor
# near furnace I wanna restart my sendActionBar timer everytime a player hits another player, a...

What is inCombat for ?
I see no reason for it to have a Long, it is not used. Could be a Set<UUID> as well.
And instead of removing a player from inCombat via a scheduled task in the handleCombatStatus, do it in sendActionBar, when the task would be cancelled. That would solve the "restarting" too.
Would also be good to change the name of the method in that case probably.
And why does the sendActionBar method have a message parameter when it is called only once and it is always the same.

#

I don't exactly understand the need for playerBedLocations. Can you not do player.getBedSpawnLocation() once the player has left ? Wherever you use it, you already have a player instance, this seems as a pointless waste of memory.

near furnace
smoky anchor
#

And I don't exactly like defSecondsLeft and refreshTime in the sendActionBar method.
Those should be static final constants instead.

near furnace
#

cuz the player has already left

#

it showed an error something

smoky anchor
near furnace
#

and i need the bed spawn, cuz when they log back in i need to tp them there

smoky anchor
#

Yeye, gotcha.

near furnace
#

i put defSecondsLeft (aka define seconds left) and ill make it a config thing later

#

so u can change the value from config.yml

smoky anchor
#

Ok, that's fine as well then.

smoky anchor
near furnace
#

owh

#

what more changes should i make

smoky anchor
#

Just re-read my messages.
change inCombat, change restartTimerOnEachHit, change how you remove from inCombat

near furnace
#

remove handleCombatStuff and merge it into sendActionBar?

smoky anchor
#

I guess that could work

#

probably the other way around

near furnace
#

but! i need that to be customizable aswell haha, cuz i want to set in config that you can choose from action bar text or titles or subtitles

smoky anchor
#

And one small thing, change the HashMap<...> .. = new HashMap<>(); to Map<...> .. = new HashMap<>();

near furnace
#

thats why like, if its said in config, call sendActionBar method, otherwise, call something else like titles or subtitle timers

near furnace
smoky anchor
#

Sure, but if you do my suggestion to remove from inCombat in the sendActionBar then it would be silly to have it multiple times
Instead make method "send message" and there make the decision which way to send the message.

smoky anchor
near furnace
#

ohh sendmessage method, and the config will choose which type of message to send

near furnace
smoky anchor
#

I can't explain these things as well as other ppl here can.

#

Speak of the devil

worldly ingot
#

There’s practically zero benefit for any other parts of your code to know it’s a HashMap. All it should care about is that it’s a Map. If it then later has to change to an EnumMap or a ConcurrentHashMap, your methods and uses of the map object probably will not change at all, but if it were defined as a HashMap then you may have to update all your signatures that expect a HashMap

#

Obviously you may need a more specific type of map, like a Multimap, but you often want to just define your types by what you expect to use them for.

near furnace
#

ok im gonna do my inCombat logic in the sendMessage method

smoky anchor
#

sendMessage should only decide what type of message it should send
That is it.

near furnace
#

oh

#

okie

smoky anchor
#

Do fix it up and feel free to send it here again
But preferably use

#

?paste

undone axleBOT
near furnace
#

ok ill use ?paste next time

smoky anchor
#

no just go that that website

near furnace
#

yea yea

smoky anchor
#

the ?paste is just a command to send the website

#

okok good :D

near furnace
#

:)

near furnace
#

i cry when i look at my noob ass code,

ive kinda "organized" it, and made a chain of things. PlayerHit called handleCombat method, and it calls the sendCountdownTimer method and it calls the appropriate type of countdown which is actionBar...

somber scarab
#

I remember having hte issue "org.bukkit.craftbukkit.bootstrap.Main
java.lang.UnsupportedClassVersionError: org/bukkit/craftbukkit/bootstrap/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 62.0"

I had it before long ago but I forgot how to fix it again

#

I tried installing java SE 18 but that didn't fix

worldly ingot
#

That's cause Minecraft requires Java 21

somber scarab
#

hmm

#

I remember having 21 tho.. that's what the Build Tool used

worldly ingot
#

It may not be set to 21 on your classpath though. java --version would tell you what it's using by default

#

Sorry, in your environment variables*, not classpath

somber scarab
#

right it's 18

#

thanls

worldly ingot
#

You can either update your environment variables to use the 21 installation, or just directly invoke the java executable from your 21 install path

#

Either one works

lilac dagger
#

the second one is great if you still wanna run servers on lower java versions

#

or higher

buoyant viper
blazing ocean
proud badge
#

Is it possible for BlockPlace or BreakEvent to fire in a chunk which hasnt sent ChunkLoadEvent?

eternal oxide
#

no, not unless a plugin fires the event itself

proud badge
#

with Bukkit.callEvent?

eternal oxide
#

yes

proud badge
#

ok got it thanks

somber scarab
#

Could not load 'plugins\LetterShuffle.jar'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `org.bluenova.letterShuffle.LetterShuffle'

HMMMM

´´´yaml

eternal night
#

letterShuffle

#

lettershuffle

somber scarab
#

I get that

eternal night
#

HHMMMMMM

somber scarab
#

but there is no letterShuffle

eternal oxide
#

S s

eternal night
somber scarab
#
name: LetterShuffle
main: org.bluenova.lettershuffle.LetterShuffle
version: 1.2
api-version: 1.21.1
author: BlueNova
description: can't use the letter that it gives you
commands:
  LS:
    description: Letter Shuffle main command
    usage: /LS <start/end>```
somber scarab
eternal night
#

sounds more like your buildtool cache is fucked

#

mvn clean package

somber scarab
#

but that doesnt exit in my plugin.yaml

eternal night
#

or gradle clean; gradle build

somber scarab
#

yep worked

#

thx

proud badge
#

ChunkUnloadEvent is fired before the chunk is unloaded, right? So modifying the chunk's PDC during the event shouldnt cause issues

eternal night
#

Yea

somber scarab
#

I have another issue

#

it seems Intellij keeps injecting its own plugin.yml

#

instead of using mine

#

any idea how to change that?

eternal night
#

how does IJ "inject" things? Is the file being changed?

somber scarab
#

when I check the jar with WinRaR I see a plugin.yml that Ididn't create.

#

mine is different

#

and it's using the wrong api version (i think)

eternal night
#

what build tool are you using?

somber scarab
#

mvn

eternal night
#

IJ should not touch anything regarding maven

#

so ehhh

somber scarab
#

well maybe it's maven then

#

how do I tell it to use this plugin.yml and not whatever this is

eternal night
#

anything funky in your pom.xm l? Are you sure it isn't just an issue that was solved with clean

somber scarab
eternal night
#

your plugin.yml is in the src/main/resources folder ye?

somber scarab
#

oh

eternal night
#

figured omegaroll

#

Yea, the one in the root of your project is not picked up by maven

#

that is just whatever "old" method you were using

somber scarab
#

man I've forgot so many of the basics lmao

#

I'vnt been developing for a while

#

thanks

eternal night
#

👍

somber scarab
#

making some shitty plugin for a minecraft challenge for my channel

cinder abyss
#

Hello, I've got a method triggered in a command to spawn an ItemDisplay and a light block up, Idk why, but when doing the spawn of the light block, everything after is not achieved. Here is my code :```java
/**

  • Spawn the custom block at the given location

  • @param blockLoc The location of the block
    */
    public void spawn(Location blockLoc) {
    blockLoc.getBlock().setType(blockInside);

    // BLOCK
    blockLoc.getWorld().spawn(blockLoc.add(.5, .5, .5), ItemDisplay.class, itemDisplay -> {
    spawnedDisplay = itemDisplay;

         itemDisplay.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.HEAD);
    
         itemDisplay.setTransformation(new Transformation(
                 new Vector3f(0f),
                 new AxisAngle4f(0f, 0f, 0f, 1f),
                 new Vector3f(1f),
                 new AxisAngle4f(0f, 0f, 0f, 1f)
         ));
    
         commonArguments.apply(this);
     });
    

    // TODO : Wtf not working, it blocks everything
    Block lightBlock = blockLoc.add(0, 1, 0).getBlock();
    lightBlock.setType(Material.LIGHT);
    Light light = (Light) lightBlock.getBlockData();
    light.setLevel(emittingLightLevel);
    lightBlock.setBlockData(light);

    BountifulLib.trackedDisplays.add(spawnedDisplay);
    }```

smoky anchor
proud badge
inner mulch
#

Does World#getLoadedChunks return all Chunks that have at least been loaded once or does it return the chunks that are currently loaded by a player?

cinder abyss
proud badge
inner mulch
#

Array of All loaded chunks

proud badge
#

means currently loaded

#

in memory

inner mulch
#

Is there a way to read the data of all chunks that have existed?

slender elbow
#

not with the api

shadow night
#

That reminds me of aternos' "optimize worlds" feature (it breaks shit most of the time)

umbral ridge
eternal night
#

without the API of course

umbral ridge
#

XD

#

you could read world region files

#

and parse them somehow

eternal night
#

Yea that is how its usually done

proper cobalt
#

im trying to leash a player to an entity

#

would Entity#setLeashHolder be correct

#

it says

#

Method invocation 'setLeashHolder' may produce 'NullPointerException'

#

so ig this is only if they have a leash holder

#

how can i "create" a leash holder

#

oh nvm im dumb

bold plume
#

world.loadChunk(-825, -650) - do these two integers represent chunk coordinates or world coordinates? Spigot 1.8

chrome beacon
#

chunk

bold plume
#

I know that if a UUID is in ANIMALS, it is not in wave_animals but if it is not in ANIMALS it may be in WAVE_ANIMALS. That said, what is the fastest option?

option 1:

if (MonsterRunnable.ANIMALS.remove(entity.getUniqueId()) == null) {
MonsterRunnable.WAVE_ANIMALS.remove(entity.getUniqueId());
}

option 2:

MonsterRunnable.ANIMALS.remove(entity.getUniqueId());
MonsterRunnable.WAVE_ANIMALS.remove(entity.getUniqueId());

proper cobalt
#

idk im tryna do this
player.setLeashHolder(stand.getEntity());

#

i want the player to leash the armor stand

#

but nothing happens

chrome beacon
#

You're leashing the player to the armorstand

#

instead of the other way around

proper cobalt
#

oh ight

proper cobalt
#

how can i unleash the player later when i dont have a reference of the armorstand entity tho

chrome beacon
#

the performance is negligible

chrome beacon
#

or just setting null

#

The docs are a bit confusing ngl

proper cobalt
#

yeah idk still not leashing

#

"non-living entities"

#

ig it doesnt work on armor stands?

chrome beacon
proper cobalt
#

why doesnt it work then bruh

bold plume
chrome beacon
#

That works too

bold plume
#

what u think more usable

chrome beacon
#

second one looks cleaner

bold plume
#

ok

#

gpt: "Option 2 is more efficient because it reduces the complexity of logic flow while still achieving the desired result. It directly attempts to remove the UUID from both HashMaps without additional checks, making the code cleaner and more performant"

sweet pike
#

I'm facing some issue trying to set block data Powerable to true. In my example, I am attempting to set powered rails as powered for every block in a region location:

poweredRails.forEach { region ->
            region.key.toSingleBlockLocations().forEach { // <- Location object
                it.block.type = Material.POWERED_RAIL

                it.block.blockData = it.block.blockData.apply {
                    (this as Rail).shape = region.value
                    (this as Powerable).isPowered = true
                }
            }
        }```
the rail does not seem to be set as powered. I have also tried delaying he set the `isPowered` by at least 2 ticks. nothing seems to actually set it to powered
pseudo hazel
#

dont have to add the data to the block just like item meta?

young knoll
#

Does apply call getBlockData, edit it, and then setBlockData?

#

Idk how Kotlin works

pseudo hazel
#

idk

#

apply is called on the blockdata, not on the block

#

how would it know the block to apply it to

#

unless this is kotlin voodoo magic

sweet pike
sweet pike
pseudo hazel
#

well idk

#

you can try it ig

sweet pike
#

well that's what im doing

pseudo hazel
#

oh

#

right because there are no setters

#

magic after all

sweet pike
#

let me clarify by using the expanded method what im doing:

it.block.setBlockData(it.block.getBlockData().apply {
    (this as Rail).shape = region.value
    delay(2) {
        (this@apply as Powerable).isPowered = true
    }
    return
});
young knoll
#

Set it without applying physics

sweet pike
sweet pike
young knoll
#

It should

#

Does the shape change?

blazing ocean
#

or you could just onEach instead of forEach, because that's what it's made for

tall gyro
#

hi

#

how i can generate a world throw a code with my datapack?

chrome beacon
#

I don't understand the question

tall gyro
#

so datapack cheanges my world generation

#

so how i can do this

#

without putting it in a my world folder with my hands and do it throw my code

#

sry for my bad english i probably not an english-speaker user

#

in short, i want to create a small plugin that will genearate a large amount of small worlds with my datapack

outer river
#

hello, i have an issue, i try to moove my world my plugin's folder when i create it but it doesnt work:


private void moveToFolder(World w) {
        w.getWorldFolder().renameTo(new File(main.getDataFolder(), "Maps/"+w.getName()));
    }
chrome beacon
#

So why are you trying to rename it like that

#

instead of moving it

#

Use the Files API and make sure the world is fully unloaded before you do so

#

(if you have the world instance like above it's probably not unloaded)

outer river
#

hmm i see, and maybe you know a way to create the world directly in a wanted folder ?

#

i rode thats was not possible but idk

chrome beacon
#

I believe you can specify the folder path directly in the world name

#

when using the WorldCreator

#

Though I can't say if that's intended or not

outer river
#

okok, i'll try thx

young knoll
#

It’s relative to the world folder tho

#

Idk if you can go up directories with it

toxic sorrel
#

is there a way to set a wolf's armor? i've tried using ((Wolf) entity).getEquipment().setArmorContents but it seems like this isnt even where the armor is "stored" on a wolf

young knoll
#

Isn’t there an EntityEquipment#setItem(EquipmentSlot, ItemStack)

#

Or something similar

umbral ridge
#

how to measure in bytes a size of a block

river oracle
#

you look it up

umbral ridge
#

is each block different size?

#

is it texture based

river oracle
#

which is completely variable

#

boolean remember is 1 byte

umbral ridge
#

tnx

river oracle
#

good luck you've just started an nearly impossible task!

umbral ridge
#

is there a packet for incoming and outgoing traffic?

#

so i could just grab that number instead

#

im doing some heavy optimizations

river oracle
#

you could maybe decipher the chunk load packets

#

you'll have to read the NBT though

umbral ridge
#

NBT 🥴

#

ill try

blazing ocean
river oracle
#

aka I am making some stupid optimization which ends up just being worse performance

#

but I don't know that yet

blazing ocean
#

premature optimisation moment

river oracle
#

or are you just doing it because you don't know what you're doing

umbral ridge
#

who in this world knows what they're doing without trying it first?

river oracle
#

me

sly topaz
#

I never understand people who go to crusades like that

#

usually when it comes to performance, it mostly comes down to how well you can take advantage of a data structure as well as correcting seemingly innocent mistakes in your code

#

that leaves out a good performance without trying to be clever

#

what bothers me is that people always want to be clever, and that rarely gets good results on the broader scale

echo basalt
#

There are multiple types of "performance"

#

For example you can have an algorithm that's quite fast but uses a lot of memory

river oracle
#

I'm looking at you Trie

echo basalt
#

You can have an algorithm that works great across multiple cores but struggles on single-core systems

#

You can have an algorithm that takes forever to "train" but gives great results once done (for example, sorting data)

sly topaz
#

well, when it comes to performance, you don't really think about paraellization/concurrency unless it ultimately matters, since it introdces a bunch of mental overhead which nobody likes to deal with

echo basalt
#

You only need to make it concurrent when it becomes a problem

#

For example, if you're scanning thousands of blocks it might be worth it to make it multi-threaded

#

Either big batches or really long individual processes can be done async

#

Sometimes you have a big batch that once done leads into a sorting process

sly topaz
#

I could probably write a blogpost about it tbh, more geared towards the minecraft community where young devs really think "async" is the magic keyword for everything

echo basalt
#

terminology go brr

paper viper
#

Async is such a general category

#

Could mean a million things

echo basalt
#

here's a concrete explanation

sly topaz
#

asynchronous just means it runs independently of the main set of tasks

young knoll
#

On the server each block state is stored once

#

And mapped to an integer

#

A chunk section normally stores the blocks in it using a palette

#

Normally palettes use a variable number of bits for each block, depending on how many are in that section

#

Minimum of 4

wary oyster
#

im trying to make a command that summons a block display at the players location starting at a small size that grows to a full size and then sets the actual block in place on the last incremeent before the size reaches the full size to prevent z fighting and then remove the block display, but im really lost on how to use the transformation stuff

chrome beacon
wary oyster
#

uh well my current code translates the block display instead of scaling it

#

its baffling me

chrome beacon
#

to visualize transforms

wary oyster
#

oh misode ive used his stuff before for datapacks alonggg time ago

young knoll
#

Ur editing the wrong value if it’s translating instead of scaling

wary oyster
#

i cant remember if im allowed to send code but this is what i have

public class BlockSummoner {

    private static final Vector3f INITIAL_SCALE = new Vector3f(0.2f, 0.2f, 0.2f); // Start with a tiny block
    private static final Vector3f FULL_BLOCK_SCALE = new Vector3f(1.0f, 1.0f, 1.0f);
    private static final float SCALE_INCREMENT = 0.05f; // How much the block grows each tick
    private static final Vector3f ZERO_VECTOR = new Vector3f(0.0f, 0.0f, 0.0f); // No translation
    private static final Quaternionf NO_ROTATION = new Quaternionf(); // No rotation
    private static final Material INITIAL_COLLISION = Material.FLOWER_POT;
    private static final Vector3f INITIAL_COLLISION_SCALE = new Vector3f(0.6f, 0.6f, 0.2f);

    public static void placeBlock(Location location, Material block, JavaPlugin plugin) {

        // Step 1: Summon a small BlockDisplay
        BlockDisplay blockDisplay = (BlockDisplay) location.getWorld().spawnEntity(location, EntityType.BLOCK_DISPLAY);
        blockDisplay.setBlock(block.createBlockData());

        // Set the billboard to FIXED
        blockDisplay.setBillboard(Billboard.FIXED);

        // Set initial tiny scale, with no translation and no rotation
        Transformation initialTransform = new Transformation(ZERO_VECTOR, NO_ROTATION, INITIAL_SCALE, NO_ROTATION);
        blockDisplay.setTransformation(initialTransform);

        // Step 2: Animate the block growth using a scheduled task
        new BukkitRunnable() {
            float currentScale = INITIAL_SCALE.x();

            @Override
            public void run() {
                // Step 3: Grow the block (uniformly in all axes)
                currentScale += SCALE_INCREMENT;
                Vector3f scaleVector = new Vector3f(currentScale, currentScale, currentScale);
                Transformation growingTransform = new Transformation(ZERO_VECTOR, NO_ROTATION, scaleVector, NO_ROTATION);
                blockDisplay.setTransformation(growingTransform);

                // Step 4: Once it's grown bigger than the flowerpot hitbox size, place a Flower Pot for early collision
                if (currentScale >= INITIAL_COLLISION_SCALE.x()) {
                    Block blockAtLocation = location.getBlock();
                    blockAtLocation.setType(INITIAL_COLLISION);


                }

                // Step 5: Once it's grown slightly larger than full block, replace with actual block
                if (currentScale >= FULL_BLOCK_SCALE.x() + 0.05f) {
                    location.getBlock().setType(block); // Set the real block
                    blockDisplay.remove(); // Remove the BlockDisplay to prevent flashing
                    this.cancel(); // End the animation
                }
            }
        }.runTaskTimer(plugin, 0, 1); // Run task every tick (1 tick = 50ms)
    }
}```
chrome beacon
#

You don't need to force it to scale like that

#

Display entities have interpolation

wary oyster
#

oh?

chrome beacon
#

Yes set the interpolation delay

#

It will make it animate smoothly clientside

#

looks a lot better

chrome beacon
#

yes that

#

Also when spawning an entity that you plan on modifying use the spawn method that accepts a consumer

sly topaz
#

it simplifies code a lot that they're interpolated client-side

chrome beacon
#

That will ensure you modify the entity before it's spawned and not after

#

The Transformation class is immutable so you can make it in to a constant

wary oyster
#

spawn method? sorry im not really familiar with spigot this is my first full project ive just done small stuff

chrome beacon
#

world.spawn

#

instead of spawnEntity

wary oyster
#

and what is a consumer

chrome beacon
#

It's a functional interface that's part of Java

wary oyster
#

oh

#

im taking java classes in college rn

chrome beacon
#

In this case it allows you to give the method a function that you can modify the entity in

wary oyster
#

so is it like a lambda

chrome beacon
#

yes

wary oyster
#

ah

chrome beacon
#

Not just like

#

functional interfaces are commonly used with lamdas

#

(almost always)

sly topaz
#

any interface that is annotated with @FunctionalInterface is well, a functional interface

#

their main characteristic is that they have a single abstract method

wary oyster
#

ok so i should summon with spawn method, use interpolation, but any reason why my current code would be translating

chrome beacon
#

haven't really looked in to why

#

since there's no need to keep that part of the code

young knoll
#

(Interpolation doesn’t work directly on spawning)

wary oyster
#

lol ok

young knoll
#

For some reason

#

You have to delay it a tick

sly topaz
wary oyster
#

uh so instead should i just do some delay method

chrome beacon
#

runTask in the scheduler

wary oyster
#

in the consumer

#

ok

young knoll
#

Presumably it’s because the client doesn’t have the previous transformation yet, since the entity just spawned the same tick

#

You can’t interpolate from nothing to a new transformation

sly topaz
#

so it'd be fine if you set the initial transformation as well as interpolation delay on the spawn consumer and then do it again outside of the consumer

young knoll
#

You don’t really need to set the delay

#

It’s 0 by default

sly topaz
#

I assume they want a bigger delay, so it smoothly interpolates from x to y

wary oyster
#

yeah i dont want it instant

young knoll
#

Delay != duration

wary oyster
#

ah ic

sly topaz
#

ah yeah, I always get the two mixed up

young knoll
#

But yeah you don’t need to set it in the initial spawn

#

Just when you make the change a tick later

wary oyster
#

i found the scheduler code from a tutorial, and the scheduler seems like a core concept i havent learned yet, are there any resources on it besides the javadocs?

young knoll
#

?scheduling

undone axleBOT
wary oyster
#

figured there would be

sweet pike
#

i would still need to call it to access the reference

blazing ocean
#

onEach calls apply for each element

blazing ocean
sweet pike
blazing ocean
#

huh well it calls apply but not T.() -> Unit but rather (T) -> Unit

sweet pike
#

am i supposed to change anything?

sly topaz
#

yes

#

remove kotlin altogether from your codebase

sweet pike
blazing ocean
#

yea ig

#

but rename it from it

sweet pike
#

why

blazing ocean
#

confusing

sweet pike
blazing ocean
#

i still always find it confusing if you have bigger stuff

sly topaz
#

people make it so unreadable

river oracle
#

I love kotlin, but I also don't use vodoo magic DSL for anything so maybe that's why I love it?

young knoll
river oracle
#

I sometimes use extension functions, but that's about it

sly topaz
#

turns out forEach is appropriate here since they're doing a terminal operation on the elements

chrome beacon
sly topaz
#

onEach is the intermediate version between forEach and map. That is, I want to do something with the data but return it back as is

blazing ocean
#

IJ always told me to myList.onEach { ... } instead of myList.forEach { it.apply { ... } }

dry hazel
#

well onEach isn't that

blazing ocean
#

so i just assumed that was correct lmfao

sly topaz
blazing ocean
#

oh is onEach just forEach { it.also { } } then

#

which kinda wouldn't make sense to do

#

(and then just return self)

dry hazel
#

it's just forEach but it returns the collection you just operated upon

sly topaz
#

yes, but if the semantics of it is for it to handle side-effects, I assume you don't want to modify the data there, even if you could

wary oyster
chrome beacon
#
BlockDisplay blockDisplay = world.spawn(location, BlockDisplay.class, display -> {
    display.setBlock(block.createBlockData());
    display.setTransformation(INITIAL_TRANSFORM);
    display.setInterpolationDuration(TRANSFORM_DURATION);
});
young knoll
#

Remove the last line from that part

#

But yeah

wraith delta
#

Question about setting blocks in the world; Needing to spawn blocks around 128 area repeatedly. Error im having is its not spawning any blocks and lags the server till it closes. Heres the code: https://paste.md-5.net/pehisekogo.java

chrome beacon
#

didn't know you had to change the duration next tick as well

young knoll
#

Don’t think so

#

You need to set the duration the same time you make the change

wraith delta
#

I would figure at least some would show before it crashes

chrome beacon
#

Server can get killed before that is sent to the client

wraith delta
#

Weird it maps from -64 to 63

young knoll
#

It’s aligned to a grid

gloomy crow
#

How to appeal a resource that was removed?

chrome beacon
undone axleBOT
wet breach
gloomy crow
#

It tells you why

#

We have looked into it

#

and wish to correct it

wet breach
#

Then correct the issue and resubmit the resource

#

That is all there is to it really

gloomy crow
#

It would take a long time to recreate the entire page again

#

So if it can be reinstated by contacting support I wish to contact them directly through the email

wet breach
#

I think once it is removed it is gone and have to resubmit it. Unfortunate but that is just how it is sometimes

gloomy crow
#

Guess we will find out

#

😢

wet breach
#

Gives you an opportunity to make it better

blazing ocean
#

what do I put here if I wanna publish a library

#

it's not a plugin, just a lib for spigot

wary oyster
sly topaz
wary oyster
#

i havent learned what an anonymous class is, is that one that isnt public? like one that cant be acessed everywhere?

sly topaz
wary oyster
#

new Consumer<BlockDisplay>() { i guess i have even more learning because this syntax is also new to me

sly topaz
#

and the way that works is that inside the World#spawn method, it'd be used like this:

// actually uses generics but simplified for the sake of explaining it
public BlockDisplay spawn(Location loc, Class<BlockDisplay> entityType, Consumer<BlockDisplay> consumer) {
  BlockDisplay entity = null;
  /* here goes the entity creation logic */
  consumer.accept(entity);
  this.addEntity(entity); // this = World instance
}
wary oyster
#

i have been reading on generics cuz they keep popping up

wary oyster
#

that is a new BlockDisplay class?

sly topaz
#

that would be the spawn method inside the World class, just simplified for explaining purposes

wary oyster
#

so like what is actually in the spigot implementation that im not seeing

sly topaz
#

yes

#

the reason the API gives you a consumer here is so you can do things to the entity before it is added to the world. You create a lambda/function that consumes the entity and does something with it, then the World#spawn method takes that consumer and gives it the entity to work with, then after your modifications the entity would actually be spawned

wary oyster
#

oh that makes sense

#

its like having a better way to specify what you actually want to spawn

#

for the entity

sly topaz
#

basically, yeah

wary oyster
#

rather than creating an "empty" entity then adding its attributes after, it modifies it before creation

#

is what im understanding

sly topaz
#

yes, exactly. You got it

sly topaz
wary oyster
#

so BlockDisplay.class, display is the class and name it becomes in the expression

sly topaz
#

the class there is actually used to identify which entity to spawn, since the compiler can't know what type of entity you're going to pass there without an actual object to serve as reference

wary oyster
#

ah

sly topaz
#

that's the reason there's also an overload which uses EntityType instead of a Class, they serve the same purpose in this case

wary oyster
#

that it is created in the same way with a consumer?

sly topaz
blazing ocean
#

doesn't it also mean that it doesn't have an actual name

#

*other than the Parent$index thingy

umbral ridge
#

hey

sly topaz
#

well, the name is part of the namespace

umbral ridge
#

how can you find out if the world isnt loaded or if the world doesnt exist?

sly topaz
#

how can a world be loaded if it doesn't exist

umbral ridge
#

but the world can also be unloaded and it theoretically doesnt exist in Bukkit.getWorld

sly topaz
#

right, so it isn't a world, it is just a folder with a world structure at that point

#

the easy way to go about it would just be walking through the root directory looking for folders with a region.dat file or something

#

if you have control of when the worlds are unloaded, save the world path somewhere before you unload it, so you can save off looking for the exact path as they may not be in the root folder

umbral ridge
#

if a player tries to teleport to the world that isn't loaded, how can i know if the world actually exists and is not loaded, or if it doesn't exist? but someone could make these folders up.. by creating them in the root directory

#

and so the logic would fail

sly topaz
#

it isn't possible for the player to teleport to a world that isn't loaded

umbral ridge
#

it is possible because i can load it with WorldCreator

#

but here's my question

#

does createWorld() from WorldCreator create the world or load it

#

and how to know which is which

#

🚬

#

hmm

sly topaz
#

If the world already exists, it will be loaded from disk and some options may be ignored.

#

that's what its javadocs say, so I assume it'll just load it if it already exists

umbral ridge
#

yea most likely but with third party plugins you can unload them

#

so

sly topaz
#

why does that matter

umbral ridge
#

we're back at the start

sly topaz
#

so, in WorldUnloadEvent, just add the world name and path to a map and you're good

#

you may have to write it to a file even

umbral ridge
#

alright

#

ty

sly topaz
#

I do wonder whether world management plugins like MV keep track of it

umbral ridge
#

yea

#

and mv also somehow detects worlds that were never loaded.. eg.: if you're trying out a new parkour map and you place it in the root directory

#

I guess it goes through the world region files or something

sly topaz
#

it does not

#

it just checks whether the world is one of the listed MV worlds in its config or not

#

if it isn't a MV world but the world is loaded, it asks you to import it through /mv import so it can recognize the world in the future

umbral ridge
#

i see

sly topaz
#

if you are using the plugin though, you can just use MV's API instead so you don't have to keep track of it yourself

umbral ridge
#

this is what i was dealing with

#

now i just do that instead

sly topaz
#

not related to your issue, but that usage of optionals is kind of weird

#

you usually want to use the functional utilities instead of dealing with the optional directly, but w/e

sly topaz
umbral ridge
#

Optional comes all they way from YamlConfig

sly topaz
#

but shouldn't you load that kind of thing when they join, instead of at request? It's pretty non-substantial amount of data so it wouldn't hurt just having it in memory

umbral ridge
#

I think at request is better because they might not always teleport to their home

#

instead of loading everything at the join event

#

the data can also change anytime

sly topaz
#

I mean, it is up to you, I'd consider it less troublesome for all the player-related data to be loaded when they join, since in the end home locations wouldn't even amount to 1 KB of memory

#

then again, the outcome would still be the same, you'd just have more freedom to check whether the world is loaded or not and what to do about it (i.e., preemptively load the world if not loaded)

umbral ridge
#

it's not just homes. there is a lot more

sly topaz
#

are you serializing the Location itself or its fields separatedly (x, y, z, pitch, yaw, world uuid or name)?

#

iirc if you do serialize the Location, it fails to deserialize when the world isn't loaded right?

#

if you do serialize its fields instead, then you can just check if the world is loaded, if it isn't then just load it by using the world creator

#

of course, you'd need a Map<String/UUID, Path> where the key would be the world name/uuid and the path would be the one you use for the WorldCreator instance, in the rare case you use a different location other than the server root directory

wet breach
#

Typically you dont want to be dynamically loading and unloading worlds constantly as it can cause some lag in doing so. This is the primary reason mc at minimum keeps the spawn chunks of worlds loaded.

#

Also can cause some memory leaks

#

As for the home stuff just keep it in memory or make a player wrapper for it.

#

As for detecting if a world gets added to the world directory there is events that can be listened to in regards to directories or files being modified

#

That come from the jvm. But it also wouldnt be hard to just have some timer task that checks for modifications as well

worldly ingot
#

FileWatcher is a fun one

fading drift
#

I'm getting java.lang.SecurityException: Invalid signature file digest for Manifest main attributes when using the org.eclipse.jgit library

fading drift
#

should be

#

do I need <scope>compile</scope> - no that didnt work

carmine mica
#

why did md_5 add 400 new boat class types? This is just setting up another API headache in the future. It would've been better to move away from using Class as unique per entity type and use EntityType instead

wet breach
fading drift
#

so quick fix is to just download the jar and remove the signing

#

and upload locally

wet breach
#

Basically

fading drift
#

thnaks that worked

#

such a shit fix though

#

it musnt be shading because I get this error

#
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jgit/api/Git
        at net.xincraft.command.list.developer.maps.PullMapsCommand.execute(PullMapsCommand.java:21) ~[?:?]
        at net.xincraft.command.Command.execute(Command.java:52) ~[?:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) ~[patched_1.8.8.jar:git-PandaSpigot-"b0ab6d0"]
        ... 15 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.api.Git
        at java.net.URLClassLoader.findClass(URLClassLoader.java:387) ~[?:1.8.0_432]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:102) ~[patched_1.8.8.jar:git-PandaSpigot-"b0ab6d0"]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:87) ~[patched_1.8.8.jar:git-PandaSpigot-"b0ab6d0"]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_432]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_432]
        at net.xincraft.command.list.developer.maps.PullMapsCommand.execute(PullMapsCommand.java:21) ~[?:?]
        at net.xincraft.command.Command.execute(Command.java:52) ~[?:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) ~[patched_1.8.8.jar:git-PandaSpigot-"b0ab6d0"]
        ... 15 more
paper viper
#

PandaSpigot ☠️

obtuse hedge
#

whats better, nullability or optionals

fading drift
#

I give up

obtuse hedge
#

good for you

paper viper
#

And how you’re gonna use it

#

One thing for sure is that you should never be passing Optionals around

obtuse hedge
#

lol

#

why not

glad prawn
obtuse hedge
#

ah

obtuse hedge
glad prawn
obtuse hedge
#

viaversion team

#

i saw the code recently

#

for recipes

#

they have a optional list

glad prawn
#

...

short pilot
#

Fellow intellectuals need ur help real quick!

Is there any way to run an async thing on server shutdown that syncs some local stuff I have to a sqlite database?

#

im concerned that the server will shut down before the async even finishes running and also not sure which event to use for this

worldly ice
proven jay
#

Hey, I have a 1.21 Spigot server compatible with 1.8 and when I try to make a new flat world in 1.8, the world is black and doesn't load, but when I make the world in 1.21, it works for it. Does anyone know how to fix the problem in 1.8 for it?

orchid trout
#

delete system 32 and try again later

quaint mantle
proven jay
#

The problem happens in normal Minecraft.

quaint mantle
#

lmao

wet breach
undone plank
#

chat i have this line and it's throwing a nullargumentexception cause the file doesn't exist lmao what's the best approach to making a new file

plugin.saveResource("variables.yml", false);
#

wait nvm i'm fixin it

summer scroll
undone plank
#

OH THE RESOURCES FOLDER 💀

summer scroll
#

Yes sir

sly topaz
sly topaz
#

then just use the Files API

undone plank
#

you've been typing for 20 minutes @sly topaz

sly topaz
# undone plank you've been typing for 20 minutes <@1006728015176274000>
private static final String VARIABLES_FILE_NAME = "variables.yml";

/**
* Creates a file in the plugin's data folder
*/
public static Path generateFile(Path path) {
  try {
    var dataPath = plugin.getDataFolder().toPath();
    // just being annoying here, as this only matters in the case the passed path contains relative directories
    dataPath = target.getParent();
    if (dataPath == null) 
      return null;

    if (!Files.exists(dataPath))
      Files.createDirectories(dataPath);

    var target = dataPath.resolve(path);
    
    return Files.createFile(target);
    }
  } catch (IOException ex) {
    if (plugin.debug())
      plugin.getLogger().log(Level.ERROR, "Couldn't write to the plugins data folder, cause: ", ex);
    else
      plugin.getLogger().warning("Something went wrong while trying to create variables.yml; lack of write/read permissions?");
  }
  return null;
}
var file = generateFile(Path.of(VARIABLES_FILE_NAME));

turns out creating a file properly is more annoying than I had expected

#

I had to test something in jshell lol

eternal night
sly topaz
#

it doesn't happen that often in the context of minecraft servers, but it happens

eternal night
#

I mean, so can all other calls there omegaroll

sly topaz
#

the only one that would throw for permissions would likely be the ones that write, since I doubt a setup would be that messed up to throw due to lack of permissions to read properties

#

there's apparently also the case where the directory exists but as a file rather than a directory, in which case createDirectories does throw, but idk how one can fuck that up lol

#

I guess one could preemptively check for permissions before writing instead of just letting it throw, but eh, it's annoying

mellow edge
#

I have a weird little problem. I want to create my own explosion but I don't know how to detect it that it was that exact explosion. My final goal is to give the player custom damage and knockback (velocity)

#

I spawn it ofc via World#createExplosion

smoky anchor
mellow edge
#

yes

#

did you mean I can rewrite that from scratch too?

smoky anchor
#

Well if you need the blocks, then just use the createExplosion

wintry dagger
#

And listen for the BlockExplodeEvent or EntityExplodeEvent or whatever, loop nearby players I guess is your best solution?

mellow edge
#

probably, because there is an event triggered by it, called EntityDamagedByBlockEvent that doesn't tell me the damager.

smoky anchor
mellow edge
#

or even better just make my own explosion implementation from scratch

#

because I don't want to rely on that

smoky anchor
#

Yeah don't
If you need the blocks and you want them to look the same

#

It's already quite bad in vanilla and Spigots block manipulation will make it even slower.

mellow edge
#

so I can:
-explode block in some radius
-spawn needed particles
-damage players if in given radius
-and give then custom kb

lilac dagger
#

what do you get when listening to netty before mojang transforms them into their own packets?

#

i wanna listen to a packet before using mojang's api, i wonder if i can skip a few steps this way

chrome beacon
#

You get a bytebuf

#

with the data in it

#

You can read wiki.vg on the packet structure and how to read certain datatypes from it

lilac dagger
#

but i think wiki only contains the structure for latest no?

chrome beacon
lilac dagger
#

ah awesome

chrome beacon
#

Do note the older you go the worse the docs get

lilac dagger
#

i only need 1.17+

#

also, is this worth it?

#

i'm using sockets to send a json back and forth

#

and it can get larger, so i was wondering if compressing it is a good idea

upper hazel
#

Is it possible to get Id of some block, door, fence from mod through plugin?

#

for example get string id

young knoll
#

We don’t support hybrid servers

upper hazel
#

I'm asking about the technicalities involved with spigot.

young knoll
#

Spigot can’t run mods

#

Therefor if you are running mods either spigot you are using some sort of hybrid fork that adds their own APIs

upper hazel
#

spigot/bukkit api has method for get string id from block?

young knoll
#

No

upper hazel
#

dem

#

i not can getting string material id? Only "enum"?

lilac dagger
#

or material.ordinal();

young knoll
#

Or getKey

lilac dagger
#

or that

young knoll
#

But this assumes the fork injects modded materials into the enum

waxen acorn
waxen acorn
mortal hare
#

honestly when i think about it Skript as a whole is not a bad concept

#

sure its a bloat on top of already existing java runtime

#

but no one's stopping the community to create Skripts which work across bedrock and java

shadow night
#

That's an interesting idea

mortal hare
#

basically cross compatible plugins

shadow night
#

Using it as an abtraction from programming language?

mortal hare
#

yea

#

Basically you use Skript syntax and build Skript runtimes based on the server architecture

#

just like JDK

shadow night
#

So, skript that works on:
Spigot (and derivatives)
Forge (and derivatives)
Fabric (and derivatives)
Bedrock (dunno what software there is for that)
And stuff like that?

mortal hare
#

Kinda yeah

#

we have datapacks but they're kinda limiting

#

also on bedrock there's dedicated scripting api

#

but that's specific to bedrock only

shadow night
#

Js

#

Wrote some behaviour packs in the past

mortal hare
#

building Skript runtimes on top of already existing codebases, like if you're running Spigot you're using Spigot SkRE, if you're using Bedrock you use Bedrock SkRE, if you're running sponge you use Sponge SkRE etc etc

#

i would even go as far as not using bukkit or sponge api's altogether and hook it directly to NMS

upper hazel
mortal hare
#

the problem i can currently see is with bedrock is that its not completely in par with Java edition but that gaps is closing real fast

upper hazel
shadow night
mortal hare
#

Skript is a plugin for Bukkit API based server software which allows you to write very human readable interpreted .sk scripts dedicated for controlling server's behaviour

#

basically programming language of minecraft's server functionality

#

for example

command /gmc:
    permission: tutorial.creative
    permission message: &cYou do not have permission to use this command 
    trigger:
        set player's gamemode to creative 
        send "&aYour gamemode has been set to creative." to player
upper hazel
#

you mean addons?

mortal hare
#

no

upper hazel
#

im confused

mortal hare
#

its completely different language

upper hazel
#

how write scripts

#

for bukkit

mortal hare
#

you install Skript plugin in spigot

#

then add your .sk script in plugins/Skript directory

#

./skript reload all

#

voila

#

you made a script

upper hazel
#

this is like addons

mortal hare
#

not sure what you call addons but whatever

#

its an old thing

#

it existed since at least 2011 iirc

#

its still very contraversial part of minecraft server community, as devs despise people writing them

#

since they treat such scripts as a kid's version of plugins

blazing ocean
#

skript is finee for really small stuff

#

but then seeing people make bigass minecraft events & servers with it

#

fucking hurts my soul

#

and then wonder why it's slow

#

and then have like a trillion skript reflect usages

mortal hare
#

but i think its not so bad as people might call it because having universal language to control the server is not inherently bad

#

its just gets bad rep because there's no cross platform support, so you cant really do cross compatible scripts with it

upper hazel
#

i see now. In russian this calls "addons". I have seen such cases when developing plugins

#

but this is a very rare thing in the server

#

I never found a use for them

mortal hare
#

my story in programming started off from Skripting, then I've got constantly roasted for using it

#

so i've tried to prove a point and inherently learned Java