#help-development

1 messages · Page 1313 of 1

thorn isle
#

sora 2 is $0.10 per second

torn shuttle
#

where are you seeing htat

worthy yarrow
#

What the fuck

thorn isle
#

the api pricing

worthy yarrow
#

Why are they pricing by time lol

thorn isle
#

or no, wrong link

#

here

torn shuttle
#

ah

#

look at that

#

$120 output for gpt-5-pro

#

fucking hilarious

#

50 cents for the large sized pro model

#

how long are the clips?

#

like at least 5 seconds right

thorn isle
#

i think they can go pretty far contiguously, i'd guess the limit is maybe 30 seconds but i have no idea, i've never used it, and the sora 2 release blog post is down

torn shuttle
#

amazing

#

I think they might actually be starting to have money problems ngl

thorn isle
#

oh looks like it's only 10 seconds

torn shuttle
#

5 bux for my cool ai video

#

per attempt of course

thorn isle
#

i guess if you want to make a movie you have to switch scenes every 10 seconds

#

and yeah then pray that the people don't randomly switch places or the scene doesn't change

#

and regenerate each 10 second segment 5 times to get one that kind of matches with the others

#

neat, the agent builder is live on the platform

#

not that i'll use it probably

torn shuttle
#

the main thing I wonder about is if sora 2 actually folows advanced instructions

#

which I am guessing no

#

I wanted to use it for generating highlights from my dnd campaign from session transcripts that have been auto highlighted

#

but they are incredibly bad at following anything more than a general vibe with 5 words

thorn isle
#

from what i've fiddled with the image models, they can do some relatively detailed positioning and detail instructions, not so sure about sora though

torn shuttle
#

not when there's more than one actor

#

characteristics sstart bleeding

#

tell them character X has a sword, they all end up with swords, or the wrong person has a sword, etc

#

happens for everything

thorn isle
#

well to be fair i only tried it by applying different styles of lace and color to variously located pillows on a sofa and it did work for that, but maybe swords and people are different

torn shuttle
#

from experience it just never gets even remotely close to anything specific you might want

#

haven't tried sora 2 yet but I did try pretty much all of the other ones

thorn isle
#

i have no clue how video models work, but for image models there are a lot of control tools, like controlnet, regional prompting and segmentation, that definitely can get your swords right

#

but i don't think chatgpt makes any use of them for image generation

torn shuttle
#

it doesn't

thorn isle
#

in theory i'm guessing similar systems should work for video but i have no idea how video models work

torn shuttle
#

oh did they not oepn up sora 2 yet

#

so you get to pay for the api but you don't have a way into sora 2

thorn isle
#

it's on the api but i don't want to write a client to try it

#

and it's not available in the "web client" for the api, i.e. the api playground

#

nothing useful ever is

#

according to some quora post, chatgpt users should have some free sora 2 generations on launch

#

maybe i can find my chatgpt credentials from 2 years ago and give it a shot

torn shuttle
#

sora 2 isn't available in europe and also requires an invite code to use on their website

thorn isle
#

oh well

#

can't find the request format docs for it in the api docs anyway

#

or no there it is

#

seems to work

#

i've spent 5 dollars on A calico cat playing a piano on stage

#

it's terrible

#

do you have a prompt with swords or whatnot that you want me to try with it? or did you get access to it on your own yet

bold nebula
#

anyone here have ever done a smooth recoil system for guns?

#

it's like 8 months that in trying to find a packet that doesn't cancel the movements of the player

#

and runs on 60 fps

#

not 20

smoky anchor
#

have you managed to successfully try the teleport one with all relative flags set ?

bold nebula
#

yea it does cancel the movements

smoky anchor
#

alright

bold nebula
#

but i can't move my head

#

Without getting lag spikes

#

or whatever

#

I actually found a way with packetevents but i have two issues, 1) i get stuck in mid air
2) sometimes after server restart i dont receive the packet at all

smoky anchor
#

reading https://minecraft.wiki/w/Java_Edition_protocol/Packets#Synchronize_Player_Position
Due to latency, the server may receive outdated movement packets sent before the client was aware of the teleport. To account for this, the server ignores all movement packets from the client until a Confirm Teleportation packet with an ID matching the one sent in the teleport packet is received. The vanilla client will also send a Set Player Position and Rotation packet after the Confirm Teleportation packet with the position and rotation received from this packet, and horizontal collision and on ground set to false.

Is it possible that this feature is fucking it up for you somehow ?

bold nebula
smoky anchor
#

on 1.21.9 I tried this command execute as @a at @s run teleport @s ~ ~ ~ ~ ~0.2
Seems to work perfectly. No weird teleporting or camera warping. Tried on my server with 45ms ping.
Not sure how or if that can help you. But once again, I wish you luck.

smoky anchor
#

I ran this in a repeating command block

bold nebula
#

My server is on 1.21.4

smoky anchor
#

and does this command work ?

bold nebula
#

i will try

thorn isle
#

i'm guessing you didn't set the relative flags for x y z as well

thorn isle
#

aren't like half of the plugins on the site prank or troll plugins

#

i thought that rule was only for premium plugins, because troll/prank plugins are considered low effort and not worth selling

chrome beacon
#

Yeah I doubt you'll get banned for posting that as a free plugin

young knoll
#

Just post it

#

If it’s premium and doesn’t follow the rules then it will get rejected when reviewed

#

Granted if this is your first time posting to spigot then it’s not going to be a premium plugin

#

No

#

You need 2 free resources to post a premium plugin

thorn isle
#

you first need to spam the free resources section with 5 troll/prank plugins

young knoll
#

And you won’t get banned for trying to upload a plugin that isn’t fit for the premium category

thorn isle
#

(this is why half of them are troll/prank plugins)

young knoll
#

Unless you keep spamming the same thing over and over again

weak wasp
#

Yes you need to give back to the community for free before being able to use the paid service

#

I just stops people whose sole purpose is to profit from plugins for a FREE server software

#

A lot of people will have a stripped down or demo version of their paid plugins for free. Maybe modify your Halloween one to some kind of free version and then you already got 1/3 resources

young knoll
#

4-5 days for a premium plugin isn’t much

weak wasp
#

It's not even much for a free plugin

young knoll
#

@worldly ingot probably spent more time than that on veinminer

worldly ingot
#

10 years aPES_Sob

weak wasp
#

\o/

young knoll
#

Dang 10 whole years of coding

worldly ingot
#

Yeah never stopped once

young knoll
#

That’s like 90,000 hours

weak wasp
#

Then you have stuff like world edit, and multiverse, both free, guaranteed more than 5 days

young knoll
#

Quick how many lines of code is that per hour

gray oracle
worldly ingot
#

So it's probably like 0.2 lines/day

gray oracle
young knoll
#

Smh

dull python
#
Caused by: com.google.gson.JsonParseException: Disallowed chat character: '§'
        at com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287) ~[datafixerupper-8.0.16.jar:?]
        at org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(CraftChatMessage.java:250) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
        at org.bukkit.craftbukkit.util.CraftChatMessage.bungeeToVanilla(CraftChatMessage.java:364) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
        at net.minecraft.network.protocol.game.ClientboundSystemChatPacket.<init>(ClientboundSystemChatPacket.java:21) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
        at org.bukkit.craftbukkit.entity.CraftPlayer$2.sendMessage(CraftPlayer.java:3453) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
        at org.bukkit.craftbukkit.entity.CraftPlayer$2.sendMessage(CraftPlayer.java:3441) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
        at org.bukkit.craftbukkit.entity.CraftPlayer$2.sendMessage(CraftPlayer.java:3421) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]

If you follow this error and look at the code, you will know that it has been available since 1.21

worldly ingot
#
  1. Leaf. Third party fork. Could be their doing
  2. Are you sending the section symbol next to a valid chat colour?
dull python
#

No, it has nothing to do with third parties. I looked at the code of spigot and it also has the same judgment operation.

slender elbow
#

and what does your code look like?

#

player.sendMessage("§chello") works perfectly fine

dull python
#

I have tested it before asking, and there is no problem with using &, but there is a problem with §, just like you

slender elbow
#

please show some code

dull python
#

sender.sendMessage("§etest")

dull python
#

Very strange problem, I tested it before and it was broken, but now it is normal again.

#

Normally, it should output normally as you said, instead of reporting an error. Then, my paper core test reported an error yesterday, and it is normal again today.

young knoll
#

I don’t think CraftChatMessage#bungeeToVanilla even exists on spigot

dull python
#

Maybe I should ask the Leaf developers.

slender elbow
#

that would be pretty wise

tawny osprey
#
        World world = p.getWorld();

        List<BoundingBox> boxes = new ArrayList<>();
        for (Location eachBlock : locationsList) {
            BoundingBox box = new BoundingBox(eachBlock.getX()-1, eachBlock.getY(), eachBlock.getZ()-1,
                                            eachBlock.getX()+1,eachBlock.getY()+3, eachBlock.getZ()+1);
            boxes.add(box);
        }
        for (BoundingBox boxBlock : boxes) {
            for (Entity nearbyEntity : world.getNearbyEntities(boxBlock)) {
                nearbyEntity.getWorld().strikeLightning(nearbyEntity.getLocation());
            }
        }

    }```
short pilot
#

if you cancel the chatevent for a player, are there any ways they can bypass that and still send a message or communicate in chat

young knoll
#

If they have access to some sort of message command they could

#

Otherwise no

worldly ingot
young knoll
#

What about an asshole

#

I may be a hole filled with donkeys

worldly ingot
#

I guess I can't tell you what you are or aren't

slender elbow
#

I'm just emily idk

worldly ingot
#

Verifiable fact

young knoll
#

And yet they aren’t verified

#

Curious

umbral ridge
dull python
#

@slender elbowI found the problem. When he sent BaseComponent, suggest_command appeared &f. After careful investigation, I found that it was returned by the ComponentSerializer.parse method. After giving the {"text":""} parameter, I got &f instead of an empty text, which led to the illegal symbol.

#

This is very strange. If there was a problem, it should have appeared earlier, but it only appeared in 1.21. I am confused about this.

smoky anchor
#

changes happen

dull python
#

Are you talking about me?

smoky anchor
#

mainly the suggest command was changed, now it actually needs to be a command
tho idk what exactly you're trying to send

dull python
#

Yes, you are right, that is used to click to automatically write content in the chat bar, but because ComponentSerializer.parse returns &f, it is parsed as § and an error is reported. But what I don't understand is why it is not empty text, but a color.

thorn isle
#

components to legacy text parsing has always been finicky and sometimes straight up bad

#

that is definitely some kind of an implementation error

dull python
#

So I used ChatColor.stripColor to process it and it gave me &f&f, which became empty text after removing it.

#

I don't know if this problem will be fixed later (referring to the version that has stopped maintenance)

vast ledge
#

Just check if the string is empty?

slender elbow
#

if (string.isEmpty()) {
string is empty
}

#

that's epic

vast ledge
#

YAY

#

if(string.strip() == "") return "Empty"

#

or smth like thtat

thorn isle
#

that'd roughly be isBlank i think

slender elbow
#

yep

thorn isle
#

isEmpty is if length is 0

slender elbow
#

also string interning :Clueless:

quaint mantle
#

string.ameliorate()

dull python
#

The use of stripColor is just because the final result is &f, which causes the check § to report an error when json is sent

dull python
#

Found the reason, it is because of the color added in addFormat in TextComponent#toLegacyText method

quaint basin
#

.md5

#

.logs

tall plinth
#

Guys which APIs do you prefer for making GUIS

hollow gull
tall plinth
#

I see

hollow gull
#

Want a GitHub link?

tall plinth
#

Well I am trying rn IF GUI

tall plinth
#

Just wanna try all

#

And see which one suits me most

hollow gull
#

It does more than just guis aswell

tall plinth
#

I see

#

Will check it out

hollow gull
young knoll
#

That name…

hollow gull
tall plinth
hollow gull
tall plinth
#

So I might refrain from using the API

hollow gull
#

I honestly don’t know that much about him but the API is pretty good

tall plinth
hollow gull
#

It’s kinda weird but effective

tall plinth
#

I see

echo basalt
#

I usually just run my own

#

Every lib does things a lil different and most of them are a little too basic for my needs

tall plinth
echo basalt
#

Yeah

#

I needed some incredibly niche features

tall plinth
dawn flower
#

Is there an event for when the console executes a command in bungeecord? ChatEvent doesn't seem to trigger

stiff harbor
#

Anyone have an example of a working block cracking animation cancel? I've looked all over for how to stop block cracking animation but I can't seem to find an updated one or an older one that works.

stiff harbor
#

I’m not at my pc anymore but I think 1.21.0

chrome beacon
#

I see

#

You need to use Mining Fatigue 255

stiff harbor
#

Doesn’t that slow down the swinging animation?

chrome beacon
#

It doesn't

stiff harbor
#

So if I wanted to mine blocks slower and make the cracking animation take longer, I just adjust the mining fatigue and hide all portion effects?

chrome beacon
#

You're better off updating

#

since that's a builtin attribute now

stiff harbor
#

Oh I definitely will then, I just hadn’t updated my server at all

#

Where can I find the docs for the updated servers?

chrome beacon
#

?jd-s

undone axleBOT
stiff harbor
#

I’ll experiment with it tomorrow, but do you think that is the same as adding efficiency to the pickaxe? I ran into problems before that any pickaxe with efficiency 5+ and haste just insta broke blocks. I’m just trying to have more control over mining effectiveness

chrome beacon
#

If your mining speed is too high you will insta break blocks

#

you can reduce the block break speed to control that

#

or mining efficiency

#

though that might be a bit off due to latency. Maybe tweak the attribute modifier on the pickaxe itself

#

Feel free to ping me tomorrow if you need help with anything

stiff harbor
#

Nvm I found it, thanks. I’ll let you know what I get tomorrow

static osprey
#

Hi

#

Anyone plz give me item adder plugin

#

@everyone plz anyone give me item adder plugin

smoky anchor
static osprey
#

Plz help me

#

@smoky anchor

#

Plz

#

Plz steve

smoky anchor
#

Stop being annoying child

static osprey
#

Ok

smoky anchor
static osprey
#

Steve you can give me item adder plugin

rotund ravine
#

No

smoky anchor
#

oh wait that's the paid one, no

static osprey
#

But I saw in YouTube some are telling it is free but I open link it not opening only

#

Tera are some free item adder plugin also

#

So you can give me @smoky anchor

vast ledge
#

Bro is out here trying to get cracked plugins on the official Spigot discord

hollow gull
#

You have to buy them yourself

#

Using someone else’s copy is bannable

torn shuttle
#

?mappings

undone axleBOT
outer ember
#

yo
i have a problem with adding a plugin to my project
i added a plugin called Wanted to project structure > depandencies with compile scope
but when i reload my project with maven(compile included) the jar will disapear in depandencies

violet blade
#

Please dont promote piracy

outer ember
quasi gulch
quick parcel
#

🛠️ Join the ShardBound MMORPG Dev Team!

ShardBound MMORPG is a dark fantasy Minecraft MMORPG, fully custom, with rich lore, unique quests, and one-of-a-kind cosmetics. We’re looking for volunteer developers to help bring this world to life!

Roles Available:

Plugin / Spigot / Paper developers

Datapack creators

Modders (Forge/Fabric)

What you’ll do:

Implement custom mechanics, quests, bosses, and abilities

Create systems for items, events, and special cosmetics

Collaborate with lore writers, builders, and artists to integrate gameplay with story

Requirements:

Basic to advanced experience with Java, Minecraft plugin/modding, or datapacks

Willingness to work in a small volunteer team

Motivation to learn and contribute, even if you’re not an expert yet

What you get:

Portfolio credits and in-game recognition

Creative freedom to help shape a unique MMORPG world

Experience in collaborative Minecraft development

How to apply:
Just send me a DM using this format:

Discord Tag / Username:

Age:

Experience / Skills:

Availability:

Portfolio / Examples (if any):

What you hope to contribute:

“Help us bring ShardBound MMORPG to life — your code could shape the next great fantasy Minecraft world.”

bold nebula
# smoky anchor and does this command work ?

It does but i found a weird bug, i tried to apply this loop to an item. Lets say i hold right click and i move away from A location and then release the right click it teleport me back to A location

undone axleBOT
quick parcel
#

ty

smoky anchor
wraith delta
bold nebula
#

now that i remember, this excact bug happen when i tested teleport flags

smoky anchor
#

well that shouldn't be happening, wait a sec I'll check fixed bugs
'cause I think I recall some TP bugs being fixed

ancient imp
#

Hey eNot sure if this is the correct place for this, if not i will remove it, but I could really use some help with this.

I’m currently using the RivalPickaxe plugin together with JetsPrisonMines, both work perfectly on their own and even together.
Now, I wanted to add custom coin blocks inside my prison mines using ItemsAdder, and I managed to get that part working. However, there’s one issue: RivalPickaxes doesn’t recognize or mine the custom ItemsAdder blocks when they’re spawned by JetsPrisonMines.

If I mine the block with a vanilla pickaxe, everything works as expected, so the problem seems to be on the RivalPickaxes side.
I’ve been in contact with the Rival developer for about a year now. He keeps saying support will be added, but nothing has changed so far. So I’m reaching out here to see if anyone else can help or maybe provide a workaround.

This is pretty important for me since RivalPickaxes integrates with PlayerPoints, which is how I handle my coin system.
Any help or suggestions would be massively appreciated 🙏

smoky anchor
# bold nebula paper teleport flags

so somehow the command doesn't actually update the player position server side until the tping is done
which is really dumb, lemme test on 1.21.10

echo basalt
#

Or fork it and fix it yourself

#

?services

undone axleBOT
echo basalt
#

or check the pinned post on #general

ancient imp
#

Thanks!

smoky anchor
smoky anchor
#

Well in that case - I'm out of ideas

bold nebula
#

My only option is nms

#

i think that server is using nms packets

stiff harbor
chrome beacon
#

Get the attribute instance then either add a modifier or change the base value

alpine solar
thorn isle
#

shartbound

potent crescent
hardy spoke
#

Hey, is there any way to check if a player has an inventory open currently?

hardy spoke
thorn isle
#

there's a method to get the player's current inventory(view)

#

call it and check if it's the players own inventory; if it isn't, the player has an inventory menu open

#

if it is, the player may or may not be looking at their own inventory

hardy spoke
#

The method returns the players own inventory if none is open. But the problem is that I am trying to fix a bug, that also occurs in the players own inventory. In any inventory from which you can drop items.

chrome beacon
#

The server doesn't really know when the player has their inventory open

hardy spoke
#

yeah, I figured...

stiff harbor
hardy spoke
#

I'm scared of that being unreliable

stiff harbor
#

On a larger scale idk but I did something similar in my last plugins

hardy spoke
#

Mhh. I'll try it. Just gotta do lots of testing then. Anyway, thanks for the help

chrome beacon
#

Mind telling us what the exact issue you're trying to solve is

#

perhaps there's a better way of fixing it

hardy spoke
#

I have a selection item, similar to the wand in WorldEdit. To detect if it has been clicked or not it listens to the PlayerInteractEvent and specifically Action.LEFT_CLICK_AIR and Action.LEFT_CLICK_BLOCK.

Problem is, if you drop an item from your inventory while having the tool selected in your main hand, it triggers for some reason. So my solution was to block the tool from being used while an inventory is open.

thorn isle
#

rather than that, i'd maybe listen to the item drop event and ignore the interact event if an item was dropped in the same tick

hardy spoke
#

Yeah... that could also work maybe

thorn isle
#

you can't for certain tell if a player is looking at an inventory or not, since the client simply doesn't tell the server when it opens/closes the player inventory menu

#

well, i recall there being some hack that involved listening to the "taking inventory" advancement being completed and immediately resetting it, but that isn't ideal

hardy spoke
#

Yeah, I wouldn't do that either

#

Your solution probably makes a lot more sense

#

Thanks

stiff harbor
#

Holy Olivo I'm finally editing the values correctly and changing mining speed. Right now I have it set to a static number but it seems to be working as I need it

#

For a while I was trying to block or edit the animation packets being sent to the player but lets just say that doesnt work

chrome beacon
#

nice

#

There actually is a trick to do the animation packets which is what I was talking about yesterday

#

Basically you give mining fatigue to stop the block from breaking on the client. Then from the server you manually send the correct block break animation with a different players id and then handle the block mining entirely server side

stiff harbor
#

ahhh ok

chrome beacon
#

That's how you'd do it in older versions and it's a lot more work since you basically need to rewrite the entire mining system to make that work relatively smoothly

thorn isle
#

doesn't mining fatigue make the arm item swinging animation much slower

stiff harbor
#

I for the life of me couldnt figure out how to block the packet

chrome beacon
#

basically send mining fatigue 255

outer ember
#

I have a question
That REALY REALY matters.
How to debug my codes?

99% Commands of my plugins not working with error : an error ...

quaint mantle
#

Helpful

buoyant viper
#

and then u look on stackoverflow :LeTroll:

#

but fr stacktraces are your frienemy

mortal vortex
#

claude, analyse my stacktrace

claude:

quaint mantle
#

Ai, fix

buoyant viper
#

computer, compute

quaint mantle
#

Jarvis, engage the ragebait protocol

mortal vortex
#

Is it safe to delete Jetbrain caches from /home/<me>/Library/Caches?

quaint mantle
#

Yes

#

But the cache will need to be rebuilt anyway

slender elbow
#

/home/me :(
~me :)

mortal vortex
#

~me would /home/me/me

young knoll
#

Heh, me/me

buoyant viper
#

useradd -D me 🤞🏻

tall plinth
#

are schedulesyncrepeatingtask aka runnables good for efficient updating of stuffs

#

like updting items and titles in a gui according to different conditions

violet blade
#

this feels like an xy problem

tall plinth
young knoll
#

Can you even modify items in a gui async

tall plinth
#

this is what i made ( textures will be changed ) , a feature involving changes in title ( custom fonts if yk abt them ) and item lore change

tall plinth
slender elbow
#

~foo is /home/foo

violet blade
slender elbow
#

~ is self but you can also do ~someuser

tall plinth
violet blade
#

you are rebuilding the whole inventory every time?

#

and inside a command executor?

tall plinth
#

no

tall plinth
tall plinth
#

but the gui variable and strings for title are outside of it

violet blade
tall plinth
#

actually not an issue rather suggestions like how i can improve my code further

#

like it works but will runnable cause glitches or memoery leaks for updating the gui

violet blade
#

well it will glitch because its hammering the main thread every time its updating

tall plinth
tall plinth
violet blade
#

i think you could keep an async task but like, read-only, checking the items inside of the inventory and just kick an update (sepparated, in sync) only when it needs to

tall plinth
violet blade
tall plinth
violet blade
#

every creation and modification of the inventory should be in sync, this async is just to check changes in the inventory

#

so you dont have a constant clock in your background updating your main thread when it doesn't need to

tall plinth
#

hm

#

got it thanks a bunch

lime pulsar
#

org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!

#

hrm forgot how to not spam code...

#

its just basic listeners all right out of the api

#

no wonky stuff

hybrid spoke
lime pulsar
#

i have never done anything that required a handlerlist

#

its just basic stuff

#

<code> @EventHandler
void onBlockBreakEvent(BlockBreakEvent event) {
Player player = event.getPlayer();
if (player.getWorld() == plugin.getSpawnWorld()) {
if (player.hasPermission("voidspawm.editspawn"))
return;
else
event.setCancelled(true);
}
}
</code>

#

maybe im just loading it too soon

mortal vortex
#

send it.

#

Error means you tried to register a base event class instead of a proper subclass that has a getHandlerList() method. But the event you did was a proper subclass, so you probably have a problem where you're registering it.

lime pulsar
#

@Override
public void onEnable() {
reloadConfig();
String spawnWorldName = getSpawnWorldName();
spawnWorld = getServer().getWorld(spawnWorldName);
if (spawnWorld == null)
new BukkitRunnable() {
@Override
public void run() {
createVoidWorld(spawnWorldName);
cancel();
}
}.runTaskLater(this, 1);

    String rtpWorldName = getRTPWorldName();
    rtpWorld = getServer().getWorld(rtpWorldName);
    if (rtpWorld == null)
        new BukkitRunnable() {
            @Override
            public void run() {
                createWorld(rtpWorldName);
                cancel();
            }
        }.runTaskLater(this, 1);

    if (!getConfig().contains("max-step")) {
        getConfig().set("max-step", 5000);
        saveConfig();
    }
    maxStep = getConfig().getInt("max-step");

    File spigotFile = new File(getDataFolder().getParentFile().getParentFile(), "spigot.yml");
    YamlConfiguration spigotConfig = YamlConfiguration.loadConfiguration(spigotFile);
    spigotUnknownCommand = spigotConfig.getString("messages.unknown-command");

    getServer().getPluginManager().registerEvents(new VoidSpawnListener(this), this);
    getServer().getPluginManager().registerEvents(new SpawnProtection(this), this);
}
hybrid spoke
#

?paste

undone axleBOT
hybrid spoke
#

we would need the voidspawnlistener and spawnprotection classes

mortal vortex
#

Yes lol

#

you are probably registering a base class

lime pulsar
mortal vortex
#

other classes man

hybrid spoke
#

no need to stress him lol

mortal vortex
#

I'm not? Watch yourself bud.

lime pulsar
#

this is the newest class

hybrid spoke
#

looks fine to me, can you send us the full stacktrace please?

lime pulsar
#

if i remove the SpawnProtection listener the error goes away...

mortal vortex
#

getEntity does not return a Player

#

it returns a Hanging

hybrid spoke
#

it could be the PlayerBucketEvent, since that is an abstract event

#

maybe try to listen to bucketempty and bucketfill instead

lime pulsar
#

oooo

#

ok yea the bucket thing makes since

#

and the hanging thing thats a bug on my part but it should just not work not cause an error

hybrid spoke
#

exactly, but it will throw an exception most likely, so keep that in mind

lime pulsar
#

thank you I'll try fixing the bucket

mortal vortex
#

also use HangingBreakByEntityEvent

lime pulsar
#

yes I just changed it to that

mortal vortex
#

aight now as a service charge, going to need you to donate to Children in Gaza.

lime pulsar
#

ok sanity restored, thank you so much peoples 🙂

#

Heh my wife has been donating to some gaza charity every 2 weeks when she gets paid dunno if its children though

mortal vortex
#

Good!

thorn isle
# tall plinth check this

now instead of having those comically tall up/down arrows for scrolling, make it a handlebar with the arrows at the top/bottom only and a rivet in the middle that moves/scales to indicate where your viewport is; like in normal scrollable guis in real life interfaces

#

looks good apart from that

#

editing inventories async is iirc "safe" in that the backing structure for them is synchronized somewhere, but there's no way to do atomic operations to, e.g. "check if inventory has x of y and remove it if it does"; another thread can change the contents in between the check and the set (removal)

tall plinth
tall plinth
echo basalt
#

Basic ass menu

#

🙄

tall plinth
#

lol

#

yeh

#

for my purpose i dont need complex ones

tall plinth
#

so for my purpose i dont need them to be inside the runnable

#

i just update the item lore and the title thats it nothing much complex

faint tide
#

helleuh, I might be asking for the obvious but I seem to be blind.

I've got a minigame plugin and I am implementing custom rewards. Part of this is that I want to give the server admin creative control over the rewards, so I want the admin to be able to make custom rewards by adding the option to run commands.

I got the configuration part, but how does one run a command? I think this is something pretty obvious but my google searches only mount to "spigot command creation", which is not what I want. I want command execution

thorn isle
#

Bukkit.getServer().dispatchCommand() iirc

#

you typically pass it the console command sender which you also get from bukkit/server

faint tide
#

Awesome! this is exactly what i was looking for, thanks!

tacit estuary
#

does anyone know a good gui library for making a trading UI

tall plinth
chrome beacon
#

?gui

glacial narwhal
#

Hello, did the bungee-chat 1.8 artifact get removed from the repo?

#

Is there anything that i could use as a replacement?

chrome beacon
waxen hound
#

hi, does anyone know how to send an entity metadata packet using protocollib for modern versions

chrome beacon
#

?mappings

undone axleBOT
chrome beacon
#

take a look at the packets format here ^^

waxen hound
#

are these classes

chrome beacon
#

ProtocolLib is just a reflection based wrapper

waxen hound
#

ik the packet format as it hasnt really changed since 1.8

chrome beacon
#

If you know what the packet format is then just get/write the data it contains

waxen hound
#
    private void updatePlayerLine(@NotNull Player ply, @NotNull Entity entity) {
        PacketContainer packet = ProtocolLibrary.getProtocolManager()
                .createPacket(PacketType.Play.Server.ENTITY_METADATA);
        StructureModifier<List<WrappedDataValue>> watchableAccessor = packet.getDataValueCollectionModifier();

        packet.getIntegers().write(0, entity.getEntityId());

        WrappedDataWatcher.Serializer chatSerializer = WrappedDataWatcher.Registry.getChatComponentSerializer(true);
        Component component = this.generateLine(ply, entity);
        String json = GsonComponentSerializer.gson().serialize(component);

        watchableAccessor.write(0, List.of(new WrappedDataValue(2, chatSerializer, Optional.of(WrappedChatComponent.fromJson(json).getHandle()))));
        ProtocolLibrary.getProtocolManager().sendServerPacket(ply, packet);
    }
#

this doesnt crash my client but it doesnt update the name either

#

it has a name, already so i shouldnt have to set the customnamevisible flag

#

but i also tried that and it still didnt work

chrome beacon
#

Are you capturing outgoing packets as well?

waxen hound
#

yeah, which works fine

#

im implementing a leaderboard that players can customize

#

(f.ex. displaying different time periods)

#

when the player joins they have the correct leaderboard visible, but it doesnt update after this

#
    @Override
    public void onPacketSending(PacketEvent event) {
        PacketContainer packet = event.getPacket();
 
        Entity target = packet.getEntityModifier(event.getPlayer().getWorld()).read(0);
        Player ply = event.getPlayer(); 
        if(target == null) {
            return;
        }

        LeaderboardHologram holo = this.leaderboardManager.getHologram(target);
        if(holo == null) {
            return;
        }
 
        Component component = holo.generateLine(ply, target);
        String json = GsonComponentSerializer.gson().serialize(component);

        List<WrappedDataValue> values = packet.getDataValueCollectionModifier().read(0);
        values.get(1).setValue(Optional.of(WrappedChatComponent.fromJson(json)));
        packet.getDataValueCollectionModifier().write(0, values);
    }
``` (this works)
chrome beacon
#

Try removing getHandle from WrappedChatComponent

waxen hound
#

this causes the client to crash

#

ill get the error for u 1 sec

#
io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:set_entity_data'
        at net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:62)
#
Caused by: java.lang.ClassCastException: class com.comphenix.protocol.wrappers.WrappedChatComponent cannot be cast to class net.minecraft.network.chat.Component (com.comphenix.protocol.wrappers.WrappedChatComponent is in unnamed module of loader 'ProtocolLib (5) (1).jar'
chrome beacon
#

What version are you on?

waxen hound
#

1.21.10

#

i think we might be still on a protocollib version compiled for 1.21.9

weak wasp
#

I'm making a sort of Twitch integration plugin. Currently I have done the OAth2, you can use the command msg to send a message in Minecraft to your Twitch chat and next I will be adding in events that will run a command when people follow or subscribe and other things. After that it's integrating ranks for followers / subscribers.

You think people will use it / will you use it?

#

And also if you have any feature ideas let me know...

chrome beacon
#

Someone might 🤷‍♂️

opaque osprey
#

Anyone know where to find (if it exists) the lastest protocollib version compatable with mc version 1.21.8?

rotund ravine
#

Did you google it

opaque osprey
weak wasp
#

People say PacketEvents is better

#

Haven't used it myself

opaque osprey
#

Ill give that a try then

chrome beacon
opaque osprey
#

I see now, thanks!

sullen marlin
#

Because there's other requirements and also you might not have waited more than 3 seconds

#

The page is pretty clear

weak wasp
#

So many people only in it for da monies

#

I can post premium resources and I didn't even try...

mortal vortex
#

I can post resources and i dont even.

echo basalt
#

the only time I sold a premium resource was when I paywalled src

#

and the guy was also a developer

#

just wanted to see how I handled data saving

summer scroll
#

Hey guys, any recommended open-source wiki/docs project that has built-in editor?

#

Trying to create wiki for my plugins and want one of my friend to help me to create the wiki.

weak wasp
echo basalt
#

🙄

#

was doing mysql with locks

#

to avoid race conditions

#

and using redis and whatever

weak wasp
#

Ah fancy data handling

#

I'm working on a plugin right now and am thinking about making it premium so maybe I shouldn't judge...

#

Or maybe free i duno

#

... I just know if I make it free someone will copy it and make a premium version

umbral olive
#

would anyone know why PlayerSpawnLocationEvent never gets called? im only getting AsyncPlayerPreLoginEvent and PlayerJoinEvent when joining

weak wasp
#

I have no idea unfortunately

mortal vortex
#

Each page is just markdown and can be editted on GitHub

#

its better than an integrated editor bbecause version control

summer scroll
mortal vortex
outer ember
#

How big plugins like essentials,vault,luckperms etc.
store datas like hashmaps?

smoky anchor
#

probably a database ?

sullen marlin
#

Essentials uses yaml files last I checked; vault doesn't store anything; luckperms various.

But in memory all some firm of hashmap likely

quasi gulch
thorn isle
#

Using the player PDC for anything is almost always a mistake

mortal vortex
#

all my plugin's data is stored in a block, at 0,240,0

young knoll
#

What’s wrong with the PDC

onyx fjord
#

not that easy to see all the data

#

unlike db table or usm

young knoll
#

Pfft who needs to see data

onyx fjord
#

good for identifying an item or storing temporary data

#

just tagging in general

young knoll
#

I can feel the data in my bones

thorn isle
#

it's also impossible to clean up, and doesn't really support useful data formats (half of the time you will be encoding shit as base64 strings or json strings)

#

unless you're on paper you won't be able to access data for offline players at all, and even on paper that's read-only i think

young knoll
#

I mean, the primitive types are useful data formats

thorn isle
#

it's super convenient but also a trap, in the sense that once you use it and need anything it doesn't support well (i.e. anything more complex than primitives), it's very difficult to move away from it

eternal night
#

PDC for like

young knoll
#

Does sql even support that many other data types

eternal night
#

gameplay related data is just ass

thorn isle
#

it doesn't in most flavors, but it checks every other box

eternal night
#

but that is a given considering that the storage is so tightly bound to the lifecycle of an entity

#

"Who has the most kills", lemme just load all offline players and read their PDC

young knoll
#

Well yeah if you need anything like that it isn’t good

eternal night
#

"I wanna migrate my data format", lemme just read all offline players

young knoll
#

But if you just need to store something persistent on a player it’s nice

eternal night
#

Yea

thorn isle
#

sure, but needs evolve

eternal night
#

Something small, something throw away, perfect

thorn isle
#

that something simple and persistent might be needed somewhere else later, like statistics

#

or it may become more complicated and need a better representation

#

in my experience, of the many times i've used the player pdc for anything that isn't very very transient (at which point maybe metadata is better), i've always regretted it and felt i've painted myself into a corner

young knoll
#

I throw some per player settings in it for one of my plugins

eternal night
#

Yea I have it for settings too

thorn isle
#

i did too, then i needed them to be network wide

torn shuttle
#

hm I wonder if we could train ai to do image compression, what that would look like

#

technically there's ai upscaling but I don't know that I've seen someone trying to reduce fize size with ai

waxen hound
#

pied piper

placid rivet
#

how can i install fawe as an api for my plugin?

onyx fjord
#

you just use worldedit api i think

placid rivet
#

should i just add the dependencies and repository text or install something?

pseudo hazel
#

yeah just add it to the deps

placid rivet
#
#

i get these issues

#

should i just the fawe core or fawe bukkit and core

pseudo hazel
#

can you show your config file?

placid rivet
#

config of the plugin?

pseudo hazel
#

yeah the maven build file

#

where you put the dependency

potent crescent
#

worng pom. xml

pseudo hazel
#

its been years since I have used maven haha

placid rivet
#

so what should i do

pseudo hazel
#

..

#

send the pom.xml that you have so we can read whats wrong?

placid rivet
#

i dmed it to u

#

i can't send it here

potent atlas
#

pastebin

placid rivet
#

it's too big and i can't send txt files

pseudo hazel
#

?paste

undone axleBOT
placid rivet
pseudo hazel
#

the fawe dep is not inside the list of dependencies

potent atlas
#

When you're done with that
My custom warden insists on despawning after its 60 seconds if I restart the server. I've tried several methods of making it persistent. Does anyone know of any besides these?

  • warden.setPersistent(true)
  • nms get brain and clear all behavior on spawn
  • clear it again in the entity change pose event which fires when the warden burrows

It's fine until the server restarts. Would really like it to survive that.

placid rivet
#

should i just add separately everything to my normal code

#

?

pseudo hazel
#

well they messed it up

#

iirc its supposed to be in a dependencies tag

#

dependencies-> dependency

placid rivet
#

so i just change the name dependencies to dependency

potent crescent
#

?tryandsee

undone axleBOT
placid rivet
#

oh i got it

potent atlas
#

okay so... about my warden?

pseudo hazel
#

not sure, could be a bug

#

did you try a nametag?

potent atlas
#

nah. I haven't tried manually naming it. that would not be ideal because it's spawned out of a custom spawn egg and I'd have to go rename it every time

pseudo hazel
#

well I am fairly it just sets persistent to true when using a nametag, but if it works, then you can look at how it works and replicate that in the plugin

#

maybe its just a bug

placid rivet
#

going back to me it doesn't give me any error but i still can't use fawe

thorn isle
potent atlas
#

I've got an idea for the warden. brb

thorn isle
#

the crummy 1.5gb open source llama models are strange hybrid between babel's library and a 1.5gb lossy archive of all text ever written by anyone so far

#

with a little bit of luck you can extract the bible and several other books out of it, at a compression factor far higher than any conventional algorithm

#

for images, i'm not too sure; technically the tokenized form of an image is it being compressed, but i think that might be a one-way process for most models

placid rivet
#

the pom.xml for fawe doesn't give out any issues, but i still can't use any fawe methods

#

how to fix it

#

?

chrome beacon
#

What happens when you try to use their api?

thorn isle
#

send your updated pom.xml

#

the last one you sent was botched

placid rivet
potent atlas
#

Warden no longer despawns ^-^ had to use EntitiesLoadEvent

placid rivet
topaz cape
#

yo i heard mojang changed up AuthLib again but alot of changes this time, anybody know what changed?

sullen marlin
#

?xy

undone axleBOT
placid rivet
#

https://pastebin.com/1xV9sWTp
i fixed some things and now there's no errors and it shows that fawe is installed as core and bukkit version in maven dependencies but i still can't import anything from fawe / worldedit

placid rivet
#

okay, ty

orchid bison
#

ello, mind if i ask. what version did ItemModel released on Spigot?

pseudo hazel
#

do you mean ItemDisplay?

#

or do you mean the setItemModel for an item

#

iirc item displays got added in 1.19.4 and this version of setItemModel is probably like 1.20.5 or later I cant remember

orchid bison
pseudo hazel
#

I think before it was a string but it got changed to a namespaced key because of how vanilla does it

orchid bison
#

Yeah, I'm currently making a plugin using that and I do need it to support to all version soo yeah I need to check what version did that API released.

#

But thank you tho

pseudo hazel
#

its pretty recent

orchid bison
#

Like in 1.21.x?

eternal oxide
#

just check if the class exists before using

pseudo hazel
#

yeah maybe , def after 1.20.5

orchid bison
#

Alrighty

#

Thanks!

surreal wadi
#

anyone how to add model to a custom item i mean i have a model which work in item adder but i want to add it to a custom item which have power so how do i do it

sly topaz
sly topaz
#

you do have to send a resource pack with the model to the client, though

timid hedge
sly topaz
#

if you're lucky just using the latest build there might work

timid hedge
clear elm
#

Hey, how can i remove the warning?

thorn isle
#

go in survival mode and/or deop yourself

sly topaz
#

is that actually a minecraft thing

thorn isle
#

yeah

clear elm
thorn isle
#

i don't remember exactly what about an item triggers it, i think a tile entity in the item data

#

e.g. a spawner with the mob type set

sly topaz
#

though ideally, you shouldn't have operators in the server

clear elm
#

Hm, ig aslong it doesnt show to regular players its fine

wraith delta
#

its dedicatingly to /op

thorn isle
#

regular survival players won't see it, but i'm not sure whether it's being op or being creative or being both that triggers it

sly topaz
#

Tooltip contexts have both an advanced and creative flag so it might just be both

thorn isle
#

advanced is i think the f3+h advanced tooltips setting

wraith delta
#

Even if you have * perm and creative mode its not going to show. you need /op. It will show regardless of survival or creative as long as you have /op

sly topaz
#

so it is just dependent on the op level huh

wraith delta
#

yea

#

and hiding additional tooltips with attributes wont get rid of it

violet blade
#

that doesnt make sense, why would a warning like that only be available to Ops

thorn isle
#

that's the main target group for "forceop book" style exploits

#

you can do it for not-op players as well, but what are you going to make them execute? /me?

violet blade
#

yeah but still its kinda pointless imo

thorn isle
#

this app could harm your pc

wooden furnace
#

Cannot use setOwnerProfile on player's own profile on 1.21.10 (4541-Spigot-6e369ba-aa5381f).

Caused by: java.lang.IllegalArgumentException: The skull profile is missing a name or textures!
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[guava-33.3.1-jre.jar:?]
        at org.bukkit.craftbukkit.v1_21_R6.profile.CraftPlayerProfile.validateSkullProfile(CraftPlayerProfile.java:53) ~[spigot-1.21.10-R0.1-SNAPSHOT.jar:4541-Spigot-6e369ba-aa5381f]
        at org.bukkit.craftbukkit.v1_21_R6.inventory.CraftMetaSkull.setOwnerProfile(CraftMetaSkull.java:204) ~[spigot-1.21.10-R0.1-SNAPSHOT.jar:4541-Spigot-6e369ba-aa5381f]
        at se.file14.procosmetics.util.item.ItemBuilderImpl.lambda$setSkullOwner$12(ItemBuilderImpl.java:279) ~[?:?]
        at se.file14.procosmetics.util.item.ItemBuilderImpl.modifyItemMeta(ItemBuilderImpl.java:327) ~[?:?]
#

(Works on Paper, but broken on Spigot atm)

sly topaz
#

?jira

undone axleBOT
sly topaz
#

that being said, does the setOwningPlayer method work properly?

wooden furnace
wooden furnace
mortal hare
#

i've underestimated KVM/QEMU Windows VM speed. Its more than capable of running simple programs like MS Office or photoshop. You can even use single gpu passthrough to make it run gpu intensive tasks

#

awesome

ivory sleet
bright spire
#

Guys where do i check all protocol ids? wiki.vg is dead!

ivory sleet
#

i got moved right?

#

like to minecrafts wiki site

bright spire
#

you nailed it. is there a way to see for specific versions? I need to map from 1.21.10 to 1.8 packetplayintransaction and clienttickend also ping and pong

ivory sleet
#

it should have a protocol history

bright spire
#

nice

#

I will check

ivory sleet
#

oh ye here i think?

bright spire
#

nope

ivory sleet
#

oh wait here

#

fk

sly topaz
#

snapshot versions of course don't have one

ivory sleet
#

ye thats the one

bright spire
#

Hmmm

ivory sleet
#

page <<

bright spire
#

they all take to the same page

ivory sleet
#

nope

bright spire
#

ah nvm

#

thank you

#

now lets get into mapping lol

sly topaz
ivory sleet
#

yea

#

reasonable to be the root of the issue

sly topaz
#

and since CraftPlayerProfile#buildResolveableProfile expects a full GameProfile, it ends up like that

#

I am not too sure but it probably can be solved by just changing the returned ResolveableProfile.Static to return a partial profile instead of a full one, though I don't know why md made it so it always return a partial profile when the server has resolved the gameprofile anyway

#

I guess in a near future it'll be made so no profiles are resolved on the server maybe? Idk

ivory sleet
#

or whatever the method call

sly topaz
#

yeah, CraftPlayerProfile#validateSkullProfile or something like that

bright spire
#

Guys what the actual name in wiki.vg for the PacketPlayInTransaction?

#

Like I see confirm transaction but the description doesnt seem like its the one

#

It seems like transaction confirm is the correct one

#

Based on a excel i found on internet loll

torn shuttle
#

is ther an easy way to get a player's body yaw?

#

I know there is a non easy way

#

I've done it

#

but I was wondering via api

bright spire
# bright spire Guys what the actual name in wiki.vg for the PacketPlayInTransaction?
sly topaz
#

if you don't mind using internals it isn't hard tho, just nms.LivingEntity#getBodyYaw

wraith dragon
#

hey guys, just curious, is there any resource to learn about when to use factory, registry, controller, lifecycle, or any of the fancy terms? Its getting kinda annoying putting everything into one manager class :/

echo basalt
#

you're fine to just stick 90% of things in a single class if it means achieving the result you want

wraith dragon
#

Ah I see, but I think having things separated out is always the best approach no? Single responsibility class type shii

echo basalt
#

Different data structures and patterns are suitable for different things and it's more of a matter of how much you'd like to enforce the standards

#

at the end of the day you spend 3x the time to achieve the same result

#

But hey if you'd like to learn then sure

#

A registry holds data (usually identified by a key)

#

A factory transforms data in a polymorphic way

sly topaz
echo basalt
#

For example, if you have a Reward interface with different implementations, like CommandReward, CoinsEngineReward, ItemReward etc

#

And you'd like to load it from a shared medium (like a ConfigurationSection)

#

You could define a "factory interface", have a registry of them

#

and the factory interface converts the data into that impl of the interface

wraith dragon
#

this is all really cool stuff, really interested to see how I could start implementing it into my projects

#

I got this idea when looking at your minigame demo sample code, super well structured btw

echo basalt
#

I wrote that forever ago

#
public interface RewardType {
  Iterable<Reward> create(ConfigurationSection node, String key);
}
public class CommandReward implements Reward {

  public static final RewardType TYPE = new CommandRewardType();

  private final String command;

  private CommandReward(String command) {
    this.command = command
  }
  
  ...

  public static class CommandRewardType implements RewardType { // can this be private?

    @Override
    public Iterable<Reward> create(ConfigurationSection node, String key) {
      List<Reward> rewards = new ArrayList<>();

      for (Stirng command : node.getStringList("commands")) {  
        rewards.add(new CommandReward(command));
      }
      
      return rewards;
  }
}  
public final class RewardTypes {

  private static final Map<String, RewardType> TYPES = new HashMap<>();

  public static RewardType get(String name) {
    return TYPES.get(name);
  }

  public static RewardType register(String key, RewardType type) {
    TYPES.put(key, type);
    return type;
  }

  private RewardTypes() {
    // Prevent init
  }

  public static final RewardType COMMAND = register("command", CommandReward.TYPE);

}
sly topaz
wraith dragon
#

the support in this server is insane

echo basalt
#

Something like that

#

is a registry + factory polymorphic kinda deal

#

or you can save 15 minutes of your life and just

List<String> commands = config.getStringList("commands");

for (String command : commands) {
  Bukkit.dispatchCommand(..., command);
}
#

it's uglier and less elegant but gets to the point 10x faster

#

the main drawback being that the imaginary developer that'll totally hook custom rewards into your plugin cant add them anymore

echo basalt
#

but who are we kidding it'll probably be you anyways

wraith dragon
#

but its definitely nice to have more scalability in the future, even if it is a personal project

#

practice ig

echo basalt
#

it makes the code fancy

wraith dragon
#

in short, yes

echo basalt
#

and impresses whoever's reading your github projects

sly topaz
echo basalt
#

hurray

wraith dragon
sly topaz
#

I had to check to make sure lol

echo basalt
#

It's 6:30am I'm watching shows off my laptop aint no way im testing it

sly topaz
#

jshell makes it very easy tho (also 02:25am here)

ancient plank
#

I've been on a teaching trend for java lately

echo basalt
#

In practice a registry of factories can also be considered to be the "strategy pattern"

wraith dragon
echo basalt
#

We have a common reward interface and discrete factories for creating that given type of reward

#

We then have a registry of those types

wraith dragon
#

@echo basalt would you be down to teach me this design pattern by breaking down a project that I made? I'm not done yet, just asking for future purposes. If you don't mind ofc

echo basalt
#

Uh

#

what like a "how would you do this" kind of thing?

wraith dragon
#

lemme rephrase

#

so im jumbling everything into my manager class rn

#

and I would like to know how and when to separate the roles into diff classes

#

ok so now that I'm explaining it, kinda sounds stupid

echo basalt
#

Practice is the best teacher out there

#

Turn the class into an interface

#

the first impl is how you have it done right now

#

make a second impl and make it better than the first

#

if you're not happy with the second impl think real hard about why

#

and make a third impl that fixes that

wraith dragon
#

should I first get it working then do the abstraction or the other way around?

echo basalt
#

Think of the ideal API and then build towards it

#

make a mental model of all the different components you have

#

what creates them, what uses them

#

Sometimes different concepts are just the same abstraction applied in different ways

wraith dragon
#

that's interesting

#

time really is the main factor here

echo basalt
#

Abilities and quests are fundamentally the same base but applied in a different way

#

something happens -> runs through some filters -> runs an action

wraith dragon
#

yeah wait

#

yeahh

echo basalt
#

That action can be rewarding you with some exp, launching a fireball or changing the state from on -> off

wraith dragon
#

if you put it that way, a lot of things really build on simple conditions and actions

echo basalt
#

but understanding that "common dna" is the icky part

#

and you should know all of it to write a good abstraction

wraith dragon
#

that's where practice comes in

echo basalt
#

practice and intuition

#

Back on the rewards topic I start by knowing the different kinds of rewards I'll need

#

and I also know I have to load them from a config somehow

#

So I make a class for each kind

#

and I make an interface they all share

wraith dragon
#

kinda like a blueprint

echo basalt
#

Each kind loads its data in a different way

#

so I need something to represent that

wraith dragon
#

then every class has a different shaped house but same foundation

#

sorry to interrupt, please continue

echo basalt
#

when in doubt, make interfaces

#

write some demo code on how things would work on an ideal scenario

#

You can even leave it in and revisit later if it feels overengineered

#

I have some at work myself

wraith dragon
#

that's pretty cool, so you make sure to not stray from the original path

echo basalt
wraith dragon
#

I see

#

so you already have a more complex solution for that method?

echo basalt
#

Uh no

#

The current impl goes like

#

if type is number
result.add(sum(one, two))
else
result.add(overrideValue(one, two))

#

it does the same with 3x less work because I haven't reached the scenario where I need the elegant overegineered one

wraith dragon
#

ohh

#

I think I'm starting to see it now

#

I guess I should just start on making things work, then finding ways to abstract it and make diff implementations

#

then just build from there

echo basalt
#

You should always find a good approach

wraith dragon
#

definitely not going to learn this design overnight thats for sure

echo basalt
#

finding a great / the best approach is just icing on the cake

#

but don't settle for mid

wraith dragon
#

how are you supposed to differentiate between good and great?

echo basalt
#

pride

#

You feel happy about good code but you feel prideful about finding the bestest solution

wraith dragon
#

I'm a victim to the second one

#

premature optimization is my worst enemy

echo basalt
#

There's no pride in premature optimization

#

Write code with a standard of performance in mind and optimize if it's a problem

wraith dragon
#

🙏 thanks for the advice

polar heart
#

I need a dev

mortal vortex
# polar heart I need a dev

if only this channel was called "help-a-homie-out-finding-a-developer-please-i-do-not-have-the-technical-ability-to-check-spigot-forums-if-perhaps-there-is-a-place-to-find-developers" and not "help-development" 😕

polar heart
#

for a comission is payed

mortal vortex
#

r u a moron?

polar heart
#

?

mortal vortex
#

irregardless. is this channel called, or baring a description that has ANYTHING to do with recruiting a developer?

polar heart
#

Theres no channels like that idk

#

In here theres a lot of ppl that do know coding then why ur mad from me to ask that

mortal vortex
eternal oxide
#

?services

undone axleBOT
mortal vortex
#

could u not read this?

polar heart
#

I am not reading a message that of someone is being sarcastic with me

#

U could just typed this and i leaved

polar heart
tranquil ferry
#

@vagrant stratus sorry for the ping but how to transfer a my paid resource to another dev as i want him to maintain the plugin from now

wet breach
#

I have personally taken control of others resources and given them back so its really easy to do 🙂

timid hedge
#

If i want to make some .yml files for my plugin can i do it with just making the code that makes all the files do i need to make the 1st file (config.yml) in the resource folder? or can i just make all files in code

drowsy helm
timid hedge
thorn isle
#

what was that plugin again with the animated structures

#

the thing with like doors and windmills and shit

young knoll
#

There’s a plugin for that?

thorn isle
#

yeees

#

it was called animated something

young knoll
#

I only know of the create mod :p

thorn isle
#

found it

#

looks like it's still alive too

#

nice

young knoll
#

Neat

#

Display entities go brrr

thorn isle
#

looks kind of jittery in the video, i guess they don't have interpolation set

umbral ridge
#

that could be done better @wet breach

#

i am dissapointed

#

its hardcoded

#

😿

wet breach
#

because for my purposes it didn't need to be dynamic

timid hedge
wet breach
#

nice, you are on the right path it seems

umbral ridge
#

secret package codes

wet breach
#

my way I showed is not the only way to do it as someone has noted, but it is one of the easiest 😉

wet breach
# umbral ridge secret package codes

Hawkfalcon originally created ServerTutorial. After some time he became busy in real life and since the majority of the project was my code anyways gave me full rights. I just never bothered to change the package naming

timid hedge
#

is there a good place to look up if i need help with something like this again? because i dont know where to look or ask

umbral ridge
#

ahh i see

wet breach
#

Here is a good place to ask 🙂

#

sometimes spigot forums has some stuff too

timid hedge
#

alr thx

umbral ridge
#

🍔

wet breach
#

original repo

umbral ridge
#

nice

#

a few tutorial classes

wet breach
#

Both Hawkfalcon and myself used to be bukkit dev staff, that is how I was introduced to his project

umbral ridge
#

how's bukkit doing nowdays?

thorn isle
#

no images on the readme boo

wet breach
#

have no idea, haven't been on those forums in years

#

I have thought about taking over bukkit though a few times, but I don't really have the time to do that nor a sufficient group for it

#

as far as I am aware bukkit is still technically up for grabs

umbral ridge
#

hmm

thorn isle
#

okay it turns out i don't like the way how animated architecture does the animations

#

what they do is they manually adjust the rotation and translation transforms of the blocks to make them appear to rotate around a point

thorn isle
#

this means that having any interpolation is going to have artifacts, so they have no choice but to use no interpolation, which makes everything jittery

umbral ridge
#

use transformation matrices and quaternions with a defined pivot

timid hedge
# wet breach Here is a good place to ask 🙂

im a bit confused about how the configs work... if i create the config.yml by myself i can add all the values by typing them in, but if i want to do it with coding i need to add all the lines on onEnable
so if i create the config.yml can i still do so if it dosent exist it creates the file and it dosent override every time the server starts and how do i get the values from the config.yml in my command class?

thorn isle
#

that's roughly what they do, but the problem is that the client interpolates rotation and translation separately

wet breach
#

I am assuming you mean from other yml files? Because there is api methods already for config.yml to do all what you are wanting

thorn isle
#

e.g. if you transform a block to say 5 blocks to the left of its origin, and then change the transformation so that it goes 5 blocks above its origin, what'll happen is that the block gets translated in a straight diagonal line from left to up

#

while for rotating things, you'd want it to interpolate over an arc maintaining a 5 block distance from origin

#

it's tiny for small rotations, but causes things to get noticeably squished

umbral ridge
#

you can get a headache from this

wet breach
#

no matter, I guess I can explain how it works when loading files. The first important thing is you need to load the yml file and you need to ensure it only loads into a single object and not lose that object otherwise you end up with two different instances of the same file which is normally a bad thing. You are free to look through the project I linked and use code from there as it is under the MIT license which means only have to give credit if this is something public you are making.

thorn isle
#

there is a trick around this, however, which is to not touch the transforms at all and instead teleport the display itself; this also supports interpolation

young knoll
#

You can’t rotate the display with a teleport

thorn isle
#

you can

young knoll
#

Well you can, but only on the Y axis

thorn isle
#

the downside is that you're locked to only two dimensions of freedom; the yaw/pitch rotation of entities, no roll

#

but this is sufficient for most things

#

especially doors, which rotate horizontally

#

not sure about windmills though

quaint mantle
#

js make a mod bro

timid hedge
wet breach
#

you can use the spigot/bukkit apis when it comes to config.yml

#

you would only need to have a separate class to load/save other yml files

timid hedge
#

yea but what i mean is dosent it make more sense to load and save all my .yml files from serperate class so its easier to find everything from 1 class?

wet breach
#

right, you will need to make it dynamic from what I gave

#

which is not hard since the methods I use allows for adding in strings

#

so this link, shows a method in dataloading and is how I always ensure I am using the same object instance

#

it also takes care of loading the object if it wasn't already

#

this is called a singleton method but should answer how I was doing it

#

you don't have to do it this way if you don't want to. Also I am not a fan of just giving someone the answers rather I am more fond of pushing people in the right direction and having them try to make the code themselves

thorn isle
#

why would the permissions be in a config

wet breach
#

which ironically if they look through my plugin I have that in there 😛

#

shouldn't be too hard to find it

timid hedge
#

i think i see it now but its because i meant to make the whole thing in 1 method/function or what its called insted of using 1 method to make 1 config so i could make 12 configs with the same method if understand what i mean

wet breach
# timid hedge alr thx
    public void loadData() {
        File f = new File(plugin.getDataFolder(), "data.yml");
        if (!f.exists()) {
            try {
                f.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        dataFile = f;
        data = YamlConfiguration.loadConfiguration(f);
        if (plugin.getConfig().contains("tutorials")) {
            ConfigurationSection section = plugin.getConfig().getConfigurationSection("tutorials");
            data.set("tutorials", section);
            saveData();
            plugin.getConfig().set("tutorials", null);
            plugin.saveConfig();
        }
    }

so as you can see this is in dataloading class if we wanted to make this dynamic without much change you would do like the following

    public void loadData(String fileName) {
        File f = new File(plugin.getDataFolder(), fileName);
        if (!f.exists()) {
            try {
                f.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        dataFile = f;
        data = YamlConfiguration.loadConfiguration(f);
        (This section below is not needed and simply moves data from config.yml to data.yml)
        if (plugin.getConfig().contains("tutorials")) {
            ConfigurationSection section = plugin.getConfig().getConfigurationSection("tutorials");
            data.set("tutorials", section);
            saveData();
            plugin.getConfig().set("tutorials", null);
            plugin.saveConfig();
        }
    }
#

so now loadData takes a value of a String which is fileName and it will load any file with that fileName

#

this is not the only change you will have to do there is some others also you will need a mechanism to ensure you always have the same object because as I stated before it is possible to end up with 2 objects of the same file

#

this is generally bad because you can be editing the file from one object, and saving data from the other object and then get some weird problems 😛

#

this is why I went with the singleton method

timid hedge
#

sry but wdym with objects?

wet breach
#

Classes = Objects

timid hedge
#

yea sry i just havent heard that

wet breach
#

you can load a class more then once which equates to 2 objects

#

and this can be done accidentally and fairly easy

grim ice
wet breach
#

I have helped people on more then one occasions

grim ice
#

yeah it's amazing tbh

wet breach
#

it is one of the primary reasons I am here after all

#

Anyways back to what I was saying, you will notice with my class dataloading that it doesn't have a constructor

#

and this is also due to the singleton method

#

so the only way you can load this class and its methods is through the method at the bottom in that class and thus ensures you always have one object and the same object

#

the downside of this is that it does not really allow for a whole lot of dynamicness to it

#

but as I said previously I didn't need the class for that purpose

#

Singletons are handy for manager classes(because they ensure a single instance of an object), thus you could instead make this class a config manager, and then make additional classes coupled to this one and get your dynamic stuff you are wanting all the while you getting the protection the singleton provides 🙂

waxen hound
#

i’ve never got spigot devs obsession with dependency injection when they never write unit tests anyways

#

maybe people have started to tbf

wet breach
#

and receive help if they need it

waxen hound
#

i guess yeah

#

i would argue that good dependency injection is harder than “good” singletons

#

a lot of the time u end up with like a massive get chain

#

which is low-key gross and the indirection can’t help for performance

wet breach
waxen hound
#

yeah true

#

the main benefit of dependency injection is injecting mocks tho

wet breach
#

well I wouldn't say that is the only benefit

waxen hound
#

there’s the logical dependency separation too

#

what else do u think there is

wet breach
#

the other benefit is it allows others to utilize your methods more easily without resorting to some hacks

waxen hound
#

yeah that is true asw

#

i agree

wet breach
#

but it depends on the purpose of your plugin. My old plugin for example provides an API thus it shouldn't be necessary for someone to depend on the main portion of the plugin

#

hence, I am not worried about the main portion being easy for someone to use or not 😛

waxen hound
#

i guess it’s more expansiveness than ease of use ?

#

if u don’t want people using ur managers in a new way anyways

#

like instantiating them

#

it doesn’t really make that much of a difference

wet breach
#

but yeah the main reason as far as I am aware why many here harp on DI is mainly for new devs and just makes it easier for both lol

#

I have helped with some when it comes to static or even some other types of stuff where you can get some confusing results that don't really make sense in how something is happening since its not obvious from the errors

waxen hound
#

yeah that makes sense

thorn isle
#

the thing with DI aside from unit testing is that it ensures that the dependencies are available, because they're provided by whoever is responsible for constructing whatever needs them

#

compare that to e.g. a class initializer in a singleton that just get()'s something from some static accessor elsewhere

#

if anyone causes that class to be initialized for any reason at an unexpected time, it will explode and possibly permanently fuck up application state

#

DI gives you more control by making sure that the logic only fires when someone intentionally constructs the object, and also clearly indicates what dependencies must be initialized before that can be done

#

DI frameworks like guice completely throw this out of the window of course with "lol bruh it comes from a .properties config or some shit don't worry about it"

waxen hound
#

what about the “lazy” singleton pattern?

#

you have a dag of dependencies anyways

#

do you think that manually arranging and piping the dependencies helps on a logical level

thorn isle
#

lazy implies that it's initialized when it's needed

#

and you can't control when it's needed

waxen hound
#

which doesn’t work if the developer accidentally adds a cycle in the dependency tree

timid hedge
# wet breach ```java public void loadData() { File f = new File(plugin.getDataFol...

idk if im doing it right but im trying to understand it.. but i just want to hear if i am on the right path

import java.io.IOException;

public class FileManager {

    private static FileManager instance;

    public final Main plugin;

    public FileManager(Main plugin){
        this.plugin = plugin;
    }


    public void createConfigFile(String fileName){
        File file = new File(plugin.getDataFolder(), fileName);

        if (!file.exists()){
            try {
                file.createNewFile();
            }catch (IOException e){
                e.printStackTrace();
            }
        }
    }

    public void loadConfigFile(String fileName){
        File file = new File(plugin.getDataFolder(), fileName);

        if (!file.exists()){
            try {
                file.createNewFile();
            }catch (IOException e){
                e.printStackTrace();
            }
        }
    }

    public static FileManager getConfigFile(Main plugin){
        if (instance == null){
            instance = new FileManager(plugin);
        }
        return instance;
    }
}```

```public class Main extends JavaPlugin {

    private FileManager fileManager;

    @Override
    public void onEnable() {
        fileManager = FileManager.getConfigFile(this);
        fileManager.createConfigFile("config.yml");
    }

    @Override
    public void onDisable() {
    }

}```
waxen hound
#

so you should never have a problem of things not being around when they are needed

#

unless you need to instantiate things at a specific time

#

maybe i’m misunderstanding what you mean

wet breach
thorn isle
#

that does probably work though i've never tried it in practice; i'd assume that it's easy to run into a situation where something up the line can't be initialized on demand

#

this is roughly what guice and similar do

waxen hound
#

yeah, i think it might be down to personal taste tbh if u aren’t worried about mocking or reusing components (you know for a fact that there will only ever be one instance that you own)

#

i also use dependency injection for everything

waxen hound
#

except high level resources, like loggers

#

it just feels neater

wet breach
kindred valley
#

No the static should never be usef

waxen hound
#

lol

wet breach
#

it has to be static for it to be used properly since it doesn't have a constructor

timid hedge
mortal hare