#help-development

1 messages · Page 1175 of 1

dire maple
#

That would be an issue, my host doesn't allot extra ports atm

paper viper
#

You can inject into netty pipeline

#

I do have an example if you want it

chrome beacon
#

Yeah that's what Rads inject library does

#

Which I'm using to run Javalin on

#

I also have Spring running

dire maple
#

Would receiving webhooks put much stress on the server? It shouldn't if it's ran asynchronously?

paper viper
#

Shouldn’t

dire maple
#

Just assuming that HTTP stuff would be ran async..

chrome beacon
#

Yeah it's run async

paper viper
#

Run them on another thread and use like a virtual executor

chrome beacon
#

Javalin has builtin virtual thread support

paper viper
#

Use that

chrome beacon
#

Just enable

config.useVirtualThreads = true
#

as shown in the example on the main page

dire maple
#

idk why I'm googling "minecraft webhook listener example" and not "java webhook listener example" 🤦

chrome beacon
#

That's fine

#

Webhooks are not Spigot or Minecraft specific

dire maple
#

Apparently the only type of webhooks that Minecraft/Spigot knows of are Discord 🤣

paper viper
#

When I think webhook my mind redirects to those ratter mods lmao

#

Even though I know that’s the malicious way

dire maple
#
import static spark.Spark.*;

import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;

public class WebhookListener {

    public static void main(String[] args) {
        port(8080);

        post("/webhook", (req, res) -> {
            // Parse the webhook payload (assuming JSON)
            Map<String, Object> payload = new Gson().fromJson(req.body(), HashMap.class);

            // Process the webhook data
            System.out.println("Received webhook: " + payload);

            // Return a response (optional)
            return "Webhook received successfully";
        });
    }
}

Google's AI overview spit this out..? Is this roughly what the code might look like? Just need a foundation to start..

#

It's using Spark? Never heard of it

chrome beacon
#

Just use Javalin

dire maple
#

ok

chrome beacon
#

and read the docs

#

Try not to use GPT

dire maple
#

💀

young knoll
#

Hey Gemini isn’t ChatGPT

remote swallow
#

i miss bard

chrome beacon
young knoll
#

What about Claude

chrome beacon
#

I don't use AI tools so can't really say

nova notch
#

did u guys see gemini told some guy to die

#

idk if i can send the link but its wild

chrome beacon
#

There were a lot of fake gemini images

#

it was a bit of a meme for a while

nova notch
#

no its a real chat

chrome beacon
#

You mean the AI chatbot convo

young knoll
#

It’s nice that Gemini can replicate COD players

chrome beacon
#

That's not Gemini

nova notch
#

i can dm you it if you wanna see it, pretty sure its real

chrome beacon
#

I mean sure

spice spear
#

looking for a professional developer to modify this plugin to work with my needs
I am willing to pay $$$ if you're reliable

[Send DM]

remote swallow
#

no

#

?services

undone axleBOT
nova notch
#

wait thats 3 dollar signs

#

thats a better offer than the guy offering nitro

echo basalt
#

my #1 advertising tool atm

remote swallow
#

?advertising when

timid berry
#

chat please help why isnt my scoreboard showing

sonic goblet
#

I know after the 4th time you post it you’ll get it figured out

worthy yarrow
#

Try applying the scoreboard to the player a couple ticks after ie: RunTaskLater

remote swallow
#

nuclear even coll knows how to code in console know

worthy yarrow
#

At least I can spell

sonic goblet
# timid berry 5th

I don’t use the spigot implementation for scoreboards so can’t help you there but for this when you do event.getPlayer().getLocation().set you’re creating a new location object each time. Instead of doing that just modify your “mark” location with mark.setX(0); etc

summer scroll
#

I'm creating a stamina system where if player sprint, their stamina will be drained, and player need at least 2 stamina to sprint, for some reason the server think that the player is not sprinting so the stamina is not reduced (when stamina depleted), but I'm somehow sprinting and my stamina is not reduced.

summer scroll
#

I even test it with creating a task that run every tick to disable player sprinting status, the result is what you see in the video.

young knoll
#

I think the client just really doesn’t care what the server says when it comes to sprinting

#

You could temporarily drain their hunger I guess

worthy yarrow
#

Interesting to see how you can cancel the sprint event and even apply setSprinting to false and it still don't work kek

summer scroll
#

Yeah I've tried every way lmao.

summer scroll
young knoll
#

Blindness also disables sprinting… and yknow, seeing

summer scroll
#

Might decide to give slowness effect instead.

young knoll
#

Better off using attributes then

#

You can add and remove a modifier using the event I would assume

summer scroll
timid berry
#

chat where is my scoreboard

#

i swear im tweaking out

river oracle
timid berry
river oracle
#

Ya try delaying it a tick yet

#

Sometimes that does it with events

timid berry
worthy yarrow
timid berry
#

delaying it a tick did not work

#

and its not a problem with the delay because

remote swallow
#

that is 20 ticks

timid berry
#

does not work

paper viper
#

use addEntry

#

And add the player’s name

timid berry
#

thanks

#

how do i stop exploding tnt's from breaking blocks?

sonic goblet
#

That question has likely never been asked before and cannot be solved with 1 google search

paper viper
#

not BlockExplodeEvent

timid berry
#

i want the players to be hurt

#

but the blocks to not be broken

paper viper
timid berry
#

yah iw as right

#

no block break but player damage

#

:)

summer scroll
#

That list will contains all blocks that will be destroyed upon explosion.

young knoll
#

It does cover bows

#

But the damager will be a projectile and you’ll have to check the shooter of said projectile

#

There’s no general event, no

#

Yes

summer scroll
#

Pain it is

echo basalt
#

wait since when the fuck does checking blocks async not cause any exceptions

#

probably a paper moment but I totally expected this to bug out

echo basalt
#

maybe

#

but like

#

this is thread safe?

slender elbow
#

no

river oracle
#

so I'd totally not bet on that never happening

#

I'm sure there are other reasons it'd throw, but yeah I wouldn't lol

sly topaz
#

isn't blockdata a snapshot

#

or am I crazy rn

paper viper
#

It was in PaperLib I think? Idk tbh

misty ingot
#

dont trust everything you see on the internet
the wiki says that in a 3 row chest UI the ids start from 0 and end at 26 but then for the player's inventory they then start from 27 and end at whatever

30 minutes of debugging later, i just found out that that was a huge lie
the slots in both parts start with the index of 0?? (honestly could not have expected this ever)

#

(the spigotmc website links to this page)

#

oh and the spigotmc page that links to this page says the same

smoky anchor
#

I think it is correct, for packet information that is.
Spigot interprets it differently.

lilac dagger
#

but those 2 are different inventories

#

the hotbar appears at the bottom only on client render

#

i mean for the player inv

misty ingot
#

i understand that but

#

sort of misleading

#

anyway i fixed it by checking InventoryType

lilac dagger
#

don't check by slot nor inventory type

#

check by .equals

#

if you use anything more complex your system will fail

misty ingot
#

how would i check using equals here

lilac dagger
#

and equals isn't even needed on newer versions of spigot since inventories use the same object between calls

misty ingot
#

or well i am using equals

lilac dagger
#

if player get inventory == inventory

#

or in inventory click

misty ingot
lilac dagger
#

if player get inventory == clickedinv

misty ingot
lilac dagger
#

this one is even better

#

the benefit of understanding this is that you can have an open gui while also being able to edit your own inventory

inner mulch
summer scroll
smoky anchor
#

You got any antivirus or something that could meddle with the file ?

chrome beacon
echo basalt
#

Does anyone know if new players get teleported to "spawn" before or after PlayerJoinEvent?

lilac dagger
#

before

echo basalt
#

Odd then

lilac dagger
#

there's an event for it too

#

wait a sec

echo basalt
#

having a wicked issue at work where in production people spawn in a random spot

lilac dagger
#

use this 😄

echo basalt
#

Cool

#

Well I do more than just teleporting the player but will keep that in mind

heavy void
#

Hey guys, players have any sort of thing that i can differ if he died between 2 players instances (same player both) without creating a death counter?

lilac dagger
#

well, this is where you have control over the spawn location

echo basalt
#

I just have like 12 event handlers that all call a resetPlayer method

#

¯_(ツ)_/¯

summer scroll
vital ridge
#

Can intellij idea newest version be even used for free or you need to buy the subscription? I had the free trial for a while but Id like to keep using the free version from now on

young knoll
#

Community edition

echo basalt
#

There are 2 versions of intellij: Ultimate and Community

#

Community is free but lacks some features

#

Namedly the ability to use it as an IDE for completely unrelated languages (python, js etc) and some other features (diagram generators, databases?)

#

You usually have separate jetbrains tools that can make up for some of it (Pycharm)

vital ridge
#

I used to use some 2021 version of community edition, but it didnt properly import materials anymore for example and I read online that you need to update your intellij to have no issues with newer MC versions

wintry dagger
vital ridge
#

But I think I accidentaly installed the ultimate intellij

young knoll
#

Yeah java 21 and enums did some weird things

echo basalt
#

Hence why they all look and feel the same

wintry dagger
#

Yeah so why would anyone buy ultimate for the sake of getting the ability to write python

#

Sidenote: Python’s sick

echo basalt
#

PYTHON 💥 💥 🗣️

wintry dagger
#

It booms

#

though list comprehension in python is just streams in Java which I find as one of those cool python features

vital ridge
#

Cant find the community edition download link

#

Intellij Official page seems to only have a download for the ultimate version

echo basalt
#

scroll down

summer scroll
vital ridge
#

ty

chrome beacon
summer scroll
#

Maybe only windows virus & thread protection

#

Still give error even when I'm disabling windows security

chrome beacon
#

Builds fine for me

#

Run in empty folder and send the entire buildtools log

#

?paste

undone axleBOT
acoustic pendant
#

Hey, i'm using block.setBlockData() To change the age of a wheat block right? However this method is sending packets to all players, even if you are not in the same world.

#

Resulting in this:

#

Could someone help me avoiding this?

eternal night
#

That would be a spigot bug 👀

acoustic pendant
#

So there's no way to solve it?

eternal night
#

Open an issue with a minimal reproduction setup

young knoll
#

And make sure you are up to date first

eternal oxide
#

and are you ONLY using setBlockData?

acoustic pendant
acoustic pendant
young knoll
#

/version

acoustic pendant
#

Well, i'm not using spigot so

#

I'll have to contact the fork ig

eternal night
#

1.21.3?

#

Because .0 is long dead lol

acoustic pendant
#

no, for some reason i'm using 1.21.0

#

don't ask why

eternal night
#

Well then I wouldn't worry contacting the fork XD unless you run a 1.21.0 specific fork

young knoll
#

If the fork is paper you should totally contact them

#

They’ll love it

acoustic pendant
#

it's not luckily

chrome beacon
acoustic pendant
#

But maybe i'll have to

chrome beacon
echo basalt
#

dfu be like

acoustic pendant
#

from 1.20.4 to 1.21

young knoll
#

You should blame lynx

echo basalt
young knoll
#

Or item components

echo basalt
#

praying lynx gets all the blame

acoustic pendant
#

But I think nbt changes happened in 1.20.6

young knoll
#

I imagine that was a tricky update

eternal night
#

Probably more BukkitObjectOutputStream

young knoll
#

What happens if we put you in a BukkitObjectOutputStream

eternal night
#

Spooky things

young knoll
#

Sounds fun

#

I failed to consider json and yml won't preserve the type of numeric data

#

hmm

summer scroll
young knoll
#

cached stuff

#

NBT: {"test-byte":12B,"test-short":34S,"test-int":6454,"test-long":4645L,"test-float":23.0F,"test-double":346.0D,"test-string":"Test","test-boolean":1B,"test-list":["First","Second"]}
YML: {"test-byte":12,"test-short":34,"test-int":6454,"test-long":4645,"test-float":23.0D,"test-double":346.0D,"test-string":"Test","test-boolean":true,"test-list":["First","Second"]}
JSON: {"test-byte":12.0D,"test-short":34.0D,"test-int":6454.0D,"test-long":4645.0D,"test-float":23.0D,"test-double":346.0D,"test-string":"Test","test-boolean":true,"test-list":["First","Second"]}

#

Apparently GSON really likes doubles

slender elbow
#

yes

brazen badge
#

Is there a way to make an armor stand move smoothly towards blocks?

smoky anchor
#

What version are you on ?

#

@brazen badge

brazen badge
smoky anchor
#

Have it ride a display entity, teleport that display entity, set its teleport duration to some value

#

If you're using the armor stand to show some model, you should use only display entity

brazen badge
#

thanks

sly topaz
#

you don't really have to do all of that in 1.21.3

mellow edge
#

So Player#sendBlockChange sends the block change. This will work, but when I will try to place a block on it, the fake block will disappear. So I wonder, can I simply send block change for every block again when a player places or block or smth.

sly topaz
#

teleporting of armor stands continuosly has been made smoother

smoky anchor
#

That... is more work than my way

sly topaz
sly topaz
river oracle
smoky anchor
#

ye, you need to make a runnable
grab the entity by UUID ('cause you should not store the Entity reference)
calculate the position for the tick
and teleport

my way: teleport and call extra method

sly topaz
#

it is fine to store entity references, it only matters if the entity was unloaded in the chunk

mellow edge
river oracle
#

Yeah i mean I'd say if your concerned use a weak reference

sly topaz
#

actually, is there a need to teleport at all, wouldn't pushing the entity around do as well?

#

depending on what they're doing, of course

smoky anchor
#

motion is even more work I think, requires knowing vector math

mellow edge
sly topaz
#

it'd get annoying if you just wanted to move the armor stand at a consistent speed from location a to b

mellow edge
#

I do that. It is very bad and I don't recommend it. I must now rewrite the projectile to use nms classes and sh*t

sly topaz
#

steve's method is pretty simple tbh, I am just considering the options here

smoky anchor
#

mhmm

mellow edge
#

The constant teleport gets very laggy

smoky anchor
mellow edge
#

Cause afaik movement is in internal mc client-sided

sly topaz
#

teleporting a display entity shouldn't be the case since it doesn't depend on the server constantly updating the location

#

I however haven't tested how reliable it is so I wouldn't be able to say for sure

mellow edge
smoky anchor
#

what
the teleport duration gets interpolated on the client
wait- now I'm doubting myself here
You may be right

mellow edge
#

If you send the client two teleport packets in one tick, the client will receive both but handle them both in the next tick. (Combine that with ping and gg)

worldly ingot
#

Correct. The smooth interpolation is only useful across multiple ticks. It will smoothly animate it with delta time, but the actual coordinate change is done each tick

mellow edge
#

That is why internally in mc protocol you just send the client the velocity, then the client will on client side render the projectile/entity with the wanted velocity. Meanwhile server will also calculate its pos with the given velocity. But not send the packets for the pos.

At least I think

worldly ingot
#

Until it hits something and needs to synchronize, yeah, I believe that's correct

mellow edge
#

Yeah, ofc synchronization as you said is included. And also pathfinder goals for entities eliminate the need for the server to send the pos. packets for animal movement.

spiral light
#

what ?
the pathfinder is completly server side ?

mellow edge
#

Idk this part of the protocol isnt really straight forward to me

spiral light
#

the pathfinder can be completly customized and thats why it is server side and the client does not know anything about the pathfinders.... it will still sync the movement of the entity directly

mellow edge
spiral light
#

i think the move packet or at least the position packet

mellow edge
#

Kk

#

What about players, do they have any optimisations or do they actually send their positions every tick (because in game they dont appear laggy at all)

spiral light
#

thats because the client interpolates the movement

#

you could try to use a packet reader and check which packet is send when

mellow edge
#

Oooh now it makes sense teleport doesnt interpolate as good as their internal system for entity movement, if it would then any custom projectile would simply move smoothly with teleporting no metter the speed. That is why for projectiles they have velocities because they unlike entities have constant direction+gravity

spiral light
#

i think it is teleporting instant if the distance is higher then the move packet would allow

mellow edge
#

Yes

lilac dagger
#

i've seen a lot of games having characters stuck going forward when there's lagg

#

they just simulate the last intruction they were given

proper cobalt
#

so if i wanted to have a custom data type for these StorageComponent.CompStorageType, StorageDataType

#

which is enum, class

#

PersistentDataType<byte[], StorageDataType>

#

would the adapter be like that

proper cobalt
#

enum class

river oracle
#

Why do we need to serialize an enum to bytes exactly?

proper cobalt
#

this is the class it holds

@Getter
@Setter
public abstract class StorageDataType {
    private final int multiplier;
    private float bytesUsed;

    protected StorageDataType(int multiplier) {
        this.multiplier = multiplier;
    }
}
sly topaz
#

the enums can be described by a single byte, as all you need to know is the index, the classes however do have to be serialized into a byte array

proper cobalt
river oracle
#

Using an ordinal can certainly be described as a single byte thats all you need

proper cobalt
#

yeah sure about the enum thats the easy part

#

i mean the class

river oracle
#

You can also describe the inner class as a compound tag with one int and one float

proper cobalt
#

yooo thats exactly what i need bro

#

compound tag ? can u exapnd

river oracle
#

Since it's an abstract class I'd define an abstract serialize method and provide it a PersistentDataContainer to put it in

#

You can create a new PersistentDataContainer by getting it's context and using the newPersistentDataContainer method

proper cobalt
#

whats a compound tag

sly topaz
#

look at the PersistentDataType.TAG_CONTAINER type

river oracle
#

It's just internals name for PersistentDataContainer

#

I just said compound tag because it's the name in nms

proper cobalt
#

ok so just a container

#

so i put the fields in the container

#

and return it for use in the PersistentDataType extender

river oracle
river oracle
proper cobalt
#

zamnnnnnnnnnnn

river oracle
#

You can just use a container and insert it within a container

proper cobalt
#

so how does one obtain PersistentDataContainer ctx

river oracle
#

If you delegate load and save behavior to your abstract class you'll be far more flexible

river oracle
#

?jds

#

?jd-s

undone axleBOT
proper cobalt
#

found her

sly topaz
#

that'd be used if you were to make a type

river oracle
river oracle
proper cobalt
sly topaz
#

well, the entity or item

proper cobalt
#

its a class

river oracle
#

I mean wherever you're inserting it into will have a container for you

#

You just have to make a method within your abstract clas that delegates how that's handled

sly topaz
proper cobalt
sly topaz
#

it's called getPersistentDataContainer both for ItemStack and Entity

proper cobalt
#

i dont have a reference to pdc

river oracle
sly topaz
river oracle
#

Which includes ItemMeta Entities BlockStates Chunks

proper cobalt
#

creating a new PersistentDataType

sly topaz
#

yes, but you use the peristent data type inside the set and get methods of the PersistentDataContainer

sly topaz
proper cobalt
#

are we on the same page

river oracle
#

No you are not you have no clue what we're talking about

proper cobalt
#

what you told me earleir isnt relevant to my situation

karmic phoenix
#

Hey everyone, I've got an issue in my idea project, it's my first time using gradle & kotlin, the issue is idea won't recognize my dependencies, it was working fine a few minutes ago until I restarted it, any ideas?

river oracle
#

Do the latter first If it doesn't work do the former

karmic phoenix
river oracle
#

You changed something and it will no longer work

karmic phoenix
#

It's not mine, I'm modifying a plugin that I use on my network to be compatible with the other plugins we have.

#

It was working perfectly fine.

river oracle
#

You changed something and it broke

karmic phoenix
#

I didn't change anything.

river oracle
#

If you can compile fine but intellij complains it's intellij issue if you can't compile your gradle script is malformed

karmic phoenix
#

I changed some parts of the code, didn't touch any of the gradle stuff.

blazing ocean
#

send your buildscript

#

?paste

undone axleBOT
karmic phoenix
blazing ocean
#

yes

karmic phoenix
sly topaz
# proper cobalt what you told me earleir isnt relevant to my situation

here

private static final NamespacedKey STORAGE_TYPE_MULTIPLIER_KEY = new NamespacedKey(MyPlugin.instance(), "multiplier");
private static final NamespacedKey STORAGE_TYPE_BYTE_USED_KEY = new NamespacedKey(MyPlugin.instance(), "byteUsed");
private static final NamespacedKey STORAGE_TYPE_KEY = new NamespacedKey(MyPlugin.instance(), "storageType");


var PDC = entity.getPersistentDataContainer();
// serialize
var storageTypeContainer = PDC.getAdapterContext().newPersistentDataContainer();
storageTypeContainer.set(STORAGE_TYPE_MULTIPLIER_KEY, PersistentDataType.INTEGER, someStorageType.getMultiplier());
storageTypeContainer.set(STORAGE_TYPE_BYTE_USED_KEY, PersistentDataType.FLOAT, someStorageType.getByteUsed());
PDC.set(STORAGE_TYPE_KEY, PersistentDataType.TAG_CONTAINER, storageTypeContainer);

// deserialize
var storageTypeContainer = PDC.get(STORAGE_TYPE_KEY, PersistentDataType.TAG_CONTAINER);
var multiplier = storageTypeContainer.get(STORAGE_TYPE_MULTIPLIER_KEY, PersistentDataType.INTEGER);
var byteUsed = storageTypeContainer.get(STORAGE_TYPE_BYTE_USED_KEY, PersistentDataType.FLOAT);
var storageType = new StorageType(multiplier, byteUsed);
#

someone could probably make an automatic adapter instead of this tbh

#

like Gson does

blazing ocean
#

var PDC is crazy

karmic phoenix
# blazing ocean yes

Also here's my settings, just in case.

Build and run using: Gradle
Run tests using: Gradle

Distribution: Wrapper
Gradle JVM: corretto-1.8 Amazon Cretto 1.8.0.432

sly topaz
blazing ocean
#

no like the variable name

sly topaz
sly topaz
#

I have my own naming conventions for this kind of thing lol

karmic phoenix
#

It didn't work.

#

I remember it failing and telling me to use java 8.

blazing ocean
#

🤨

sly topaz
#

what version are you developing for

#

because if it is 1.21, you need java 21

blazing ocean
#

1.21.1

karmic phoenix
#

I mean, I'm not sure, the project isn't mine, the developer is no longer active, and it worked with java 8 for like 2 days, and when I decided to add a dependency, it stopped recognizing all of the dependencies after I reloaded it.

#

I tried removing that dependency, still didn't work, tried using the original project's buildscript, that didn't work.

sly topaz
#

ah it is a kotlin project

sly topaz
karmic phoenix
#

Wdym?

blazing ocean
#

compiling with gradle

sly topaz
#

./gradlew clean build in a terminal

karmic phoenix
#

It failed.

blazing ocean
#

send the error

sly topaz
#

didn't know about slimjar

karmic phoenix
#
Execution failed for task ':checkLicenseMain'.
> License violations were found: src\main\java\me\glaremasters\guilds\special\KitSelection.java

It mentioned a class that I just created.

blazing ocean
#

then fix those license checks

sly topaz
#

I mean, the error is pretty self-explanatory

karmic phoenix
#

What are those?

sly topaz
#

you need to add the license header to that class

sly topaz
# karmic phoenix What are those?

you might not have noticed because IntelliJ collapses them, but if you look at any of the existing classes, above the package declaration there should be a license header

karmic phoenix
#

Failed again.

sly topaz
#

same error?

karmic phoenix
#
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
sly topaz
#

what is it

karmic phoenix
#

I don't know where the compiler error output is.

#

Just updated to idea 2024.3 to get kotlin to function, I was using 2022.

sly topaz
pure dagger
#

how to make location as a value in config? i need x y z and world

karmic phoenix
#

Well there are tons of errors, it's all of the dependencies not being recognized.

chrome beacon
#

There you go ig

#

Were you using artifacts or smth

karmic phoenix
#

?paste

undone axleBOT
chrome beacon
#

you can set it directly

#

set("my.location", location)

sly topaz
#

it is but if the world is unloaded then you're fucked kek

pure dagger
#

what if it would not ?

chrome beacon
#

wdym?

pure dagger
#

if it would not be serializable, i mean i would want to store it as 4 values

sly topaz
#

yes

karmic phoenix
sly topaz
karmic phoenix
#

It only mentions the dependency that I've added, the rest are warnings mentioning spigot.

chrome beacon
#

Too old

karmic phoenix
#

Which java should I use, already tried 21.

pure dagger
#

do block.getLocation()'s always have pitch and yaw = 0 or what?

chrome beacon
#

Run with Java 21 and send the new error

karmic phoenix
#

Should I restart ide after that?

chrome beacon
#

No

karmic phoenix
#

Reload gradle?

sly topaz
#

you just need to set JAVA_HOME and the PATH variable

#

then re-open your terminal so it reads the output again

chrome beacon
#

Or just set the jvm tool chain

#

In your build file

sly topaz
#

they'd have to setup the resolver as well, more trouble than it is worth right now

tender shard
#

+1 for toolchain

tender shard
#

well it's only like this
settings

plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}

build

java {
  toolchain {
    languageVersion = JavaLanguageVersion.of(21)
}}
#

imho that's easier

karmic phoenix
sly topaz
#

it is a runtime dependency downloader, like gremlin but outdated

river oracle
#

Ah

sly topaz
river oracle
#

Oh no lol

sly topaz
#

the foojay resolver is a JDK toolchain provider

river oracle
#

Ohh

sly topaz
#

so, if you don't have the jdk it'll download it for you

proper cobalt
sly topaz
#

without it, it'll just fail to compile if you don't have the version

proper cobalt
#

private final @NotNull PersistentDataType<?, ?> type;

#

i dont have anything to serialize

sly topaz
#

PDC is something you get out of persistent data holders, not something you create

proper cobalt
#

sorry i meant crwating the PersistentDataType

#

PersistentDataType

sly topaz
#

but you don't need to create the persistent data type, as shown above

#

all you have to do is serialize it as a tag container

proper cobalt
#

oh no way u tailored it to my example

#

i thought you just got that from an old plugin

#

thanks

karmic phoenix
#

I was able to fix it, I had to use java 17.

river oracle
#

I wouldn't copy it

karmic phoenix
#

Thanks everyone, y'all are amazing.

proper cobalt
#

i mean i would still need some sort of persistent data holder for the impl u gave

sly topaz
#

entities, block states, item meta, worlds and chunks are persistent data holder

proper cobalt
#

icl i just needed the keys i got it from here

#

would it be possible to combine all those keys into to just one

#

key

sly topaz
#

not really, since they hold different things

#

ideally you just put a serialize and deserialize method in StorageType so you don't have to worry about using these constants

sly topaz
blazing ocean
#

or just spigot libraries

sly topaz
#

right, I always forget that exists

tender shard
#

only downside is that stuff must be on maven central for that

proper cobalt
#

why does java not have an expiring map

sly topaz
#

just use caffeine

tender shard
#

i usually just use guava's cache / LoadingCache

river oracle
sly topaz
proper cobalt
#

oh yo mfnalex im using ur lib right and i used to have some impl of DataType.asEnumMap(Enum.class, DataType.FLOAT) which worked awesome but now i chaged it to be Enum, Class where the class holds an int and a float, does ur lib support doing smth like this?

sly topaz
#

that said, in a plugin one would opt for guava's cache considering it is right there already. Given a simple caching task

proper cobalt
tender shard
# proper cobalt oh yo mfnalex im using ur lib right and i used to have some impl of DataType.asE...

what you need is a PersistentDataType<?, YourClass>. e.g. like this

import org.bukkit.NamespacedKey
import org.bukkit.persistence.PersistentDataAdapterContext
import org.bukkit.persistence.PersistentDataContainer
import org.bukkit.persistence.PersistentDataType

object MyClassDataType : PersistentDataType<PersistentDataContainer, MyClass> {

    val nameKey = NamespacedKey.fromString("asd:name")!! // whatever
    val ageKey = NamespacedKey.fromString("asd:age")!!

    override fun getPrimitiveType() = PersistentDataContainer::class.java

    override fun getComplexType() = MyClass::class.java

    override fun fromPrimitive(pdc: PersistentDataContainer, ctx: PersistentDataAdapterContext): MyClass {
        val name = pdc.get(nameKey, PersistentDataType.STRING)
        val age = pdc.get(nameKey, PersistentDataType.INTEGER)
        return MyClass(name, age)
    }

    override fun toPrimitive(data: MyClass, context: PersistentDataAdapterContext): PersistentDataContainer {
        val pdc = context.newPersistentDataContainer()
        pdc.set(nameKey, PersistentDataType.STRING, data.name)
        pdc.set(nameKey, PersistentDataType.INTEGER, data.age)
        return pdc
    }s

}

data class MyClass(val name: String, val age: Int)
#

obv that's kotlin but you get the idea

proper cobalt
#

aight ill take a look thanks

tender shard
#
public class MyClassDataType implements PersistentDataType<PersistentDataContainer, MyClass> {

    private static final NamespacedKey NAME_KEY = NamespacedKey.fromString("asd:name");
    private static final NamespacedKey AGE_KEY = NamespacedKey.fromString("asd:age");

    @Override
    public Class<PersistentDataContainer> getPrimitiveType() {
        return PersistentDataContainer.class;
    }

    @Override
    public Class<MyClass> getComplexType() {
        return MyClass.class;
    }

    @Override
    public MyClass fromPrimitive(PersistentDataContainer pdc, PersistentDataAdapterContext context) {
        String name = pdc.get(NAME_KEY, PersistentDataType.STRING);
        Integer age = pdc.get(AGE_KEY, PersistentDataType.INTEGER);
        return new MyClass(name, age);
    }

    @Override
    public PersistentDataContainer toPrimitive(MyClass data, PersistentDataAdapterContext context) {
        PersistentDataContainer pdc = context.newPersistentDataContainer();
        pdc.set(NAME_KEY, PersistentDataType.STRING, data.getName());
        pdc.set(AGE_KEY, PersistentDataType.INTEGER, data.getAge());
        return pdc;
    }

Then just create an instance of that and done

sly topaz
#

we were just telling the guy that they don't need a PDT for their class but turns out whatever your lib does requires one anyway lmao

tender shard
#

yes ofc it does, how else would it save it to the underlying pdc

tender shard
#

didnt they mention they wanted to store a Map<Enum,CustomObject>?

sly topaz
#

custom object would be StorageType in this scenario I assume

#

ah, you're the guy of the more data types library

proper cobalt
sly topaz
#

so they were trying to use your Map PDT, I understand the context now

#

hm, do you need to use a MapDataType for this tho

#

does a tag container array allow nulls? cc: @river oracle since you know better than me

river oracle
sly topaz
#

ah, the API doesn't let you anyway, shame

river oracle
#

Especially when you could legit just have the tag not be there if the value is null

sly topaz
#

but what if you want to preserve order

river oracle
#

You can preserve order while not creating unneeded nullability

sly topaz
#

a whole extra byte per element smh

#

more than a byte depending on the size, but I doubt anyone would put a gigantic tag container array inside PDC lol

river oracle
sly topaz
#

getContents returns a Collection with null elements for air kek

river oracle
#

You can keep counting up even if an element is null

#

Since it's a map you wouldn't lose order

proper cobalt
#

does that mean i need to create one of these for every single class that extends it

sly topaz
#

and they would deserialize/serialize from/to PersistentDataContainer

proper cobalt
#

bro what

sly topaz
#

the only way to serialize all the data of the abstract class would be to have its subtypes handle the serialization logic

river oracle
#

You need to learn more java I think I mean this is a somewhat basic idea here. You have an abstract class you need to delegate your logic to that class

#

That's somewhat the point of an abstract class

sly topaz
#

you'd add a default implementation for the things that the abstract class store then handle it recursively

proper cobalt
#

i got it sorted

#

ur wording is just complex for no reason

sly topaz
#

I mean, I am not using any fancy words here, but it depends on your mileage

proper cobalt
#

aight bro "im not using fancy words" " mileage"

#

are u trolling

sly topaz
#

experience, it isn't a fancy word lol

#

at least I think it is pretty common way to say it

proper cobalt
#

its unnecessary..

river oracle
#

Mileage is not fancy 💀

blazing ocean
#

YMMV

river oracle
#

Nothing we've said is complex I mean maybe delegate is probably the least used

wet breach
river oracle
#

Recursive is a word you learn within the first 5 weeks of an entry level compsci course

sly topaz
proper cobalt
#

everyone wants to do too much for no reason

#

its just like why

wet breach
#

idk, I am a native english speaker and understood them just fine

proper cobalt
#

what have u gained from saying mileage

blazing ocean
#

😭

sly topaz
#

it is just another way to say experience man, it isn't that deep

proper cobalt
#

java mileage isnt even a thing

#

nah i know its not deep

#

its just unnecessary

#

its like ur trying to show off look at my english skills

#

cool man

wet breach
#

so either you are a non-native english speaker and thus are having a difficulty translating appropriately or you are a english speaker who isn't well versed in their vocabulary

proper cobalt
#

no i am native

river oracle
proper cobalt
#

its not vocab

#

i know what mileage is

river oracle
#

You're legit just showing you have a small vocabulary

proper cobalt
#

and i understood what he meant

shadow night
proper cobalt
#

but just why

#

no im native

wet breach
river oracle
#

That makes this far more sad lmfao

shadow night
#

I'm not native and Idk english

proper cobalt
wet breach
#

so you are not well versed

proper cobalt
#

wow its so sad some of us know less and some know more than eachother

#

so so sad

wet breach
#

if you were, you would understood in less time

proper cobalt
#

in what aspect

sly topaz
#

let's go a few step back here, since the whole convo is turning into a mess

#

I don't think it's necessary to question john's vocabulary whatsoever

proper cobalt
#

u see what i mean u just chose to use some saying "well versed" and u didnt even use it properly

#

like come on man

wet breach
#

it means your level of comprehension especially in regards to meanings of words or context is not very high, thus it took you time to understand a phrasing or to know the context.

proper cobalt
#

yeah now ur trying to hard to prove what point

wet breach
#

what point?

#

your english sucks

proper cobalt
#

my vocabulary isnt great

#

cool man

wet breach
#

its what I said in the beginning

proper cobalt
#

is that what you wanted to hear

#

yeah it sucks

#

now what

#

🤦‍♂️

wet breach
#

good, now you understand the problem 🙂

sly topaz
#

I also am a firm believer on the fact that one shouldn't try to use fancy words to communicate unless the situation calls for it

proper cobalt
#

init man

wet breach
worthy yarrow
#

Hi frost

sly topaz
wet breach
worthy yarrow
#

I started the wfc

#

and it's like

#

Working kek

sly topaz
#

https://news.ycombinator.com/item?id=42123879 this is an example of a guy who likes to use fancy words on the other hand

keeganpoppen

that's because the judge(s) and executioner(s) aren't engineers, and the jury is not of their peers. and for the record i have a hard time faulting the non-engineers above so-described... they are just grasping for things they can understand and have input on. who wouldn't want that? it's not at all reasonable for the keepers of the pursestrings...

wet breach
#

nice

sly topaz
#

sui generis, bro just say unique

wet breach
proper cobalt
#

its not practical

#

an idiot admires complexity, a genius admires simplicity

#

simple as that

sly topaz
#

this whole sentence just makes me ugh

wet breach
#

its beautiful

#

it conveys meaning in the simplest of ways 🙂

sly topaz
#

it's overly poetic for hackernews if anything lol

wet breach
#

lmao

#

true

wet breach
proper cobalt
#

mate shut up

wet breach
#

offended now?

#

just words you know 😉

proper cobalt
#

talk like that to someone irl see what happens

#

safe over the internet n that

wet breach
#

the last one I did died

proper cobalt
#

surprised you go outside tbf

wet breach
#

well, I am a veteran of the US military so I got out plenty and played games with some other countries folks

proper cobalt
#

i thought the army creates men not geeks

river oracle
proper cobalt
#

from what im seeing it creates geeks

eternal oxide
#

NONE of you are real. You only exist as figments of my imagination.

blazing ocean
#

am i real

shadow night
blazing ocean
#

are you real

#

who knows

wet breach
blazing ocean
#

it's not just text

shadow night
wet breach
#

someone sure likes moving goal posts

blazing ocean
#

cafebabe is

#

beyond the limits of our imagination

tender shard
# proper cobalt Ahhh little problem, you see my class in abstract

Then you'd usually have some kind of "MyClassFactory" or sth and then do sth like this:

public MyClass createFromPdc(PersistentDataContainer pdc) {
  // ...
  MyClassType /* (or String or whatever) */  myType = pdc.get(....); // Let's assume you got an enum or String or whatever for the actual different impl types
  switch(myType) {
    case OneThing: return new OneThing(...);
    case AnotherTHing: return new AnotherThing(...);
shadow night
blazing ocean
#

no no you don't get it

wet breach
#

We can go with geeks, but then you have to admit that geeks are overpowered in the US winning wars and conflicts etc 😛

proper cobalt
#

thanks for the normal reply

#

idk what other bro was talking abt 🤣

tender shard
proper cobalt
#

ah its not bad

wet breach
#

in other words, it might seem better to be a geek than this so called man persona you are spouting because you seem to be neither regardless 🙂

sly topaz
#

I was thinking some more along the lines of how ItemMeta serializes

#

but that works too

wet breach
#

hmmm, maybe I should've been using simpler words 🤔

#

all well, seems they went off to have fun somewhere else after being beaten with words here XD

proper cobalt
#

nerd

river oracle
tender shard
#

I'm going to harvest one of my plants now, bb

wet breach
tender shard
river oracle
#

Have fun

proper cobalt
#

whats strains u growing

blazing ocean
river oracle
#

no its bad for you rad

#

Wait till your brain stops developing 💯

sly topaz
#

you just reminded me I also got to take care of my new plant lol

river oracle
#

I wish I could have plants 🪴 😕 😔

wet breach
#

it should be fine 🙂

proper cobalt
sly topaz
#

in my country we just call it burrito

#

it has a somewhat distinct flavor, we use it for mate

river oracle
#

Plus aloe Vera is useful

wet breach
sly topaz
#

never use it directly, always leave sitting in water overnight to remove the toxins

river oracle
#

They're super useful if you burn yourself

#

Also sunburns

sly topaz
#

aloe vera is good for the skin in general, it's pretty good

river oracle
#

Yeah I love having them around

#

My cat tries to eat them tho :<

sly topaz
#

also cheaper than buying skin care products since they will just grow if you leave them be lol

wet breach
sly topaz
wet breach
sly topaz
#

eh, that's a common misconception but skin care products are very heavily regulated so they don't do funny business in them

wet breach
#

White Brush, Bitter herb, Horse Mint, Liquorice Verbena, Burro

sly topaz
#

we use it for mate here, just as a flavor herb

#

it has some medicinal property, don't remember which, my grandma does

sly topaz
wet breach
sly topaz
#

it works for anxiety, that I didn't know

#

I just use it because it adds some flavor and it grows easily if you let it be lol

wet breach
#

well good news it helps your digestive system and your anxiety levels 😄

#

also makes you feel good at the same time

#

I don't really see any downsides of this thing lol

sly topaz
#

probably has some kind of downside with excessive use, like every medicinal herb but I use it ocassionally to drink terere so shouldn't be an issue

river oracle
#

does anyone know if its possible to mix java and kotlin javadocs. I've got a project that uses both java and kotlin and I'd like to, if possible, export a single javadoc jar. For kotlin I'm using dokkaHtml, and I'm curious if its actually possible for it to accurately document java classes as well? Or if I need to jank something together

eager flame
#

are transfer packets out

river oracle
#

yes

eager flame
#

How am I able to use it in a plugin

#

#transfer?

river oracle
#

idk let me look

#

?jd-s

undone axleBOT
river oracle
eager flame
#

Ok thank you

pure dagger
#

is getting items from set random?

#

for loop

river oracle
#

not random

#

just not ordered as you'd expect

pure dagger
#

if i need to get random element from a set can i just take the first one ?

river oracle
#

no

pure dagger
#

okay

sly topaz
#

they are separate modules I imagine so it'd make sense to have different docs for each one

river oracle
#

no same module though

sly topaz
#

ah, you mean like merging javadocs and kdocs or whatever together

pure dagger
#

then how do i get random element from map or set

river oracle
#

it'd be easier to get a random element from a list though

#

O(1) vs O(r) r being a random number between 0 and n

pure dagger
sly topaz
# pure dagger then how do i get random element from map or set

I'm feeling crazy today

public static <E> Optional<E> getRandomElement(Collection<E> collection) {
        if (collection.isEmpty()) return Optional.empty();

        return collection
                .stream()
                .skip(ThreadLocalRandom.current()
                .nextInt(collection.size()))
                .findAny();
}
pure dagger
#

whatis that

sly topaz
#

a random element getter

#

for a map, you'd do getRandomElement(someMap.values())

pure dagger
#

umm okay

sly topaz
#

wonder if it'd be wise to throw if the collection is empty

quaint mantle
#

where can i download intellij idea community edition?

#

someone any idea ?

#

bcs i could't fnd

lilac dagger
#

it's on their page

river oracle
#

wow

blazing ocean
river oracle
#

1 gogole search for intellij

#

2 buttons

blazing ocean
#

scroll down here

river oracle
lilac dagger
blazing ocean
#

well ultimate is at the top

quaint mantle
#

lol

#

guys wait

#

this isnt community edition

lilac dagger
#

oh yeah

blazing ocean
lilac dagger
#

check the bottom one

quaint mantle
#

oh 1m

river oracle
quaint mantle
#

ty

quaint mantle
blazing ocean
#

idk mine looks a bit weird

#

dunno why

river oracle
#

its probably my tokyo night theme

#

that's my only guess

blazing ocean
#

I take it back then

river oracle
#

okay

sly topaz
# river oracle

you missed dubstep in the background and explanation of the steps in notepad, bad tutorial smh

river oracle
#

one sec

sly topaz
#

wait, why are the pages not using the full viewport

blazing ocean
#

?howtopostathread

sly topaz
river oracle
sly topaz
#

why would a privacy thing take away screen real-estate 💀

river oracle
#

basically uses the most common aspect ratio

#

but I use the most common aspect ratio now

#

My old monitor wasn't

sly topaz
#

I would never, I care more about my screen real estate rather than a concise aspect ratio or privacy

#

the bigger the better

river oracle
#

I mean I use librewolf so I'm pretty much already braindead

sly topaz
#

I tried to make a funny one like that but OBS is dropping too many frames since my laptop is too weak lmao

river oracle
#

Throwback to the early 2010s youtube lol

chrome beacon
wet breach
river oracle
#

Dreamscape fuck

river oracle
pseudo hazel
#

shoutouts to the ads on youtube embeds in discord

#

when I have premium

chrome beacon
#

Yeah happened after that whole discord viewbotting incident

proper cobalt
river oracle
#

Oh.... it's because of some other thing I have :3

quaint mantle
#

:3

pseudo hazel
vagrant stratus
#

Making trigger boxes, which would be more efficient long term and with a lot of them (of varying sizes)?
Each trigger box register its own PlayerMoveEvent or looping every trigger with a single event?

chrome beacon
#

single event

worldly ingot
#

I mean yeah if you think about it, all you're doing is 6 number comparisons for each box

#

That's not that bad lol

#

Or I guess 12 comparisons if you're wanting to check if they entered/exited

#

But also those are 12 comparisons that short circuit

wet breach
pseudo hazel
#

yeah I know

#

but like

#

yikes

wet breach
#

well it didn't hurt anyone

#

as far as I know

#

its not like discord makes it difficult to navigate to the link itself

stiff stratus
#

Hello guys i have kinda huge problem with my smp can i talk with someone?

wet breach
#

?ask

undone axleBOT
#

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

stiff stratus
#

?ask How to fix lags cost by originall bliss smp plugin

wet breach
#

you could not use it as a solution

#

or utilize the services section on the forums to pay someone to fix it, or you could attempt fixing it yourself if the code is opensource if it isn't then good luck I guess

timber eagle
#

guys how do i make the player lookat a location i've been using all of the top spigot results and all of them don't work

slender elbow
#

RTree :nodders:

slender elbow
#

epic

young knoll
#

Minecraft conveniently already has a spacial partitioning system built in

#

Called chunks

stiff stratus
#

Does anyone know good server hosting website on eu region where can i pay with paysave card?

vagrant stratus
young knoll
#

Worldguard does it

vagrant stratus
#

what's even the point anyways? They're not always gonna be a chunk big, or multiple chunks box

young knoll
#

You map every region that intersects a chunk to that chunk

#

Then you can get all regions intersecting that chunk and iterate over only them

vagrant stratus
#

Eh. Seems easier to just loop the triggers & check that way.
More complicated to keep track of all the chunks, check if the player's chunk has any triggers and then check if the player enters/leaves one

#

especially when the very first check is gonna be if they're even in the trigger zone to begin with lol

slender elbow
#

chunkMap.getOrDefault(player.chunk, List.of())

#

shockingly difficult

vagrant stratus
#

Yea, still makes it needlessly more difficult lol

slender elbow
#

the cost to reward ratio is absurdly small

#

spacial partitioning is very performant

young knoll
#

Long2ObjectOpenHashMap when

slender elbow
#

looping through all regions simply does not scale well at all

vagrant stratus
#

lol it's not looping through regions

#

unless you count getting a player's location & basing the check off that anyways

slender elbow
#

"Seems easier to just loop the triggers"

vagrant stratus
#

Yea, each trigger will have its bounds w/ are checked against the player's loc

#

I'm not like.. storing entire chunks or worlds

slender elbow
#

yes, so you have to loop through all of them to see if the player is inside and then call the trigger

#

or am I missing something in your solution?

vagrant stratus
#

(probably) not enough for it to matter

#

You'd need like what.. a few thousand? 10s of thousands?

slender elbow
#

how many players are you expecting?

#

it isn't just region count

vagrant stratus
#

Most likely not enough for it to matter lmao

slender elbow
#

okay then

#

I love asking for help and then dismissing the received help

vagrant stratus
#

Yea, cause the help is overcomplicating a non-issue

slender elbow
#

it really isn't

#

especially when there are readymade solutions

vagrant stratus
#

Except for when they don't do what I'm looking for lol
I'd rather not rely on worldguard either, if anything I'd just look at the necessary code & rewrite it to fit what I actually need

slender elbow
#

how do they not do what you're looking for?

#

I don't wanna know

vagrant stratus
#

I'm going through their code literally right now

timber eagle
#

guys how do i make the player lookat a location i've been using all of the top spigot results and all of them don't work

vagrant stratus
slender elbow
#

well, that's because worldguard supports a more flexible set of features than what you're looking for, presumably

#

none of that is needed for BVH

vagrant stratus
#

Yea, and I don't need the flexibility that it provides I'm doing something almost entirely different compared to how WG's doing this so I might as well roll my own solution that actually fits my requirements

slender elbow
#

yes, but pulling a BVH setting is very trivial for a very high reward

young knoll
#

Generic region api when

slender elbow
#

BVH isn't a feature of worldguard, by features I mean membership, flags and stuff

#

BVH is the optimised way in which it organises regions in memory

#

and it is very much trivial

young knoll
#

Binary vanilla hammock

vagrant stratus
#

Even if I did eventually need BVH, doesn't mean I need to rely on a library that overcomplicates things and includes unnecessary code.
I'd be surprised if the project even ends up on servers with high enough trigger or player counts for it to even matter ngl

slender elbow
#

i never said you need to use a library?

vagrant stratus
#

Looked into WG more, and yea that definitely overcomplicates things. Can't even use it as a reference point for this.
WG's also coded for 100s of players, where as I highly doubt any of my plugins are on servers with 10+ albeit I don't include metrics since I have no real use for them lol

#

If I did implement or use a BVH library, it would have to be as basic as possible lol
Too complex and it won't be worth using for the expected player counts (which is likely to be stupidly low) as that would throw more checks and time into it than just looping the triggers, which are just a few Math.min checks and can probably be optimized more depending on how tf Java implements the method

#

5 players, each looping say 8 times (chunk radius) for (possibly little to no triggers) still adds up, compared to a (likely) less intensive loop through the trigger list lol

sly topaz
#

why are you trying to convince Emily that the solution you choose is better

#

you're the one that needs to be convinced of it not them lol

vagrant stratus
#

like I get using BVH if there's guaranteed 100s of players or a fuck ton of triggers but both are just as unlikely lol

#

also I'm bored & procrastinating KEK

sly topaz
#

well, better is arguable but fitting most likely

vagrant stratus
#

or knowing my plugins and how popular they are, just loop the trigger list on every movement, check if the player's in them & go from there

vagrant stratus
#

For BVH to actually be useful one of 2 things has to happen

  1. A lot of triggers
    or
  2. A lot of players

I'm unlikely to hit the second thing, so the first is likely to not matter that much given how fast Java can be

#

otherwise it's added checks for little to no actual gain (as much as they say otherwise)

sly topaz
vagrant stratus
#

Oh yea, I know the gotchas but the extra effort simply isn't worth it when I know I'd get none of the benefits from the more optimal system lol

#
        for (int dx = -1; dx <= 1; dx++) {
            for (int dz = -1; dz <= 1; dz++) {
               // 
            }
        }

This alone is 9 checks

young knoll
#

Why would you need that

vagrant stratus
#

^ Then there's that, can easily fuck up the very thing they're telling you to implement which can easily be worse than just doing it the original way

#

by assuming one actually knows how to implement the thing they're talking about lol

#

(which, I do not lol)

torn shuttle
#

@vagrant stratus got mod powers? #general has an advertiser

#

oh nvm it's good

vagrant stratus
#

if you're gonna want it implemented properly and more optimally than me just looping a single Set or List or something, you're gonna have to provide a non-complicated impl I can easily use or rewrite into what I actually need or a tutorial or something @young knoll lmfao
Otherwise you're just gonna be complaining about however I go about implementing it because I've got better things to do than go on a duck hunt to find something on spigot's site relative enough to what I need instead

torn badge
#

You just map a trigger to every chunk it is in, problem solved

vagrant stratus
#

Stupidly basic testing but I highly doubt one's gonna have 1,000,000 triggers & i highly doubt a few players will make much of a difference

Checking
Total   | Type     | Player Amount | MS
1000    | for-loop | 1             | 0
1000    | BVH      | 1             | 0
1000000 | for-loop | 1             | 20-30
1000000 | BVH      | 1             | 0

Only reason I'm gonna keep it is I assume what I got ChatGPT to make real quick off your msg is good enough 🤷‍♀️

rapid wharf
#

im using maven shade plugin, to make my java discord api working in the plugin? is it correct way to make it working?

torn badge
drowsy loom
#

Hey yall, has anyone worked with Mobchiplite?
I'm going insane trying to make a plugin that depends on it and idk what I'm doing wrong (tho I also have little experience with Java, also using this to learn since I'm more of a python and C dev) , when trying to load the compiled plugin into an arclight test server I get the error java.lang.NoClassDefFoundError: me/gamercoder215/mobchip/ai/goal/Pathfinder
which is strange cause it is in the library from what I can tell
Is this me being an idiot (would be the likely outcome), a "very few things work in Arclight anyways, either swap to vanilla spigot or do it with a mod" problem or a problem with the library?

vagrant stratus
torn badge
#

Your expected player count is 1?

vagrant stratus
#

Definitely way less than whatever WG & such pull

torn badge
#

It doesn't have to be WG, pretty much every plugin saving data by position is doing it like that

#

With 10 players your complexity will also x10

vagrant stratus
#

Highest i'm getting with 1000 triggers & 1 player is 0.879 ms

#

Lowest I'm getting is 0.0256 ms

Keeping in mind 1000 is going to be quite high for this specific thing

torn badge
#

That's 44% of the tick

#

With a pure loop your time complexity will be O(n*m) where n = player count and m = trigger count, whereas a map approach brings this down to O(1) in the best case

#

For 10 players x 1000 triggers that is 10,000 vs. 1

young knoll
#

I could write up a basic partition system pretty quickly

#

If I wasn’t in bed :p

vagrant stratus
#

Got curious, and actually looked at how long the 1000 triggers take cause I shoved them all at a single location:
3.8385 ms KEK

torn badge
#

That's very high for such a simple task

vagrant stratus
#

Yes, because there's a fuck ton of them at a single location

remote swallow
young knoll
#

No

#

Bed warm

torn badge
#

3.8ms for 1 player using BVH?

remote swallow
vagrant stratus
#

Just cause they're in a chunk doesn't mean they're in the trigger itself

torn badge
#

Yeah, but it significantly reduces your required amount of checks

vagrant stratus
#

Debatable going off the metrics, but I also don't know wtf I'm doing so I wouldn't be surprised if ChatGPT'd code can be optimized further

summer scroll
#

Is there an api to check player's view, like first-person or third-person yet?

torn badge
#

That's actually fact, however putting all locations into 1 spot defeats the purpose of spatial hashing

worldly ingot
torn badge
#

That's not a realistic test scenario

vagrant stratus
#

Yea, which is why I ignored it and only focused on the looping part lol

torn badge
#

All you need is a Map<ChunkLocation, List<Trigger>>, really not that deep

#

And you don't need a custom system for it, you literally have chunks already

young knoll
#

To be extra fancy you use a long as the key

#

To be extra extra fancy you use a Long2ObjectOpenHashMap

vagrant stratus
#

Which is more or less what ChatGPT gave, just used Chunk lol
5800ns-17600ns, for whatever reason

Albeit I need to rewrite this mess anyways because of what I actually need Triggers to do

torn badge
#

Getting a Chunk object will load the chunk, hence only its coordinates

vagrant stratus
torn badge
#

Ig rip server if you populate that map from a database or something on startup

vagrant stratus
#

Want it done properly? One of you are gonna have to gimme a proper impl then

#

I'm not gonna do much better 😎

torn badge
#

If you replace Chunk with a ChunkLocation class or something that will already fix it

#

Just so you don't need to call getChunk() to populate it

vagrant stratus
#

And I'll probably screw that up too somehow so I'm better off sticking with one of the two solutions I have for now and actually making progress kek

#

If I can't get ChatGPT to do it properly then I know I won't be able too, since that's more or less how I'd have done it myself anyways

vagrant stratus
#

Alas PR or shut up does not work here, so that's good enough kek

vagrant stratus
timber eagle
#

guys how do i make the player lookat a location i've been using all of the top spigot results and all of them don't work

#

it sounds simple but its not.

sullen marlin
#

.teleport?

worldly ingot
#

I think they're wanting vector subtraction to look at a specific point

timber eagle
#

yh

#

they are not teleporting, but looking at the location

sullen marlin
#

teleport controls yaw and pitch too

worldly ingot
#

Yeah they don't know the math 😛

timber eagle
#

i have it.

#

it doesn't work.

#

and yes i dont know the math tbh

sullen marlin
#

share the code you have tried

timber eagle
#

i just found some code lol

#

alr

#
public static Location lookAt(Location loc, Location lookat) {
        // Clone the location to avoid modifying the original
        loc = loc.clone();

        // Calculate differences in coordinates
        double dx = lookat.getX() - loc.getX();
        double dy = lookat.getY() - loc.getY();
        double dz = lookat.getZ() - loc.getZ();

        // Calculate yaw (horizontal rotation)
        double yaw = Math.toDegrees(Math.atan2(-dx, dz)); // Minecraft flips X-axis
        if (yaw > 180) {
            yaw -= 360; // Wrap around to -180 to 180 range
        } else if (yaw < -180) {
            yaw += 360;
        }

        // Calculate pitch (vertical rotation)
        double dxz = Math.sqrt(dx * dx + dz * dz); // Horizontal distance
        double pitch = Math.toDegrees(Math.atan(-dy / dxz)); // Vertical angle

        // Apply yaw and pitch to the location
        loc.setYaw((float) yaw);
        loc.setPitch((float) pitch);

        return loc;
    }
worldly ingot
#

Way overcomplicated :p

#
Vector direction = targetLocation.toVector().subtract(playerLocation.toVector());
#

That's all you need

timber eagle
#

oh

#

thanks so much

#

could you explain how it works for the future

#

i'd appreciate it

worldly ingot
timber eagle
#

thank you

glass inlet
#

How to hide scoreboard score numbers? Apparently it was added in new versions but I can't seem to find how to do it.

worldly ingot
#

No API for it. I never finished it

glass inlet
#

Oh interesting

young knoll
#

You have to use NMS :(

glass inlet
#

How is this called in Minecraft or what would i be searching for if i wanted to do that myself

young knoll
#

Smh

worldly ingot
#

Yes

#

But we also have a 1.7 server base lol

#

We didn't support hidden potion effect particles until today when I added them