#help-development

1 messages · Page 1079 of 1

dawn flower
#

it's serializeAsBytes and deserializeBytes in ItemStack.class

jolly solstice
#

I mean, you still might want to base64 it afterwards anyways (maybe even compress it, if you are concerned about DB size)

dawn flower
#

you can base64 byte arrays

#

honestly i never serialized itemstacks / inventories before so i have 0 experience. whatever you say is prob better

#

i did read some threads about it before tho

jolly solstice
#

What I see many times with "complex" data or generally JSON is that people do JSON > Base64 > Deflate > Base64 > Network

#

JSON > Base64 makes it "uniform" character set, Base64 > Deflate adds compression, Deflate > Base64 makes it URL safe (if you choose to add it as URL parameter)

#

Also Base64 and Deflate are supported by pretty much any OS / Software natively

#

If you have some fancy SSO services that handle your public ID data over URL, it can even happen that you find some silly ?id=<Base64 string> that has been going through like 3 layers of this and is triple-base64'd
xD

slender elbow
#

why would you want to base64 a byte array that you're gonna throw into a db anyway?

eternal oxide
#

no point in base64 as you are actually increasing teh data size

slender elbow
#

base64'ing any array will only make it larger, and blob db types exist

#

and, speaking specifically about paper's serializeAsBytes, that is already gzip'd

slender elbow
#

just use a blob type on the db

#

no need to b64

brazen badge
slender elbow
#

i'm not sure what you mean

#

just skip the base64 parts and keep it as a byte[]

brazen badge
worthy yarrow
#

I think that may be the armor

#

If I had to guess?

brazen badge
#

but the armour also needs to be synchronised

worthy yarrow
#

Well perhaps it could be the armor trying to fit into the inventory slots rather than the armor slots?

#

These inventories are going back to the player right?

worthy yarrow
brazen badge
#

I added this:

    if (size % 9 != 0) {
        size = ((size / 9) + 1) * 9;
    }


    if (size < 9) {
        size = 9;
    } else if (size > 54) {
        size = 54;
    }

beacuse, I had another error before:

[22:31:18] [Craft Scheduler Thread - 7/WARN]: java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 41)

worthy yarrow
#

iirc the player inventory is technically 45 slots, 41 + 4 armor slots

#

no I'm lying

#

41

#

yeah

#

36 + 4 armor + 1 offhand

brazen badge
#

so I have to remove this:

if (size % 9 != 0) {
size = ((size / 9) + 1) * 9;
}

    if (size < 9) {
        size = 9;
    } else if (size > 54) {
        size = 54;
    }
worthy yarrow
#

The player inventory is a total of 41 slots, so yes I would think so

brazen badge
worthy yarrow
#

Couldn't you just get the players inventory and replace it with the serialized one?

worthy yarrow
#

I'd prefer not

#

I'm not the only person who can help here haha

#

Point being you would get more help here

brazen badge
worthy yarrow
#

I'm still guessing on the armor

#

I think when trying to give the player the inventory you should scan for armor items and put them into the players armor slots

brazen badge
eternal oxide
#

don;t do it in creative

worthy yarrow
#

Do you think my guess is correct elgarl?

#

I don't wanna keep leading them down a useless path lol

eternal oxide
#

uh, didn;t read

worthy yarrow
#

The armor is causing the issue

brazen badge
worthy yarrow
#

(if there is any)

torn shuttle
#

why can't windows count file edit times over 24h

eternal oxide
#

Why are you using Inventory and looping each slot when serializing, then using setContents when restoring?

brazen badge
eternal oxide
#

Inventory#getContents() Inventory#setContents(deserialized array)

#

you are storing in a temporary Inventory which has no armor slots

worthy yarrow
#

That brings up my next question, if you somehow figured a way to make a player the inv holder, would that help?

#
Inventory inventory = Bukkit.createInventory(null, size);

as opposed to

Inventory inventory = Bukkit.createInventory(player, size);```?
brazen badge
eternal oxide
#

you don;t need to base64 it, just return outputStream.toByteArray()

worthy yarrow
#

man

#

Since when was PlayerInventory an object

#

This woulda been helpful on like 4 projects lmao

brazen badge
eternal oxide
#

each string (char) is a byte

#

its ready to put into a db blob

tardy delta
#

dunno what you are doing with the complicated size retrieving, just read in the size and act on that

eternal oxide
#

or change it to a byte array

#

no need for string

#

the main thing is drop the base64 encode

#

its just expanding the data

#

um, I wonder if it would be better to keep base64

#

imagine someone writes a book with an sql injection exploit on a page

worthy yarrow
#

Wish I knew enough to understand this

eternal oxide
#

I'd have to see teh output of the byte array

#

in base64 it would be impossible to exploit

brazen badge
#

so? what I have to do?

eternal oxide
#

just use teh code as shown

brazen badge
#

How can I save an Array of strings in a database? I have to use blob?

eternal oxide
#

you can provide multiple values in a varChar

lost matrix
#

The proper way would be to create a new table for your array

eternal oxide
#

^

lost matrix
#

one-to-many relation

eternal oxide
#

old people like me would use varChar or concatenation

dapper flower
#

what does Material#isSolid() check? i want to make sure a player isn't standing on dangerous stuff like lava/water cacti without checking 100 materials, i hope that check helps me

worthy yarrow
#

Whoa hi smile

dapper flower
#

,-,

lost matrix
eternal oxide
#

nope I may be mistaken. javadoc says its fine

#

isSolid means it's a Block and can be built upon.

dapper flower
#

checked bukkit source but it goes to an abstract implementation so idk what the hell tha does

dapper flower
brazen badge
#

so

CREATE TABLE inventory {
   inventory longtext NOT NULL,
   armor longtext NOT NULL
}

and then?

dawn flower
lost matrix
#

What

dawn flower
#

blame intellij for that

#

it autocompleted for me

worthy yarrow
#

Don't use auto complete

#

sometimes

lost matrix
dawn flower
#

that just changes the gap between each particle

worthy yarrow
#

ie: the size

dawn flower
#

well

#

technically it does change the size

#

but like

lost matrix
#

Use it as a scalar for this as well

dawn flower
#

a

worthy yarrow
#

you could add more particles per larger scaling ig? idk if that sounds incredibly efficient

dawn flower
#

good idea

#

but like

#

i want to be able to change width and height pretty much

worthy yarrow
#

3d?

dawn flower
#

but in 1 parameter

#

idk how to explain this

lost matrix
dawn flower
#

let's say i have an 800x600 image and the "size" is 0.5, then it would display a 400x300 image

#

why am i so bad at explaining

lost matrix
#

Ah, ok you can just resize the image then and use an interpolation strategy for each pixel. Java already has those builtin.

dawn flower
#

where is it builtin?

lost matrix
#

You can either use awt graphics, or an affine transform:

  public BufferedImage scale(BufferedImage image, double scaleFactor) {
    int w = (int) (image.getWidth() * scaleFactor);
    int h = (int) (image.getHeight() * scaleFactor);
    BufferedImage after = new BufferedImage(w, h, image.getType());
    AffineTransform at = new AffineTransform();
    at.scale(scaleFactor, scaleFactor);
    AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
    return scaleOp.filter(image, after);
  }
dawn flower
#

ok so i somehow need to turn my ImageData into BufferedImage or implement my own scaling

#

thanks anyways

lost matrix
#

Here is the graphics solution

  public BufferedImage scale(BufferedImage image, double scaleFactor) {
    int w = (int) (image.getWidth() * scaleFactor);
    int h = (int) (image.getHeight() * scaleFactor);
    BufferedImage after = new BufferedImage(w, h, image.getType());
    Graphics2D g2d = after.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g2d.drawImage(image, 0, 0, w, h, 0, 0, image.getWidth(), image.getHeight(), null);
    g2d.dispose();
    return after;
  }
dawn flower
#

wai what's the difference?

#

which one should i use

lost matrix
#

Doesnt matter really. Both are quite slow and the result is the same.

dawn flower
#

alr

lost matrix
#

Affinetransform however will allow you to also rotate and stretch the image

#

*In 2D space that is

dawn flower
#

alr

river oracle
#

@young knoll its been a long time coming I finally am actually doing it lol

river oracle
#

I'm sick of using internals for my item stack serialization

lost matrix
#

How does this differ from javas Serializable interface?

river oracle
slender elbow
#

serializable id?

#

you mean the long serialVersionUID?

#

you don't have to specify that, the vm will automatically generate one for the class based on the fields, hierarchy and stuff

river oracle
slender elbow
#

methods don't change the serializable structure of a class, so no

#

fields do, however, (unless it's transient blah blah), but even then you can have a writeReplace/readResolve methods and stuff

river oracle
#

what if bukkit were to add a field and DFU can handle the upgrade

#

java serialization would fail because of an ID mismatch

#

I could go regular serializable I forget it exists

#

but I'll have to explicity define an ID

slender elbow
#

i mean, dfu can't magically upgrade data

river oracle
#

no ofc not, but it'd be better than the JVM just guessing

slender elbow
#

you have to have a schema and a DataFixer for you to upgrade your data from version x to x + 1

young knoll
#

Well this is mostly for things like ItemStack and Entity

#

Which DFU will handle

slender elbow
#

you can totally use java serialization (although, it's pretty bleh) across class versions, just, gotta be careful with it and how you design the data upgrades, readResolve and writeReplace are definitely gonna help with that

#

but you can certainly do it

inner mulch
#

can i send messages or commands, while having a inventory opened, when using a modded client?

slender elbow
#

the server doesn't know if you have your own inventory opened

#

so, yes

inner mulch
#

do you know if there is a mod like this?

#

or do i need to make my own :/

slender elbow
#

probably a cheat client lol

eternal oxide
#

is this an xy issue?

slender elbow
#

but, you can just have your inventory closed to send messages

#

the server literally doesn't know if you have it opened or closed

inner mulch
#

okay

eternal oxide
#

If you are wanting to send commands/messages from teh client while the inventory is open, why?

inner mulch
#

i want to try some stuff

#

i want to break minecraft

eternal oxide
#

it sounds like it 🙂

young knoll
#

Tbf it’s not that hard to break :p

shy belfry
#

Dumb question did anything for plugin loading change between 1.20.6 and 1.21 becaue my plugin works fine for 20.6 but on 21 it's a zip file is closed error exact same jars so Im lost

blazing ocean
#

your jar is corrupt

shy belfry
#

same jar works just fine on a 1.20.6 server

eternal oxide
#

Don't replace jars with the server still running

shy belfry
#

Im not it's stop the 1.21 server go over to the folder for my 1.20.6 test server put jar in start and watch it work when it just previously failed

eternal oxide
#

which java version?

shy belfry
#

believe java 21 for both servers

#

yep 21 for both

#

I got it figured out

runic pine
#

new pottioneffect

#

the duration is on seconds

#

ticks

#

what

eternal oxide
#

everything in Bukkit is ticks

runic pine
#

ok thx

brittle geyser
shy belfry
#

because fps is suject to user computer

runic pine
#

to add pottioneffect need bukkit thread?

shy belfry
#

need a constant for all things in server

eternal oxide
#

and is nothing to do with Bukkit

eternal oxide
runic pine
#

this all code

#

need be sync because from one buff to 5 buffs

shy belfry
eternal oxide
#

just get all teh buffs, then jump back sync to apply them

#

nothing seems complex there. You may bne wasting cycles running it async

runic pine
#

What if I give infinite speed when activating the buff (outside the runnable) and then execute a task to be synchronous in which it removes the effect if the buff ends but the scheduler is asynchronous?

eternal oxide
#

a speed buff has a duration so no need to remove it

runic pine
eternal oxide
#

there is nothing complex in there which requires async

runic pine
eternal oxide
#

no

#

why not calculate a proper duration and apply it

runic pine
runic pine
eternal oxide
#

is there some trigger for removing this buff?

#

I don;t see why you are even using a runnable

runic pine
eternal oxide
#

apply the buff with a duration and let it expire, or apply it with an infinite duration and remove uponm whatever trigger you use

#

why?

runic pine
eternal oxide
#

why are you manually removing the buff?

#

set teh propper timer and forget about it. No running able, no async or sync

runic pine
eternal oxide
#

Why do you need to know it has expired?

runic pine
#

Are you suggesting to always compare the times when you kill a monster etc?

eternal oxide
runic pine
eternal oxide
#

what?

#

the only thign you are doing in that runnable is repeatedly applying an effect until the time is up, then you send a message

#

none of that is needed

runic pine
#

and modifying the time of a Map

eternal oxide
#

apply effect with correct duration, use Listener to see when the effect expires and do whatever you need to do

#

none of what you are doing is needed

runic pine
#

public static Map<BuffType, Map<UUID, Integer>> PERSONAL_BUFFS = new HashMap<>();

public static Map<BuffType, Integer> GLOBAL_BUFFS;

}

#

im modifing the integer values on runnable too

eternal oxide
#

unneeded

runic pine
eternal oxide
#

no you seriously don;t

runic pine
eternal oxide
#

you know when you apply a buff, you can check when iut expires. you don;t need toi track anything

runic pine
#

if i don't do this from the runnable, i need to check the time with System.currenttime whenever someone breaks a resource block or kills a mob

eternal oxide
#

what? no you don;t you get the buff duration remaining on the effect

runic pine
#

only one buff has speed

#

the rest has no effect whatsoever

eternal oxide
#

I give up. You don't need 90% of the code you are showing.

drowsy helm
#

NOOO

runic pine
#

I don't understand where you're going with this, but the problem isn't the amount of code, it's the performance.

#

Now my question is whether I do async or not

eternal oxide
#

YES, because you are doing shit you don;t need to do!!!

blazing ocean
#

lmao

eternal oxide
#

remove ALL the runnables and you no longer have any performance problems

runic pine
eternal oxide
#

no you apply a PDC flag

runic pine
#

and another thing, if the player leaves the potion also leaves and the buff time has to be maintained after the player leaves

runic pine
eternal oxide
#

there are alternatives to all yoru code and none of them use runnables

#

lol

#

1.8

runic pine
#

10min to talk this pdc shit

blazing ocean
#

wha

runic pine
#

I had to say the same shit 1000 times

eternal oxide
#

well you never said 1.8

blazing ocean
#

just sounds like a 1.8 issue

#

stop using 1.8

eternal oxide
#

even so, there is STILL no point in your runnables, even on 1.8

#

you cna still achieve it without runnables

runic pine
#

potion effects go off when a player comes out correct

eternal oxide
#

comes out? What tells his parents he's gay?

runic pine
# eternal oxide well you never said 1.8

but I always asked how the hell I did it without runnable, I always talked about comparing with System.currenttime and you didn't say anything. I had to tell you about 5 times for you to mention PDC

quaint mantle
#

anyone know how I can make my text display fade when it's behind walls like a player's nametag?

#

currently it stays bright white even though walls

runic pine
eternal oxide
runic pine
#

whats the way without runnable

blazing ocean
runic pine
drowsy helm
#

It is not

#

Comparing times is extremely performant

eternal oxide
#

comparing times is just a littel math double

young knoll
blazing ocean
#

not thaaaat much

#

it's a rather expensive operation and can only be done by blocking the main thread

runic pine
drowsy helm
#

Are you implying a runnable does 1 check in 15 seconds?

eternal oxide
#

nm not bothering.

runic pine
#

That's not what's going to make the server explode

eternal oxide
#

If you are sticking with what you have, only loop active buffs. Not every player

#

track all actives

young knoll
#

Honestly you could check it async once a second or so, assuming everything is stored in concurrent collections

runic pine
young knoll
#

And then just handle the removal with a callback

runic pine
young knoll
#

Handle the adding and removal sync

#

Then just do the checking async

runic pine
young knoll
#

Pretty much

runic pine
#

wdym

young knoll
#

Not that the runnable being async probably makes much of a difference

runic pine
#

with 500 players

#

I know there are several factors to consider, but in a good processor

eternal oxide
#

if you are running async it will not stop teh main thread

runic pine
#

I'm talking about being synchronous

young knoll
#

Do they all have an effect at once

drowsy helm
#

why won't you just query it on a need-to-know basis

#

instead of a runnable

runic pine
runic pine
young knoll
#

Depends on what the effects do as well

drowsy helm
#

have you not abstracted your code?

runic pine
#

then just remove it from the map or modify an int value in the map

young knoll
#

I mean if it gives a 15 second effect to all players

#

Can’t you just add speed for 15 seconds

runic pine
young knoll
#

Sure that won’t go down if they are offline, but it’s only 15 seconds

runic pine
#

I can give a speed of 20 seconds and execute the runnable every 15 seconds

#

i thhink gpt did what I asked 😂

#

save lifes

young knoll
#

Either way I can’t imagine a 500 iteration loop with a map get and then comparing 2 longs takes very long

wet breach
#

not sure why we are having to keep track of the potion effect times

#

is something supposed to happen at the end of these effects?

young knoll
#

I think some buffs don’t involve a potion effect

#

Or at least that’s what they said

wet breach
#

alright, but....you could just add them as a custom potion effect

young knoll
#

That’s not a thing

#

Well, maybe you could add one server side but the client would freak out unless you intercept packets

runic pine
wet breach
#

there is a potion effect that does nothing if I recall or you can give the player a poition effect status without it doing anything

runic pine
#

I'm not even going to read the code. I doubted the capabilities of GPT so much and he was right that I already trust him 100%.

young knoll
wet breach
#

then I don't see why the client would freak out

drowsy helm
#

does clicking this send a packet?

wet breach
#

only the newer clients seem to do that

young knoll
blazing ocean
wet breach
#

since they like to sync the stuff

drowsy helm
young knoll
#

Actually idk if opening it calls an event

drowsy helm
#

but definitely packet?

blazing ocean
#

common spigot L

brittle geyser
drowsy helm
brittle geyser
#

for spigot

young knoll
#

Ah yeah it should call the settings change event

drowsy helm
brittle geyser
#

i tested it

drowsy helm
#

ah this is for actual recipe

drowsy helm
#

fuck u rad

#

lying to me

blazing ocean
#

love you too

young knoll
#

You’d think id remember

#

I’m pretty sure I made that event

wet breach
#

lol

young knoll
#

Lul

brittle geyser
#

i have plugin that run command when player clicks green book

drowsy helm
#

omg i love that font

young knoll
#

Ah perfect I can make it ban players for using the recipe book

runic pine
#

not have pottionendevent idk?

young knoll
#

EntityPotionEffectEvent

#

Iirc

runic pine
#

not have on 1.8

#

xd

drowsy helm
#

:)

runic pine
#

I'll give the exact speed time of the buff. How dumb am I?

torn shuttle
#

I wonder why microsoft still insists on discovering all files before deleting them when doing a mass deletion

drowsy helm
torn shuttle
#

they can definitely start deleting before discovering the full 2.5mil files

runic pine
#

potions finish if player leaves correct

torn shuttle
#

no

runic pine
#

you liying

torn shuttle
#

why ask if you're not going to believe the answer

runic pine
#

Selixe
How would I check if a potion effect has expired without using some sort of runnable? Is there any kind of event that I could use? I know that there is custom spigots with these events but I just want to use normal spigot
#1Selixe, Feb 7, 2023
Report+ Quote Reply
Like Agree Funny Winner Informative Friendly Useful Optimistic Creative
TheSniper99
TheSniper99
There are no events. What you can do is listening to PlayerItemConsumeEvent and if the player drank a potion, start a future runnable that will run at the potion's end (so now + potion time)
#2TheSniper99, Feb 7, 2023

#

OMG HAHAA

runic pine
runic pine
#

Do you swear on your life?

torn shuttle
#

no, I just remembered I forgot to block you from before so I really don't care if you get this right or not

eternal oxide
#

he'll swear on YOUR life 🙂

runic pine
#

if potion ends when player quit

eternal oxide
#

couldn;t say

#

probably not

nova notch
#

why dont u just test it

eternal oxide
#

they have a duration which ticks. if they are offline, it will not tick

#

if a duration is for 500 ticks, thats online ticks

runic pine
#

🙂

nova notch
#

what

runic pine
#

basically staff slavery

slender elbow
#

he said ""make me a test someone ?
drink potion speed 5m inut
and leave the server
and see if potion was removed on join again ""

runic pine
#

yea

real lagoon
#

Quick question:
Is it normal that hiding default item attributes doesn't work?

young knoll
#

Potions do not tick when the player leaves

drowsy helm
real lagoon
#

Bruh

drowsy helm
#

        meta.setAttributeModifiers(this.item.getType().getDefaultAttributeModifiers());
#

just do that

#

if oyu want defaults

real lagoon
#

Does setting it to null or an empty map work?

drowsy helm
#

probs

#

idk why you would want no attributes though

real lagoon
#

For guis icons

drowsy helm
#

ah

#

yeah if it works, sure

real lagoon
#

Nice

young knoll
#

You used to be able to hide them with the flag

#

But I think Mojang mucked that up with item components

fleet kraken
#

How to teleport player to "safe" place in the end and in the nether?

eternal oxide
#

define "safe"

#

both have a default spawn

drowsy helm
#

or can iforce them to hide their recipe book menu

young knoll
#

Uhh

#

Idk

river oracle
#

its confusing asf but afaik
getRepairCost -> getRepairCost
getRepairCostAmount - getRepairItemCost

#

the costAmount is the item cost

sullen marlin
#

@river oracle the original method didn't exist, can you open a PR with the right one? or just let me know what it actually should be

#

getRepairItemCountCost ?

river oracle
#

yep that was it

#

must have been an error from an earlier iteration thanks

river oracle
#

gotta draft up MenuType now

mortal hare
#

pyramid of abstraction:

this.enchantmentTypeManager = new IdentifiableRegistryConfigurableObjectManager<>(
    new MapRegistry<>(),
    new IdentifiableContainerConfigurableFactory<>(
        new EnchantmentTypeIdentifiableContainerBuilder(
            new SimpleEnchantmentTypeBuilderFactory(
                new EnchantmentCostConfigurableFactory(new SimpleEnchantmentCostBuilderFactory()),
                new ItemTypeConfigurableFactory(factory)
            )
        )
    )
);
#

looks bad but works as intended lol

#

my main purpose of this thick layers of abstraction is to build a base for my mod to be cross compatible between neoforged and fabric

river oracle
#

oh

#

modding

mortal hare
#

this thicc abstraction allows me to register enchantments in intermediary enchantment registry classes:

fabric version hook:

handler.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntrySet().forEach(entry -> {
    net.minecraft.enchantment.Enchantment enchantment = entry.getValue();
    net.minecraft.enchantment.Enchantment.Definition definition = enchantment.definition();

    this.enchantmentTypeManager.register(enchantmentType -> enchantmentType
        .setIdentifier(entry.getKey().getValue().toString())
        .setMinLevel(enchantment.getMinLevel())
        .setMaxLevel(enchantment.getMaxLevel())
        .setMinCost(cost -> cost
            .setBaseCost(definition.minCost().base())
            .setPerLevelCost(definition.minCost().perLevelAboveFirst())
        )
        .setMaxCost(cost -> cost
            .setBaseCost(definition.maxCost().base())
            .setPerLevelCost(definition.maxCost().perLevelAboveFirst())
        )
        .setWeight(enchantment.getWeight())
    );
});

that way i dont need to create specific objects and the intermemediary classes will do the job for the hook, due to how every factory method is platform-aware (it gets the information about brand of the server, version, etc, so it registers it as it should properly according to the loader and version of choice

pastel coyote
#

is this when players first join a server and are given a spawn location?

summer scroll
pastel coyote
keen abyss
#

@sullen marlin i want to make a proxy repository in china, but i found something wrong with the spigot nexus repository that i couldn't pull artifacts in my proxy

#

for example

#

in the repository 'snapshots' i found the org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml, its content-type should have been 'application/xml', but it's 'org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml'

#

only the versions after '1.20.4' are correct

echo basalt
#

can't you compile them yourself

sullen marlin
#

sorry I really don't know what to do about that

#

it shouldn't affect your ability to proxy

tame wolf
#

What's the best way to stop hostile mobs from spawning in a certain radius?
I thought about despawning them immediately after they spawn or cancelling the spawn event, but I've found those two to be very laggy on the server

rough ibex
#

It shouldn't be very laggy, how specifically were you doing it

wooden zodiac
#

how do i add placeholder API support for my plugin?

warm mica
rough ibex
#

Okay how do yall do config file handling - and by that I mean examples

#

looking into validation and something that isnt stupidly complex

mortal vortex
#

that will only check for syntax errors, and not match the types

hazy parrot
#

What type of validation are u expecting

#

If someone put string into your config and u call getLong, class cast exception will be thrown or smth

mortal vortex
#

^

upper hazel
#

If I change the biome of a block, will the weather change with the temperature?

young knoll
#

Yes

runic pine
#

that the potion time does not count, that is, it remains the same time when entering?

#

bukkit have any method to play sound for all?

#

https://paste.md-5.net/holixoketa.cpp Would it be problematic to call globalService.update(globalUser) after updating the time? This data update would probably still be from another thread of the runnable because the database API is asynchronous

drowsy helm
#

I dont see it mentioned anywhere

#

Also you need to re think your class names, having 3 User classes which clash in the same project is just bad naming

#

4 actually

runic pine
stiff grove
#

Hi guys, i know i should not ask that, but is it normal to wait a month for a premium plugin approval? Last time i had to wait just a few days

drowsy helm
#

they're probs just really backed up

stiff grove
#

is there anything I can do?

drowsy helm
#

i doubt it

stiff grove
drowsy helm
#

but don't re-upload

torn crystal
#

Hi guys, how to report a bug?

PortalCreateEvent#getEntity always returns null on a spigot server, with same spigot plugin I made on a paper server it works as it is supposed to

stiff grove
undone axleBOT
undone axleBOT
stiff grove
rough drift
#
player.spigot().sendMessage(new ComponentBuilder().append("test").event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "say test")).create());

why does it never run said command when clicking "test"?

#

Each time I try to click test it doesn't do anything

tardy delta
#

minecraft:say?

rough drift
#

yep

#

the only plugin is this test plugin

river oracle
#

this is gonna sound stupid but you forgot the "/"

rough drift
#

istg sometimes it needs that sometimes not

river oracle
#

oh nvm I read the docs wrong

tardy delta
#

indeed sounds stupid

#

ah

blazing ocean
#

also please make a newline after each builder call thingy

river oracle
#

commands have the same permission level as a command block instead of using the player's permission level, are not restricted by chat length limits, and do not need to be prefixed with a "/" slash.

rough drift
river oracle
#

Its possible it could be a BungeeChat bug though I'd try it anyways

rough drift
#

same exact things, just making new components myself

river oracle
#

does hover work with the builder?

rough drift
#

I haven't tested

#

let me try

rough drift
pseudo hazel
#

the only reason players have to use slash is because you dont have to use say when you want to say something

rough drift
#

a few specific methods require you to put a / in front though

#

at least that's how it used to work a few years back

paper viper
#

use adventure /s

rough drift
paper viper
#

Im gonna be honest I think I never used bungee chat before lol

rough drift
#
Today's challenge
 
       say Hi
 In the paper discord
           Without getting banned
tardy delta
#

what if you are already banned?

paper viper
#

Wait you’re banned?

rough drift
tardy delta
#

dunno, might be enginehub or paper

paper viper
#

How lmao

blazing ocean
#

not necessarily hard

rough drift
#

I got banned for asking "hey what's sugarcane"

blazing ocean
#

what 💀

rough drift
#

I swear to the heavens above

blazing ocean
#

gettin gbanned in spigot seems to be the hardest thing ever

rough drift
#

fr

#

I WILL ULTRAKILL YOU, YOU INSIGNIFICANT FU-

#

it doesn't click.

#

it don't work

#

nothin

tardy delta
#

ah i got banned in worldguard and worldedit discord

#

for helping people

paper viper
#

Did they think you didn’t give good advice or smthing lmao

#

I’ve never been in those discords before

tardy delta
#

nah they like WE DO THE HELPING HERE

blazing ocean
tardy delta
#

wouldve banned you too

rough drift
#

chat

#

I just unlocked my phone so fast

#

(11 digits pin)

tardy delta
#

are you fucking crazy

rough drift
tardy delta
#

11 DIGITS

paper viper
blazing ocean
paper viper
#

I know docs say it’s optional

rough drift
#

I have REALLY good sequential memory, apparently

paper viper
#

But just try it with a slash

rough drift
#

I can remember like, what, 25 arbitrary digits in a row 😭

#

doesn't sound that good but whatev

#

I never trained it

paper viper
#

If it doesn’t work with slash then idk what could be causing it

rough drift
#

finally sent it

paper viper
#

Does it send the player the text at least

rough drift
#

yeah

paper viper
#

So the issue is that it just doesn’t run the command

rough drift
#

ye

#

lemme try

#

suggest

paper viper
rough drift
rough drift
glad stag
#

hi, i'm having problem developing it, (i made an example in command blocks)
mainly the part of rotating the block display

paper viper
inner mulch
#

is there a way to add a listener with just knowing the event class i want to listen to?

#

(i want to add an uknown amount of listener of uknown event types on runtime)

inner mulch
#

uh what do i need to pass as Listener or EventExecutor?

tender shard
#

you can pass anything as listener, it's actually not really needed

#

you can just do new Listener() { } for the listener

#

usually the EventExecutor calls the Listener's method but you can also do the event logic in the EventExecutor directly

inner mulch
#

okay

#

thanks

tender shard
#

e.g. like this

        Bukkit.getPluginManager().registerEvent(PlayerJoinEvent.class, new Listener() { }, EventPriority.NORMAL, (listener, event) -> {
            // Event logic
        }, myPlugin);
inner mulch
#

thanks

dawn flower
#

does File#listFiles use cached files?

#

after updating my directory, it still show the same files

#

nvm it doesnt

tame wolf
#

What would be the best way to go about clearing the rewarded_players tag in Vaults' NBT data?

#

I'm hoping there's some magical library or some niche I'm missing so I don't have to resort to NMS

eternal night
#

NMS

tame wolf
#

sad times

astral pilot
#

what is the best way to restrict any actions made by a player until countdown is done

river oracle
#

Using events

#

And a timer

astral pilot
river oracle
#

Probably the events yoh use related to interacting with things

#

PlayerInteractEvent PlayerMoveEvent

astral pilot
#

do i just cancel them?

tardy delta
#

if having cooldown, yes

hybrid spoke
#

no need for a timer

astral pilot
real lagoon
#

Yo guys

astral pilot
#

anyways thanks for the help

real lagoon
#

I think I found a bug

hybrid spoke
hybrid spoke
undone axleBOT
astral pilot
hybrid spoke
#

but you do you

real lagoon
torn crystal
astral pilot
remote swallow
#

new profile

dawn flower
#

there are about 20000 pixels in the small image

floral drum
#

honestly one thing I would change is cloning the location every time and just clone it once before the for loop, then just using .add and .subtract when you're done

dawn flower
#

wouldn't that be heavier on the server?

floral drum
#

actually lighter, because when you clone the location it's creating/instantiating a new object every time

dawn flower
#

ah

#

anything else to change?

floral drum
#

whereas when you .add or .subtract all it's doing is adding or subtracting to a number

#

What is the imagedata .setSize doing?

dawn flower
#
    protected void setSize(int percentage) {
        int newWidth = (width * percentage) / 100;
        int newHeight = (height * percentage) / 100;

        Pixel[] newPixels = new Pixel[pixels.length];
        int newSize = 0;

        for (Pixel pixel : pixels) {
            if (pixel != null) {
                int newX = (pixel.x() * percentage) / 100;
                int newY = (pixel.y() * percentage) / 100;
                newPixels[newSize++] = new Pixel(newX, newY, pixel.red(), pixel.green(), pixel.blue(), pixel.alpha());
            }
        }

        this.pixels = Arrays.copyOf(newPixels, newSize);
        this.width = newWidth;
        this.height = newHeight;
    }```
it's not the reason, since it still does it at 100 size
floral drum
#

ah okay

#

honestly just try it with that one change and see if it improved the performance

dawn flower
#

it barely did anything

floral drum
#

honestly it's probably to do with how many packets it has to send to the client

#

it's 20000 particles right?

dawn flower
#

yeah

#

is there a way to send it all at once

floral drum
#

so 20,000 packets it sends to the client

#

that's shit tons

dawn flower
#

i've seen some plugins like this one use packets to send the particles and i was confused on why they did that

#

i can take a look to see hwo they do it

#

this is how they render it in the loop:

renderer.setParticleParam(new ParticleParamRedstone(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 4.0f));
renderer.render(player);```
this is the "render" method
```java
    @Override
    public void render(Player player) {
        PacketPlayOutWorldParticles particles =
                new PacketPlayOutWorldParticles(particleParam, far, location.getX(), location.getY(), location.getZ(),
                        size.getX(), size.getY(), size.getZ(), speed, amount);

        //Gets the NMS player representation and sends the particle packet.
        ((CraftPlayer)player).getHandle().playerConnection.sendPacket(particles);
    }```
honestly idk how that makes a difference
inner mulch
#

Is it okay to add listeners on runtime?

eternal night
#

okay yea, performant, no

inner mulch
#

Why isnt it performant?

brittle geyser
floral drum
brittle geyser
#

all methods which have annotation

floral drum
eternal night
#

It has to rebuild the entire event handler map

#

When you register something

blazing ocean
#

fuck reflection

tardy delta
#

uses the system with reflection

worldly ingot
#

Yeah the whole baking process, while it makes it more performant, is a bit gross :p

#

Considered using method handles once upon a time

tardy delta
#

wouldve been a good choice

floral drum
#

I mean mine might use a bit... but lmaooo

#

it's just getters rather than invokes though so...

tardy delta
#

> insert bounds checking here <

worthy yarrow
#

Well I suppose we make it work eh?

#

I need to look over some custom event examples, I always have a hard time figuring when I actually need to invoke it

tardy delta
#

remember me to write my own event system one day

#

it will probably use methodhandles

worthy yarrow
#

My only practice was with my seasons project, and tbf it was more or less a copy / paste from stephen kings udemy on custom events

#
public class PlayerTemperatureChangeEvent extends Event {

    private static final HandlerList HANDLERS = new HandlerList();
    private final Player player;
    private final double temperature;

    public PlayerTemperatureChangeEvent(Player player, double temperature) {
        this.player = player;
        this.temperature = temperature;
    }

    public Player getPlayer() {
        return player;
    }

    public double getTemperature() {
        return temperature;
    }

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

    public static HandlerList getHandlerList(){
        return HANDLERS;
    }

}```
floral drum
remote swallow
#

why not a PlayerEvent

tardy delta
#

id probably write an annotation processor at that point

remote swallow
worthy yarrow
#

...

#

Yeah that woulda

#

helped

#

When was this an event?

remote swallow
#

Its not an event

#

its a common class for implementing events

worthy yarrow
#

Oh i shoulda clicked on it

#

kek

worthy yarrow
# remote swallow why not a PlayerEvent
public class PlayerTemperatureChangeEvent extends PlayerEvent {

    private static final HandlerList HANDLERS = new HandlerList();
    private final double temperature;

    public PlayerTemperatureChangeEvent(Player player, double temperature) {
        super(player);
        this.temperature = temperature;
    }
    
    public double getTemperature() {
        return temperature;
    }

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

    public static HandlerList getHandlerList(){
        return HANDLERS;
    }

}

So whats the difference between extending event / PlayerEvent? I see I get a default getPlayer method, anything else particularly useful?

glass inlet
#

Hello, when I do:

player.setGameMode(GameMode.SPECTATOR);
player.teleport(targetPlayer);
player.setSpectatorTarget(targetPlayer);

The problem is if I do that and the targetPlayer is in another world the client player doesn't seem to be spectating them. (if I do getSpectatorTarget() I do get the targetPlayer so it's as if only the client didn't update properly).
This works perfectly when the player is in the same world with the targetPlayer.
Does anyone know how could I get around this problem?

remote swallow
worthy yarrow
#

Kinda figured

worthy yarrow
#

Does it need to work across multiple worlds?

glass inlet
#

Yeah

glass inlet
worthy yarrow
#

Is multiverse open source? And does it have an api? If so you could probably just use their world navigation methods

#

I'm not too sure on how they handle moving players world -> world

kind hatch
worthy yarrow
#

Also send us any errors

#

3 lines aint really enough to go off of

kind hatch
#

You should be able to teleport the player and then delay the spectating by a tick or so.
If that fails, you'll likely have to use one of the Teleport or WorldChange events.

glass inlet
kind hatch
#

Teleport should be instant.
Spectating should have a delay.

glass inlet
glass inlet
restive mango
chrome beacon
#

Just use 2.4.1

warm ledge
#

any of you happen to have experience w overwriting vanilla items? Essentially I have custom stats on armour pieces hence why I need to overwrite them, which in itself works, so every item extends from Item() which then has a few methods, custommodeldata for id, name for namespace key, displayname, lore etc, either way the relevant part is

    abstract fun recipe(): Array<Array<String>>
    abstract fun item(): Material

whichll determine the recipe and the item the recipe returns - this works in the regard that the items will be registered with the recipe and the right material, and items are craftable, though for whatever reason if you take e.g. iron chest and leggings, that goes great - if you do the same thing w the helmet and the boots, it still tries to craft vanilla boots. I suppose it's some magic w which item registers first, but there's not really a good approach to removing the vanilla recipe either.

rough ibex
#

I already have type validation

runic pine
#

event.getdrops.clear on playerdeathevent Does it make the dead player not lose their items?

worthy yarrow
#

No that clears all items that would have been dropped

#

I'm not sure if you wanna mess with the game rules, but that's an option, otherwise I'd say cache the contents of their inventory and give it back to them when they respawn

blazing ocean
worthy yarrow
#

How to better override vanilla recipes if I had to guess?

warm ledge
#

that

worthy yarrow
#

jesus i cannot spell

worthy yarrow
#

Could use this to remove / replace with your recipes

warm ledge
#

yeah, I did find that, but it kinda messes with the recipes too much for what i found

#

just wondering why it would prioritise e.g. chest and leggings but then for boots and helmet it says "nah I'm good"

worthy yarrow
#

You just remove the ones you want for example: iterator.remove(Material.IRON_HELMET), then add your custom recipe back Bukkit.addRecipe();

#

er

worthy yarrow
#

You wouldnt put the material in the it.remove

tame wolf
#

What is a HolderProviderLookup and why do I need it to call loadWithComponents?

worthy yarrow
runic pine
#

event.getdrops contains null itemstacks?

tame wolf
#

Put null checks in your code

worthy yarrow
runic pine
#

The problem is if they die and the server crashes, they lose their items.

tame wolf
#

That's true for everything

worthy yarrow
#

Prevent items from dropping when a player dies?

runic pine
worthy yarrow
#

...

#

What defines a player as a beginner

#

Freshly joined?

runic pine
warm ledge
#

eh

#

e.drops.removeAll()

#

btw

#

playerdeathevent

runic pine
#

e.drops.clear ? .-.

warm ledge
#

clear in java yes

runic pine
#

but

worthy yarrow
#

They do the same thing

runic pine
#

if i save on map

#

i get the items on map when he respawn

#

but if he not respawn?

#

and if quit

warm ledge
#

then youd have to cache them in a file / db and retrieve on join

runic pine
#

playerquitevent is called before right?

runic pine
worthy yarrow
#

The fact is if you're already caching the contents, then just save them to a file / db as mentioned then load the contents and put them back when the player joins again

warm ledge
#

i very much doubt u can modify playerinv on quit

runic pine
warm ledge
#

you may have the methods ofc cuz player is part of the event but I'd imagine it's very hackery and caching it is the better option

runic pine
#

player.spigot().respawn(); but i make this on playerdeath

worthy yarrow
#

playerQuitEvent has 4 methods, 2 for the chat message, and 2 for the handlers, you can't do anything but manipulate the leave message with this event

runic pine
#

I don't know if it's possible for playerdeath to be called and not respawnevent

worthy yarrow
#

it is

#

If a player quits the server before respawning, the respawn event is not called

runic pine
runic pine
worthy yarrow
#

Thats not going to work...

warm ledge
worthy yarrow
#

How are you going to spawn a non existent player

worthy yarrow
#

At least on quit

runic pine
worthy yarrow
#

No because the player is currently quitting the server

#

How can you repsawn a player who is closing their connection to the server?

runic pine
#

brother but the player still exists

brazen badge
#

there is any guide for redis messaging system?

worthy yarrow
#

Which is where you can perform cleanup

#

You can't respawn a player that is in the process of quitting

#

Why is that so hard to understand

runic pine
warm ledge
#

it

#

does

#

very much so

worthy yarrow
#

Idk what to tell this guy

runic pine
#

the respawn method can simply call PlayerRespawnEvent

worthy yarrow
#

No it cannot

warm ledge
#

try it then

worthy yarrow
#

If the player is qutting the server

runic pine
worthy yarrow
#

Because thats basic protocol BrOtHeR

warm ledge
#

because what happens when the event is called?

#

the connection is being closed

runic pine
tame wolf
warm ledge
#

aka no new things are accepted

#

so if u try to set something on a clsoed connection

#

it will do absolutely nothing

blazing ocean
worthy yarrow
#

Possibly will even error out

worthy yarrow
warm ledge
#

I'd imagine u get a big fat error

tame wolf
#

Ah, on that sentiment

blazing ocean
#

just spent 15 minutes implementing vec3i, vec3d, mat2x2i, mat2x2d and their respective serializers 🙃

worthy yarrow
#

I dont see rad out here trying to help folks

blazing ocean
warm ledge
#

btw Kat while what u said in regards to armour, ye sure works, though interestingly enough, it's not that mc really cares

#

though then again if I add an iron ingot anywhere on the recipe itll craft the helmet, I stg

slender elbow
worthy yarrow
warm ledge
#

the removal is fine

worthy yarrow
#

The recipe still seems to be present though?

#

Vanilla*

warm ledge
#

no, you just simply can't craft the item at all although the recipe exists, and even the great crafting book tells u it exists

worthy yarrow
#

I'm confused then, if you can't craft it then what's the problem? Just replace it with your recipes

#

Or is it the custom ones that aren't crafting?

warm ledge
#

it is replaced with my recipes and it doesn't care

worthy yarrow
#

...

#

ok

#

odd

warm ledge
#

yeah it's great really

warm ledge
#

like the book will tell u it's here

#

so you'd think cool, I'll just tell the book to fill the recipe and surely that'll do it, but oh how wrong you could be

worthy yarrow
#

Yeah I'm a bit confused myself, just removing / adding your own should work

warm ledge
#

I wonder whether it's cuz boots technically have 2 recipes

worthy yarrow
#

Send us some code and errors if any I guess

warm ledge
#

but that'd be stupid and kinda shouldn't be a reason for one of them to work

worthy yarrow
warm ledge
#

ye sure

worthy yarrow
#

Add some debugs then

warm ledge
#

it has a loving amount of debugs and I know for a fact the recipe is registered with the right shape :D

worthy yarrow
#

Well it appears in the book so yeah

slender elbow
#

have a registryAccess method

worthy yarrow
#

?paste just show us some code

undone axleBOT
warm ledge
worthy yarrow
#

import net.kyori.adventure.text.Component

Isn't this paper btw?

blazing ocean
#

yes

#

and omg kotlin stdlib fuckery i love it

worthy yarrow
#

Yeah rad I think this is a you thing

#

Get you some helper clout

warm ledge
#

sure kyori is

worthy yarrow
#

I'm confused why are we mixing spigot and paper kek

blissful tusk
#

Hi, I'm looking for Brazilians interested in helping with the creation of a factions server. The requirement is to be trustworthy, know how to program and have basic brain capacity to help. thanks. come dm (pv) for proposals.

worthy yarrow
#

?services

undone axleBOT
worthy yarrow
blazing ocean
#

question

rancid mauve
#

Anyone run into the config serialization not applying flags back to itemstacks on deserialization?
Code/Serialization text, may be overlooking something after being up for 15 hours https://paste.ee/p/7yPi3

blazing ocean
#
  1. why tf are you using colour codes with components 🤨
#
  1. why not static import text()
warm ledge
warm ledge
blazing ocean
#

🤨

warm ledge
blazing ocean
#

then you are doing something wrong if you need to

tawdry shoal
#

hi, how can I make the player's hitbox one block smaller? lower it into the ground, or are there any dependencies that can implement this? version 1.20.1

worthy yarrow
rancid mauve
#

you may be able to fudge it using the hit event and checking the attacking player's pitch compared to the player that got hit's location

worthy yarrow
#

Yeah you could probably figure a way to do this with the api but I can't imagine it to be very clean

rancid mauve
#

using math*

worthy yarrow
#

Cleanliness isn't math

#

You can still have some disgusting calcs

rancid mauve
#

of course math isn't clean

worthy yarrow
#

But hey if it works it works ig

rancid mauve
#

but it's cleaner than NMS

warm ledge
#

performance wise definitely not

worthy yarrow
#

Fair enough, but this is why I use packet events

rancid mauve
#

true

warm ledge
#

calculating on every hit some abstract maths? doesnt sound very resource friendly

slender elbow
#

you do realise the game does just that.. right?

rancid mauve
#

^

warm ledge
#

and add more maths on top?

#

great idea

rancid mauve
#

it's less resource intensive than sending extra packets

warm ledge
#

you have maths from the game and then on top of that you re-calculate for every hit what mc already calculated uh huh

rancid mauve
#

no worse than plugins that have to do it on every move

#

such as land protection

slender elbow
#

thank god the game doesn't shit itself every time you hit someone and the math is cheap

worthy yarrow
#

Completable future all the calcs duh

#

iffisent

rancid mauve
#

just use Minestom

#

xD

#

resolved

worthy yarrow
#

Didn't we get methods to change the size of the player?

rancid mauve
#

hmmm

slender elbow
#

there's the scale attribute yeah

blazing ocean
worthy yarrow
#

Aha

blazing ocean
#

fuck my internet

slender elbow
#

but you can't just change the scale in one axis

worthy yarrow
#

#WideBodyPlayer

brazen badge
#

a question, it's better to use PDC to save data in armor stands or it's better use a database? If I use database how can I get the exact armor stand I click?

worthy yarrow
#

pdc

#

The server already holds all pdc so why make a new db to hold more data?

worthy yarrow
#

?pdc

worthy yarrow
#

You can do whatever you want

#

It's just a container of said data

rancid mauve
#

never use a database when you don't have to

#

xD

worthy yarrow
#

ie: pdc.set(someNamespacedKey, PersistentDataType.SomeType, insert some type of data here)

brazen badge
#

yes, but to change the data I have to delete the pdc and add it again?

sterile token
#

hello, how do i disable git plugin to automatically add the the files to git staging area without doing manually the use of the command git add. I cant find how to disable it, thanks!!

worthy yarrow
compact haven
#

it depends on what you’re doing lol

worthy yarrow
#

Take that with a grain of salt I don't actually remember

compact haven
#

if you need to ever query data then the database is vastly superior because there’s no real way to query data from the PDC of all entities

#

(not to mention how slow it would be)

worthy yarrow
#

That too

#

given the context ith he just needs to verify it's his "custom armorstand"

brazen badge
rancid mauve
#

"This method will override any existing value the PersistentDataHolder may have stored under the provided key."

compact haven
compact haven
#

PDC 100%

worthy yarrow
#

pdc

compact haven
#

also for a minigamr since state is not persistent you can use memory too

worthy yarrow
#

db would be better with a larger set of data being like player stats for example

compact haven
#

I’m guessing there’s only like 4 or so of these so I’d probably do memory especially if there’s already a type that it would go under suitably like a Team with a armoryUpgradeLevel field

runic pine
#

Set<Door> doors = doorRepository.findAll();
this.doors = doors == null ? new HashSet<>() : doors;

Should I do this when the plugin turns on and associate all the doors placed in the game in the cache, or simply create a get method that takes from the cache and if this value is null, take it from the database.? What would be the best option? But if for some reason the door is placed on the ground (Minecraft door) and is not in the cache or in the database and someone keeps spamming this door, it will always be taking it from the database (perhaps a heavy operation even though it is asynchronous to the database)

compact haven
#

iirc writing to and from a PDC is memory based until the world is saved so it’s effectively the same just with more steps (and less efficient)

runic pine
worthy yarrow
compact haven
#

show your Door type

runic pine
#

im not using pdc because im on 1.8

compact haven
worthy yarrow
#

breh

compact haven
#

like how could that have been a response LOL

brazen badge
#

k, thanks

compact haven
#

mate why in the world are you storing the owner as a String of its name

worthy yarrow
#

^

compact haven
#

instead of a UUID

worthy yarrow
#

Was gonna say

#

And why is the password an int?

#

Door code kinda thing?

compact haven
#

this seems like a Lockette plugin

#

you can create a really complex caching system that caches the most used doors and then all the ones attempted to be loaded during the plugins enabled time

#

or you can just cache them all on startup

worthy yarrow
#

I'd just cache them all

compact haven
#

I’d just cache them all too, until you hyper optimize memory usage you won’t really notice it

runic pine
# worthy yarrow Well I'd think you'd load your data / cache it to memory whenever needed, that b...

but it is very difficult for what I said to happen xd, it would only be in the database without having the door in the world if I placed the door, gave the auto-save (I believe that the auto-save is in the thread itself, if so then this is impossible to happen) and then the line that saves the door in the database is not executed (a matter of milliseconds). but this would be impossible if the auto-save is in the thread itself, but if it is asynchronous this is possible but very unlikely. Could you tell me if the auto-save is asynchronous or synchronous?

worthy yarrow
#

Uh

compact haven
#

what does auto save have anything to do with this though

runic pine
#

but this is no problem

#

my server is cracked

compact haven
#

1.8 still has UUID

#

Ah ok

worthy yarrow
#

lovely kek

blazing ocean
#

no problem
cracked

#

mhm

#

we do not support offline mode

compact haven
#

w/e it’s not a problem with offline mode

runic pine
rancid mauve
worthy yarrow
#

1.8 has uuid

runic pine
#

1.8 have uuid

rancid mauve
#

oh

compact haven
#

I get that but are we assuming that the door will disappear before auto save if a crash and now the database has an entry that isn’t true?

rancid mauve
#

then just use that

compact haven
#

it’s cracked so the UUID is equally irrelevant

runic pine
#

worldsave is on minecraft thread?

worthy yarrow
#

Every operation happens on some thread

compact haven
#

in spigot, to my knowledge, all world operations in 1.8 are on the main thread

#

In paper even in 1.8 I believe the same

worthy yarrow
#

All world operations (.) are done on the main thread

compact haven
#

it’s just chunk loading in paper that’s async, pretty sure writes are sync but I’m not positive

sterile token
blazing ocean
#

minecraft is not single threaded

compact haven
#

Right

#

As for Minecraft being single threaded, the vanilla server implementation is indeed single threaded is it not?

runic pine
#

imagine: onblockplace event:

door = new ...;
service.update(door); (save on db).

player put a door and auto-save is called between this 2 lines. the db not has an entry but the world have the door

compact haven
#

it’s sync it won’t happen between the two processes

runic pine
compact haven
#

just said it’s not

#

nothing in 1.8 is async, I don’t even think player chat is yet right?

rancid mauve
runic pine
runic pine
worthy yarrow
slender elbow
#

the only things that run on separate threads in 1.8 are probably just chat, networking and auth, lol

compact haven
#

why not keep all doors in cache and then a separate cache of database modifications then attach to the auto save operation and write it to the database post auto save?

compact haven
runic pine
sterile token
runic pine
compact haven
#

If you’re so worried about inconsistencies then you need to do the database operations after it has been written to the world

#

so you can either engineer a method to write the door to the region file pre-save or write to the database post-save

#

there’s not many options lol

runic pine
sterile token
#

also remember this is minecraft, you are not doing a business