#help-development

1 messages · Page 1196 of 1

young knoll
#

Probably

chrome beacon
#

Yeah probably

young knoll
#

I don’t think the library has built in worldedit listeners

proper cobalt
#

so I were right

chrome beacon
#

It's a good enough fix

#

If you want a better one fork spigot and PR

proper cobalt
#

dont even be using spigot but i fw the community

#

paper is cringe

chrome beacon
#

because a plugin doesn't have the access it needs to for a proper fix

young knoll
#

Could add an event that’s called whenever a blocks type changes

#

But that might be a bit heavy

proper cobalt
#

doubt it justt do it

#

we need to fix PDC

#

make spigot great again

young knoll
#

PDC isn’t broken

proper cobalt
#

yerrr it is for blocks

young knoll
#

Blocks don’t have PDC

#

Hence why the workaround is to store it in the chunks

proper cobalt
#

yer sad world we liv eit

#

lets add it to blocks

#

and make spigot great again

remote swallow
#

blocks dont have a container to add it to

orchid gazelle
#

Make a wrapper for chunk pdcs to basically make block pdcs

proper cobalt
#

lets add a container to blocks then?

orchid gazelle
#

Just make a wrapper

remote swallow
#

?blockpdcc

#

?blockpdc

undone axleBOT
orchid gazelle
#

It is a bit more RAM heavy but anyways

remote swallow
#

alex already made it

orchid gazelle
#

Dafuq is a custom block data

proper cobalt
#

after all these years we shoudl

remote swallow
young knoll
#

Because blocks don’t save any additional data

orchid gazelle
#

Oh literally what I just recommended to program yourself LMAO

proper cobalt
young knoll
#

Yeah hold on let me go rewrite half the game

#

And make world files absolutely huge

proper cobalt
#

oh is it a minecraft limitation

remote swallow
#

yes

orchid gazelle
#

Yes

proper cobalt
#

fairz

chrome beacon
#

Hence why I said you'd need to fork Spigot

proper cobalt
#

how is spigot and minecraft related in that aspect tho

orchid gazelle
#

JÄÄÄÄGERMEISTER

chrome beacon
#

Vanilla blocks do not store nbt tags

proper cobalt
chrome beacon
river oracle
proper cobalt
river oracle
#

so it is related

orchid gazelle
river oracle
#

in all aspects

proper cobalt
#

type beat

#

yall ever make classes extend HashMap

#

is it safe

naive spire
#

extend hashmap erry day

proper cobalt
#

yeah calm

orchid gazelle
#

Extend MinecraftServer everyday

proper cobalt
#

how is Pair not in standard java lib

#

im surprised

young knoll
#

Technically there’s Map.Entry

worldly ingot
#

Because Pairs are kind of just... bad? lol

#

They're poor API design. If you need to return more than one result, you should create a record instead. You then effectively have a Pair but

  1. The method names are better than getFirst()/getSecond() or getLeft()/getRight()
  2. If you ever need to add more return values, the method signature doesn't need to change
  3. No generics
proper cobalt
#

i have recoil angles

#

list of Pair<int int>

#

X, Y

#

how is it bad

young knoll
#

int[]

worldly ingot
#
Pair<Integer, Integer> angles = getRecoilAngles();
if (angles.getLeft() < 90) {
    // what is left?
}
worldly ingot
#

Yeah, you know that

#

The reader doesn't

proper cobalt
proper cobalt
proper cobalt
#

record for x, y

#

im good off that ibr

worldly ingot
#
public record Angles(int x, int y) { }

Angles angles = getRecoilAngles();
if (angles.x() < 90) {

}
#

No generics, primitive ints, clearer method names, immutable

proper cobalt
#

ill consider it

worldly ingot
#

It's a Pair but better :p

proper cobalt
#

yerr\

#

how would i do like zooming in

#

i know people add slowness or something to make zoom in

#

is that the best way

remote swallow
#

but pair, triple quadruple

slender elbow
#

if I ever need to return two ints I just return them packed into a long instead

slender elbow
#

infallible strategy

young knoll
#

What if you need 3 ints tho

slender elbow
#

BigInteger to the rescue

young knoll
#

I was thinking Vector3i

worldly ingot
#

Except with a spyglass but you can't trigger that from the server

tribal wraith
#

        Location location = player.getLocation();

        EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
        PlayerConnection playerConnection = entityPlayer.f;

        PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(54, UUID.randomUUID(), location.getX(), location.getY(), location.getZ(), 0.1f, 0.1f, EntityTypes.bN, 0, new Vec3D(0, 0, 0), 1);

        playerConnection.sendPacket(packetPlayOutSpawnEntity);

        List<DataWatcher.c<?>> dataWatchers = new ArrayList<>();

        dataWatchers.add(new DataWatcher.c<>(5, DataWatcherRegistry.k, true));

        PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(54, dataWatchers);

        playerConnection.sendPacket(packetPlayOutEntityMetadata);

    }```

I'm using NMS to create client based entities and messing with their entity meta data on 1.21.4, I've tried looking but I'm not entirely sure what the DataWatchSerializer does or where's used; the dataWatchers list is a list of ``public static record c<T>(int a, DataWatcherSerializer<T> b, T c) {`` that's inside DataWatcher. Could anyone point me in the right direction ?
echo basalt
#

you can do slowness zoom without changing player speed

earnest girder
#

could stuff like this cause performance issues if there are several players with their own boss bars at a time?

for(int i = 0; i <= 100; i++) {
            double progress = i / 100.0;
            Bukkit.getScheduler().runTaskLater(Wicklow2.getInstance(), () -> {
                harvestBar.setProgress(progress);
            }, (long) (progress * duration));
}
mortal vortex
#

if anything, I wouldn't do it at intervals of 100.

mortal vortex
wraith dragon
#

yeah because thats going to startup 101 tasks

mortal vortex
#

You can do 1 single repeating task, as compared to the 101 that Yeboieee mentioned:

BukkitTask progressTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
    double currentProgress = // do something here to calculate / get current progress
    harvestBar.setProgress(currentProgress);
    
    if (currentProgress >= 1.0) {
        // Cancel task when complete
        Bukkit.getScheduler().cancelTask(progressTask.getTaskId());
    }
}, 0L, updateInterval);

Or use a single delayed task with interpolation, though this essnetially assumes that the progress bar will be complete by a set period of time

Bukkit.getScheduler().runTaskLater(plugin, () -> {
    harvestBar.setProgress(1.0); 
}, duration);
earnest girder
#

how would the interpolation work?

#

it just goes from 0 to 1 when the duration is over?

echo basalt
#

or you can make a single task that ticks everyone

mortal vortex
echo basalt
#

we just use coroutines at work 😛

mortal vortex
#

we use heroin at my work

echo basalt
#

type deal

remote swallow
#

and lets see the newCoroutine method

echo basalt
#

that's my special sauce :)

remote swallow
#

im guessing it starts with

fun newCoroutine(().CoroutineScope -> Any)

#

maybe

echo basalt
remote swallow
#

my order was fucked but close

earnest girder
#
long progressStart = world.getFullTime();
        BukkitTask barProgress = Bukkit.getScheduler().runTaskTimer(
        Wicklow2.getInstance(), () -> {
            double progress = (double) (world.getFullTime() - progressStart) / duration;
            harvestBar.setProgress(progress);
            if(progress >= 1.0) {
                Bukkit.getScheduler().cancelTask(barProgress.getTaskId());
            }
        }, 0L, duration / 5);

I have this now, but I'm getting a compile error: Variable 'barProgress' might not have been initialized

mortal vortex
#

dude...

#

u reference barprogress in its own creation

#

that creates a circular dependency

young knoll
#

Use task -> instead of () ->

chrome beacon
#

?scheduling

undone axleBOT
young knoll
#

Then you can call task.cancel inside the runnable

chrome beacon
#

^^ has examples

mortal vortex
earnest girder
#

what was that example supposed to be then

#
BukkitTask progressTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
    double currentProgress = // do something here to calculate / get current progress
    harvestBar.setProgress(currentProgress);
    
    if (currentProgress >= 1.0) {
        // Cancel task when complete
        Bukkit.getScheduler().cancelTask(progressTask.getTaskId());
    }
}, 0L, updateInterval);
```this was your example, how would you do it correctly?
chrome beacon
#

Open the wiki and take a look

#

Or do what coll said

#

Jishuna* mb mb

#

Not used to the new name

earnest girder
#

I see thanks

#
BukkitTask barProgress = Bukkit.getScheduler()
.runTaskTimer(Wicklow2.getInstance(), task -> {
     double progress = (double) (world.getFullTime() - progressStart) / duration;
     harvestBar.setProgress(progress);
     if(progress >= 1.0) {
           task.cancel();
     }
}, 0L, duration / 5);

is this not correct? I am getting Required type: BukkitTask, Provided: void

slender elbow
#

the runTaskTimer method that takes a Consumer<BukkitTask> does not return anything, it's a void method

#

the one that takes a Runnable returns a BukkitTask

earnest girder
#

oh I see

#

thanks

earnest girder
#

?gui

cold mango
#

need big help

#

:(

#

I need the spigotAPI but i cant find it anywhere.

cold mango
#

ima be honest

#

i used chatgpt to make a plugin for me

#

so i have NO idea

#

:D

#

just said i needed spigotAPI

glad prawn
cold mango
#

im cooked 😭

wet breach
#

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

quaint mantle
#

I prefer w3school as a guide 😭

river oracle
#

W3 is just okay tbh

#

It doesn't have enough depth imho

#

It's good if you only want surface level examples with very little examples or explanations of actual uses

quaint mantle
#

It does the trick though

timber crescent
#

what does period do on tasks?

nova notch
#

its the ticks between iterations

earnest girder
#

If I want to have permanent spawned in entities, such as TextDisplays, and want to avoid duplicates of them, should I spawn them in on server start, add them to a list, and then delete them on server shutdown?

wooden frost
#

anybody know what the hell this error is?

sullen marlin
wooden frost
sullen marlin
#

That's our problem how?

wooden frost
wooden frost
# wooden frost

i mean it probably is a problem with me setting the IDE up incorrectly, so it doesn't probably matter, does it?

mortal vortex
wooden frost
#

you can say what you want, if i did not intend for it and consider your claim to be out of thin air , i have the right to

mortal vortex
#

idk dude, not our problem, you should ask in Paper... oh wait

wooden frost
#

its my profile and your is yours

nova notch
#

womp womp

wooden frost
mortal vortex
#

bhaha dont bring ur trolling here

wooden frost
#

i was not?

#

ok, you started this, not gona engage, this server is too valuable for me

wooden frost
# wooden frost

Well that was dumb. I realised that it was indeed a mistake in the IDE, I was exporting the World Edit API i was using ALSO with the plugin (basicaly the error in the console that i ignored)```
[10:51:36 ERROR]: [WorldEdit]


** /!\ SEVERE WARNING /!
**
** A plugin developer has included a portion of
** WorldEdit into their own plugin, so rather than using
** the version of WorldEdit that you downloaded, you
** will be using a broken mix of old WorldEdit (that came
** with the plugin) and your downloaded version. THIS MAY
** SEVERELY BREAK WORLDEDIT AND ALL OF ITS FEATURES.
**
** This may have happened because the developer is using
** the WorldEdit API and thinks that including
** WorldEdit is necessary. However, it is not!
**
** Here are some files that have been overridden:
**
** 'EditSession' came from 'zombies (file:/C:/Users/user/Desktop/minigames/zombie/plugins/.paper-remapped/zombies.jar)'
** 'CommandManager' came from 'zombies (file:/C:/Users/user/Desktop/minigames/zombie/plugins/.paper-remapped/zombies.jar)'
** 'Actor' came from 'zombies (file:/C:/Users/user/Desktop/minigames/zombie/plugins/.paper-remapped/zombies.jar)'
** 'World' came from 'zombies (file:/C:/Users/user/Desktop/minigames/zombie/plugins/.paper-remapped/zombies.jar)'
**
** Please report this to the plugins' developers.
**********************************************```
Lesson learnt: never troll liberals, never ignore erorrs, and always search for the errors to occur in the most unexpected places

wooden frost
# sullen marlin That's our problem how?

I mean thanks for letting me know ( i already kind of forgot im using paper and not spigot XD) , technicaly speaking if it were a paper only mistake, i would've just wasted a lotta people's time

#

@nova notch i genuinly dont want to engage in this interaction, please dont. You dont know the full story, the "trolling" was in my pronouns and probably still is, because cant have shit nowadays

nova notch
#

huh

mortal vortex
#

huh

wooden frost
#

@mortal vortex ok, have to ingage, one question: do you WANT Me to continue trolling liberals?

#

or what

mortal vortex
#

im not a liberal, sry. also this inst a relevent place for this.

wooden frost
wooden frost
#

but i mean you kinda brought it up first

glossy laurel
#

Is giving normal members a string field that I will parse with PAPI a bad idea? Can they op someone or do some other unintended actions?

wooden frost
# mortal vortex im not a liberal, sry. also this inst a relevent place for this.

can we just close that chapter off already, it's gotten stale. Also OFFTOPIC AF, jesus christ. how long has it been since i got banned from there? jesus. if somebody cant take jokes/puns(or whatever they are called idk) one degree higher than stale then idk, maybe it's actually a problem in them and not me? (an easterner speaking)

mortal vortex
mortal vortex
mortal vortex
# glossy laurel What does sanitize mean

Just like it would otherwise mean, removing anything harmful.

This is commonly done in things like SQL, where you remove anything code or query related from a string, so nothing can be executed.

mortal vortex
#

Thats the thing, I am not sure if PAPI has things that can be executed. You dont want people to be able to execute commands through PAPI. so be mindful

#

How would you parse it to papi anyways? using a command?

glossy laurel
glossy laurel
hybrid spoke
#

pathetic is currently being completely decoupled, so you could just yap the engine and do your own stuff with it

deft geode
#

Is there a way to spawn a custom raid? I'm assuming not because I don't see anything. Maybe I'll have to make a custom Raid Handler?

mortal vortex
#

You can try inducing bad omen?

deft geode
#

Well, I meant more along the tracks of spawning a raid without being triggered/using a player

hybrid spoke
#

and see how a raid is triggered programmatically

deft geode
#

Do you have a link to the source code perhaps? Never really dived that deep before, so idek if it is a link lol

hybrid spoke
#

either here or you have to dive into NMS

#

but i would advice that at a given point without a clear solution you stop, and just create your own raid logic.

deft geode
#

That's what I was potentially thinking because I did at first try to see if making a new RaidTriggerEvent with the parameters of (my custom raid class, world, and me), would work, but nothing happened

hybrid spoke
#

well, the event is not what triggers the raid, but the result of it

#

its called when the raid is triggered

deft geode
#

true, guess I'll have to make my own logic/handler then

#

I aappreciate the help

hybrid spoke
deft geode
#

Yea, custom number of waves, what entities to spawn, number of entities, etc

tribal wraith
#

Hi, I'm using packets to make client side entities; how do I send a text component in the entity's metadata? I tried using an NBT Compound as well as a string in the line
dataWatchers.add(new DataWatcher.c<>(2, DataWatcherRegistry.t, nbt.p("{\"text\":\"string\"}")));
How do I approach this? I'm using the wiki.vg protocol page where it says the index 2 is the custom name entity metadata index and it needs an optional text component

public static void test(Player player) {

        Location location = player.getLocation();

        EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
        PlayerConnection playerConnection = entityPlayer.f;

        PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(54, UUID.randomUUID(), location.getX(), location.getY(), location.getZ(), 0.1f, 0.1f, EntityTypes.bN, 0, new Vec3D(0, 0, 0), 1);

        playerConnection.sendPacket(packetPlayOutSpawnEntity);

        List<DataWatcher.c<?>> dataWatchers = new ArrayList<>();

        NBTTagCompound nbt = new NBTTagCompound();

        //nbt.p("{\"text\":\"string\"}");
        //{"text":"string"}
        //dataWatchers.add(new DataWatcher.c<>(0, DataWatcherRegistry.a, (byte) 0x40));
        dataWatchers.add(new DataWatcher.c<>(3, DataWatcherRegistry.k, false));
        dataWatchers.add(new DataWatcher.c<>(2, DataWatcherRegistry.t, nbt.p("{\"text\":\"string\"}")));

        PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(54, dataWatchers);

        playerConnection.sendPacket(packetPlayOutEntityMetadata);

    }
#

Whenever I try it I get kicked with "Network Protocol Error" and no information - I'm definitely sending a packet wrong ☹️

lilac dagger
#

worth seeing how the packet sends text components

#

ComponentSerialization.TRUSTED_STREAM_CODEC.encode(byteBuf, playerTeam.getDisplayName()); //if you use mojmaps this is how components are serialized in 1.21

sly topaz
lilac dagger
#

it's worth a look into mojmaps on how they send entitydatas

#

probably also the entitydata for a zombie is incomplete

blazing ocean
chrome beacon
#

or at least use Mojang mappings 💀

blazing ocean
#

true

#

data watchers are a fucking weird ass name

smoky anchor
#

Did you all just add a santa hat png to your profile pictures ?

modern meadow
#

Any fixes for this? my console is spamming it and i cant get weapons from mmoitems as well

blazing ocean
smoky anchor
#

omg that's hilarious XD

chrome beacon
#

yeah thank @remote swallow uwu

smoky anchor
#

This makes me unreasonably happy

sly topaz
#

I should put a Christmas hat on mine too now that you mention it

pliant topaz
modern meadow
#

more of it

pliant topaz
#

contact the plugin author

modern meadow
#

thank you for ur time

remote swallow
marsh sluice
#

how can i decrease the price of a villagers trade in 1.21

#

nothing im trying is working

#

ive got an upgrade system and i want to decrease the price of a villagers trade by 10% per upgrade

manic delta
#

If I want to move an armor stand to the player's position and aiming direction, what would be the best option? Spawn the entity and start a task where every x time I move the armor stand to the direction/movement or with the playermoveevent or what other option can you think of?

#

i want to make a pet

sly topaz
#

people usually will use a repeating task out of general avoidance of the player move event since it is triggered more times than one normally wants

#

but when it comes to these things that follow the player movements, that isn't as much of a concern

manic delta
#

so should i use packets or normal entities?

sly topaz
#

just use normal entities for the time being

finite patrol
#

Hello, I have a question about Custom Crafting plugin. Is it better to make the whole crafting system yourself or rely on addRecipe and let it handle by vanilla minecraft and build custom system on top of it? I asking because I want to make sure I cane make recipes that require more items in one slot. (So for example 32 iron ingots in one slot + a nether star would craft something)

sly topaz
#

only thing that is annoying is the recipe book being bugged with exact choices

finite patrol
#

Well the worst thing is that you cannot make the Exact choice type check if the itemstacks amounts are correct

woeful bronze
#

someone here to help?
i have a problem, can someone help me with plotsquared? i bought it completly legally and really need some help because i dont know if its a bug or im just not smart enough xd. my problem is: im using paper server 1.21.4 but the plotsquared skript is telling me on the first line. using plattform:bukkit!! and not paper. so i cant use the nice paper setting like animal pathing etc. can someone help pleasE? i cant send screenshots sadly

finite patrol
#

It will always treat all ingredients as a stack of 1

manic delta
#

🤣

#

but anyway

sly topaz
#

that'll just make your life harder for no real gain

manic delta
#

i have a friend that do big plugins and he said that the server will lag because of using normal entities

#

public class MiniaturesHandler {
    private HashMap<String, MiniatureArmorStand> miniatures = new HashMap<>();
    private HashMap<String, BukkitRunnable> movementTasks = new HashMap<>();

    public void spawnMiniature(Player owner) {
        if (miniatures.containsKey(owner.getName())) return;

        Location loc = owner.getLocation().add(0.5, 1.3, 0);
        MiniatureArmorStand miniature = new MiniatureArmorStand();

        miniature.spawn(owner, loc);

        miniatures.put(owner.getName(), miniature);

        startMovementTask(owner, miniature);
    }

    public void removeMiniature(Player owner) {
        MiniatureArmorStand miniature = miniatures.get(owner.getName());
        if (miniature != null) {
            miniature.remove();
            miniatures.remove(owner.getName());
        }

        BukkitRunnable task = movementTasks.get(owner.getName());
        if (task != null) {
            task.cancel();
            movementTasks.remove(owner.getName());
        }
    }

    private void startMovementTask(Player owner, MiniatureArmorStand miniature) {
        BukkitRunnable task = new BukkitRunnable() {
            @Override
            public void run() {
                if (!owner.isOnline()) {
                    this.cancel();
                    miniatures.remove(owner.getName());
                    movementTasks.remove(owner.getName());
                    miniature.remove();
                    return;
                }

                Location playerLocation = owner.getLocation();

                double shoulderOffsetX = -0.3;
                double shoulderOffsetY = 1.4;
                double shoulderOffsetZ = 0.3;

                float yaw = playerLocation.getYaw();
                double radians = Math.toRadians(yaw);

                double offsetX = shoulderOffsetX * Math.cos(radians) - shoulderOffsetZ * Math.sin(radians);
                double offsetZ = shoulderOffsetX * Math.sin(radians) + shoulderOffsetZ * Math.cos(radians);

                Location shoulderLocation = playerLocation.clone().add(offsetX, shoulderOffsetY, offsetZ);

                miniature.teleport(shoulderLocation);

                miniature.setRotation(playerLocation.getYaw(), 0);
            }
        };

        task.runTaskTimer(NexuMiniatures.getInstance(), 0L, 1L);
        movementTasks.put(owner.getName(), task);
    }

}
#

i do it

sly topaz
#

a

#

what the heck

#

what word is blocked in here lol

manic delta
manic delta
#

that will lag for sure

sly topaz
river oracle
#

damn clearly you got a skill issue

sly topaz
#

I tried to resend it many times but it just wouldn't let me lol

river oracle
#

new slur discovered???

manic delta
lilac dagger
#

Client entities don't tick as much so it should be fine no?

sly topaz
manic delta
sly topaz
#

most people should stay away from doing these manually

manic delta
lilac dagger
#

I haven't looked at the library myself

#

But assuming it's well made you should build with it

sly topaz
#

it isn't more so about reinventing the wheel but rather the fact that essentially re-doing the tracking logic for your client-side entities is a pain in the ass to get right

#

so it's mostly easier to just leave it to libraries that probably have done a better job than most of us are capable of lol

#

I like CubBossa's ClientEntities since its API is pretty nice (it's essentially bukkit's but with PlayerSpaces instead of the World)

#

only disadvantage is that it doesn't support all entities nor all events

#

but for most things, it does the job

manic delta
bitter rune
#

And re inventing the wheel in coding is good you learn as well it's not a bad thing

manic delta
#

i dont want to learn packets

#

just use them

#

🤣

sly topaz
#

I find that to be a lie most of the time to be honest

#

reinventing the wheel is a rather inefficient way to go about learning a system lol, or at least that is what I've experienced when teaching people

lilac dagger
#

I'm happy that I know packets

bitter rune
#

It's not a lie if you really want to learn code and not just use libraries

manic delta
sly topaz
#

jesus christ

sonic goblet
#

Especially with a library involving NMS, I much prefer to reinvent the wheel myself than have to wait for the developer to update to the latest versions

sly topaz
#

what is wrong with discord today

manic delta
#

u got shadowbanned

sly topaz
#

I hate that it is just specific messages lol

pliant topaz
# sly topaz

maybe they now run an ai over each message and it now believes you wanted to hack something xd

#

tbh, as far as it has already gotten with implementing ai into everything even if it's useless or brings disadvantages, i would not rule that option out ;-;

bitter rune
#

If it was ai it could decipher the meaning of hack and it wouldn't have blocked the message

#

The ai we currently have is really good at words and translating not much else yet

pliant topaz
#

not if discord decided they also gotta train their own model

#

in the end, there's always a good chance an ai will screw something up, especially if it hasn't had enough training, but at some point, it just won't get better

bitter rune
#

I don't think we know the won't get better part yet, I do think chatgpt does improve but it's held back by all the regulations this company has and that's why I'd we can get true ai we won't be the first country to get it

pliant topaz
#

yes, ai gets better, but there's always a kind of hard limit of to what extend an ai will increase it's probability to being correct with training. it follows a kind of linear path if we compare different ai's with one another

#

atleast thats what we've been observing in all ai models

bitter rune
#

And we are just learning how to do quantum computing that changes the game completely

pliant topaz
#

yep

bitter rune
#

I'm also in cyber security, and the fact I am alive when quantum computing is going to be widely available, everyone in this field needs to essentially start over cause it can crack all current encryption methods in minutes

dreamy arrow
#

i can't find info on .schem to how to parse it. anyone got any resource like snippet

chrome beacon
#

Use the WorldEdit API

dreamy arrow
#

i need something standalone. like a library

mortal hare
#

ah yes

#

nonsense that i dont understand anymore

glossy laurel
#

Call it a stupid question, but there's 100% that "call()":

public static int a = 0;
public void inc(){
  a++;
  a++;
  a++;
}
public void call(){
  inc()
  a = -1;
  System.out.println(a);
}

would always print -1 right?

chrome beacon
glossy laurel
chrome beacon
#

but it can also be very hard to read and understand

mortal hare
glossy laurel
mortal hare
#

operations are sequential

glossy laurel
#

yeah alr

#

I think I got a race condition somewhere in my code but I can't find it

mortal hare
#

searching those feels like searching needle in a haystack

chrome beacon
#

Yeah

glossy laurel
#

welp

#

fuck

chrome beacon
#

Race conditions are a real pain to debug

mortal hare
#

Bukkit api needs Rust's unsafe {} syntax, but for concurrency

glossy laurel
chrome beacon
#

It allows you to write unsafe code

#

that would otherwise cause compile time errors due to not being safe

glossy laurel
#

😂

#

epic

mortal hare
#

basically it nags you to check if the code you wrote is really safe

glossy laurel
#

sounds... unsafe

blazing ocean
mortal hare
#

its just there to remind you that you may fuck up here

blazing ocean
#

so you can supabase.get("MyCoolTable") or something and get it directly in a schema

mortal hare
#

just like Optional<> in java

blazing ocean
#

it's fucking crazy

chrome beacon
#

Very common in Nuxt uwu

glossy laurel
#

alr chat, spammed a bunch of prints, wml ig

tribal wraith
blazing ocean
#

why

#

setVisibleByDefault exists

tribal wraith
tribal wraith
blazing ocean
#

I mean yeah it exists server-side

quaint mantle
#

Still you need to add handlers for your 'client' entities though

fleet pier
#

what sound is harp.ogg in spigot 1.8.9?

rustic beacon
#

Hi all, I have this question, I have created a custom world generation:

``package net.swordpvp.survival.world;

import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.generator.WorldInfo;
import org.bukkit.util.noise.SimplexOctaveGenerator;
import org.jetbrains.annotations.NotNull;

import java.util.Random;

public class WorldGenerator extends ChunkGenerator {

@Override
public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biome) {
    ChunkData chunk = createChunkData(world);
    SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8);
    generator.setScale(0.010D);
    for (int x = 0; x < 16; x++) {
        for (int z = 0; z < 16; z++) {
            int rawX = chunkX * 16 + x;
            int rawZ = chunkZ * 16 + z;
            chunk.setBlock(rawX, 0, rawZ, Material.STONE);
        }
    }
    return chunk;
}

}``

When I want to upload to the world:

`` WorldCreator worldCreator = new WorldCreator(“world”);
worldCreator.generateStructures(true);
worldCreator.generator(new WorldGenerator());
worldCreator.createWorld();

    System.out.println(“CreateWorld”);``

it doesn't want to accept my generation, what could it be?

soft flame
#

does kickevent fire quitevent ?

inner mulch
#

im pretty sure no matter why the player leaves, the event is being called

soft flame
#

okay ill test by myself xd

#

answer: yes its called

mortal hare
#

i've never thought that i would be so happy for one library which contains 4 annotations

#

jspecify's @NullMarked is so cool

inner mulch
#

what does it do

mortal hare
#

it marks @NotNull for every field, parameter inside class

#

but then you use @Nullable to mark nullable return types and fields

#

basically you declare @MarkNull and it will nag IDE to check for nullability

#

if you dont want that, you add @Nullable and mark that field/property as nullable

#

its just for maintainability is a good lib to have

chrome beacon
mortal hare
#

like jetbrains annotations but with whitelist/blacklist for property nullabilities

chrome beacon
#

If you want to make a new world with your generator give it a new name

fast jasper
#

hi, I'm quite new to Spigot I just started recently, so apologies if I am misunderstanding some basic things here.

on the Spigot documentation I see the following: (can't attach images so here's me pasting it)

static final Criteria KILLED_BY_TEAM_AQUA Increments automatically when a player is killed by a player on the aqua team. static final Criteria KILLED_BY_TEAM_BLACK Increments automatically when a player is killed by a player on the black team. static final Criteria KILLED_BY_TEAM_BLUE Increments automatically when a player is killed by a player on the blue team. static final Criteria KILLED_BY_TEAM_DARK_AQUA Increments automatically when a player is killed by a player on the dark aqua team. static final Criteria KILLED_BY_TEAM_DARK_BLUE Increments automatically when a player is killed by a player on the dark blue team.
(this list continues for a fair bit...)

how could I make use of these? could anyone explain how they work with a bit more details than listed on here? or are these outdated vanilla scoreboard criteria that aren't usually utilized for a plugin? all I know is that it's a number for a specified player than can increment up when the condition is met, although I'm not entirely clear with what the condition exactly is.

what I'm mainly confused about is this: teams can have custom names. there's no team that's "THE Aqua team" for instance. there's just "a team, that has been assigned the aqua color" right? and there can be more than one "teams assigned aqua color" so how can this criteria differentiate? I'm not quite understanding. would it just be any team colored (as an example) "AQUA" regardless of the name?

chrome beacon
#

for things like glow outline

#

If you want to set the team color use Team#setColor

fast jasper
#

thanks for the quick response. I am asking about the criterias here listed in my example from the docs though (eg. "KILLED_BY_TEAM_AQUA")

chrome beacon
#

Those are based on the team color

#

You can get the value with Player#getStatistic

fast jasper
#

so the name has affect on this check I'm assuming? and what if there's more than one uniquely named teams, that all are colored as aqua

chrome beacon
#

No name has no effect

#

The display name is different from the team color

#

or well can be

fast jasper
#

I see, understood. that clears that up

mortal hare
#

i feel like JSpecify is lightweight version of Kotlin's typesafety with @NullMarked, i recommend you guys this lib, it can eliminate many null-safety bugs, and if there's null safety warnings you know cannot exist on runtime you just add noinspection comment and be done with it. It works very well with Intellij

#

its nothing special but damn it works well for me

#

i like it

chrome beacon
#

Yeah JSpecify is nice

sharp cosmos
#

I guess this is more of a general java question, but I have a abstract Minigame class, and two subclasses called CTFMinigame and RocketMinigame.
The subclasses are supposed to have Settings (List<String>), which are supposed to be the same for all instances of the classes.
How can I achieve this, since you can't have static methods or such in abstract classes?

chrome beacon
#

abstract getter method in Minigame and then static lists in CTFMinigame and RocketMinigame

#

That's one option

twilit coral
wet breach
sharp cosmos
#

so much text

twilit coral
#

you can just skip to the diagrams

chrome beacon
#

refactoring guru does have great and detailed guides

#

It's worth reading through them

sharp cosmos
#

uh oh factories

spiral cape
#

Hey! 🙂

wet breach
#

identify stuff that never changes, move it out of objects that don't need it

#

and essentially addressing the duplicity problem

twilit coral
#

yeah factories are pretty useful, should review dry and solid principles

wet breach
#

in regards to that article, if you were making a game, this is where you get into what should the client track vs what does the server really need to know. In that articles example, the client should be the one applying the colors to objects and the server really shouldn't be worry about that stuff. Unfortunately wish MC client was built differently because of this

spiral cape
#

I'm wondering if anyone would have some guidence when it comes to MC 1.21.3 update.

I have my own plugin that I maintain and update whenever I see a new update comes out.

I seem to be having some issues with an experience bar where My plugin has issues setting the XP of a player after they join a server once and then leave and join back in.

I'll probably get some backlash out of this, but this experience bar gets updated on PlayerMove event (its used as a timer). It had worked completely fine up until 1.21 😦

wet breach
#

one of my pet peeves is everyone thinking stuff needs to be done immediately the moment someone joins lol. (not directed at person needing help fyi)

spiral cape
#

I'll do some more digging, but I'm pretty sure the player does get thrown out of the maps I store them in

echo basalt
#

we have self-cleaning maps at work :3

wet breach
#

never hurts to check, but I think the issue is more or less just trying to do stuff immediately before everything is fully initialized when they join/leave/join etc. And all you should do is just delay what you are needing done.

#

in fact it is good practice you don't do stuff immediately upon a player joining if you don't need to. This gives time for everything to be stable, and then knowing if the player is going to stay

#

makes no sense to start doing work if in the next 1-5 seconds they just leave lol

echo basalt
#

^ pretty sure frosty came up with this on the spot

wet breach
#

if its super important that you get stuff loaded before they can run around, this is why lobby worlds or waiting worlds are a thing

#

I had a waiting world where you can do some stuff while stuff was being prepped if it came down to it. wasn't used all that much, but still nice to have instead of making the player stay in one spot lmao

echo basalt
#

That's an entirely different situation to an exp bar

#

In short, lifecycles are a thing and attaching logic to the player's lifecycle is appropriate when that logic is specific to that player

#

For example, when a player logs in we load their data, and when they quit we yeet it back to the database

wet breach
# echo basalt That's an entirely different situation to an exp bar

they are using it as some kind of timer for something. And yes I am aware of that, however since I don't know their specifics and just that their issue is exp bar I was simply giving examples in practices where you resolve players moving around and causing more work for the server

echo basalt
#

Lobby / temporary worlds are nice for 2 purposes: Load balancing and providing choice. If you have 2 gamemodes then you want to limit how much data you load

#

At work we have the mentality of "only do necessary IO"

wet breach
#

^

#

that is the mentality I like

echo basalt
#

If you're loading data when the player joins, only load what's needed and prefer doing things lazily when latency isn't an issue

wet breach
#

anyways, I have to go to work now. So I will have to leave this help with other people lol

echo basalt
#

For example, on one of our gamemodes we have a "reward station" system where you can get a reward every few minutes and upgrade the station for a shorter cooldown / reward. We only load "reward station" data when the player logs in to that particular gamemode. It wouldn't make sense to load it on the lobby

spiral cape
#

Alright! 😄 found the root cause. I was in fact not removing the player from one of the Maps on quit/leave event

#

not sure how I've got away with that for so many minecraft versions 😅

wet breach
echo basalt
#

sure

wet breach
#

Thinking next year i will upgrade my mobo. Thinking of something like the z790

#

And then getting an intel series 2 chip. This way it should be a while before i cant upgrade my cpu. Currently i am stuck with the i7-4790 which is not bad but i do want more then 4 cores lol

#

Also want to try out that ddr5 ram

#

And then i will save this mobo and cpu i currently have and build my wife a computer off that. She doesnt need anything fancy since she doesnt do gaming like i do lol

echo basalt
#

why not amd

#

9800x3d is a beast and laps intel in gaming performance

barren peak
#

so I recently updated a plugin to 1.21 from 1.19 but for some reason now it doesn't recognize the imports net.md_5.bungee when it used to on the old version. anyone know why?

grave depot
#

Update the latest version of the dependency?

barren peak
# grave depot Update the latest version of the dependency?

so I updated spigot to the newest dependency version, but haven't ever used a bungeecord dependency. I don't need one, correct? (other plugins I have created on the newer version don't use a bungeecord specific dependency that I can tell and they work)

grave depot
#

Amd your spigot dependency is right?

barren peak
#

pretty sure

grave depot
#

I mean correctly updated

#

Hm

echo basalt
#

smh

#

imagine the transitive dep of bungeecord chat is gone and lyam's just tweaking

#

🙄

barren peak
#

did they remove it

echo basalt
#

dunno

#

it's an option

barren peak
#

is there a new better way to do ChatMessageType & chatcolors from rgb?

#

its just not registering it anymore and i'm not entirely sure why

wet breach
# echo basalt why not amd

Because from my experience in using both amd and intel. Amd tells to not be as stable mostly in regards to drivers. I dont like to play the find the driver that works which may not be the latest game

#

In regards to performance in gaming amd doesnt significantly beat intel cpu wise. It might have a slight edge but i am willing to sacrifice that slight edge for stability. In gpu though no comparison obviously lmao

#

I currently with the 4790 can game on max settings and even if i wanted to have multiple stuff going while gaming too. So at present i dont have much of a reason to go with amd

kind hatch
marsh sluice
#

how can i decrease the price of a villagers trade in 1.21
nothing im trying is working
ive got an upgrade system and i want to decrease the price of a villagers trade by 10% per upgrade

sullen marlin
#

Look at the villager trade events

mortal vortex
#
for (MerchantRecipe recipe : villager.getInventory().getOffers()) {
  double newMultiplier = Math.max(0.1, 1.0 - (0.1 * value));
        
  MerchantRecipe newRecipe = new MerchantRecipe(
    recipe.getResult(), 
    recipe.getIngredients().get(0), 
    recipe.getMaxUses(), 
    recipe.getUseCount(), 
    newMultiplier
  );
        

  villager.getInventory().removeOffer(recipe);
  villager.getInventory().addOffer(newRecipe);
}
ebon topaz
#

hi, um i cant quite work out how to do custom model data in 1.21.4 with strings?

tiny tangle
#

hi

#

I was wondering

#

since the paper api has many new functions, is its possible to wrap the paper api to be as a library plugin so when making a plugin use that library "zip?" as a dependency to run bukkit/spigot server?

blazing ocean
#

no

tiny tangle
#

is there a way to port other api functions?

blazing ocean
#

I mean you can copy the implementation

#

but atp just use paper run

tiny tangle
#

uhm, thats make sense to use just paper , but im from the hybrid dark side, the idea came from because i saw many library mods, such as kotl, or other personal libraries.

blazing ocean
#

don't use hybrids lmao

#

absolute shitshow

tiny tangle
#

the bad side its, not all mods works and not all plugins works, if use like such as carboard, that its trash , very outdated xD

tiny tangle
candid meteor
#

hello everyone this is a very weird problem im having to face

#

on version 1.21.1

#

player.performCommand("some command");
just doesn't want to work

#

or even this when i want to test it out
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say Hello, this is a test!");

#

like it just doesn't work for any reason

sullen marlin
#

Share your code

#

What debug have you done

candid meteor
#

im not sure how my code is going to help but okay
`TikTokLive.newClient(username)
.onGift((liveClient, tikTokGiftEvent) -> {
// Retrieve the player dynamically when the event is triggered
Player player = Bukkit.getPlayerExact("ShoseGaming");

                if (player != null && player.isOnline()) {
                    String tiktokCoins = String.valueOf(tikTokGiftEvent.getGift().getDiamondCost());

                    player.sendMessage(tiktokCoins + " coin amount");
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say Hello, this is a test!");

                } else {
                    Bukkit.broadcastMessage("ShoseGaming is not online.");
                }
            }).buildAndConnect();
}`
#

this is like a trigger event when someone sends a gift on tiktok live

#

and i just wanted to create an action based of that event right?

#

that action involves performing commands but for some reason it just doesn't want to, the player is a valid player in this case i've debugged that

#

actually i just added a try except block to my code and it says "error aoccurred while executing the command: Asynchronous command dispatch!"

#

so yeah there we go

#

thanks anyways

quaint mantle
#

?scheduler

eternal oxide
#

ing

quaint mantle
candid meteor
#

❤️ i love you

#

thanks

buoyant viper
#

TikTok

glossy laurel
#

Can PlayerPreLoginEvent not get called before PlayerJoinEvent somehow?

young knoll
#

Isn’t that one deprecated

#

Over the AsyncPlayerPreLoginEvent

river oracle
#

Pretty sure yeah I don't really thinknyou should be using PlayerPreLoginEvent either way

glossy laurel
#

Will it always get called before PlayerJoinEvent?

young knoll
#

Yes

river oracle
#

Yeah also you can pause that thread for up to 20 or 30 seconds iirc

#

So it's safe to do DB calls on

sly topaz
#

well, as long as the player timeout time isn't greater than whatever delay you make in that event I guess

slender elbow
#

that's what they're saying

#

the client (and server) will close the socket after 30 seconds of inacticity

echo basalt
#

Pretty sure it's 20

ebon topaz
#

So for custom model data components for 1.21.4 how would a string look? And is it better to do a string or just use the normal custom model data with integer numbers?

glossy laurel
#

uh

#

nvm

slender elbow
# echo basalt Pretty sure it's 20

apparently there is a hard 30 seconds timeout for inactivity on the socket, and the server has a separate 15 seconds timeout linked to the keep alive packet

pliant topaz
#

yep, client will also timeout when itself isnt sending a keep alive for 20s, if the server hasnt kicked it yet for some weird reason

pliant topaz
wise mesa
#

out of curiosity, is there a thread safe way to use a queue that's not synchronized if one thread is ALWAYS writing and the other thread is ALWAYS reading

#

im gonna guess that's not possible

wet breach
#

in most cases that is true

echo basalt
#

smh

wet breach
#

however, on some systems that timeout is longer

echo basalt
#

that timeout is minecraft's timeout

wet breach
#

minecraft doesn't control socket

#

the OS does

#

the 15 seconds is minecraft

echo basalt
#

you'd need to be a special kind of fucked up to receive a call saying "yo this socket times out after 30s" and go "nah"

wet breach
#

there is some systems mostly linux where applications are not allowed to modify socket settings

#

and on those systems typically the time out is greater then 30 seconds

echo basalt
#

both the client and server are set to disconnect if there's a keepalive timeout

#

even if the socket doesn't the application will

wet breach
#

ok....I didn't say anything about the application except acknowledged it has a 15 second time out

echo basalt
#

because this keepalive system is built by the application and not just the socket

wet breach
#

the application doesn't control the socket was all my point was and just pointing out that the timeouts for sockets is system dependent not application dependent

echo basalt
#

Emily's message was about the application timeout, not the OS timeout

#

ffs

wet breach
#

they said socket in their message

echo basalt
#

🙄 whatever

wet breach
#

apparently there is a hard 30 seconds timeout for inactivity on the socket

#

yep believe I read that correctly

echo basalt
#

still a pointless argument for the sake of drama

wet breach
#

it wasn't an argument

#

you argued it

upper hazel
#

why i not can get player attributes if he not online

wet breach
#

I was pointing out its not a hard limit set by minecraft except on systems that allow applications to modify socket settings

upper hazel
#

i want remove some modify

echo basalt
#

you technically can modify the player's nbt data

#

Or you can do it on quit

upper hazel
#

i need get file ?

#

or

echo basalt
#

sounds like a case of xy

#

?xy

undone axleBOT
upper hazel
#

bruh i just want remove modify from attribute

#

but i cant get attribute from offline player

echo basalt
#

yeah but why

upper hazel
#

i create plugin with custom attributes

pseudo hazel
#

why would you care about offline players

upper hazel
#

ok i see you dont undestand what i mean

pseudo hazel
#

then explain what you mean ppease

upper hazel
#

i slove problem

#

i just will not do this

#

nevermind

#

but I still have to access the player's attributes if he's not online.

pseudo hazel
#

why is that

upper hazel
#

bc if you want manipulate with attribute if player not online

#

this

#

unconfortable

#

I also need it for statistical purposes

pseudo hazel
#

ah

echo basalt
#

just make your own decoupled attribute system and update values when the player logs in Chad

#

or fork spigot and add your own offline support GigaChadGIF

pseudo hazel
#

💀

upper hazel
#

i think getting some "file" from player and update hist stats be better

slender elbow
upper hazel
#

idk maybe you right

#

what better?

pseudo hazel
#

probably reading the player data

#

iirc its nbt

#

but ideally you dont wanna change it

#

just read only

#

and make changes when they log in if you need to

upper hazel
#

and you know, I was thinking about it and I realized that I've never seen an api that allows you to access data that you logically have the right to access.

echo basalt
slender elbow
#

it's just a normal task on a scheduler that calls close(fd) lol

echo basalt
#

Just clean up after yourself when the player logs off etc

echo basalt
#

ilmir the kind of guy to keep every player that's logged in on a hashmap to be able to modify attributes when they're offline

pseudo hazel
#

if a ppayer isnt online, you shouldnt have to care about them

echo basalt
#

^

pseudo hazel
#

and if you do, you would likely be using a database

#

or something similar

upper hazel
echo basalt
#

It is

upper hazel
#

for example plugin stats

#

oh no

echo basalt
#

Such as?

#

You know they just usually use time-series databases for that kind of stuff

#

just push a point once in a while and use that to render graphs

upper hazel
#

I just mean making a whole system to just update the data of a player who logs into the game looks cumbersome.

#

"crutch"

echo basalt
#

Just don't support updating data for offline players then

#

because ✨ there's no need to ✨

upper hazel
#

but I guess it's just not an improvement.

echo basalt
#

you can achieve your goal with a database

upper hazel
#

i know but this still big combesome

echo basalt
#

just means you suck at coding then

upper hazel
#

bruh i dont suck coding it just illogically

#

I don't know how minecraft is set up, but intuitively it doesn't make sense given that player data is stored somewhere.

#

bukkit api moment?

echo basalt
#

nope

#

NMS doesn't care about that data either

#

It wouldn't make sense to keep offline player data loaded forever

#

Just a waste of RAM

#

and technically a really slow memory leak

upper hazel
#

huh?

#

minecraft moment then?

chrome beacon
#

That would be a you moment

#

Not a Minecraft one

upper hazel
#

yea?

chrome beacon
#

Having data loaded for offline players when it's not needed is just a bad idea

upper hazel
#

sounds logical

upper hazel
#

sounds logical considering that plugins are custom addons.

#

now i see

#

Then right call this "Minecraft canon"

#

Ehehe

sly topaz
#

people usually don't bother with trying to access that data while the player is offline since it implies using NMS due to how the Bukkit API is designed, there is no good way to make an API to access the data of an offline player

#

Paper has considered decoupling Player and OfflinePlayer in order to make that feasible, however that change would break many things

#

any option that implies using minecraft's default storage would imply being dependent on the minecraft version, and there's only so much you can store inside PDC and the such anyway, so people just go for a database instead to avoid the hassle

#

the first part wouldn't be a problem if the API for it was there, but it isn't and there will probably never be in Spigot at least, until someone finds a novel way to implement it without breaking backwards compat too much if at all

upper hazel
#

So this all bc plugins not official lol

sly topaz
#

it's more of the fact that it is a lackluster solution to most problems without API for it

upper hazel
#

I guess this still "Minecraft moment"

sly topaz
#

I mean, if you're stubborn and want to go that route, you could still do it, maintaining NMS-dependent code isn't rare for plugins anyway and I don't think the code for this specifically has changed all that much between versions

upper hazel
#

This complicates my situation considering that the plugin has a shell over the characteristics of the players which in theory should be updated regardless of the online will have to make a system

#

💀

sly topaz
#

I mean, just use a database

upper hazel
#

😢

#

Yea

#

I need to

fossil ridge
#

How can I check when a player gets revived by totem? EntityResurrectEvent seems to also trigger when the player respawns normally and the event doesn't produce a Cause to check for a totem for example

#

"Get the hand in which the totem of undying was found, or null if the entity did not have a totem of undying." just check if getHand is != null?

hybrid spoke
#

then make your own tickcounter

fossil ridge
sly topaz
#

I might do the hand check as well just to be on the safe side

jovial grove
#

Is there any way to transfer all information about a player (like inventory contents, enderchest, achievements, stats, etc.) from one account to another?

quaint mantle
#

Possible 🤔

#

Just load the player's inventory to a hashmap and then add it to the other player's inventory

wraith delta
lilac dagger
#

i think it works with the server online as well if both players are offline when doing so

wraith delta
#

and same with inside the advancements folder

wraith delta
lilac dagger
#

true

#

but not that big of an issue to reconnect

wraith delta
#

easier than going through a long list of attributes to copy paste over using plugin code that you need to restart to add anyways

jovial grove
jovial grove
#

Okay, that's what I wanted to know
Thanks

wraith delta
#

there are for loops to get advancements, then write them. same for inventory items.

#

each feature of the player would be individual. so as another method you could just rename the playerdata file

sharp cosmos
#

Is there an Event for a pressure plate being stopped on- and off of?
I know there's PlayerInteractEvent for stepping on a pressure plate, but what about stepping off it?

blazing ocean
#

after all it's ass pressure

sharp cosmos
#

yeah no its def only triggering when stepping on it @blazing ocean

young knoll
#

BlockRedstoneEvent probably

#

Won't have the player tho

sharp cosmos
barren peak
#

so I made simple damage indicators using armorstands as markers, but sometimes when hitting a mob the armorstand flashes (for like a split second) before going invisible. is there any way around this or is it just something you have to deal with? (probably the second, but let me know)

chrome beacon
barren peak
chrome beacon
#

Use world#spawn and modify it in the consumer

barren peak
young knoll
#

no

chrome beacon
#

^ that is an API method

barren peak
#

what would I put in as the consumer

chrome beacon
#

A lambda

#

Or a method reference if you prefer

barren peak
#

could you provide an example? I haven't done this before

chrome beacon
#

Would look something like this:
world.spawn(location, ArmorStand.class, armorStand -> {
armorStand.setInvisible(true);
armorStand.setDisplayName(etc)
});

#

Typing on mobile and going of memory but should be close enough

barren peak
#

yeah that makes sense

#

let me try that

#

thanks

chrome beacon
#

For reference what I used is a lambda function

barren peak
#

yeah its like the one in stream() i just never realized thats what they were called

chrome beacon
#

Now you know :)

barren peak
#

ty

wet breach
echo basalt
#

frosty where's my 5 bucks

wet breach
ebon topaz
sonic goblet
#

I would assume it has a check for operators and excludes them

soft flame
#

Hello, I have an error upon loading my plugin. it say a class was not found. I am trying to use ProtocolLib as a dependency for my plugin and use packets, but it cannot find the main class which is ProtocolLibrary

warm mica
#

Validate by opening your jar as a zip and checking that there are no copied protocllib files

#

And you need to have it running on your server as well

soft flame
#

it is running on the server, my plugin.yml has the depend and the scope is provided, i don see whats wrong

dense shoal
#

Someone that has familiarity of the Map interface (like the Minecraft map), is there a way to prevent a map from being copied via a property or something?

autumn ingot
#

is jitpack down for anyone else rn?

#

when building with maven i keep getting stuck on Downloading from jitpack.io

wet breach
#

if there is something that uses jitpack I will just pull the repo and build the dependency myself

#

this way I don't have to worry about such things

blazing ocean
#

jitpack my behated

ebon topaz
#
// Raw_Chicken_Nugget
private static void createRawChickenNugget(){
    ItemStack item = new ItemBuilder(Material.CHICKEN, 9)
            .setDisplayName("Raw Chicken Nugget")
            .setCustomModelData(8)
            .build();

    ShapedRecipe recipe = new RecipeBuilder("raw_chicken_nugget", item)
            .shape("R", "", "")
            .setIngredient('R', Material.CHICKEN)
            .build();

    getServer().addRecipe(recipe);
}


// Cooked_Chicken_Nugget
private static void createCookedChickenNugget(){
    ItemStack item = new ItemBuilder(Material.COOKED_CHICKEN, 1)
            .setDisplayName("Cooked Chicken Nugget")
            .setCustomModelData(9)
            .build();

    FurnaceRecipe recipe = new FurnaceRecipeBuilder("cooked_chicken_nugget", source, item, 0, 5)
            .build();

    getServer().addRecipe(recipe);
}

how should i access the raw chicken nugget itemstack in the cooked chicken nugget recipe builder
should i just predefine a itemstack for the raw chicken nugget?

glossy laurel
#

DISCLAIMER: IDK ANYTHING ABOUT THREADS
So I am using a custom CompletableFuture executor that has 4 threads allocated to it. I'm only using it to create 4 completable and I dont need it afterwards. Supposedly my plugin is leaking, so how do I fix that? Can I somehow kill all threads made by an executor?

pseudo hazel
#

if you know nothing about threads dont use them

cedar drift
#

any idea if there is a way to check an entity's NBT tags?

#

my code is checking the names but I figured I might have to read something from the nbt tag

lilac dagger
#

uhm

#

why do you need reflections for this?

cedar drift
#

no idea actually, this part isn't my code

lilac dagger
#

if you want to have some information about your vehicle use a hashmap or pdc for persistency over restart

cedar drift
#

the thing I was trying to do is trying to read this on the "vehicle entity" that the player is riding in

glossy laurel
pseudo hazel
#

idfk

glossy laurel
lilac dagger
#

your only choice is to get it at nbttag load

glossy laurel
#

If idk how java works internally should I not use it either??

lilac dagger
#

is this your code?

cedar drift
#

this part is but both mod and plugin was based on someone else's stuff

#

was trying to make proper traffics in minecraft with physics and shit

lilac dagger
#

in that case you need to learn more on how the plugin/mod works

cedar drift
#

I get it, so far I've only got timer, rewards working as I intended

#

I was thinking if I add NBT to the entity and if the plugin can somehow access the NBT stored on the mod vehicle to tell what they are

lilac dagger
#

you can save the nbt of the entity to your own nbt wrapper and then get the value from there 😄

#

it's not really efficient but it's better than trying to do it on entity load

cedar drift
lilac dagger
#

there's nvidia recording, obs and even windows has a way to record i think

cedar drift
#

I get that, it's just old habits

#

this is what I was thinking but not sure what am I suppose to import to the project for the NBTTagCompound

lilac dagger
#

what is the type of the vehicle entity data?

#

is this even spigot/bukkit?

#

i'm 99% sure this method doesn't exists in bukkit/spigot

cedar drift
#

oh

#

I guess I'm out of luck at this point xD

lilac dagger
#

you'll eventually figure it out tho

#

don't give up

cedar drift
lilac dagger
#

i'm just saying, chat gpt isn't helping rn

cedar drift
#

look at this code 🤣

cedar drift
lilac dagger
#

what's this code supposed to do exactly?

#

why is it like this?

cedar drift
#

so long story short this is my check point race plugin, I got someone to write me a base(since I'm still using 1.12.2) and added all the features I needed

vital ridge
#

Im looping through a list of materials to print them to the screen, but it throws this error:
https://paste.md-5.net/fogivomequ.rb
This is my code:

BlockBlackListFile blockBlackListFile = GlarkourParkour.getInstance().getBlockBlackListFile();

            List<Material> blockBlackList = blockBlackListFile.getBlockBlackList();

            ConsoleManager.message(b.getType()+"");

            blockBlackList.forEach(mat -> ConsoleManager.message(mat+""));

            if (blockBlackList.contains(b.getType())) {
                p.sendMessage(ChatColor.RED + String.format(ChatColor.RED + "You are not allowed to use %s in your course.", b.getType()));
                e.setCancelled(true);
            }

It throws this error at line 98 were im looping through the blacklist and printing the material

lilac dagger
#

blockBlackList.forEach(mat -> ConsoleManager.message(mat+"")); here?

vital ridge
#

Yes.

lilac dagger
#

the material list is made of strings by the looks of it

#

is getBlockBlackList raw type?

vital ridge
#
public List<Material> getBlockBlackList() {
        return (List<Material>) getConfiguration().getList("blacklist");
    }
lilac dagger
#

ah

#

this is wrong

#

you need to use getStringList

#

and replace it with strings

#

and do the material conversion yourself

vital ridge
#

This better?

lilac dagger
#

there's a better way than value of

#

one sec

vital ridge
#

Why doesnt regular casting work when Im just using #getList?

cedar drift
lilac dagger
#

it's of string type

vital ridge
#

So yml files automatically convert a list to string list?

lilac dagger
#

that's the expected behaviour in most cases so yes

vital ridge
#

Gotchu

lilac dagger
#

unless you save a list of materials to yml

#

where at the start of the list it says the type

#

it's a string double etc

vital ridge
#

Gotchu gotchu

lilac dagger
cedar drift
#

with these

#

xD

lilac dagger
cedar drift
#

at least it works lol

lilac dagger
cedar drift
#

guess still got a long way to go before i can finally put pizzaboy missions in place lol

cedar drift
#

so far the only way I found to limit players from vehicle class is making sure they "don't having certain items in their inventory"

cedar drift
wet breach
#

joke in that it is misspelt?

cedar drift
#

ok that's just me being dumb

wet breach
#

lol

cedar drift
#

but not gonna get into details but the whole project I'm trying to do is a joke

wet breach
#

I was just making sure it was misspelt or if it was intentional

#

but yeah its a nice joke that isn't obvious unless someone is paying attention 😛

cedar drift
#

I guess that depends on how I claim that stuff lol

#

@wet breach here is another one lol

wet breach
cedar drift
#

but anyway, I still have to figure out somehow attach NBT tag on mod vehicles and then read it from plugins lol

cedar drift
#

doing cars in minecraft kinda makes me question my life decisions lol

wet breach
#

do you mean mods client side and plugins server side?

cedar drift
#

idk if I am understanding it correctly here but both server and client has the mod, and since the mod vehicles are just an entity so I was thinking

#

attach nbt tags on mod vehicle, and then let the plugins to read from it

#

u can probably tell which part is from me by how some functions are "badly implemented" comparing to the rest lol

wet breach
#

why do you need to communicate between mod and plugin via nbt?

cedar drift
#

tbh I don't really know why, I just got this idea when I was doing the code on the mod side and

#

I am assuming spigot and mod aren't gonna directly access each other

wet breach
#

but why not?

#

what is stopping that ?

cedar drift
#

ok u got me, I never thought why not

#

so what would be a good solution for checking the vehicle name?

wet breach
#

I would imagine that is the name of the entity? anyways not sure why we mixing mods and plugins anyways

cedar drift
#

that's what the mod vehicles returns by checking the name directly from plugins

wet breach
#

if both are your projects, you could just have the mod just communicate directly with the plugin

#

just have the mod, tell the plugin, this is the name of this thing

cedar drift
#

so implement something on the mod side to change the name?

wet breach
#

well it can be done on the plugin side too, you could just make a method in the mod for the plugin to access

#

this way, it doesn't have to do weird things to get something like a name lol

cedar drift
#

ok seems like this is out of my knowledge, is there anything I can look into?

#

ok, so nametag doesn't read aswell xD

wet breach
#

generally, you don't have mods and plugins

#

but, my understanding of how mods work is mods essentially replace code/classes in the server when they are loaded, thus it should technically be possible for a plugin to simply just access a mods code/classes directly since plugins are loaded into the server as well just they don't replace functionality like mods do rather sit on top

cedar drift
#

I think I have a solution now, a stupid one

wet breach
#

lol

#

if it works, it works

cedar drift
#

getcustom name will get nametag, gonna add nametag to vehicles

cedar drift
#

check ur pm 🤣

wet breach
#

as I said, if it works it works lol

#

I am quite familiar with needing to be creative, I am one of the people who made holograms a thing just fyi 😉

sly topaz
#

you could do Bukkit#getRecipe instead if you don't want to pass it as argument, however it doesn't seem like you are saving the namespaced key anywhere to reference the recipe properly

#

it just screams desync issues doing it that way, if you were to change any part of it

#

ideally, what I would do is convert those methods into an enum, that way you don't have to worry about desyncs

ebon topaz
#

Thank you for the pointers I’ll look into them

sly topaz
# ebon topaz Thank you for the pointers I’ll look into them

eh, scrap the enum idea, I don't know how to feel about it after typing it out lol:

public enum Recipes {
    RAW_CHICKEN_NUGGET("raw_chicken_nugget", new ItemBuilder(Material.CHICKEN, 9)
            .setDisplayName("Raw Chicken Nugget")
            .setCustomModelData(8)
            .build()) {
        @Override
        public Recipe createRecipe() {
            return new RecipeBuilder(getKey(), getItem())
                    .shape("R", "", "")
                    .setIngredient('R', Material.CHICKEN)
                    .build();
        }
    },
    COOKED_CHICKEN_NUGGET("cooked_chicken_nugget", new ItemBuilder(Material.COOKED_CHICKEN, 1)
            .setDisplayName("Cooked Chicken Nugget")
            .setCustomModelData(9)
            .build(), RAW_CHICKEN_NUGGET) {
        @Override
        public Recipe createRecipe() {
            return new FurnaceRecipeBuilder(getKey(), getDependency().getItem(), getItem(), 0, 5)
                    .build();
        }
    };

    private final String key;
    private final ItemStack item;
    private final Recipes dependency;

    CustomRecipes(String key, ItemStack item) {
        this(key, item, null);
    }

    CustomRecipes(String key, ItemStack item, Recipes dependency) {
        this.key = key;
        this.item = item;
        this.dependency = dependency;
    }

    public String getKey() {
        return key;
    }

    public ItemStack getItem() {
        return item;
    }

    public Recipes getDependency() {
        return dependency;
    }

    public abstract Recipe createRecipe();

    public static void registerAllRecipes() {
        for (Recipes recipe : values()) {
            Bukkit.getServer().addRecipe(recipe.createRecipe());
        }
    }
}
#

maybe if you got rid of the recipe builders it'd look more clean, but eh

#

oh and unrelated but you should use item name instead of display name for this

young knoll
#

I would just have static fields for the items somewhere

hybrid spoke
#

or just dont hardcode them and have a item database

sly topaz
#

eh, that's often way too complex for most use-cases, you'd have to define a human-readable format for item stacks and all that jazz

#

it'd be good for a exhaustive recipes plugin or whatever but I doubt that's their goal

hybrid spoke
#

KFC has a huge arsenal of food

young knoll
#

I wonder if people would use a generic item database plugin if I made one

#

With an api

hybrid spoke
#

otherwise you'll never know

sly topaz
#

I don't think there's enough of a demand for that kind of thing, but it sounds fun

hybrid spoke
#

i thought the same about pathfinding and i was proven wrong

#

as long as its easy enough to integrate, people will use it

sly topaz
# young knoll I would just have static fields for the items somewhere
public class Recipes {

    public static final ItemStack RAW_CHICKEN_NUGGET_ITEM = new ItemBuilder(Material.CHICKEN, 9)
            .setDisplayName("Raw Chicken Nugget")
            .setCustomModelData(8)
            .build();

    public static final Recipe RAW_CHICKEN_NUGGET_RECIPE = new RecipeBuilder("raw_chicken_nugget", RAW_CHICKEN_NUGGET_ITEM)
            .shape("R", "", "")
            .setIngredient('R', Material.CHICKEN)
            .build();

    public static final ItemStack COOKED_CHICKEN_NUGGET_ITEM = new ItemBuilder(Material.COOKED_CHICKEN, 1)
            .setDisplayName("Cooked Chicken Nugget")
            .setCustomModelData(9)
            .build();

    public static final Recipe COOKED_CHICKEN_NUGGET_RECIPE = new FurnaceRecipeBuilder(
            "cooked_chicken_nugget",
            RAW_CHICKEN_NUGGET_ITEM,
            COOKED_CHICKEN_NUGGET_ITEM,
            0,
            5
    ).build();

    public static void registerAllRecipes() {
        Bukkit.getServer().addRecipe(RAW_CHICKEN_NUGGET_RECIPE);
        Bukkit.getServer().addRecipe(COOKED_CHICKEN_NUGGET_RECIPE);
    }
}

looks simple enough

hybrid spoke
#

if its too complex, only people will use it who have no other choice

sly topaz
#

pathetic?

hybrid spoke
#

yes

sly topaz
#

eh, people don't really use that library lol

#

since most devs don't quite understand what pathfinding algorithms entail

#

they find it daunting, even though it is pretty easy to use

hybrid spoke
#

well, im the dev and i can say they do

sly topaz
#

I am talking about the average spigot developer in this case

hybrid spoke
#

but in the beginning of pathetic i thought the same

#

thats where i was proven wrong

#

you cant succeed if you overthink the outcome

sly topaz
#

I mean, this isn't a motivation type of thing, but rather the fact that there's simply not much people dealing with pathfinding in general, as there isn't a lot of use for it in your average public plugin

young knoll
#

The api would be very simple, something like ItemDatabase.getItem(name)

hybrid spoke
#

i dont really want to flex with numbers, but i can tell you its the opposite. thats what i mean with if its easy enough, people will use it

#

and even tho pathfinding is a niche, there are still several people using it for many different things

#

and i dont do shit for the big crowd, but for the people who need it. and i think that should be the main goal in the first place

#

i suggest to have a system behind it. a factory for new items, configuration options like what file or database type etc

young knoll
#

Yeah ofc

sly topaz
#

if you can achieve that, the rest would be easy

young knoll
#

I was just gonna do binary serialization

hybrid spoke
#
  • tests are very important in your case
sly topaz
#

that works for just storage, but I'd imagine for use cases such as recipes, they'd want the option to have an human-readable format too

hybrid spoke
#

a database lib should be reliable

sly topaz
#

in newer versions that's easy since you can just tell the codec to spew json, in older versions not as much

#

though the json format is quite verbose, so probably some standard transformation options too

#

I don't know, I just personally find more appeal in standarizing how items are stored, be it for configuration purposes or just plain storage but maybe that isn't your goal

young knoll
#

I mean for recipes you could just reference the item by its unique name

cedar drift
#

@wet breach just came here to say thank you, I found that by adding tags with exact same name will actually work as a name tag

sly topaz
#

it looks like roblox

cedar drift
#

yes

hybrid spoke
sly topaz
#

that's crazy

cedar drift
#

it is minecraft

hybrid spoke
#

concentrate on the database stuff and give them the api to query the items

#

the rest is their deal

sly topaz
#

whether that is a good choice is debatable, however that's the reality

hybrid spoke
#

eh, thats why you can choose the file type or database type

#

as mentioned earlier

sly topaz
#

I mean, I don't know what Jish is making lol

hybrid spoke
#

i also am a lazy user throwing everything into my yaml

young knoll
#

That’s when you reference a custom item by name

sly topaz
#

right now it is just all ideas

hybrid spoke
sly topaz
young knoll
#

A human readable format would be painful with all the fancy components we have now

#

Easier to edit the items in game with some sort of gui

sly topaz
#

I dread having to join the game just to edit some items but ig it is what it is

hybrid spoke
#

but to get back to your question @young knoll, just do it and give it some time. you would have my support, since it would be useful for me as well

sly topaz
blazing ocean
#

nice

sly topaz
#

it looks cool yeah

blazing ocean
#

I wanted to make a mario kart recreation at some point

#

though kev did that with xenyria (or was it cytooxien?)

young knoll
#

Turbo kart racers

sly topaz
#

I always liked the idea of those minigames however they just fall apart with bad ping and that's what I live with lol

young knoll
#

Yeah there’s a Mario kart datapack iirc

sly topaz
#

so I never really actually tried to make one

blazing ocean
#

well currently I'm just working on [redacted] which is also pretty fun

hybrid spoke
#

even open source

blazing ocean
#

I wish xenforo had embeds

sly topaz
#

that gets you half of the way

#

the rest is having good maps, which is the hard part

cedar drift
blazing ocean
#

definitely

hybrid spoke
#

building is always the part that sucks the most

blazing ocean
cedar drift
#

nope

#

forge

young knoll
#

Someone is doing a full physics system for racing in a datapack

cedar drift
#

and still at 1.12.2

blazing ocean
#

😭

young knoll
#

Which is wild

slender elbow
#

it just calls close

sly topaz
slender elbow
#

when closing the socket doesn't close the socket :bigbrain:

young knoll
#

Let me find it

sly topaz
young knoll
blazing ocean
#

He's making a full physics engine in a datapack

#

he made his own programming language that compiles to datapacks

blazing ocean
sly topaz
#

that I did see, various of those spawned afterwards

blazing ocean
#

did you see that guy doing Portal?

young knoll
#

Yeah

sly topaz
cedar drift
sly topaz
#

to think it is made in mc commands/functions

hybrid spoke