#help-development

1 messages · Page 1058 of 1

shadow night
#

Np

worthy yarrow
#

@agile anvil I did the item sorter today

#

Wasn't that bad at all

distant leaf
#

Hi can anyone help how to make authme not leak the cords when logging in

agile anvil
agile anvil
worthy yarrow
tepid turret
worthy yarrow
#

@agile anvil I think I found a bug with minecraft code lol

agile anvil
#

Huh?

worthy yarrow
#

Maybe I'm stoned I'm not sure, but this sorting function should relay the iron sword where the gold is in the creative gui

#

comparator = Comparator.comparing(ItemStack::getType);

#

I know it's sorting by the enum but I guess the enum constant is misplaced?

agile anvil
#

Nice! Mmmh I guess many things are dependant of some categories over other

worthy yarrow
#

Kind of an issue cuz perhaps there are a lot more cases like this

quaint mantle
worthy yarrow
#

So the workaround is just sorting by the name of the type I think?

#

I'm trying to mimic how it sorts in the creative gui is all

quaint mantle
worthy yarrow
#

yeahhh lol

#

I gues what I have right now is fine with the few exceptions

wooden zodiac
#

how to spawn fully charged TNT that it just spawns and blasts at the same moment

  @EventHandler
    public void onProjectileHit(ProjectileHitEvent event) {
        if (event.getEntity() instanceof Trident) {
            Trident trident = (Trident) event.getEntity();
            if (trident.getShooter() instanceof Player) {
                Location hitLocation = event.getEntity().getLocation();
                hitLocation.getWorld().strikeLightningEffect(hitLocation);

                hitLocation.getWorld().spawnEntity(hitLocation, EntityType.TNT);
            }
        }


    }
#

it spawns tnt but blasts after few seconds

#

i want it to explode right away

pseudo hazel
#

might aswell just spawn an explosion

wooden zodiac
pseudo hazel
#

probably like world.createexplosion or something

wooden zodiac
#

lol but it didnt cause any damage

worthy yarrow
#

do like 4F

wooden zodiac
#

ok

#

it worked

#

tysm for help

worthy yarrow
#

Sure!

quaint mantle
#

@tender forge

#

yo

#

i texted

#

the support

#

over 1d ago

#

and still0 rpely

#

?support

undone axleBOT
quaint mantle
#

this email

eternal oxide
#

stop pressing enter

worthy yarrow
#

kek

eternal oxide
#

form a full sentence

quaint mantle
eternal oxide
#

don;t care

pseudo hazel
#

is it allowed to put a link to your modrinth page on the spigot page?

eternal oxide
#

no

pseudo hazel
#

okay

#

sadge

eternal oxide
#

Would be like a McDonalds employee going into Wendys and putting up McD's adverts

pseudo hazel
#

i guess

#

but I am allowed to link discord right?

eternal oxide
#

yes

wraith delta
#
The type net.md_5.bungee.api.chat.BaseComponent cannot be resolved. It is indirectly referenced from required type org.bukkit.entity.Player.Spigot
```Do we really need bungeecord jar for ChatComponent? I cant seem to get it to import.
eternal oxide
#

no you don't

#

its in spigot

wraith delta
eternal oxide
#

net.md_5.bungee.api.chat.BaseComponent

wraith delta
eternal oxide
#

it sounds like your project is not setup correctly

mellow edge
#

It doesn't need any external jars

worthy yarrow
#

Oh @agile anvil sorry for the ping but before I forget do you have any suggestions for learning about game dev? Sources, links perhaps?

tender forge
wraith delta
eternal oxide
#

?bootstrap

undone axleBOT
#

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

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

agile anvil
#

Sticking to one source might be restrictive, just let your imagination work!

wraith delta
eternal oxide
#

read the bot text

wraith delta
pseudo hazel
#

can I force a resourcepack to players from my plugin?

agile anvil
#

The players can refuse

pseudo hazel
#

right

#

is there nothing I can do about that?

#

I guess I can kick them

#

I have seen a few servers just kicking people if you deny the resource pack

#

but my question was more of like the server owner having to approve or set up the resource pack in any way or if I can send it to players from my plugin directly

eternal oxide
#

you can't send it from teh plugin unless it has web access to be able to host

pseudo hazel
#

ah nice, and it seems like I can use PlayerResourcePackStatusEvent to respond to players not using it. Thanks 😄

pseudo hazel
#

if I put my pack on github I can just send a link to that right?

eternal oxide
#

you would have to be able to host it from yoru plugin, ie expose a simple web server

#

yes

pseudo hazel
#

right

#

makes sense

#

the pack needs to be downloaded by the client from http server

astral pilot
#

is there a way to make PersistentDataContainer return a reference instead

pseudo hazel
#

wdym

#

is it not?

drowsy helm
astral pilot
astral pilot
eternal oxide
#

what? PDC is not displayed in an inventory anywhere

drowsy helm
#

Yeah what inventory

#

Like a shulker?

pseudo hazel
#

this should be written in de docs but if its absent, the value returned should be the original object

#

but if you mean if an items pdc changes you update the inventory that might be a bit tricky but if you set the item meta back to the same itemstack, it should instantly update

#

since its still the same reference presumably

#

but this depends on your inventory framework

#

like a lot of inventory systems use some kind of item builders to create inventories and they need to explicitly replace the items when they want them updated

pine spear
#

Does somebody have idea how to create basic ball physics?

eternal oxide
#

math

#

guarantee there is a google result for a bouncing ball physics simulation

sage patio
#

I've 3 data class in 1 package but when i use my plugin as a library in other plugins only 2 data class is accessable, any idea why?

chrome beacon
#

Did you forget to publish to maven local

#

or mvn install

remote swallow
#

^^ or not a public class

sage patio
#

all of them are the same with different parameters, how?

hazy parrot
sage patio
hazy parrot
#

They asked u did you mvn install it or published it to maven local

#

After you added that third class

sage patio
#

i imported it using gradle

#

lemme show

remote swallow
#

did you run the task publishToMavenLocal

sage patio
#
dependencies {
    compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
    compileOnly(fileTree("../libs"))
}
remote swallow
#

did you update the jar and reload gradle then

sage patio
#

libs is a directory containing the jar file

#

i did for sure

#

lemme try again

chrome beacon
#

jar dependencies khajiit

remote swallow
#

if anything you shouldnt be depending on it like that yopu should be publishing to maven local and using the actual dependency

sage patio
#

yea but for now i'm just testing

remote swallow
#

thats what publishing to local is for

#

you publish to local to test or just have it yourself and then publish it to a repo later

sage patio
#

sadge

#

thanks

obtuse hedge
#

did they ever fix the player portal event not firing when the end if disabled

eternal oxide
#

there is no portal interaction if the end is disabled

obtuse hedge
#

true so ig just check if player is in portal block?

eternal oxide
#

as that is contact with, not an actual portal event

obtuse hedge
#

ah

acoustic pendant
#

Hey, I don't fully understand Async behaviour so I had a question (If someone could explain it I would be very grateful)

acoustic pendant
#
    @EventHandler
    public void onCropBroken(BlockBreakEvent e) {
        if (!(e.getBlock() instanceof Ageable))
            return;
        //The block broken is a crop
        BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskAsynchronously(plugin, () -> {
            //Manage tons of code updating continuously the PDC of an item
        });
        
        //Just do it not being Async
    }```
#

So I have this

#

Is it suposed to be the first way less "laggy"?

#

Like this event is going to be fired over 80 times per second

#

So is async just faster

grim hound
#

do you know what "async" means?

acoustic pendant
#

or avoids lag too

grim hound
eternal oxide
#

You can not update in world items async

acoustic pendant
#

Like it is working in other thread

grim hound
#

async means that it's happening to a different thread than the currently processing one

acoustic pendant
#

yea

#

so as elgar said it is recommended to not change the world

#

but items neither?

eternal oxide
#

Items you can but if its in world you can not

#

if you try to modify a block async Spigot will show an error

acoustic pendant
#

hmm

acoustic pendant
charred blaze
#

how do i return value from runasync

eternal oxide
#

sync means when your code is running the server is waiting for it to finish

charred blaze
#

to func

grim hound
#

spreading heavy tasks accross multiple tasks is good

eternal oxide
#

async means your code runs along side the server main thread and it does not wait

knotty ruin
charred blaze
#

show me an example

grim hound
#

and the main thread has the tick loop

grim hound
#

meaning if the tick loop is delayed

#

cuz of your calculations

#

it can cause the illusion of lag

#

or just what we call lag, basically

eternal oxide
#

to jump back sync you can callSyncMethod or use the scheduler to runTask

acoustic pendant
#

So that isn't lag right?

grim hound
grim hound
eternal oxide
#

correct, it starts yrou code and continues without waiting

grim hound
#

kind of

#

the server still needs to use resources

hazy parrot
grim hound
#

but it won't be happening on the thread that provides visual experience

ivory sleet
acoustic pendant
acoustic pendant
#

oh

eternal oxide
#

doesn;t use less, in fact can use more

acoustic pendant
#

then i had a wrong idea about async behaviour

grim hound
ivory sleet
#

it can be faster sure, but that is in certain scenarios

acoustic pendant
#

How can I know when I should use async or not?

grim hound
#

more resources to schedule the task than just executing the code directly

grim hound
#

or just tasks that can be done off the main thread

eternal oxide
#

its best use is to perform long calculations or file/database access without making the server wait

acoustic pendant
#

so the server doesn't stop

grim hound
ivory sleet
#

for example do other work while awaiting file io such as downloading

or parallelization tho its more taking full usage of hardware to cpu computation (or gpu w cuda)

grim hound
#

it's best to do it async

remote swallow
#

you cant modify the world async

grim hound
#

I think changing the data async is fine

acoustic pendant
#

so yea

#

it is better to not use async i believe

grim hound
#

as long as you don't modify something about the block or smth

grim hound
acoustic pendant
#

Thanks for the info!

grim hound
#

👍

acoustic pendant
#

I can use little async tasks tho?

#

As i will need to do some small callculations

#

I mean, creating like 2-3 tasks when an event is fired, does that consume more resources?

eternal oxide
#

depends btu generally yes

ivory sleet
#

I mean I’d start by not doing it async, and then checkout if doing it async would help, often times it doesn’t unless you’re dealing with significant computations that can be split up into smaller ones

acoustic pendant
#

I see

#

I thought plugins that were "performance optimized" were using just a lot of async lol

#

I was so wrong xd

tardy delta
#

java is backward compatible, so to be fair, does this message even make sense?

acoustic pendant
#

How did you guys learn to optimise your plugins to consume less resources?

#

Just testing different ways on doing things?

eternal oxide
#

You usually learn by users complaining of lag

tardy delta
#

visualvm, profiler

acoustic pendant
ivory sleet
grim hound
#

and drew conclusions from what exactly needs to happen and what I'm doing unnecessarily

tardy delta
#

cant you give buildtools some more threads or smth?

ivory sleet
#

can you?

tardy delta
#

idk its slow

acoustic pendant
tardy delta
# ivory sleet can you?

my pc is on high performance and my fans are heating up this room like it isnt 35°C already aaa

ivory sleet
#

yk the jdk w all the classes yada yada :)

tardy delta
#

standard library

ivory sleet
#

^

#

std lib for short

ivory sleet
tardy delta
#

btw how do you obtain craftbukkit dependencies again? that via buildtools too?

#

been too long since i did that stuff

#

i forgot, are those spigot or craftbukkit?

eternal oxide
#

CB

pseudo hazel
#

I noticed how some plugins (and mods) have changelogs using small icons like [+] for additions and [~] for changes, does anyone know if there is some kinda standard for those or is it just what you think looks best?

tardy delta
#

been two years since i did this stuff, gonna take me a bit to get into it again

#

building a jar for someone is always fun:
Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'

ruby ermine
#

does anyone know how i can start my server in shell:startup

tardy delta
#

uhh would this be a mappings issue 🤔

#

it finds the nms package itself

eternal oxide
#

remapped

tardy delta
#

ah silly me forgot --remapped

acoustic pendant
#

ok thanks !

tardy delta
#

is running bt with --rev 1.20.1 --remapped supposed to give me the cb jar too?

eternal oxide
#

no

#

but the classes you need are in teh dependency

#

depend on spigot not -api

#

unless you have a crazy build and it depends on CB

tardy delta
#

doing exactly that lol

sand spire
#

Does anyone know how minecraft calculates on what position it should send a sound packet when elytra boosting with a rocket, or where I need to look to figure this out myself? With most projectiles it's exactly the players location but when flying with rockets it's offset with seemingly no consistency

tardy delta
#

this dude got so many submodules im wondering which one to build lol

#

now back to the silly Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' error 🤔

#

ah wonderful, maven-compiler-plugin issue

#

another question: is v1_15_R1 1.15 or 1.15.1?

#

i assume 1.15

#

now i start to get why people dont like star imports

pseudo hazel
#

afaik not all updates bump the nms revision

tardy delta
#

i just need to get these things

ruby ermine
#

does someone have musthave plugins? and can someone send me plotsquared i dont want to buy it

tardy delta
#

for some reason nothing works with cb 1.15 or 1.15.1 but with 1.20.1 everything works fine :/

#

wait a package called v1_15_R1 uses 1.15.2-R0.1 🤔

#

gotta be kidding me

remote swallow
#

1.15, 1.15.1 and 1.15.2 must all be same protocol thn

slender elbow
#

no

tardy delta
#

one more error now : package net.minecraft.world.entity does not exist 🤔

#

looking for EntityLiving

peak depot
#

is there an easy way without packets to get the players ping in 1.20.4?

tardy delta
#

heh what did this dude do

worldly ingot
#

To my recollection, things may not have been relocated in their appropriate packages in 1.15

#

So it's all under net.minecraft.server

tardy delta
#

ah dang i remove that one import and it uses the star import

worldly ingot
#

Yes

tardy delta
#

took me an hour and a half instead of my estimated 5 minutes uwu

hard socket
#

are NMS classes from 1.17+ are the same?

tardy delta
tepid turret
#

Like their mappings are the same? (I don't know if they are but be more specific for anyone who can answer ur question)

tepid turret
tardy delta
#

i function better at midnight

shadow night
#

DID SOMEBODY SAY MAPPINGS

tardy delta
#

I always say, never put off until tomorrow what you can do tonight

tepid turret
tepid turret
tardy delta
#

remember: we are not making a spaghetti, we are making a lasagna

tepid turret
#

Realest shit ever

#

bro once i tried to make mac and cheese at 2am and accidentally made lasagna

tardy delta
#

holy shit

tepid turret
#

cuz its the same packet js dif instructions (and obviously for lasagna extra ingredients u supply)

tepid turret
#

let me find it

tardy delta
#

not my code

shadow night
tepid turret
tardy delta
#

building a jar for someone

tepid turret
#
    public String giveItemUpgrade(Entity boat, ConfigurationSection section) {
        if (section.getString("upgrade.item") == null) return null;
        String secAmount = section.getString("upgrade.amount");
        int amount = secAmount == null || Integer.parseInt(secAmount) == 0 ? 1 : Integer.parseInt(secAmount);
        if (boat.getPassengers().isEmpty()) return null;
        if (!(boat.getPassengers().get(0) instanceof Player)) return null;
        Player player = (Player) boat.getPassengers().get(0);
        if (advancedMaterialHandler(section.getString("upgrade.item"), amount) == null) return null;
        ItemStack item = advancedMaterialHandler(section.getString("upgrade.item"), amount);
        ItemMeta itemMeta = item.getItemMeta();
        itemMeta.getPersistentDataContainer().set(keys.getTemporaryItem(), PersistentDataType.BOOLEAN, true);
        if (player.getInventory().firstEmpty() == -1) return messages.getString("player_inventory_full");
        player.getInventory().setItem(player.getInventory().firstEmpty(), item);
        return messages.getString("player_added_item");
    }
#

hahahahha

#

beautiful

#

very readable

#

don't worry i recoded the entire plugin cuz of that lols

#

idk what kinda mindset i was in

tardy delta
tepid turret
#

wait WHY IS IT ALL IN ONE CLASS

eternal oxide
#

thats one heck of a Spawn Listener

pseudo hazel
#

might aswell be the plugin class xD

tepid turret
pseudo hazel
#

half of that file is in 1 method

tepid turret
#

looks like after an amount of time (days) it makes the mobs spawn with effects or stuff like that

#

enchanted items

#

etc

pseudo hazel
#

yeah

eternal oxide
#

its is. It limits spawns to 8 of each type per chunk. 220 per world and modifies a few mob characteristics by the looks

pseudo hazel
#

without reading all of it I can see there are several ways to reduce the amount of code xD

tepid turret
tardy delta
pseudo hazel
#

most of it is gut feelings, if the code looks very similar it can usually be extracted and reused

eternal oxide
#

First would be to create Sets for teh types so you can do a simple .contains check

pseudo hazel
#

each if seems to have a lot of similar steps like creating armor

eternal oxide
#

you would also return in teh very first section if you are cancelling

atomic niche
pseudo hazel
#

which can probably be simplified and extracted for easier reuse

#

whose code is this anyways

tardy delta
#

lookup the plugin

eternal oxide
#

it seesm to add extra mob spawns past day 20 when phnatoms spawn

tardy delta
#

tbf i dont even know if its that one

pseudo hazel
#

there are a few guard clauses but more can be added

tardy delta
#

just picked the first one

eternal oxide
#

I kinda like the scaling difficulty, but it should be based on teh players play time not days

tardy delta
#

plot twist: its in spanish

pseudo hazel
#

which is already a vanilla metric used to spawn harder mobs

eternal oxide
#

yep

#

scaling just based upon days is terrible for a new player

#

Player joins -> get stomped on by an army of giants wearign diamond armor

#

I'd probably scale based upon distance from spawn

chrome beacon
#

The scaling difficulty mod handles it based on time but per player

#

not sure how exactly it handles different players close to eachother

#

could take a look at that

eternal oxide
#

I'd do it based on distance as then you know its going to get harder the further you travel

pseudo hazel
#

it depends on your goal

#

if you want the difficulty to be fully determined by player actions, then yeah thats a good way to do it

#

another way is to use a players experience or something

#

or keep track of total level they would be, you just have to be careful to not make it more difficult even if the player is already losing bad

quaint mantle
obtuse hedge
#

is there a way to change the default attributes of items

opaque geyser
#

Hey !
I'm new with Bukkit API, and i'm currently stuck on a problem.

I'm using a /give command to get an item with a special value in his custom_data (in NBT).

It looks something like this when I use /data get

{... , "minecraft:custom_data": {"foo":1b}, ...}

However, I spent some time trying to figure out how to get the value of the custom_data and I still can't find how i'm supposed to do.

I've tried to use the PersistentDataContainer but I also couldn't figure how it was supposed to be used/work

Thank you :)

remote swallow
#

?pdc

opaque geyser
#

Thank you !

remote swallow
#

holy shit its ntdi

mellow edge
#

I asume spectator menu that opens when you press num keys in spectator is client sided. I want to disable it, but it is client-sides. Is it possible to set his held item slot every n time in order for the player to not see it. It is not server-sided right?

subtle folio
#

gonna build a new server, what is the fatest type of db to use? no preference if its nosql, sql, might want to use ORMS for better coding standards. just asking for opinions 🙂

subtle folio
remote swallow
#

are you the non roblox roblox streamer

subtle folio
#

shhhhh

drowsy helm
#

If you want super fast use cassandra or look into mem caching

subtle folio
#

cassandra 😮

hard socket
#
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>2.0.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-obf</id>
                        <configuration>
                            <srgIn>org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
                            <reverse>true</reverse>
                            <remappedDependencies>org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
                            <remappedArtifactAttached>true</remappedArtifactAttached>
                            <remappedClassifierName>remapped-obf</remappedClassifierName>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-spigot</id>
                        <configuration>
                            <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                            <srgIn>org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
                            <remappedDependencies>org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>````


``Could not find artifact org.spigotmc:minecraft-server:txt:maps-mojang:1.17-R0.1-SNAPSHOT``
#

I just builed it with BuildTools

remote swallow
#

did you run it with --remapped

hard socket
#

yes it the .exe file

remote swallow
#

it might have been 1.17.1 that added mojmaps to spigot

hard socket
#

ohh I am dumb

#

thanks

young knoll
#

it was

peak depot
#

?gui

peak depot
#

for me

warm mica
sage patio
#

Hey, I've made a plugin for both velocity and spigot which it receives a Request from web containing a Json like this:

{
  "listener" : "listener-id"
}

when the velocity plugin receives this data, sends the listener-id to a Redis Pub Sub channel and Redis notifies all of my custom listeners with the same id received

this is how i made the listener:

fun listener(id: String, onReceive: RequestData.() -> ResponseProperties) {
    object : DataEvent {
        override val listenerId: String = id

        override fun onReceive(data: RequestData): ResponseData {
            return ResponseData(data.uuid, onReceive(data))
        }
    }.register()
}

data class RequestData(val listener: String) {
    val uuid: String = UUID.randomUUID().toString()
}
data class ResponseData(val uuid: String, val properties: ResponseProperties)
data class ResponseProperties(val properties: Map<String, Any>)

and this is how i create a listener:

listener("salamdokhtari") { ResponseProperties(mapOf("key" to "value")}

when i register a listener on the same plugin which contains this codes it works and the listener returns the data and sends it to the webserver in a response, but when i register that listener in another plugin depending on this plugin, the listener doesn't work

this is a overall information about the issue, i don't know what else i should share, lemme know if any extra information needed

#

ping me on respond

eternal oxide
#

you are probably shading the first plugin in the second so its not listening to the right event

#

?paste your pom

undone axleBOT
eternal oxide
#

@sage patio ^

sage patio
#

main plugin gradle ^

#

the second plugin including just 1 listener gradle^

eternal oxide
#

can't help you with gradle

sage patio
#

compileOnly doesn't shade the jar

#

implementation does

eternal oxide
#

then you need someone good at redis

remote swallow
#

show the redis code

sage patio
#

this is 2 class

#

RedisConnection and RedisDataReceiver

remote swallow
#

looks fine to me

sage patio
#

it works if i put the listener on the plugin it self. the api plugin

#

but when i put it in another plugin it doesn't

magic schooner
#

Hello, how can I check if a entity who died was a Raid captain?

#

nvm got it

quaint mantle
#

Someone knows whats happening here? I have no clue java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics

#

If you need full trace just tell me

grim hound
#

If I send packets to the player on proxy can I keep him there as long as I'd like?

#

and would they automatically support all client versions?

#

on bungee

magic schooner
#

How can I spawn in the Ominous banner? 💀

remote swallow
#

or libraries'ing it

quaint mantle
#

I don't know how to do that 😦 any guide?

remote swallow
#

use shadow with the dependency kotlin("stdlib")

quaint mantle
#

I'm using maven

remote swallow
#

never used kotlin with maven so cant help

quaint mantle
#

I found a guide

magic schooner
pseudo hazel
#

I dont think this is for ominous banners

#

but rather ominous spawners

#

like the new mechanic

magic schooner
#

Yeh in the trial chamber

halcyon hemlock
#

bro someone help me please
-# This user is wanted by Interpol - See more

pseudo hazel
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

grim hound
eternal oxide
#

I see no red notice for Sweattypalms 😉

halcyon hemlock
#

what did i do to get on the fuckin interpol list bro
-# This user is wanted by Interpol - See more

grim hound
#

you tell me

halcyon hemlock
#

uh

#

slavery?

eternal oxide
#

You probably offended a Clinton

remote swallow
#

its all those private project contributions

magic schooner
acoustic sail
#

-# This user is wanted by interpol - See more

#

easy

halcyon hemlock
#

bro

#

i thought we were homies and shit

tardy delta
#

nobody saw that

peak depot
#

Is there a way to open a Anvil/Workbench that work without packets?

slender elbow
#

use a library that uses packets

grim hound
#

oh that works

#

no

peak depot
grim hound
#

PacketEvents

#

even tho they don't have an enum of inventory types

#

but those changed like

#

not-that-very-often

#

throught time

remote swallow
#

not openinv

#

hold on i dont remember what its called

peak depot
remote swallow
#

open me thats it

peak depot
#

ah

#

thx

remote swallow
#

(made by the Core Inventory Related contributor at spigot)

fallow kraken
#

Hi, can someone can help me to understande the difference between spigot source and spigot plugin, juste understand, what can be done with source that can't be done with plugin

peak depot
remote swallow
#

it should do

#

its designed for it

peak depot
#

you tell me

remote swallow
#

show ur code

peak depot
#

ignore the &

#
    final Messages messages = CityBuild.INSTANCE.getMessages();
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
        if(!(sender instanceof Player player)) {
            sender.sendMessage(messages.getMessage("NoPlayer"));
            return false;
        }
        player.openInventory(OpenMe.string().createCrafting(player, null));
        return false;
    }
remote swallow
#

that should work, wait for @river oracle to get back and he should be able to help more

river oracle
#

If so I might need to edit how crafting is constructed

peak depot
river oracle
#

Probably just me missing an edge case

glacial narwhal
#

new ItemStack(Material.STAINED_CLAY, 1, (byte) 3) why does this give a stained clay without the colour ? 1.8.8;

eternal oxide
#

1.8 moment

glacial narwhal
river oracle
river oracle
#

All others should work tho <3 you can actually use api for crafting table anyways

tardy delta
river oracle
peak depot
#

nah its just a normal command opend anvil

pseudo hazel
#

before im trying to do something stupid, datapacks are enabled on a world folder level right? like I can create a world using world creator and then put a datapacks folder with a datapack in it that alters terrain generation, and then when the player loads the world by teleportation it will use the datapack?

#

if noone knows ill just try it but I wanted to see if someone ran into issues with this beforehand

pliant topaz
#

it should theoratically

#

as long as the world doesnt get loaded before the datapack

#

which here wouldnt be the case if i'm not being dumb

pseudo hazel
#

hmm I think even then I think the datapack can still affect new chunks , like if there is no player in the world, no terrain is generated right? (maybe except for spawn chunks ig)

pliant topaz
#

yes

#

unloaded chunks will be altered by the datapacks worldgen

pseudo hazel
#

yeah exactly

slender elbow
#

uh yeah i'm not entirely sure if data packs load for worlds other than the {level-name} overworld over bukkit's bastardisation

pseudo hazel
#

hmm

#

some testing required then..

slender elbow
#

since data packs are global and they can also do all the data pack funsies

unique shuttle
#

I'm a bit embarrassed to ask this, but I've always used Eclipse and recently moved some of my projects to IntelliJ IDEA using Gradle.
I have this error when trying to compile with Java 21 to work on Spigot 1.20.1
Could someone help me? 😅

lost matrix
#

?nms

obtuse hedge
#

is there a way to change the default attributes of items

young knoll
#

-# This user is wanted by interpol - [See more](https://www.interpol.int/How-we-work/Notices/Red-Notices/View-Red-Notices)

lost matrix
echo basalt
#

Any idea why the server hangs if I try to get a list from PDC when a chunk loads

#

🤔

#

goofy ass

#

if it were to recurse infinitely then we'd see a StackOverflow

pseudo hazel
#

maybe its like delaying by a tick or whatever

#

but I guess then it wouldnt be lagging like this

echo basalt
#

let me try delaying

#

if that works this is some goofy ass code

#

spot the mistake

remote swallow
echo basalt
#

crashed so hard that none of the backend servers have internet access anymore

#

what the actual fuck

umbral ridge
#

crashed so hard that i fell of the chair and my neighbour had to restart their wifi

slender elbow
modern flume
#

i have this error while trying to type anything on chat

young knoll
#

Looks like a plugin sending a component as a string

unique shuttle
# lost matrix ?nms

The problem I have is due to the Java version, and that my plugin has a module for each version it is compatible with

hollow oxide
#

i want the player to have Items here eveytime he opens his inventory but there is no event for this, how would you solve this?

i know i can place items here but i don't know when to place them since there is no event for it

dense oracle
#

I think they have slot numbers
So get the PlayerInventory and set items in the specific slots

hollow oxide
#

yup i know that but how do i know when the player open his inv

remote swallow
#

you dont

hollow oxide
#

ok

remote swallow
#

the server has no idea when its open

young knoll
#

You just do it constantly I guess

hollow oxide
#

won't that make the server lag?

inner mulch
hollow oxide
#

it wouldn't work but i found an obvious workaround

inner mulch
#

okay

viscid carbon
#

im having a hard time understanding oop. when you create a class and have fields in the class private int xp; make a getter and setter with it, the class has the players uuid in the object. does it not store it?

#

why does it create a new instance everytime?

inner mulch
#

Mining mining = "new" Mining

young knoll
#

The new keyword creates a new object

#

With its own set of values

viscid carbon
#

thats what i kinda figured but whats a good way to call it after its made.. that part is confusing me

young knoll
#

You need to store it somewhere

#

Either in a field of another class or inside some sort of collection, like a map or list

viscid carbon
#

okay, i'll give that a shot. thank you 🙂

#

trying to learn without being spoon fed. been working on this for way too long.

inner mulch
#

plus pls dont use if statements like that

#

your code is really inefficient. it should rather be a map<Material,Integer>

viscid carbon
#

so set a material map in my object class and set them in there and just call the map?

#

i'll give that a try once i figure this out, thank you

#

the whole idea of this is trying to not read/write to files everytime a block is broke. i feel like that would get bad

inner mulch
#

yes

#

file or database io should always happen async

eternal oxide
# viscid carbon

use a switch statement here```java
switch(block.getType()) {

case IRON_ORE:

eternal oxide
#

yes

inner mulch
#

no a map is better

#

switch statement breaks ocp

eternal oxide
#

why do you believe a map is better?

#

he is performing an action based upon the block type

#

and only specific types

inner mulch
#

cuz you dont need to add a case for everything, just add the material with a integer xp val

eternal oxide
#

you don;t have to add a case for every type

#

only the ones you want

inner mulch
#

sure but when he add one he needs to edit the code

#

map is better

eternal oxide
#

a map he still has to add

#

unless he is getting from config

viscid carbon
#

no, the materials are going to in the config.

eternal oxide
#

ah ok

viscid carbon
#

this was for testing

inner mulch
#

use a map

eternal oxide
#

in that case yes a Map Map#getOrDefault(block.getType(), 0)

viscid carbon
#

I never used oop correctly before, so im trying to break bad habits

#

so all the advice helps

inner mulch
#

switch statements almost always indicate a design flaw

eternal oxide
#

oop is really simple. every new object has to belong to some parent

viscid carbon
#

my issue is i didnt know you had to store the object after calling it, i figured java did it in memory somewhere lol

eternal oxide
#

nah, if in yoru code you do new Apple(); but don;t store it (assign it to a field or pass to another method) its wiped from memory once that section of code finishes

echo basalt
#

Not at the exact moment but yeah it's set to wipe eventually

#

This week I discovered that Jetbrains Datagrip is a thing

#

It's an IDE for interacting with databases :)

#

hella nice tool

eternal oxide
#

I just use a plugin for Eclipse for databases, as I don;t use them often

#

Um YT just decided to start offering me vids about hitler 😦

viscid carbon
#

can you not make the map in the object?

#

private HashMap<UUID, Mining> miningHashMap = new HashMap<>();

#

or do i have to store the fields independently?

dusk minnow
#

Is there a method to set player scale? I can't seem to find it anywhere

eternal oxide
eternal oxide
#

did they add scale now?

dusk minnow
dusk minnow
remote swallow
eternal oxide
#

I know display entities have it but I didn;t think players had it

#

nice

dusk minnow
#

you can do it for mobs too

remote swallow
#

Came in 20.6 I think

dusk minnow
#

everything i try it with seems to work except ender dragon unfortunately

eternal oxide
#

ah I've not touiched since 20.something

remote swallow
viscid carbon
#

if i make the map in the instance it wont save

grim hound
#

How do I simulate a "fake" empty limbo server on Bungeecord?

#

Fake means that no actual seperate process is started for it

#

Like no jar

#

Same vm

viscid carbon
#
            mining = new Mining(p.getUniqueId());
            mining.getMiningHashMap().put(p.getUniqueId(), mining);
        }
        mining = mining.getMiningHashMap().get(p.getUniqueId());```
#

wow i feel like an idiot.

#

thank yall

eternal oxide
#

don't put the map inside the Mining class

viscid carbon
#

no?

eternal oxide
#

you create a new Mining object for every player

#

you want a single Map outside the Mining class

worthy yarrow
#

^

viscid carbon
#

even if i'm accessing it from other classes?

eternal oxide
#

yes

worthy yarrow
#

A global map if you will

eternal oxide
#

if it is inside the class you are creating a new Map for every player

viscid carbon
#

so add a map in my say user class to get it

#

oh i thought that was the idea

eternal oxide
#

So long as your user class is a Singleton

worthy yarrow
eternal oxide
#

different map

worthy yarrow
#

If each player has their own map then technically only one key/value will exist per map

eternal oxide
#

Mining contais the players xp, level etc

#

from what I understand

#

ah yes we are talking about different parts

worthy yarrow
#

So then yes you should have a global map storing uuid or wtv to a mining object

#

If player information is already within the mining object then you can just pull wtv data you need from that mapped object

viscid carbon
#

i was planning on using a map for each skill, should i not?

eternal oxide
#

yep, one Mining object per player put into a global Map for <UUID, Mining>

#

each skill?

worthy yarrow
viscid carbon
#

i was going to make more than one skill

eternal oxide
#

one for Mining and another for Wood cutting?

viscid carbon
#

yes

eternal oxide
#

if their xp/level is seperate then yes

viscid carbon
#

^ yes

worthy yarrow
#

Oh right yeah

viscid carbon
#

thats the idea

#

lol

worthy yarrow
#

That's fine

eternal oxide
#

you could make it a Set of skills

#

Mining extends Skill

viscid carbon
#

my next question was should i make that a class for every skill so i could used like Skill mining = new skill

worthy yarrow
#

Tbf in my (wip) rpg core, I store ability levels and the class level within the class object itself

viscid carbon
#

that was the question

eternal oxide
#

Map<UUID, Set<Skill>>

viscid carbon
#

xD

#

so i should make this a global skill class?

eternal oxide
#

have a package of skills

#

or

#

as each one is identical just a single skill class, then add a field for its type

young knoll
#

I would have a class that holds all the skills for a player

#

Rather than nested collections

eternal oxide
#

actually don;t even need that

#

Skill would only contain the xp/level data

#

so Map<UUID, Collection<String, Skill>>

#

make teh string either a name or an enum

viscid carbon
#

i will have to try this because it sounds more efficient for more skills later on

young knoll
viscid carbon
#

@young knoll what do you mean?

young knoll
#

You make an object that holds all the player skills and store that in the map instead

eternal oxide
#

you could do that

#

just moves teh Collection into a skill container

#

Map<UUID, Skills>
public Skills () {

Set skills<Skill>

young knoll
#

You can also add more helper methods to said Skills object

eternal oxide
#

yep in skills you have add get methods

#

so you have a Skills object and a Skill object

#

Skills is the container for multiple Skill

worthy yarrow
#

Hmm considering this information perhaps this isn't the best design for my abilities system...

young knoll
#

Do you at least have a base ability class

#

Or interface

viscid carbon
#

@worthy yarrow i've been trying to make this system for 2 weeks now.... thats why i finally came to here lol

worthy yarrow
#

It's being worked on currently

young knoll
#

D:

#

Making child classes before the parent

worthy yarrow
#

Well cuz at first, I thought I was just gonna have 1 or two abilities per class lol

#

then I was like

#

That's just fucking dumb

young knoll
#

Either way

worthy yarrow
worthy yarrow
#

Anyways abstraction of the abilities is in progress so

viscid carbon
#

so same as me

#

    private int level;
    private int xp;
    private final UUID uuid;
    private Player player;
    private final User user;
    private int newLevel;
    private HashMap<Material, Integer> materials = new HashMap<>();
    private HashMap<UUID, Set<Skill>> skillMap = new HashMap<>();

    public Skill(UUID uuid) {
        this.uuid = uuid;
        player = Bukkit.getPlayer(uuid);
        user = new User(player);
    }
    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getXp() {
        return xp;
    }

    public void updateXp(int xp) {
        this.xp = this.xp + xp;
    }
    public void setXp(int xp) {
        this.xp = xp;
    }
    public void levelUp() {
        if (getXp() >= getLevel() + 100 * 2) {
            newLevel = getLevel() + 1;
            setLevel(newLevel);
            setXp(0);
            user.sendChat("&aLEVEL UP!");
            user.sendChat(String.format("&7Your mining level is now: &6%s", getLevel()));
            user.spawnFireworks(player.getLocation(), Color.PURPLE, 5);
        }
    }

    public HashMap<Material, Integer> getMaterials() {
        return materials;
    }

    public HashMap<UUID, Set<Skill>> getSkillMap() {
        return skillMap;
    }
}```
young knoll
#

You must embrace the abstraction

#

Eventually even the abstraction gets abstracted

worthy yarrow
#

^ what I tried to do with that registry system

eternal oxide
#

don;t track the Player, UUID or User in the Skill object

worthy yarrow
#

^ The skill is already going to be mapped to a player

eternal oxide
#

the Skill object should just be a data holder

viscid carbon
#

okay, i get you

#

so dont add like the material getter either?

eternal oxide
#

It should only have teh xp/level data

#

nope

viscid carbon
#

Okay so do that per class too

eternal oxide
#

the Skill class should be identical for all skills

viscid carbon
#

thank you so much for this information, this has been bugging me forever

prime tartan
#

hi guys, i'm trying to make a disc shape using block displays. how would i be able to achieve this

eternal oxide
#

its literally just holding the xp/level data

viscid carbon
#

    private int level;
    private int xp;
    private final UUID uuid;
    private Player player;
    private HashMap<UUID, Set<Skill>> skillMap = new HashMap<>();

    public Skill(UUID uuid) {
        this.uuid = uuid;
    }
    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getXp() {
        return xp;
    }

    public void updateXp(int xp) {
        this.xp = this.xp + xp;
    }
    public void setXp(int xp) {
        this.xp = xp;
    }

    public HashMap<UUID, Set<Skill>> getSkillMap() {
        return skillMap;
    }
}```
#

Okay i get what you're saying

eternal oxide
#

remove Player and UUID too

#

no skillMap either

#

create a Skills object that has the skillMap

viscid carbon
#

this was what i was attempting before.

#

so if i extend from the skill class it will store it?

eternal oxide
#

yes

viscid carbon
#

alright i will start working on this

#

    private final UUID uuid;
    private Player player;
    private HashMap<Material, Integer> materials = new HashMap<>();

    public Mining(UUID uuid) {
        this.uuid = uuid;
    }
    public void addMaterialXp() {
        for (String mat : Main.instance().getConfig().getConfigurationSection("Materials").getKeys(false)) {
            if (!materials.containsKey(mat)) {
                materials.put(Material.getMaterial(mat), (Integer) Main.instance().getConfig().get("Ores." + mat));
            }
        }
    }
    public HashMap<Material, Integer> getMaterials() {
        return materials;
    }
}```
#

so the mining class will contain methods i need for events/etc correct?

eternal oxide
#

yes

viscid carbon
#

and i need another class to hold the skillmap like inside my main user class

eternal oxide
#

yes skillMap goes inside each user object

prime tartan
#

i have this right now. it should make a circle / disc type shape but it's teleporting the block displays into the middle which is resulting in it looking like a regular block. how can i move the block displays as a group in a set direction?

        for (int angle = 0; angle < 360; angle += 5) {
            double radian = Math.toRadians(angle);
            double x = Math.cos(radian);
            double z = Math.sin(radian);  
            Location eclipse = origin.clone().add(x * 0.5, 0, z * 0.5);
            BlockDisplay blockDisplay = (BlockDisplay) player.getWorld().spawnEntity(eclipse, EntityType.BLOCK_DISPLAY);
            blockDisplay.setBlock(material.createBlockData());
            blockDisplay.setGravity(false);
            blockDisplay.setInvulnerable(true);
            Transformation transformation = blockDisplay.getTransformation();
            transformation.getScale().set(0.4, 0.3, 0.4);

            display.add(blockDisplay);
        }
        if (clicked) {
            shoot();
        }
        if (!clicked) {
            if (source == null) {
                getSource();
            }

            if (origin.getY() < source.getLocation().getY() + 2) {
                origin.add(0, 0.1, 0);
            } else {
                // "hovering" simulation
                origin.add(0, (Math.sin(System.currentTimeMillis() / 1000.0) * 0.03), 0);
                if (!ready) {
                    ready = true;
                }
            }```
eternal oxide
#

you only spawn one block

#

then teleport it to eclipse over and over

prime tartan
#

oh..

wraith delta
#

.append(initialMessage).append(display).append(finalMessage).create(); How would I reset the text after append(display) ? because my finalMessage shows the hover message when only display should

prime tartan
eternal oxide
#

not sure what you are attempting

prime tartan
#

i'll take a picture

#

oh i cant send pics here

eternal oxide
#

to move a display you should not teleport it

#

you should alter its translation

prime tartan
#

i updated the code

#

alter its translation how?

eternal oxide
#

what exactly are you trying to do?

prime tartan
#

okay. i'm trying to replicate a disc like shape. the shape comes out the ground and rises to player height, then hovers a bit while it waits for the player to left click to shoot

#

so i want it to move up and down, and then move in the direction when they shoot

#
private void shoot() {
        if (!ready) {
            return;
        }
        direction = player.getLocation().getDirection();
        origin.add(direction.normalize().multiply(1));
    }```
#

my shoot method

eternal oxide
#

ok, spawn the display at its origin.
start a runnable 2 ticks later to apply a translation to make it move up to wherever you want it to rise to.

prime tartan
#

this is in a method that runs every tick btw

#

and origin is the block location that the disc comes out of

eternal oxide
#

if you apply the translation when it spawns it will just apply it strasight away

#

Spawn display.
runnable 2 ticks later, getTransformation, adjust translation, set transformation back.

#

the interpolation duration is how long it takes to apply its transformation

dawn flower
#

how do i get a vector that leads from vector a to vector b at progress x

#

x is 0 to 1

eternal oxide
#

once that duration has expired reset its trasnslation and teleport it to the new location

#

Thats how you make it rise from the floor

#

you only apply a translation to the Y axis

eternal oxide
dawn flower
#

the progress

eternal oxide
#

1 is the full distance?

dawn flower
#

yes

eternal oxide
#

so you are talking about locations not actual vectors

dawn flower
#

i mean

#

both would be the same imo

#

but yeah i need it for a location

eternal oxide
#

targetVector.subtract(sourceVector) gives you the distance

dawn flower
#

amazing

prime tartan
eternal oxide
#

multiply that by your progress

dawn flower
#

that gives you distance multiplied by progress

prime tartan
#
for (BlockDisplay d : display) {
            d.getTransformation().getTranslation()
        }```
dawn flower
#

or the target vector

#

idk

eternal oxide
# prime tartan ```java for (BlockDisplay d : display) { d.getTransformation().getTr...

This causes a display to bounce up and down simulating a dropped item. You do the same but a single runDelayTask not repeating```java
entity.setItemStack(new ItemStack(Material.ACACIA_BOAT));
entity.setInterpolationDelay(0);
entity.setInterpolationDuration(1);

    Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {

        float angle = 0;
        float stepSize = 2.87f; // Sync to Minecraft animation rotation speed.
        float rotation = Math.toRadians(stepSize);

        @Override
        public void run() {

            Transformation transformation = entity.getTransformation();

            transformation.getRightRotation().rotateY(rotation);
            transformation.getTranslation().set(0, Math.cos(Math.toRadians(angle)) / 10, 0);

            entity.setTransformation(transformation);

            if ((angle += stepSize * 2) >= 360)
                angle %= 360;
        }

    }, 2, 1);```
#

this moves it every tick

prime tartan
#

but i'm already in a method that is repeated every tick

viscid carbon
#

@eternal oxide where should i add the skill class in the set?

eternal oxide
#

you would want a single transformation from origin to final position

#

you don;t need a repeating task unless you are doing more animation than just moving it up, then shooting

eternal oxide
#

so you can add any new Skill

#

also add a get method in Skills

prime tartan
eternal oxide
#

start with one display

#

get it doing what you want

#

before you attempt multiple

#

like run a delayed task (2 ticks later)java Transformation transformation = entity.getTransformation(); transformation.getTranslation().set(0, -5, 0); entity.setTransformation(transformation);

#

if you do that in a runnable 2 ticks after you spawn the display it will make it move up 5 blocks

#

it won;t actually move it, but it translates it. it's still at the original spawned location

#

entity.setInterpolationDuration(20); would make it take 1 second to cover the distance

echo basalt
#

You don't need concrete character classes

#

As each "character class" (probably / should) consist of

  • A skill tree
  • Metadata (display name, color, icon etc)
#

On the skill tree, each skill has effects, with different trigger conditions (on click / on player join etc)

#

They can be things like buffs (on join -> apply speed buff), or active effects (on click -> cast a spell or something)

#

This structure allows you to separate everything, re-use skills across classes and make derived classes (Evolved Archer is just an archer with more skills, for example)

worthy yarrow
#
public class Warrior implements CharacterClass {

    private final Map<Integer, Integer> abilityExperience = new HashMap<>();
    private final Map<Integer, Integer> abilityLevels = new HashMap<>();
    private int classExperience = 0;
    private int classLevel = 1;

Another thing I was wondering, the current system has a class object (mapped to each player when/if they decide to make said class) storing the exp and level to fields, this works but is it better to store the exp/level data somewhere else?

eternal oxide
#

int, int?

worthy yarrow
#

To simplify the writing I just mapped like 1,2,3 etc kek

eternal oxide
#

ah magic numbers

worthy yarrow
#

ability 1, ability 2, etc

#

Yep

#

It's fun

eternal oxide
#

bad man

#

slapped wrists

worthy yarrow
#

I love having to go back to the ability class to remember which one it is kek

echo basalt
#

I'd like to separate your data structure from your player data

eternal oxide
#

Namespaced each

echo basalt
#

This would take a solid hour to write

worthy yarrow
echo basalt
#
public interface Skill {

  String getName();
  SkillUsageRestriction getUsageRestriction();

  void apply(SkillCaster caster, SkillCastingContext context);
}
#

hm

#

SkillUsageRestriction would dictate when apply should be called

worthy yarrow
#

I assumed that yeah

echo basalt
#

(ON_PLAYER_JOIN, ON_PLAYER_CLICK)

#

Either that or we make skills components

#

Which is also viable

worthy yarrow
#
public class Berserk {

    private final Player player;
    private final double damageBoost;
    private final int duration;
    private final EnhancedRPG enhancedRPG;

    public Berserk(Player player, double damageBoost, int duration, EnhancedRPG enhancedRPG){
        this.player = player;
        this.damageBoost = damageBoost;
        this.duration = duration;
        this.enhancedRPG = enhancedRPG;
        apply();
    }

    private void apply() {
        Attribute attackDamage = Attribute.GENERIC_ATTACK_DAMAGE;
        if (player.getAttribute(attackDamage) == null) {
            return;
        }
            player.getAttribute(attackDamage).setBaseValue(
                    player.getAttribute(attackDamage).getBaseValue() + damageBoost);

        Bukkit.getScheduler().runTaskLater(enhancedRPG, this::remove, duration * 20L);
    }

    private void remove() {
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cBerserk mode has ended!"));

        Attribute attackDamage = Attribute.GENERIC_ATTACK_DAMAGE;
        if (player.getAttribute(attackDamage) == null) {
            return;
        }
            player.getAttribute(attackDamage).setBaseValue(
                    player.getAttribute(attackDamage).getBaseValue() - damageBoost);
    }

}```

the ability structure is a bit redundant as well, considering the character classes already have a useAbility method
echo basalt
#
public interface SkillComponent {

  String getName();

  void register(SkillCaster caster);
  void dispose(SkillCaster caster);
}
public interface ClickableSkillComponent extends SkillComponent {

  void handleClick(ClickContext context); // Would contain the target entity, click type, held item
}
viscid carbon
#

Would the get look like public Skill getSkill(Skill skill) { return skill; }
@eternal oxide ?

echo basalt
#
@EventHandler
public void onInteract(PlayerInteractEvent event) {
  SkillCaster caster = ...;
  ClickContext context = ...;
  
  for(ClickableSkillComponent clickComponent : caster.getComponents(ClickableSkillComponent.class)) {
    clickComponent.handleClick(context);  
  }
}
#

Which is how I do my entities nowadays :)

worthy yarrow
echo basalt
#

It can work if you engineer it well

eternal oxide
#

return skillMap.get(skillKey)

echo basalt
#

(excuse the kotlin) here's how I do mine at work

worthy yarrow
#

Abstraction goes crazy

echo basalt
#

yuh

worthy yarrow
#

Oh it's so lovely

echo basalt
#

I also have an "entity template" system that gets to apply components to an entity

#

And I can save templates in PDC so that when an entity loads in the world they get their components back

#

A system like this isn't just limited to simple stuff like "if I click on this entity this happens", I also use it to apply custom models and have some holograms around for things like health displaying

worthy yarrow
#

but does that take experience with the system?

#

Maybe time for some demos haha

echo basalt
#

Barely

worthy yarrow
#

oh

#

kek

viscid carbon
#

ah so instead of Hashmap we're replacing it with set<Skill>

echo basalt
#

The way I created it involves re-using the same component instance for multiple entities so most components have a Map<ComponentEntity, Whatever> internally

#

I have a TickableEntityComponent that just ticks on every entity

#

And for example, my "HealthRenderingComponent" just inherits that and updates the display on every tick

#

When the entity dies, the component gets disposed meaning I know to nuke the display

worthy yarrow
#

I got my final lesson from trooper today for a while, went over his lib and previously netty + oop concepts

#

Though per rolyn's advice I kinda wanna try some game dev

echo basalt
#

It'd look something like this

public class HealthRenderingComponent implements TickableEntityComponent {

  private final EntityHealthTemplate template; // What's used for rendering the health
  private final Vector displayOffset;

  private final Map<ComponentEntity, PacketEntity<?>> displays = new ConcurrentHashMap<>();

  public HealthRenderingComponent(...) {
    this... = ...
  }

  @Override
  public void tick(ComponentEntity entity) {
    Entity backingEntity = entity.getBackingEntity();
    
    if(!(backingEntity instanceof LivingEntity livingEntity)) {
      return;
    }

    double currentHealth = livingEntity.getHealth();
    double maxHealth = ...;
    
    PacketEntity<?> display = this.displays.computeIfAbsent(entity, (irrelevant) -> createDisplay(livingEntity));
    display.setDisplayName(template.renderHealth(health, maxHealth));
    display.teleport(livingEntity.getEyeLocation().add(displayOffset));
  }

  @Override
  public void dispose(ComponentEntity entity) {
    PacketEntity<?> display = this.displays.remove(entity);
    
    if(display != null) {
      display.dispose();
    }
  }

  private PacketEntity<?> createDisplay(LivingEntity entity) {
    return ...
  }
}
#

p much it

viscid carbon
#
        skills.add(new Mining(p.getUniqueId()));```
something like this?
#
    private UUID uuid;

    public void add(Skill skill) {
        skillMap.get(uuid).add(skill);
    }
    public Set<Skill> getSkill(Skill skill) {
        return skillMap.get(skill);
    }```
worthy yarrow
echo basalt
#

passed on the constructor

#

For example we have some crawling zombies at work

#

Their backing entity is a real zombie with a custom nms hitbox

#

If I were to use the default value the display would be too high

worthy yarrow
#

gotcha

#

It just looked a bit sus haha

viscid carbon
#

    private HashMap<UUID, Set<Skill>> skillMap = new HashMap<>();
    private UUID uuid;

    public void add(Skill skill) {
        skillMap.get(uuid).add(skill);
    }
    public Set<Skill> getSkill(Skill skill) {
        return skillMap.get(skill);
    }
}
worthy yarrow
#

Hmm someone give me a PacketType from packet events to play with, preferably from Play.Server

viscid carbon
#

ahaha i am now confused at my own code

#

@eternal oxide im confused now lol

#

should the skills class be a new instance?

drowsy helm
#

would you guys say it's an anti pattern to name for example the table Playername's id as playerId or should it just be id?

wraith aurora
#

idk

#

personally: I wouldn't use java or kotlin

#

but if I had to

#

playerid makes more sence

drowsy helm
#

im talking about for dbs

wraith aurora
#

oh

#

ok yeah I can help you

drowsy helm
#

ig same idea though

wraith aurora
#

not really

#

I would use id

#

sorry java scares me

drowsy helm
#

why lol

lime wave
#

how do I add nbt tag to player object?

drowsy helm
lime wave
#

working on 1.20.6

#

?

drowsy helm
#

yep

viscid carbon
#

how do i get from a set?

drowsy helm
#

get by index?

#

you only really ever iterate over sets

viscid carbon
#

well i have this


    private final UUID uuid;
    private HashMap<UUID, Skill> skillMap = new HashMap<>();
    private Set<Skill> skills = new HashSet<>();
    public HashMap<UUID, Skill> getSkillMap() {
        return skillMap;
    }

    public Skills(UUID uuid) {
        this.uuid = uuid;
    }

    public Skill getSkill(Skill skill) {
        return getSkillMap().get(skill);
    }
    public void add(Skill skill) {
        System.out.println(skill);
        skills.add(skill);
    }
}```
i'm trying to figure out how to get into 
```private Set<Skill> skills = new HashSet<>();```
#

nvm

eager knoll
#

Does anyone know what the best way to use models in a plugin is? Right now i'm thinking of using an invisible armor stand holding an item and then using a texture pack to replace that item with a model texture.

drowsy helm
#

It will be way too much of a pain to make your own render system

#

It’s a big job

pure lion
#

@drowsy helm can u help me in dms rq

drowsy helm
viscid carbon
#

@eternal oxide Mining mining = new Mining(); Skills skills = new Skills(p.getUniqueId()); Skill skill = skills.get();
What am i doing wrong?

worthy yarrow
#

Choco

#

I've been paid to recreate hypixels housing core

#

...

worldly ingot
#

Oh okay

viscid carbon
#

do ya @worldly ingot ?

worldly ingot
#

Have fun!

viscid carbon
#

xD

worldly ingot
#

Well, you have a Set of Skills, do you not? 😄

worthy yarrow
#

Thank god world edit exists eh?

#

Couldn't imagine hypixel to have invented it

pure lion
# drowsy helm Just post it here

Is there a way to have a config string be read in a format like "0-800:0.6" the 0.6 being a 60% chance for an entity to spawn and the 0-800 being the ticks in a day cycle.

worldly ingot
#

No the builders have WorldEdit and whatnot

#

That's a pretty standard tool that most builders expect to have regardless of where you are

worthy yarrow
#

Yeah sure, I think my biggest issue is gonna be the plot permissions

worldly ingot
#

Probably not what you want

worthy yarrow
#

I want to keep all plots in the same world and just attach offsets for loading them in when a player wants to transfer to the plots world, that being said the permissions aren't going to be world based but region based right? I wasn't sure of how to go about this

#

World guard probably?

worldly ingot
#

Well are you recreating housing? Or are you recreating a plot plugin?

worthy yarrow
#

It's supposed to be like housing

viscid carbon
#

@worldly ingot thats just getting values, get is setting the skill public Skill get() { return getSkillMap().get(uuid); }

#

in the Skills constructor its adding it to a Hashset public Skills(UUID uuid) { this.uuid = uuid; //Add skill classes Mining mining = new Mining(); add(mining); }

worthy yarrow
#

Right now I'm trying to get the foundation work done meaning plots for the players build area correct? Then moving forward to plot placement within a world when a player transfers to said world, I could spawn them at like a default 0,1,0 or whatever and have some npcs or buttons wtv to dictate housing options such as the visiting and whatnot

#

I could attach an offset to each plot location when loading it in to keep proper spacing and then use world guard for individual region permissions yeah?

young knoll
#

That just sounds like a plot plugin

#

Except the ploys can move I guess

worthy yarrow
#

I guess I have to ask what makes housing well housing then?

young knoll
#

Well it’s all separate servers

#

Actually I doubt that’s true

#

It’s probably a bunch of servers with a few worlds each

worldly ingot
#

Ideally the skills should be pretty stateless and have one instance in the JVM because they provide really nothing more than information such as a name, description, maybe a max level, etc. etc.

drowsy helm
worldly ingot
#

Then you could store some state stuff in a separate object, maybe a Map<SkillType, Integer> or something to hold the level of a skill type

worthy yarrow
worldly ingot
#

Take for example Minecraft's blocks. There's only one instance of the sand block type. It holds no data. Just acts as a stateless information class that has methods that can do various things.

#

Only one instance of it is ever created though and it's constant in the Blocks class

viscid carbon
#

@worldly ingot can i dm you?

young knoll
#

It means the entire plot is stored externally in a database

#

Specifically I imagine they use the slime format for that

dawn flower
#

is there a limit for velocity speed

drowsy helm
#

What server you talking about?

worthy yarrow
#

hypixel housing

drowsy helm
#

Ah yeah hypixel uses slime format

#

Same for their isalnds

dawn flower
worldly ingot
worthy yarrow
#

I feel like the only reason they do this though is because of the expecting player base?

young knoll
#

Housing is basically skyblock with less sky

worldly ingot
#

We can make a thread here if you'd like to consolidate things

young knoll
#

Still plenty of block tho

drowsy helm
#

Lmao

young knoll
#

Thank you, I try my best

worthy yarrow
#

Considering maybe 50 players is yml forgivable for persistence? (Specifically for individual plot data)

floral drum
worthy yarrow
#

Then just save / load like that

viscid carbon
#

the idea of all of this is to store the level and xp for each skill so i made a data class "Skill"


    private int level;
    private int xp;


    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getXp() {
        return xp;
    }

    public void updateXp(int xp) {
        this.xp = this.xp + xp;
    }
    public void setXp(int xp) {
        this.xp = xp;
    }
}```
and then we extend each skill "Mining"
```public class Mining extends Skill {

    private final Server server = new Server();
    private HashMap<Material, Integer> materials = new HashMap<>();

    public Mining() {
    }

    public HashMap<Material, Integer> getMaterials() {
        return materials;
    }
    public void addMaterialXp() {
        for (String mat : Main.instance().getConfig().getConfigurationSection("Level settings.Materials").getKeys(false)) {
            if (!getMaterials().containsKey(mat)) {
                getMaterials().put(Material.getMaterial(mat), (Integer) Main.instance().getConfig().get("Level settings.Materials." + mat));
                server.sendConsole(String.format("Added material: %s xp: %s", mat, Main.instance().getConfig().get("Level settings.Materials" + mat)));
            }
        }
    }
}```
finally we need a way to get all the data "Skills"
```public class Skills  {

    private final UUID uuid;
    private HashMap<UUID, Skill> skillMap = new HashMap<>();
    private Set<Skill> skills = new HashSet<>();

    public HashMap<UUID, Skill> getSkillMap() {
        return skillMap;
    }

    public Skills(UUID uuid) {
        this.uuid = uuid;
        //Add skill classes
        Mining mining = new Mining();
        add(mining);
    }

    public Skill get() {
        return getSkillMap().get(uuid);
    }
    public void add(Skill skill) {
        System.out.println(skill);
        skills.add(skill);
    }
}
worthy yarrow
#

Can I dictate where the schem file goes?

viscid carbon
#

the issue is getting the data.

young knoll
#

A schem file is still a file

#

You can put it wherever

worthy yarrow
young knoll
#

Probably fine assuming you don’t need any cross-server functionality

#

And the storage space isn’t a huge concern

floral drum
#

^

worthy yarrow
#

Ok cool

viscid carbon
#

am i over complicating this?

#

i tend to do that a lot. 😄

worthy yarrow
#

Lastly, should I load the plot data when the player joins the server or should I load it when they transfer to the world?

#

I'm not quite sure on whether or not they are going to dedicate a server to plots reason I'm asking

floral drum
#

I'd suggest transfer so the server doesn't have to use any extra resources for example alt accounts or bots

worthy yarrow
#

Yeah that makes sense

worldly ingot
#

the idea of all of this is to store the

livid heron
#

so im trying to make an arrow that, when you fire it, it makes you ride the arrow entity. the current way i am trying to make this happen is by using entityshootbowevent, with setpassenger. However, I cant seem to find out how to track the arrow once it's fired

#

so how could i go about doing so

worthy yarrow
#

Does the player ride the arrow? Do you see any instance of this happening?

floral drum
#

What exactly do you mean "track the arrow" in what way? What does it need to do?

livid heron
#

i need the get the arrow entity after it's fired

worthy yarrow
#

^ if you can already attach the player then it should just ride out to where it was fired no?

livid heron
#

the player is supposed to ride the arrow

#

thats what im trying to figure out