#help-development

1 messages · Page 948 of 1

young knoll
#

Yeah create is a big one

sullen marlin
#

What's it add

tall dragon
#

u dont know create?

young knoll
#

Automation system based off rotational force

quiet ice
#

well last time I used unsafe it was to replace the bukkit unsafe, so not exactly something Mojang related

young knoll
#

You unsafed the unsafe

sullen marlin
#

Sounds unsafe

echo basalt
#

I wonder if there's anything spigot related I haven't injected into yet

#

I think I gotta do world manager next

young knoll
#

SlimeWorldManager

#

No wait

#

IllusionWorldManager

tender shard
#

💉

echo basalt
young knoll
#

Boring

echo basalt
#

mf never taken a look at my big projects

#

It goes something like this

SkyblockCore
University
Tutorial
Zombies
Tycoon
MinigameDemo

#

I'm really lame when it comes to naming stuff

echo basalt
young knoll
#

Tbf my stuff doesn’t really get fancy names either

#

My server core is called ServerCore

astral scroll
#

what holograms pl yall recommend?

astral scroll
tall dragon
#

mine is called Cobra

#

dont ask me why i just name all my major systems after snakes

young knoll
#

And the first game I’m working on using it is called TowerDefense

echo basalt
#

oh yeah I have a meeting tomorrow to get paid

#

le t's go

sour bluff
#

question, how did you make it green when it was on the floor, is it just checking one block below all the minimum y coord blocks?

young knoll
#

Check that the contents are all air and the below blocks are all solid

echo basalt
#

the masculine urge to forget everything I know and quit is starting to hit

graceful oak
#

I know you can use CustomModelData to make custom item textures and such is there any way to do that with mobs? Like if I want a few different textures for withers based off the name or something is that possible?

young knoll
#

Not without optifine

#

Or a bunch of trickery with display entities

mellow river
#

Hello, who knows how to create databases in vps for luckperms?

echo basalt
#

can't wait for some loser to emulate all kinds of animations with display entities

#

One I'm looking at is chest open

#

ATM MMCI only applies a model to the chest base, what if we could replicate the lid animation perfectly

graceful oak
young knoll
#

Texture pack

graceful oak
#

Ok that works I guess

young knoll
#

Do a little subverting of expectations

#

Have the lid yeet into space

rough ibex
#

This chest empty

#

Yeet

echo basalt
#

now I gotta fuck with quaternions

young knoll
#

Now shrink it slightly

#

Also

#

Ukraine chest

echo basalt
#

it's shrunk

#

it's just offset

young knoll
#

Offset betterer

echo basalt
#

yeyeye block corner whatever

#

my idea was to make this a little bit bigger and use like item displays or something to render a 3d model

young knoll
#

I would just make a blockbench model and run those animations directly

echo basalt
#

well yeah but I want to do it with like 2 display entities

young knoll
#

And?

echo basalt
#

I can't bother learning what a model is

young knoll
#

Lol

echo basalt
#

I just need it to be simple

young knoll
#

Gotta make a full system for using blockbench models

#

Else 0/10

echo basalt
#

really simple answer to that

#

fuck you

young knoll
#

Lol

echo basalt
#

uh huh

#

how do I set interpolation again?

young knoll
#

That’s correct

#

You may need to set the delay as well

#

Also you can’t do it the same tick it spawns

echo basalt
#

fuck

#

Yeah this still doesnt work

alpine urchin
echo basalt
#

is the delay in ticks or ms?

alpine urchin
#

tick tock

#

tiktok brain

echo basalt
#

oh cool it's opening mega slow

young knoll
#

Ticks

echo basalt
tall dragon
#

but why xD

echo basalt
#

I'm gon up the scale and apply a model

#

And then sync up the animation with the client

#

So the chest has a model

#

The one thing I don't like is that the real chest lid is slightly buried in the base

#

And so the rotation point is a bit different

#

And things overlap

young knoll
#

Now send the lid to space

echo basalt
#

lmao

tall dragon
#

or open the base down instead of the lid up

#

😂

young knoll
#

Remember that really old April fools update

#

With the locked chest

echo basalt
#

I don't like this overlap

#

but the open state looks proper

young knoll
#

Shrink the lid by a tiny amount

tall dragon
#

cant that be fixed by making the lid a fraction bigger?

echo basalt
#

won't look great

young knoll
#

It won’t even be visible

wary harness
young knoll
#

You can have very fine scaling with display entities

echo basalt
#

let's see

#

nope still acting up

young knoll
#

Try a bit more

echo basalt
#

can't I fix this by just making the line on the overlapping part the same color

young knoll
#

Idk, maybe

quiet ice
#

Ah Z-fighting, a programmer's arch nemesis

young knoll
#

Try 0.01

#

Or 0.001

echo basalt
#

001 not good

#

01 also not good

young knoll
#

Eh?

#

I’ve done it before at those scales and it worked

echo basalt
#

and looks noticeable

sand spire
#

I doubt it would look ugly, doesn't it make sense for a box to be smaller than the lid

echo basalt
#

I think I need to shift it all a lil bit

#

to compensate

#

because one side looks good

young knoll
#

Welp now I gotta try this with my model framework

sand spire
#

Are you going to apply the normal chest texture back at the end?

echo basalt
#

This is so we can have like 20 different chest textures

sand spire
#

Ah, cause if it's supposed to look like a normal chest I understand you don't want the lid to be bigger

young knoll
#

Omg chests for each wood type confirmed

echo basalt
#

sumn like that

sand spire
echo basalt
#

solid 95% chance I'll just use this in the minigame network and fuck off

#

the guys wanted models for each chest on the map

#

So you could see a purple chest and run for it

buoyant viper
#

bro wanted an ender chest without the ender

sand spire
#

ah that's cool

echo basalt
#

why is it z-fighting but only in this side

buoyant viper
#

did u expand it on all sides?

echo basalt
#

yea

#

wonky ass constants

#

dividing by 2 fixed it

#

interesting

#

It's only slightly noticeable if you look for it

sand spire
#

looks good

buoyant viper
# echo basalt hm

smh didnt they teach u to always simplify ur fractions.. 7/8 instead of 14/16 😤

echo basalt
#

made it 0.0001 and it still works

#

cool

#

Just had to divide by 2

tall dragon
#

probably just some wonky math thing

echo basalt
#

this is really wonk

sand spire
quiet ice
#

That is nigh unnoticable

#

Though I do wonder what happens with floating point inaccuracies

echo basalt
tall dragon
#

lmfao

quiet ice
#

How

echo basalt
#

something about that one face

sand spire
echo basalt
#

this time it's not the left face

#

it's the back

#

huh

junior cradle
#

How to support iridescent colors in the scoreboard using a mini message

protected void setLines(String @NotNull ... scoreLines) {
        for (int i = 0; i < scoreLines.length; i++) {

            final MiniMessage miniMessage = MiniMessage.miniMessage();
            final String serialize = miniMessage.serialize(Component.text(scoreLines[i]));
            
            this.objective.getScore(serialize).setScore(i);
        }
    }
protected void createScoreboard() {
        super.setLines(
                "&6Name: ",// No color!
                "§6Rank: ", // Yes color
                ChatColor.BLUE.toString(),
                "<gold>Death: ", // No color!
                "Kills: ",
                ChatColor.RED.toString(),
                "mc.ImFoxter.com"
        );
    }
echo basalt
#

uH

#

if you're using paper there's Team#prefix(Component)

#

if not gl

junior cradle
#

Scorboard this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);

tender shard
#

you need to use deserialize to turn MiniMessage into components

#

and then turn that into legacy strings with the LegacyComponentSerializer

echo basalt
#

It seems like this only happens around 0, 0

#

aka when crossing between negative and positive coordinates

#

nvm it's when crossing between chunks

#

okay wtf

sullen marlin
tender shard
#

create an instance of it

        private LegacyComponentSerializer legacySerializer =
            LegacyComponentSerializer
                .builder()
                .hexColors()
                .useUnusualXRepeatedCharacterHexFormat()
                .build();
```(or sth like that)

and then use it
```java
String legacyString = legacySerializer.serialize(MiniMessage.deserialize("<red>My MiniMessage text")); // The result is now a §cLegacyFormattedText
echo basalt
#

it's actually just when facing west not even chunks

#

Seems like the chest opening animation lasts 5 ticks

#

Now I just need to sync this up to an actual chest

#

and up the scale

#

this is starting to get messy

young knoll
#

Needs more Matrix4f

tender shard
#

matrix 1 came out today, 25 years ago

buoyant viper
young knoll
#

(I fixed it)

remote swallow
#

scoreboard is weird with no space for numbers

kind hatch
#

An interesting feature nonetheless

#

I wonder if you could put a dynamic texture on it?

young knoll
#

The scoreboard or the chest?

kind hatch
#

The scoreboard

#

It might just be a darkened background that the client draws though.

young knoll
#

Yeah it is

#

You can mess with that via shaders tho

#

Or just slap a large font texture over it

grave vigil
#

Anyone know how to store persistent data types in NBTs?

river oracle
#

They are stored in nbt by default

#

That's a non issue

grave vigil
#

went brain dead when typing

remote swallow
#

im guessing its always going to be translateable

river oracle
carmine mica
#

.............

river oracle
carmine mica
#

.........

#

no it won't

remote swallow
#

when would the description contents not be a component contens

carmine mica
#

datapacks can make custom ones, and they define whatever component they want

river oracle
#

Then that violates the api contract and needs to be fixed make an issue on jira

#

You had plenty of time to review it before it was merged too. I'd reccomend doing that in the future 😉

#

It sat in queue for a week or two

carmine mica
#

lol wtf

#

I have to review PRs? thats what a whole community is for

#

now if the whole community could seeeeee the PRs it'd be better

#

but no, its impossible for that to happen

remote swallow
#

wow its almost as if bit bucket doesnt support that

carmine mica
#

cause they don't have an api that you can use to write custom actions to auto close PRs from people who havent signed the CLA

#

github doesn't natively support that either, doesn't stop people from making use of that kind of functionality

river oracle
#

This isn't a me problem either way ypu found an issue report it it'll be fixed

#

Gap in my knowledge let something slip through whatever shit happens. I'll fix it when I get a chance

river oracle
coral flower
#

I try to hide the nametag of an entity its not visible when im not looking at it but it gets visible when I directly look at it: ```java
public class CustomZombie extends Zombie {
public CustomZombie(Location spawnLocation, int id) {
super(EntityType.ZOMBIE, ((CraftWorld) Bukkit.getWorld("roguelike")).getHandle());
Level level = ((CraftWorld) Bukkit.getWorld("roguelike")).getHandle();
this.setPos(spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ());
this.setId(id);
this.setCustomName(Component.nullToEmpty("NORMAL_ZOMBIE"));
this.setCustomNameVisible(false);

    level.addFreshEntity(this);
}

}```

agile anvil
#

That's how CustomNameVisible is meant to work

young knoll
#

^

agile anvil
#

Why don't you use pdc instead?

young knoll
#

You can hide it by giving the entity a passenger tho

#

But yeah don’t use the name to identify things

coral flower
#

hmm okay, do you have an example for a pdc for an entity?

agile anvil
#

?pdc

coral flower
#

hmm thx! so I add the meta data after creating the entity?

agile anvil
#

Yes exactly. Use the spawn method using a consumer. You can set the pdc in there

young knoll
#

I mean this is a custom NMS entity

#

So you can’t spawn it that way

agile anvil
#

Ah ㅜㅜ

young knoll
#

Just access the internal container directly

coral flower
#

is the container this.entityData?

sullen marlin
#

idk, use the API?

coral flower
#

the api has no function to edit the meta data

glad prawn
#

you sure?

wintry lynx
#

Is there no way to get a map from a configuation section?
There is Config.getMapList but no Config.getMap

echo basalt
#

A configuration section is just a glorified map wrapper

#

What you can do is get a section and call getValues

wintry lynx
echo basalt
#

Is that valid yml

wintry lynx
#

Yea

echo basalt
#

Looks like a stringlist to me

#

Or a map list with single size maps

wintry lynx
#

Remove the second "-"

echo basalt
#

You know you can just get rid of the -'s and parse it as a section right

wintry lynx
#

Thats actually a good idea

#

Ill try to get it to work

coral flower
lost matrix
slender elbow
#

that's exactly how customnamevisible set to false works lol

lost matrix
#

Im just wondering what all those "use a pdc" and "cant change the metadata" talking was about...

hidden cradle
#

I dont get how i cannot turn off pvp in towny, i have tried to turn off pvp on all plugins even the server, and when i do /t toggle pvp and it says NO pvp its still pvp and we can attack eachother

lost matrix
#

Hmm. Doesnt sound like a problem for the development channel. smileybolb

hidden cradle
#

Which channel should i go to? 😄

#

server?

lost matrix
eternal oxide
#

tried /tw toggle ?

wet breach
#

oh look at that, the local towny expert is here

#

I am sure ElgarL can help with the towny XD

eternal oxide
#

No clue 😛

lost matrix
#

I doubt that. He has probably never heard of that plugin.

wet breach
hidden cradle
#

i mean, i want it to be pvp outside your town in towny

eternal oxide
#

yes 🙂

hidden cradle
#

But tw toggle is disabling it globally

eternal oxide
#

there are a few different PVP settings

#

admin, world, town and plot

hidden cradle
#

Okey

#

now its toggled global pvp off

#

can people still attack outside their town?

eternal oxide
#

no

hidden cradle
#

that is what i want but they should not be able to pvp in their town

#

I want it to be a safe place

eternal oxide
#

then have it enable for world, but disabled for town

granite owl
#

is it possible to use conditions for tab completion in the plugin.yml?

hidden cradle
#

How do i enable it for world?

#

i think it is but is there an ingame command?

lost matrix
eternal oxide
#

you /tw toggle pvp

#

then /t toggle pvp

#

one is world, other is town

#

you can set teh default for new towns in the config

granite owl
#

based on say permission nodes

#

or options

lost matrix
hidden cradle
#

In what category? @eternal oxide

granite owl
#

in which case i dont have to use the plugin.yml at all?

lost matrix
#

No you can just create a class, let it implement TabCompleter and then register it on your command as usual.

granite owl
#

huh

eternal oxide
granite owl
#

so i declare the command in the plugin.yml and implement everything else but the command name programatically?

#

aliases etc

#

incl tab complete

granite owl
shadow night
#

hmm

#

I wonder if TabCompleter and CommandExecutor have the FunctionalInterface annotation

hidden cradle
#

I do find alot of pvp stuff but im not sure which one it is xd @eternal oxide

lost matrix
#

But yes, you could

shadow night
lost matrix
wet breach
shadow night
#

I agree

remote swallow
#

I prefer putting all my commands into 1 on command method using an amalgamation of if statements to know what command it is

candid galleon
#

I prefer using a random number generator and hoping it works

#

sometimes i just return and hope the solar flares will flip enough bits to make it work

native ruin
grave laurel
#

Hey, I am making a plugin that has a afk system, like if you don't move in 2 minutes you will get a message like "You are AFK!" or so. Also the online_time and the afk_time should be saved in a mySql db. How would I do this?

lost matrix
grave laurel
#

alright, I'll try that!

granite owl
granite owl
#

isnt the ```java
PlayerMoveEvent

#

i feel like whenever i use it even for small operations its causing massive load

tall dragon
#

not on itself

#

its just called a lot of times

#

a lot...

granite owl
#

yea

tall dragon
#

so u need to be carefull what u do inside it

granite owl
#

even that is overhead in itself

#

and i get lag even when i just prevent players from moving

#

by cancelling it

tall dragon
#

like if u rlly need to use for for player movement u should check if the player actually moved

#

cuz its also spammed by mouse movement

granite owl
#

unless u want to prevent rotation

tall dragon
#

thats going to be glitchy asf anyway

#

why bother

ivory sleet
#

well it used to be quite the event back when reflection invocations were considered costly

grave laurel
upper hazel
#

how change my nick in spigotMc

river oracle
#

U don't

#

Or

#

?changename

undone axleBOT
#

Name changes on the forums are granted to those who have donated to the project. Donations are processed manually and generally take up to 24 hours. The donation widget can be found on the home page of SpigotMC at: https://www.spigotmc.org/.

upper hazel
#

what the stuped rule..

river oracle
#

Kek

young knoll
#

Mans gotta make money somehow

ivory sleet
#

yup

earnest forum
#

Hi, I am trying to create a plugin where every time a player joins a "PlayerCount" plugin message is sent through BungeeCord for each server, and is listened to, where the player count is updated in a hashmap. This is my code:

ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("PlayerCount");
out.writeUTF(server);
p.sendPluginMessage(MythofyHubMisc.INSTANCE, "BungeeCord", out.toByteArray());
@Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        if (!channel.equals("BungeeCord")) {
            return;
        }
        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String subchannel = in.readUTF();
        if (subchannel.equals("PlayerCount")) {
            String server = in.readUTF();
            int count = in.readInt();
            serverPlayerCount.put(server, count);
            Bukkit.broadcastMessage(server + count);
        }
    }

I am registering the plugin channels like this in onEnable.

this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
        this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);

Unfortunately, the message that is supposed to be broadcast in the plugin message recieved function is not being broadcast. Any help would be appreciated

stoic cosmos
#

I have made a scoreboard system but it only shows it to one person its not global (well the prefixes for tab arent)

junior cradle
#

Why is RGB color not supported in my scoreboard?
https://imgur.com/a/wpbZW3U

 protected void setLines(String @NotNull ... scoreLines) {
        for (int i = 0; i < scoreLines.length; i++) {
            final String serialize = LegacyComponentSerializer.builder().hexColors()
                    .useUnusualXRepeatedCharacterHexFormat().build().serialize(Utils.parseColor(scoreLines[i]));

            this.objective.getScore(serialize).setScore(i);
        }
    }
#

I can't attach a screenshot here why

rapid vigil
#

?image

#

theres a command i forgot it

#

just use a website like imgur

junior cradle
#

I passed the verification, it said that it was passed, but I have no role and no opportunities

rapid vigil
#

ah the command is

#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

rapid vigil
#

lol

junior cradle
junior cradle
rapid vigil
junior cradle
upper hazel
#

Is it possible to create a plugin loading system? There is an API that stores all the manager classes and I need 1 plugin to create them and everyone who uses it will get it after creating that class (no IDs or anything like that).

#

api -> creator -> users

wet breach
#

however you will need to expose api you want the plugins under yours to see

upper hazel
#

api users not shold know obaut creator

#

api shold sort creator and user plugins

earnest forum
#

Does ItemSpawnEvent fire when other plugins spawn an item?

upper hazel
#

that is, do i need to create your own Loader system?

#

and api shold sort it right?

#

I'll try again

There is

  1. plugin api
  2. plugin that depends on the api and works with it
  3. a plugin that depends on the API but only performs some functions

we need to make sure that 3 does not depend on 2
That's why I wanted to create a plugin loading system

stoic cosmos
upper hazel
peak jetty
chrome beacon
#

Not a JSON Object: null

junior cradle
peak jetty
chrome beacon
junior cradle
#

?

upper hazel
#

ok, here's a clearer question: PlaceholderAPi has its own plugin loader, right?

#

i mean how plugins can use placeholders from another plugin without sort load system

chrome beacon
#

Other plugins hook in to PlaceholderAPI

#

PlaceholderAPI is loaded first

#

but yes they do have an extension system too

upper hazel
#

Is it possible to save inside the api those objects that are not in the api but are available to those who use it?

wooden hearth
#

Hey, If I'm trying to register tab complete can I still do it using refelection so I don't need to put into the plugin.yml can just use commandmap instead?

orchid hinge
#
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args)
    return false;
}```
#

what is the s variable?

#

i have never seen anyone use it

glad prawn
#

label

shadow night
#

it's the alias that has been used to call the command iirc

wooden hearth
#

that would the label if your command is called test you can do if(s.equalsIgnorecase("test") { test }

glad prawn
#

I still don't see anyone using it, people often use Command.getName().equalsIgnoreCase(String)

distant wave
#

if i add permission: java.jshell.access to my command, do i still need to check if player has that permission or is it done automatically

distant wave
#

opkay

wooden hearth
#

How can I register tab complete command with command map

worthy star
wet breach
#

essentially when a reload happens, you need to clear everything in memory and reload

worthy star
#

it happens when i restart too

wet breach
#

ok, then you are not doing something in onDisable()

worthy star
#

but for reloading i just reload the config from main class instance

worthy star
wet breach
#

well you should be saving what you have in memory

#

and then in onEnable() loading everything

#

reloading is unique because not everything in the server nulls out

#

so you have to pretend some things did and just clear what you are holding and re-load it up as if onEnable() was invoked

worthy star
#

what should i have to save it

wet breach
#

just invoke the save for your yml file and then null out your class object for the handling

#

then re-initialized it

worthy star
#

uhh

#

so

  1. i call the save method
  2. i null the class handling object
  3. i re-initialize it
wet breach
#

yeah, so you are holding LinkingManager somewhere right?

worthy star
#

how should i null it if its not in that class

worthy star
wet breach
#

yeah, get rid of the instance

#

so if its a list

#

remove it from the list

#

then you just call new LinkingManager() and put that new instance in there instead

worthy star
#
private static LinkingManager linkingManager;

... onEnable() { 
  linkingManager = new LinkingManager();

}

public static LinkingManager getLinkingManager() { 
  return linkingManager;
}```?
#

and in the disable i do linkingManager = null?

wet breach
#

don't use static

#

well in onDisable() shouldn't need to do that since if that method is called your plugin is being disabled lol

worthy star
#

should i remove that and call the getLinkingManager() using main class instance?

wet breach
#

yeah you should be using DI for it

worthy star
#

ight so what about the re-initizlizing? :)

wet breach
#

check that your list for the object or however you are storing it is cleared out, if it is, use new LinkingManager()

#

and add that into the list

#

and you should be good to go

#

also, its never wise to use server reload, but it doesn't hurt to make your plugin compatible for it in case people use it

#

a bit of a nuisance when plugins don't and then need to restart because the plugin decided to go all crazy

worthy star
#

uhm well sorry for being dumb im brain dead today and didn't really get the intizling part, sorry

wet breach
#

well it will be no different then when your plugin starts

#

I guess you using static is the reason you were having issues

#

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

wet breach
#

should probably learn a bit in how to hold instances of objects

#

your main class will never go away, so its a good base class to use to hold object instances that you don't want going away

#

such as your LinkingManager

#

either use a hashmap or a list to hold the instance

worthy star
#

alright, but for the linkingManager = new LinkingManager() it required to make LinkingManager constructer public, would that cause any problems?

lilac dagger
#

yeah, make the constructor public

lean pumice
#

for (Team team : Team.getTeams()) {
team.setPoints(0);
for (int i = 0; i < team.getKills() + 1; i++)
for (int j = 0; j < Main.getInstance().getConfiguration().getInt("team.points.kill") + 1; j++)
team.setPoints(team.getPoints() + 1);
for (int i = 0; i < team.getDeaths() + 1; i++)
for (int j = 0; j < Main.getInstance().getConfiguration().getInt("team.points.death") + 1; j++)
team.setPoints(team.getPoints() - 1);
if(team.getPoints() < 0)
team.setPoints(0);
}

How i can get the kills by point and death. and death by point and kills?

#

i dont know i to do it

lilac phoenix
#

How to configure simplevoicechat, no matter how I configure it, it doesn’t work

limpid drum
lean pumice
light saffron
#

so i have my plugin 1.20.1 "Spigot" im using a 1.20.1 paper server and im getting this error

org.bukkit.plugin.InvalidPluginExeption: Unsupported Api Version 1.20.1

river oracle
#

don't use minor versions for API in the plugin.yml

#

just put 1.20

limpid drum
supple topaz
#

is there any way to prevent Minecraft (or spigot not sure what is causing it) from grouping up arrows when they are further away from the player? it doesn't happen when another player is close to the turret.

example: https://youtu.be/RbY8vXTwyuo

how it should look like: https://youtu.be/-hqL6pR1xE8

river oracle
river oracle
#

I highly doubt it has anything that you can do to prevent it

lean pumice
supple topaz
lean pumice
#

it seems to me

supple topaz
lean pumice
river oracle
#

no lol

lean pumice
river oracle
#

idk what you did in that video

supple topaz
supple topaz
#

what would change with that

lean pumice
supple topaz
river oracle
lean pumice
river oracle
#

asynchronous doesn't fix anything here

#

the grouping likely occurs because of a server optimization as I said earlier

#

so this is unavoidable

lean pumice
#

try it but not async and then see how optimize

river oracle
#

asynchronous != optimization 100% of the time

#

asynchronous processing here is useless

light saffron
#

org.bukkit.plugin.InvalidPluginExeption: Cannot find main class 'My.Plugin'

Can anyone help with this?

supple topaz
river oracle
lean pumice
#

@supple topaz how you have do the second video

supple topaz
#

put a player close to the turret

light saffron
#

org.bukkit.plugin.InvalidPluginExeption: Cannot find main class 'main.java.Speed.SpeedKillPlugin'

river oracle
lean pumice
lean pumice
supple topaz
#

it happens 2-3 chunks away

#

my simulation distance is at 10

river oracle
lean pumice
supple topaz
river oracle
#

so like you need to learn what packages are

light saffron
#

tf do i do

river oracle
#

and do the package path to your main class

lean pumice
light saffron
supple topaz
lean pumice
supple topaz
#

just set my simulation distance to 20 and it still doesnt work

lean pumice
#

?

river oracle
#

you're pointing out a bunch of non issues VedCodee.

  1. There is really only so much you can do without code
  2. If it is a server optimization there is nothing you can do
  3. I can't really see the "working" video so I myself am missing context
supple topaz
#

ill dm u

river oracle
#

I don't accept Dms

supple topaz
#

ill try to reupload

lean pumice
#

I don't need the code

river oracle
#

maybe its my college wifi _

#

it just won't load

light saffron
#

so my mainclass is in main\java\Speed\SpeedKillPlugin wouldn't it be main.java.speed.speedkillplugin

river oracle
#

that's where your source lives

#

has nothing to do with user packages

light saffron
#

ohhh

supple topaz
light saffron
#

Speed.SpeedKillPlugin it would be this?

river oracle
#

sure but you're breaking naming conventions with your package name

light saffron
#

what do i rename it

river oracle
#

?conventions

river oracle
#

if you don't have a domain something common is me.yourusernameinlowercasenonumbers

#

in your case me.hqgamingxd.myplugin or me.hqgamingxd

#

if you have a domain like i do you can do com.hqgamingxd only do this if you have a registered domain though me.myusername or com.github.myusername is the default otherwise

ember estuary
#

How can I make specific players break specific blocks faster?

tall dragon
#

give them haste

ember estuary
#

That makes them break ALL blocks faster :(

tall dragon
#

true, true

young knoll
#

Re-implement the mining system server side

ember estuary
#

ugh

young knoll
#

(A lot easier once 1.20.5 comes out)

tall dragon
#

is something like that even possible

#

u would probbably have to do packet intercepting i guess?

ember estuary
#

Can you maybe give the tool a player is holding a better mining speed? (as long as its in his hand/inv)

tall dragon
#

yea cant u just change the mine speed anyway in 1.20.5 @young knoll ?

ancient plank
#

all my homies are hype for 1.20.5

tall dragon
#

pretty sure u can there

ancient plank
#

yaes

young knoll
#

Yeah it's an attribute

tall dragon
#

shits going to be soooo nice

#

so many new opportunities

ember estuary
#

but then i still can only change it in general and not for specific blocks :(

#

so its just haste 2.0

young knoll
#

Sure but there are events for when the player stars mining a block

#

And stops

ember estuary
#

oh theres one for start? alr, yea then maybe that could be used

#

ah, then ill give him haste after that is triggered, that solves my question

#

can i give haste without it showing up?

tall dragon
#

i have this somehwere as well and thats how i do it as well Flo

#

i give haste when they begin breaking a block that has the speedup

young knoll
#

You can hide it from the top left

#

It'll still show in the inventory tho

ember estuary
#

ah ok

tall dragon
#

?paste

undone axleBOT
tall dragon
#

:d

ember estuary
#

then maybe giving the tool a higher mining speed would be better, as thats not instantly visible

#

just need to make sure he doesnt drop it .-. xD

young knoll
#

That's not a thing

#

(yet)

tall dragon
#

™️

ember estuary
#

oh nah maybe that was just for which blocks you can break with a tool.. oh

#

ok yeah, then haste it is

#

ah and armor/tools can give you invisible effects, thats a thing too

young knoll
#

?

light saffron
#

this is my plugin.yml

#

nvm

supple topaz
light saffron
#

fixed :D

wooden hearth
#

options people should I make /warp set <name> with all commands starting with /warp or make seperate commands like /warp <name> /setwarp <name>?

icy beacon
#

Better to have one command with subcommands

#

Easier to use

#

You can add tab completion to your /warp command so that the users always know everything they can do

#

If you split it into multiple commands, you won't be able to do so

wooden hearth
#

I am doing lol

#

I've made it so you can see all warps lol

icy beacon
#

What

wooden hearth
#

Il make it 1 command with sub commands then

icy beacon
#

Yes

wooden hearth
#

Alright thank you, just wanted some opionions lol

fallow violet
#

how can i generate a strucutre? I cant find any information about that
like Structure.place(x, y) or something.

young knoll
#

What structure

light saffron
#

org.bukkit.plugin.InvalidPluginException: org.bukkit.plugin.lllegalPluginAccessException: Plugin attempted to register Speed.ReviveGUI@578f208b while not enabled

fallow violet
fallow violet
#

and try to do something

light saffron
#

but

#

lik

#

how

#

i've tryed

young knoll
#

But I don't think there is api to spawn the other ones

patent quarry
#

Hello everyone !
Is there any way to get this list of tags associated to a block ?
(Obtained with f3+h)

young knoll
#

You can check if a specific material has a certain tag

#

Idk if you can get all tags from a material

patent quarry
young knoll
#

Tag.X.isTagged

patent quarry
young knoll
#

?

storm crystal
#

I want to make a system that would spawn weapons with random statistic spread, would using PDC with key of statistic and value of its value (such us magic_damage:5) be a good idea?

young knoll
#

Sure

storm crystal
#

Or is entity/weapon having up to 10 PDCs too much?

young knoll
#

Nah

#

You can combine them all into one tag if you really want

patent quarry
rotund ravine
young knoll
#

You would need a ton of data for that

#

Just the data in a single shulkerbox is already gonna be way more than a few stats

storm crystal
#

Okay 3-5 is more realistic tbf

#

I want to make PDC for level restriction too

young knoll
#

Yeah that's still nothing

shadow night
#

unless you are storing like 3 maps of maps of itemstacks, should be fine lol

storm crystal
#

Not necessarily

shadow night
#

data is pretty efficient nowadays

young knoll
#

I mean it gets turned into bytes

#

So it's going to be very small

worthy yarrow
#

Intermediate project ideas anyone?

fallow dragon
worthy yarrow
#

You call minigames intermediate D:

young knoll
#

Depends on the game

worthy yarrow
#

I had tried with a sumo game before and ended up writing the whole thing backwards lol

#

Reverse engineering was not the goal for that project and I ended up just getting frustrated and scrapped it D:

fallow dragon
#

Try following a tutorial to get the groundwork up and running. It’ll be challenging but improve the way you think about programming a lot 🙂

#

If you want something more straightforward, you could try some sort of custom enchantment plugin

worthy yarrow
#

Hmm I'm pretty confident with ce's, minigames not so much and I'm not sure I want to delve into that again, perhaps something to enhance quality of life... I just don't know what genre of server I'd want to cater to

fallow dragon
#

Part of a minigame could even be a project in its own. Hypixel has that tnt run game, so you could try making command or an item you right click that makes entire world tnt run or something

worthy yarrow
#

Lol the whole world

fallow dragon
#

You could make a way to save pets in case they ever get killed or lost so they can be recovered

worthy yarrow
fallow dragon
#

So when someone tames a pet or make changes to it, you save it in a database

#

Then have a command or GUI to spawn it back in

worthy yarrow
#

Hmm

#

Is a db even required for that process?

fallow dragon
#

You just need some sort of offline storage

worthy yarrow
#

I'd assume ymal is fine? I have zip experience with sql

fallow dragon
#

Yep that would also work

worthy yarrow
#

The only data I really need to save is just "type of pet" / "owner of said pet" right?

fallow dragon
#

What if their pet has a custom name? You’ll need to figure out all the info that goes along with each pet, how to store that in persistent memory, retrieve it, and rebuild the mob from it. It’s probably all in the documentation though

#

But you could make a phase one that just does simple stuff like an owner and type to start

worthy yarrow
#

Custom name I'd rather assume is just vanilla nametag haha but yes that's something I'd have to include in the serialization

fallow dragon
#

And version two gets more customized

lament tree
#

I have no idea what the context is of entities you’re using, but make sure to logically include entities you can ride + log off with

#

If that’s needed

#

Sorry if that’s useless

worthy yarrow
#

Might be for phase 1 but def not further down the line

worthy yarrow
lament tree
#

Any chance I could have context on the project

worthy yarrow
#

It's hypothetical currently lol

lament tree
#

Save pets? As in spawn in a new entity?

worthy yarrow
#

Something like that, I guess you could say it's similar to a pokemon egg in the sense of "saving"

lament tree
#

That’s not hard at all

#

What is your storage method

worthy yarrow
#

I was just gonna do yaml

#

cuz I don't know jack about sql

fallow dragon
# lament tree That’s not hard at all

You’ll need to be careful of edge cases, do research on how entities can be saved, consider a user friendly UI—it’s got good components of an intermediate project

#

Work with persistent storage

worthy yarrow
#

Persistent storage is something I need practice with, not such as though a hard project, just practice ya know

lament tree
#

Not really important but version?

worthy yarrow
#

I always just run latest

lament tree
worthy yarrow
#

For the base, it's just going to include a method of "saving" eg: serialization, command/egg or wtv, and a way to get the saved mob from the serialized state

lament tree
#

If this is a closed project, yaml. If this is a released project for your server, you want to learn sql. Not just for this project, but overall in general learning sql knowledge is very important to understand how data is really saved on a live server

lament tree
#

Lots of players

fallow dragon
#

Number of players has no impact on complexity here

lament tree
#

Nah not at all, but it’s good practice to involve the mindset a database is better than clear text

#

You’re completely right though

worthy yarrow
# lament tree If this is a closed project, yaml. If this is a released project for your server...

sql is something I want to learn, just get so busy irl... my father is actually really good with sql so if anything he can show me the basics... odd that I had never thought to learn some from him but I suppose I have a hard time trying to learn things I dont want to lol. I know sql is something I probably shouldn't put off especially since it's highly used when it comes to almost any worthwhile project

fallow dragon
#

I think getting the project off ground comes first, and a phase two can always incorporate a database if it means getting phase one to the finish line 🙂

lament tree
#

Honestly it’s all about what you are looking for. at the end of the day we can only give you our experiences and what we have learned

#

Truly, learn what you can and go off of your experiences

#

That’s what coooooding is all about

worthy yarrow
#

I'm looking for practice lol, the functionality of the project isn't really what I'm trying to develop rather my own experience

lament tree
#

Great! This sounds like an interesting practice problem I love it

#

Hmm, if you’re having trouble with one aspect or module with a practice problem, back up and think how to properly digest the new information you’re attempting to run

#

Learn the car first before racing with it. Basically wtf I’m yapping about is, don’t just hop in a new car and go 100. Learn how it works before you go 100% and implement it everywhere

worthy yarrow
#
@Override
    public Map<String, Object> serialize() {
        Map<String, Object> serializedKit = new HashMap<>();
        serializedKit.put("name", kitName);
        serializedKit.put("cooldown", kitCooldown);
        serializedKit.put("cost", kitCost);
        serializedKit.put("permission", kitPermission);

        List<Map<String, Object>> contentsSerialized = kitContents.stream()
                .map(ItemStack::serialize)
                .collect(Collectors.toList());
        serializedKit.put("contents", contentsSerialized);

        List<Map<String, Object>> effectsSerialized = kitEffects.stream()
                .map(effect -> {
                    Map<String, Object> effectMap = new HashMap<>();
                    effectMap.put("type", effect.getType().getName());
                    effectMap.put("duration", effect.getDuration());
                    effectMap.put("amplifier", effect.getAmplifier());
                    return effectMap;
                })
                .collect(Collectors.toList());
        serializedKit.put("effects", effectsSerialized);

        return serializedKit;
    }```
This is a serialization method I had made for a kits project, so I mean I have enough knowledge to persist data I want, just need some tips and tricks I suppose
lament tree
#

That’s a big issue I created, and now my programming experience is mostly learning new methods and rewriting everything because I thought going fast was it

#

@fallow dragon ^^ look what he posted

worthy yarrow
#

That's just yaml serialization as well, so I mean it works it could just be better... possibly through sql or wtv else

lament tree
#

Honestly I see no issues with your serialization

worthy yarrow
#

That's good to hear

fallow dragon
#

Nice, seems like you have an idea of how you plan to store your pets. So now figure out how you can spawn a pet with that information 🙂

lament tree
#

Basically, deserialize time

silent slate
#

How do i check an OfflinePlayers permissions?

worthy yarrow
#

I know I've got that method somewhere in the kits project...

grave vigil
#

Anyone know how to disable entity collision for players? #setCollidable seems to work for animals but not players.

World world = nl.getLoad_location().getWorld();
        Slime s = (Slime) world.spawnEntity(nl.getLoad_location(), EntityType.SLIME);
        s.setInvulnerable(true);
        s.setCollidable(false);
        s.setAI(false);
        s.setGravity(false);
        s.setRemoveWhenFarAway(false);
        
        s.setSize(5);
young knoll
#

Use scoreboard teams

worthy yarrow
#

Also I'd like to give you both props @fallow dragon @lament tree, you two are probably the nicest I've ran into / seen on spigot for a while

#

That's not to say no one else is kind/helpful, it's just a nice change of pace to see once in a while... especially here in spigot

lament tree
#

Player.SetCollisionRule?

young knoll
worthy yarrow
silent slate
worthy yarrow
#

LuckPerms

silent slate
#

okay

young knoll
#

Vault is a general one

worthy yarrow
#

Pex

young knoll
#

LuckPerms if you are using luckperms

silent slate
#

im using vault and lp, whats the easier one?

worthy yarrow
#

I'd argue lp

grave vigil
#

lp is easy

worthy yarrow
#

It's not that vault is hard

#

lp is just easier

grave vigil
#

they have good dev support and a cookbook so you can p much just copy code

worthy yarrow
#

Don't copy code

#

boo copying code!

silent slate
#

bro half my projects done by bard xD

lament tree
#

Remember the days of pex

worthy yarrow
#

I remember the days of pex as an operator kek

lament tree
#

What tf happened to their reign

#

Lp came in like zoom vs Skype

worthy yarrow
#

The fact that pex sucks compared to almost any other permissions plugin

lament tree
#

Devs prob quit early

worthy yarrow
#

Tends to happen to me a lot

lament tree
#

Back when ppl applied for staff using book and quill 💀

#

💀💀💀

worthy yarrow
#

Yk I hate the fact I can't get a paper application at any job no more

lament tree
#

Well after 2019 everyone became less adamant about going online

worthy yarrow
#

So I think phase 1: Is going to include a "capture egg" (for now 100% success rate), method of serialization when the pet is egged, when the egg is rethrown de-serialize and spawn the pet again

#

Phase 2: Optimization / extra implementation

lament tree
#

Why not test out nbt data if it’s an egg in your item

worthy yarrow
#

Never touched nbt... don't laugh... how would I go about that?

young knoll
#

?pdc

worthy yarrow
#

Oh nbt is apart of pdc

#

Oh the tags

#

yes

#

So I actually never went through pdc lol, I still need a serialization method? Or pdc handles all persistence needed?

#

I need to stop smoking before I write D:

lament tree
#

@worthy yarrow ^^

worthy yarrow
#

Also when it comes to my capture egg and pdc,

ItemStack itemStack = ...;
NamespacedKey key = new NamespacedKey(pluginInstance, "our-custom-key");
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.getCustomTagContainer().setCustomTag(key, ItemTagType.DOUBLE, Math.PI);
itemStack.setItemMeta(itemMeta);

...

ItemStack itemStack = ...;
NamespacedKey key = new NamespacedKey(pluginInstance, "our-custom-key");
ItemMeta itemMeta = itemStack.getItemMeta();
CustomItemTagContainer tagContainer = itemMeta.getCustomTagContainer();

if(tagContainer.hasCustomTag(key , ItemTagType.DOUBLE)) {
    double foundValue = tagContainer.getCustomTag(key, ItemTagType.DOUBLE);
}

So everytime I need to access my egg, I need a new itemstack and just check for the key?

quaint mantle
#

Crazy

worthy yarrow
quaint mantle
#

this.itemMeta.setCustomModelData(customModelData);

worthy yarrow
#

Well the base egg has one usage: capture mobs, it doesn't require any additional data until a mob is captured

quaint mantle
#

Should do the job as well

lament tree
#

“Every time you want to access or modify this data, you'll need to retrieve the item stack, get its item meta, and then access the custom tag container” found this in the docs

quaint mantle
#

If you wanna store the mob type after you should use a custom tag container

worthy yarrow
quaint mantle
worthy yarrow
#

Alright

acoustic pendant
#

I'm trying to import nms but this error happened when compiling with buildtools:

remote swallow
#

If this not resolve your issue please pastebinthe entire BuildTools.log.txt file when seeking support

acoustic pendant
lament tree
#

Did you correctly login to spigot when downloading

remote swallow
#

you dont have to login for buildtools

acoustic pendant
#

oh wait, buildtools was using java 8

remote swallow
grave vigil
remote swallow
#

highest it supports is 11

acoustic pendant
#

oh

#

then i don't know why that error happened

proud badge
#

does tilestate PDC get deleted when the block is removed?

remote swallow
#

iirc yeah

remote swallow
acoustic pendant
#

doing that

acoustic pendant
tardy delta
#

arent you supposed to use git bash instead of cmd?

sullen marlin
#

Old versions don't like default gpg signing enabled

#

Edit your git config or upgrade to a supported version

#

Or just fix your gpg config

acoustic pendant
#

uuh

#

i'll try that

hollow vessel
#

hello! I have question - what is the best option to check if some player has item in his inventory - if yes then add him potions effect, when he drop it or left it in the chest all effects clear, I mean something like talisman. The only question that I have is to do a task, but what would be the best option, please give me some advice guys 😄

lost matrix
#

Depends. Does it have to be in a specific slot?

glad prawn
#

"drop it or left it" i think it's in a specific slot

wet breach
hollow vessel
lost matrix
hollow vessel
#

okay, thanks!

lost matrix
#

Btw i would schedule this in buckets.
So dont check every player in the same tick, but create N buckets, evenly distribute the players into buckets, and then tick one bucket every tick.

hollow vessel
#

what is buckets?

lost matrix
#

If its 20 ticks then 20 buckets make sense.

wet breach
#

for a small server probably fine though

#

maybe we should see if they spot it at some point

#

not like its difficult to correct anyways

hollow vessel
#

and the second question, what would be better? create one task that loop every players in hashmap, and remove them when they drop this item or just create new task dedicated only for one player?

lost matrix
#

One task which ticks all players

#

I never randomly start repeating tasks on runtime.
Always start them when the server starts.

hollow vessel
#

okay, thanks

wet breach
#

makes no sense to have a task running that is for players when players don't exist XD

lost matrix
#

But trying to optimize performance for the case no player is on the server makes sense? 🤨

young knoll
#

When no-one is online the CPU deserves a nap

#

Don't make it work harder :c

remote swallow
#

be like minehut, turn your server off 5 minutes after theres no players online

young knoll
#

Why wait that long

#

3 seconds

lost matrix
#

I would just turn off the server instantly if only 1 player is on the server.
You need at least players queued up to even start it.

young knoll
#

Man my brain is smooth

#

If a player transfers from server A to server B, how do I ensure the database write from A runs before B tries to read it

remote swallow
#

say no

#

and block on disconnect

lilac dagger
#

you can try to create a lock so the server b waits until server a had finished writing on server a

lilac dagger
#

when player connects to server a it toggles a boolean, then when he leaves it turns it to false

#

then server b if he finds the toggle to be true he waits for the data to finish then starts loading

#

i'm sure there are better ways to do this

lost matrix
lilac dagger
#

assuming you do the transfer on playerjoinevent it should be fine

#

but i think people have figured better way to ensure continuity

#

like allowing server b to use old data, but then correct the data when server a finishes unloading

#

or have a service separated from the server that handles all the data, and the servers are just clients to reading/changing the data

lost matrix
#

The new protocol in allows for fully synced server transfers

lilac dagger
#

the minecraft protocol?

#

it would be so cool if you can embed information with the player as he transfers to a different server

echo basalt
#

you can

storm crystal
#

I havent really coded plugins for a long long time and came with an idea, but Im not sure if it would work the way Im intending to do it and want to ask just to be sure, so if I were to make a command that could spawn an item with X PDCs, I could just pass an argument as a dictionary?

echo basalt
#

it's called cookies

young knoll
#

Yeah but the client can alter them

#

So not good for my usage

storm crystal
lost matrix
storm crystal
#

couldnt you iterate over dictionary and add PDCs with said keys and values?

young knoll
#

Yes

#

You’d have to provide the type tho

#

Or a way to determine the type

storm crystal
#

it would always be an integer that Im interested in

#

Im wondering how I can make the command structure

#

Could something like that work?
/giveitem <item> <name> <key1:value1>,<key2:value2>...
I'm initially thinking of using two different delimiters so that I could extract information with some string related commands

storm crystal
#

okay thats good information

young knoll
#

Plus you can’t stop the client from disconnecting

lament tree
#

Object oriented

lost matrix
# young knoll But that’s sync

Transfer the data and notify the server when its done.
Only transfer the player afterwards.
This has the drawback that everything the player achieves in those few ticks during transfer simply gets discarded.

young knoll
#

That works if I am controlling the transfer

#

But it’s theoretically possible the player can dc and then rejoin before the save can be completed

lost matrix
#

Block him in the async event while his data is transferred

young knoll
#

True

#

Just gotta mark somewhere that the data is being transferred

#

How do the bigger networks handle this, they’ve got players changing servers all the time

echo basalt
#

Before they send the player to the target server they send the player's data so the target server can cache it

young knoll
#

What about handling really fast rejoins

remote swallow
#

limbo

zenith gate
#

https://paste.md-5.net/xeherivosu.rb

For creating a custom PersistentDataType does this all look correct? I have been debugging this for awhile. I am trying to create ItemHandlers where the events for a specific item are being stored in the items PDC, and when the player right/left clicks it looks into the items PDC to figure out what to do.

I've narrowed it down to this, these 2 events do get triggered they do work, but when it goes to handle the event from the PDC it just does nothing and I don't get any errors.

The events from the PDC of the item just send messages to the player.

PlayerLeft(Right)ClickEvent are custom events, and they do get invoked correctly as well.

private fun handleItemEvent(item: ItemStack, event: Event) {
  val handler = getItemHandler(item) ?: return

  if (event is PlayerLeftClickEvent) {
    handler.onPlayerLeftClick(event)
  } else if (event is PlayerRightClickEvent) {
    handler.onPlayerRightClick(event)
  }
}

@EventHandler
fun onPlayerLeftClick(event: PlayerLeftClickEvent) {
  val item = event.getPlayer().inventory.itemInMainHand
  if (item.type != Material.AIR) handleItemEvent(item, event)
}

@EventHandler
fun onPlayerRightClick(event: PlayerRightClickEvent) {
  val item = event.getPlayer().inventory.itemInMainHand
  if (item.type != Material.AIR) handleItemEvent(item, event)
}
hollow reef
#

what is the average chunk generation speed per chunk?

echo basalt
#

Depends on your cpu

#

And disk storage speed

#

and some other stuff

hollow reef
#

yes but on an average well hardware

flint coyote
#

There's too many parameters to give you a general average

young knoll
#

Depends on minecraft version, CPU speed, worker thread count, storage speed, etc

flint coyote
#

Also on OS, type of chunk (empty end chunks are faster than full overworld chunks obviously), load on the CPU from other applications (especially on VServers), load on the disk etc.

hollow reef
#

are 60-150ms rather slow or in the range of average?

hollow reef
echo basalt
#

Different core generations do different things

#

I can grab a 6 core cpu from 10 years ago and a 6 core today

#

IPC is different

hollow reef
#

ryzen 5 5500

foggy cave
#

is there a place i can find a specific spigot build

#

i am looking for a specific build

agile anvil
#

BuildTools is meant for that

#

What are you looking for?

foggy cave
#

build 1656

agile anvil
#

I think you can try to use the --pull-request flag.

Build CraftBukkit or Spigot using Pull Requests.
The format is the repository (bukkit, craftbukkit, spigot) followed by a : followed by the pull request id. (Ex: --pull-request spigot:111)
#

Why do you need an exact build?

foggy cave
#

it is the version that has the protocol hack inside

surreal path
#

Hey guys I am having an issue where I can type /help Citizens in MC and the log said: Below is a list of all Citizens commands - but there are no commands listed. I cannot use any command. Is this a known issue?

agile anvil
#

Do players still use 1.7 lmao?

foggy cave
#

yes

agile anvil
worthy yarrow
#

Hey there @agile anvil !

coarse finch
#

if i want to be a backwards-compatible plugin, do i need to specify an older api version, or should i use the latest api version?

agile anvil
agile anvil
worthy yarrow
#

How are you doing?

coarse finch
worthy yarrow
coarse finch
#

also rn im using org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT and intellij is telling me there are 3 cve's

agile anvil
worthy yarrow
#

It'd be incredibly niche to need previous api

worthy yarrow
#

97% of the api is pretty much the same back to 1.8

agile anvil
coarse finch
#

if i do that, am i gonna have to make sure that all of the methods im using exist in the older versions?

agile anvil
worthy yarrow
agile anvil
worthy yarrow
coarse finch
#

or will they exist in the plugin im creating?

foggy cave
agile anvil
coarse finch
#

ah alr thank you

agile anvil
worthy yarrow
agile anvil
#

Ahah it makes sense, but next time you will have to do that will seem way easier and you'll design it well Im sure

#

I love doing kits that's really pleasing to try many things and exploit the most feature you can!

#
  • the latest versions offer so much more possibilities
worthy yarrow
#

I want to have some fun with custom models and correlate that into pdc as well

#

I need to get some good practice in with pdc tbf, I never really touched it until I knew about it like in january haha

agile anvil
#

You won't struggle long, it's pretty straightforward

worthy yarrow
#

?pdc

worthy yarrow
#
ItemStack itemStack = ...;
NamespacedKey key = new NamespacedKey(pluginInstance, "our-custom-key");
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.getPersistentDataContainer().set(key, PersistentDataType.DOUBLE, Math.PI);
itemStack.setItemMeta(itemMeta);
In this example we stored the value of PI in the container instance, and by feeding the ItemMeta back into the ItemStack, we stored it even over a restart.

To now retrieve the stored value again we can use:

Code (Java):
ItemStack itemStack = ...;
NamespacedKey key = new NamespacedKey(pluginInstance, "our-custom-key");
ItemMeta itemMeta = itemStack.getItemMeta();
PersistentDataContainer container = itemMeta.getPersistentDataContainer();

if(container.has(key , PersistentDataType.DOUBLE)) {
    double foundValue = container.get(key, PersistentDataType.DOUBLE);
}
#

This was the goofy thing I saw on the thread, there must be better ways to get access to my custom wtv

#

Instead of needing a new itemStack every time

#

I was thinking of just some sort of static constant but I'm not sure

agile anvil
worthy yarrow
#

Am I just dumb?

echo basalt
#

maybe

worthy yarrow
#

In the second bit where theres an itemstack is that a new itemstack would it be the one from the previous example

#

ie: the only change is the fact we declare a new data container

echo basalt
#

I don't think you're getting the idea

flint coyote
#

Yes of course. A new ItemStack won't have your pdc value

worthy yarrow
#

I don't think I am

echo basalt
#

Let's start by rephrasing the guide

#

And define a couple starting points

#
  • ItemStacks, entities, tile entities, chunks etc can have persistent data containers
worthy yarrow
#

Yep got that bit

echo basalt
#

They're a container that's attached to that object's nbt tag

#

Great

worthy yarrow
#

My issue is the application of said methods

echo basalt
#

Now, you can get the persistent data container for any of those types

#

And with a persistent data container you can get and modify values

#

Which are identified by a namespaced key

#

Have a type

#

And then a value of the given type

worthy yarrow
#

ie: persistentDataType.X

echo basalt
#

Correct

worthy yarrow
#

Yup got that as well

echo basalt
#

The intent is to set a value on a given persistent data container

#

For let's say, an item

#

Which associates that data with that given item

#

If you want to check if an item contains that given data (is special / whatever) you get that item's persistent data container and get your special value

#

If it's present, great

#

If it's not, then it doesn't match and we can just skip it

#

As it isn't "special"

#

The idea isn't to have the same itemstack instance all around, but rather to see if the item you marked initially is the item you're looking at

worthy yarrow
#

So persistence of data on said itemstack is initialized on plugin startup the first time it's ever loaded up? Then given the plugin is continuously present throughout restarts, that itemstack will maintain its data considering we have applied pdc principals to it?

echo basalt
#

The persistence of data on said itemstack is applied.. when you apply it

worthy yarrow
#

It's held by the server then not my plugin

echo basalt
#

It will persist across restarts as that's the design of it

echo basalt
worthy yarrow
#

Gotcha

echo basalt
#

All your plugin does is add an ID to it saying "Field 123 is of type String and contains the value "gangsta" "

#

And the server just goes "Right.."

worthy yarrow
#

hmmm

echo basalt
#

And if you grab an itemstack and ask "What's the value of field 123?" and it happens to be marked it'll say "gangsta"

worthy yarrow
#
ItemStack captureEgg = new ItemStack(Material.EGG);
        NamespacedKey captureEggKey = new NamespacedKey(animalHouse, "capture_egg_key");
        ItemMeta captureEggMeta = captureEgg.getItemMeta();
        String captureEggName = animalHouse.getConfig().getString("c.nameofegg");
        captureEggMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', captureEggName));
        captureEggMeta.getPersistentDataContainer().set(captureEggKey, PersistentDataType.STRING, "CaptureEgg");
        captureEgg.setItemMeta(captureEggMeta);```
Ok so I have applied pdc to this egg... correctly I hope
echo basalt
#

Sure

worthy yarrow
#
Projectile captureEgg = event.getEntity();
        NamespacedKey captureEggKey = new NamespacedKey(animalHouse, "capture_egg_key");
        PersistentDataContainer container = captureEgg.getPersistentDataContainer();
        if (container.has(captureEggKey, PersistentDataType.STRING)){
            String foundString = container.get(captureEggKey, PersistentDataType.STRING);
        }

This was based on the example from the post, however I'm not sure how it's applied considering that I'm checking pdc from a projectile rather than an itemstack

echo basalt
#

Looks good

#

Well yeah that's the problem

#

You applied the key to the item not to the entity

#

You can try to see if the projectile is an egg and then getting the egg's item

worthy yarrow
#

let me have a look

flint coyote
worthy yarrow
#
@EventHandler(priority = EventPriority.HIGHEST)
    public void onEggHit(ProjectileHitEvent event){

        if (event.getHitEntity() == null){
            Bukkit.getLogger().log(Level.WARNING, "Hit Entity Is Null!");
            return;
        }

        Projectile captureEgg = event.getEntity();

        if (!(captureEgg.getType() == (EntityType.EGG))){
           return;
        }
        
        NamespacedKey captureEggKey = new NamespacedKey(animalHouse, "capture_egg_key");
        PersistentDataContainer container = captureEgg.getPersistentDataContainer();
        if (container.has(captureEggKey, PersistentDataType.STRING)){
            String foundString = container.get(captureEggKey, PersistentDataType.STRING);
        }
        if (event.getHitEntity().getType() == (EntityType.SPIDER)){
            event.setCancelled(true);
            event.getHitEntity().remove();
            Player player = (Player) event.getEntity().getShooter();
            player.sendMessage(ChatColor.RED + "You have just captured a spider!");
        }
    }

Does this work?

#

The first clause is just uh previous testing ik that will spam a lot lol

echo basalt
#

You need to get the egg