#help-development
1 messages · Page 1175 of 1
Yeah that's what Rads inject library does
Which I'm using to run Javalin on
I also have Spring running
Would receiving webhooks put much stress on the server? It shouldn't if it's ran asynchronously?
Shouldn’t
Just assuming that HTTP stuff would be ran async..
Yeah it's run async
Run them on another thread and use like a virtual executor
Javalin has builtin virtual thread support
Use that
Just enable
config.useVirtualThreads = true
as shown in the example on the main page
idk why I'm googling "minecraft webhook listener example" and not "java webhook listener example" 🤦
Apparently the only type of webhooks that Minecraft/Spigot knows of are Discord 🤣
When I think webhook my mind redirects to those ratter mods lmao
Even though I know that’s the malicious way
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
Just use Javalin
ok
💀
Hey Gemini isn’t ChatGPT
i miss bard
yeah I know it's worse
What about Claude
I don't use AI tools so can't really say
no its a real chat
You mean the AI chatbot convo
It’s nice that Gemini can replicate COD players
That's not Gemini
i can dm you it if you wanna see it, pretty sure its real
I mean sure
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]
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
?advertising when
chat please help why isnt my scoreboard showing
I know after the 4th time you post it you’ll get it figured out
please help
Try applying the scoreboard to the player a couple ticks after ie: RunTaskLater
nuclear even coll knows how to code in console know
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
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.
But where the code at 👀
Right, here's the code.
https://paste.md-5.net/agatohiket.java (Sprinting disable)
https://paste.md-5.net/bevebujavi.java (Sprinting disable on PlayerToggleSprintEvent)
https://paste.md-5.net/horowivoqo.java (Stamina drain)
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.
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
Interesting to see how you can cancel the sprint event and even apply setSprinting to false and it still don't work kek
Yeah I've tried every way lmao.
Thank you, will take that into consideration.
Blindness also disables sprinting… and yknow, seeing
Might decide to give slowness effect instead.
Better off using attributes then
You can add and remove a modifier using the event I would assume
Oh yeah, that's better, didn't think of that.
Post it a couple more times and it might appear
no ones gave me a solution yet
what part?
“No one told me a solution yet”
I literally already said this
chat
delaying it a tick did not work
and its not a problem with the delay because
that is 20 ticks
What if you don’t use addPlayer because that’s deprecated
use addEntry
And add the player’s name
works!
thanks
how do i stop exploding tnt's from breaking blocks?
That question has likely never been asked before and cannot be solved with 1 google search
it's EntityExplodeEvent
not BlockExplodeEvent
will this still hurt the player?
i want the players to be hurt
but the blocks to not be broken
I think you can just remove the blockList https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityExplodeEvent.html#blockList()
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
That list will contains all blocks that will be destroyed upon explosion.
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
Pain it is
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
paper!???!!!?
no
it'd only cause problems if the data was modified around the same time iirc
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
I think for Paper they have some cached snapshot?
It was in PaperLib I think? Idk tbh
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
I think it is correct, for packet information that is.
Spigot interprets it differently.
but those 2 are different inventories
the hotbar appears at the bottom only on client render
i mean for the player inv
i understand that but
sort of misleading
anyway i fixed it by checking InventoryType
don't check by slot nor inventory type
check by .equals
if you use anything more complex your system will fail
how would i check using equals here
and equals isn't even needed on newer versions of spigot since inventories use the same object between calls
or well i am using equals
if player get inventory == clickedinv
guess that'll work too
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
GetRawSlot will fix it
Guys, why I cannot build 1.20.1 using buildtools, here's the error https://paste.md-5.net/acakuxiyeq.bash and I'm using the buildtools gui.
You got any antivirus or something that could meddle with the file ?
Try running again in an empty folder
Does anyone know if new players get teleported to "spawn" before or after PlayerJoinEvent?
before
Odd then
having a wicked issue at work where in production people spawn in a random spot
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?
well, this is where you have control over the spawn location
Same errors.
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
Community edition
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)
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
But PyCharm exists which is a complete replica of IntelliJ (same company), and it too has community edition
But I think I accidentaly installed the ultimate intellij
Yeah java 21 and enums did some weird things
Most jetbrains IDEs are just forked versions of intellij
Hence why they all look and feel the same
Yeah so why would anyone buy ultimate for the sake of getting the ability to write python
Sidenote: Python’s sick
PYTHON 💥 💥 🗣️
It booms
though list comprehension in python is just streams in Java which I find as one of those cool python features
Cant find the community edition download link
Intellij Official page seems to only have a download for the ultimate version
scroll down
guys helb plz, buildtools broken
Any antivirus running
Nope, all versions worked except 1.20.1 for some reason
Maybe only windows virus & thread protection
Still give error even when I'm disabling windows security
Builds fine for me
Run in empty folder and send the entire buildtools log
?paste
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?
That would be a spigot bug 👀
Yeah, it seems like that
So there's no way to solve it?
Open an issue with a minimal reproduction setup
And make sure you are up to date first
and are you ONLY using setBlockData?
Yeah
1.21
/version
Well then I wouldn't worry contacting the fork XD unless you run a 1.21.0 specific fork
it's not luckily
I don't want to change because usually items bug out
But maybe i'll have to
sounds like a bad fork if items break when you update
dfu be like
No, it happened when I updated paper actually
from 1.20.4 to 1.21
You should blame lynx
Or item components
praying lynx gets all the blame
But I think nbt changes happened in 1.20.6
I imagine that was a tricky update
Probably more BukkitObjectOutputStream
What happens if we put you in a BukkitObjectOutputStream
Spooky things
Sounds fun
I failed to consider json and yml won't preserve the type of numeric data
hmm
I've tried it again and it works, thanks! What's the reason it's broken when executed on that folder?
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
yes
Is there a way to make an armor stand move smoothly towards blocks?
1.21
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
thanks
you don't really have to do all of that in 1.21.3
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.
teleporting of armor stands continuosly has been made smoother
That... is more work than my way
why would it be, you'd just be teleporting the armor stand in a runnable
you could cancel the block place event and send a block change for the placement instead
That requires the knowledge of how to use a runnable though pretty high skill seeling right there
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
it is fine to store entity references, it only matters if the entity was unloaded in the chunk
At least on older versions than 1.21.3 this won't work as smooth as if you would give it initial minecraft vel. (obviously)
Yeah i mean I'd say if your concerned use a weak reference
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
motion is even more work I think, requires knowing vector math
Its not hard at all actually
it'd get annoying if you just wanted to move the armor stand at a consistent speed from location a to b
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
steve's method is pretty simple tbh, I am just considering the options here
mhmm
The constant teleport gets very laggy
the teleport duration should eliminate that problem mostly too
Cause afaik movement is in internal mc client-sided
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
I tought that too, but I was told that the game updates it every tick anyway, so splitting locations into small fragments and sending them multiple times a tick shouldnt work. The only fix afaik is to slow it down.
what
the teleport duration gets interpolated on the client
wait- now I'm doubting myself here
You may be right
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)
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
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
Until it hits something and needs to synchronize, yeah, I believe that's correct
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.
what ?
the pathfinder is completly server side ?
Idk this part of the protocol isnt really straight forward to me
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
So what does it send to the client then? Positions? And then the client animates the movemebt or smth
i think the move packet or at least the position packet
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)
thats because the client interpolates the movement
you could try to use a packet reader and check which packet is send when
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
i think it is teleporting instant if the distance is higher then the move packet would allow
Yes
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
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
what do those hold exactly
enum class
Why do we need to serialize an enum to bytes exactly?
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;
}
}
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
not sure
It's your data you know which enum it'll be unless you just hate yourself and have 0 schema
Using an ordinal can certainly be described as a single byte thats all you need
You can also describe the inner class as a compound tag with one int and one float
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
whats a compound tag
look at the PersistentDataType.TAG_CONTAINER type
It's just internals name for PersistentDataContainer
I just said compound tag because it's the name in nms
ok so just a container
so i put the fields in the container
and return it for use in the PersistentDataType extender
Yes but I'd use a sub container within the container your inserting into as Javier said
Don't even need to make a type this way
zamnnnnnnnnnnn
You can just use a container and insert it within a container
so how does one obtain PersistentDataContainer ctx
If you delegate load and save behavior to your abstract class you'll be far more flexible
One sec
?jds
?jd-s
declaration: package: org.bukkit.persistence, interface: PersistentDataAdapterContext
found her
that'd be used if you were to make a type
Use PersistentDataContainer#getAdapterContext
It's useful even if you don't
aight but where do i obtain a PersistentDataContainer to call that method on
well, the entity or item
its a class
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
have you paid attention to the methods you were using when inserting things into the PDC? Lol
i dont have any reference to pdc in my code bro
it's called getPersistentDataContainer both for ItemStack and Entity
i dont have a reference to pdc
It's called that for every PersistrntDataHolder
where were you planning to use this PersistentDataType then lol
Which includes ItemMeta Entities BlockStates Chunks
creating a new PersistentDataType
yes, but you use the peristent data type inside the set and get methods of the PersistentDataContainer
right, I forgot what the common interface was called
are we on the same page
No you are not you have no clue what we're talking about
what you told me earleir isnt relevant to my situation
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?
Might need to invalidate cached or reload gradle
Do the latter first If it doesn't work do the former
I did both.
Then your gradle file is malformed
You changed something and it will no longer work
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.
I mean doesn't really matter either way it holds
You changed something and it broke
I didn't change anything.
If you can compile fine but intellij complains it's intellij issue if you can't compile your gradle script is malformed
I changed some parts of the code, didn't touch any of the gradle stuff.
It's my first time using gradle, do you mean the build.gradle.kts?
yes
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
var PDC is crazy
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
I like var, I use it a ton so other people maybe pick up on it
no like the variable name
use jdk 21
entity in this case was used as placeholder, could've been any PersistentDataHolder
I mean, it is an abbreviation, pdc in lower case would've been fine too but eh
I have my own naming conventions for this kind of thing lol
🤨
1.21.1
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.
ah it is a kotlin project
does compiling outside intellij work or not
Wdym?
compiling with gradle
./gradlew clean build in a terminal
It failed.
send the error
didn't know about slimjar
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.
then fix those license checks
I mean, the error is pretty self-explanatory
What are those?
you need to add the license header to that class
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
Failed again.
same error?
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
what is it
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.
where the heck is it printing the output lmao
Should be right above that
how to make location as a value in config? i need x y z and world
Well there are tons of errors, it's all of the dependencies not being recognized.
just put it all in a paste
?paste
Location is configuration serializable
you can set it directly
set("my.location", location)
it is but if the world is unloaded then you're fucked kek
what if it would not ?
wdym?
if it would not be serializable, i mean i would want to store it as 4 values
yes
your jdk is too new
It only mentions the dependency that I've added, the rest are warnings mentioning spigot.
Update to Java 21 JDK
Which java should I use, already tried 21.
do block.getLocation()'s always have pitch and yaw = 0 or what?
Run with Java 21 and send the new error
yes
Should I restart ide after that?
No
Reload gradle?
you just need to set JAVA_HOME and the PATH variable
then re-open your terminal so it reads the output again
they'd have to setup the resolver as well, more trouble than it is worth right now
+1 for toolchain
true
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
I've updated to 21, after I reloaded gradle it produced this: https://paste.md-5.net/runahiduka.sql
Wtf does the plugin do?
it is a runtime dependency downloader, like gremlin but outdated
Ah
oh you meant the resolver, I thought you were talking about the slimjar in the error
Oh no lol
the foojay resolver is a JDK toolchain provider
Ohh
so, if you don't have the jdk it'll download it for you
yeah but im just creating the pdc
without it, it'll just fail to compile if you don't have the version
private final @NotNull PersistentDataType<?, ?> type;
i dont have anything to serialize
wdym you are just creating the PDC
PDC is something you get out of persistent data holders, not something you create
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
oh no way u tailored it to my example
i thought you just got that from an old plugin
thanks
I was able to fix it, I had to use java 17.
I wouldn't copy it
Thanks everyone, y'all are amazing.
i mean i would still need some sort of persistent data holder for the impl u gave
entities, block states, item meta, worlds and chunks are persistent data holder
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
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
if by some point you want to make it work with newer gradle version, I'd consider switching out slimjar for gremlin: https://github.com/jpenilla/gremlin
or just spigot libraries
right, I always forget that exists
only downside is that stuff must be on maven central for that
why does java not have an expiring map
just use caffeine
i usually just use guava's cache / LoadingCache
That's too high level of a data structure to be default
caffeine is an improved version of guava's cache
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?
that said, in a plugin one would opt for guava's cache considering it is right there already. Given a simple caching task
@tender shard the class has no complex types just a float and int field
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
aight ill take a look thanks
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
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
yes ofc it does, how else would it save it to the underlying pdc
see here
didnt they mention they wanted to store a Map<Enum,CustomObject>?
custom object would be StorageType in this scenario I assume
ah, you're the guy of the more data types library
yeah i was tryna tell javier but ig he didnt understand
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
They should but inserting null would be pretty dumb
ah, the API doesn't let you anyway, shame
Especially when you could legit just have the tag not be there if the value is null
but what if you want to preserve order
Bundle an index
You can preserve order while not creating unneeded nullability
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
I mean the most realistic use case would be inventories in which case you should do a map
index -> item
getContents returns a Collection with null elements for air kek
Yeah you ignore those though :P
You can keep counting up even if an element is null
Since it's a map you wouldn't lose order
Ahhh little problem, you see my class in abstract
does that mean i need to create one of these for every single class that extends it
you would have to add abstract serialize/deserialize methods on your abstract class, yes
and they would deserialize/serialize from/to PersistentDataContainer
bro what
the only way to serialize all the data of the abstract class would be to have its subtypes handle the serialization logic
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
you'd add a default implementation for the things that the abstract class store then handle it recursively
I mean, I am not using any fancy words here, but it depends on your mileage
experience, it isn't a fancy word lol
at least I think it is pretty common way to say it
its unnecessary..
Mileage is not fancy 💀
YMMV
Nothing we've said is complex I mean maybe delegate is probably the least used
apparently their vocabulary level is 3rd grade
Recursive is a word you learn within the first 5 weeks of an entry level compsci course
I am doubting myself out here as a non-native speaker lol
no its just normal man
everyone wants to do too much for no reason
its just like why
idk, I am a native english speaker and understood them just fine
what have u gained from saying mileage
😭
it is just another way to say experience man, it isn't that deep
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
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
no i am native
Many of us are native English speakers
You're legit just showing you have a small vocabulary
and i understood what he meant
And many aren't
so you what is the issue if you understood?
That makes this far more sad lmfao
I'm not native and Idk english
took me a min
so you are not well versed
if you were, you would understood in less time
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
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
thank you
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.
yeah now ur trying to hard to prove what point
its what I said in the beginning
good, now you understand the problem 🙂
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
init man
use all the fancy words, pull all the stops and the whole shebang
Hi frost
because as said, it is just unnecessary. That said, I don't believe I have done that in this situation lol, if what I said doesn't sound right to you then that's just that, I could've worded my sentence differently but I wouldn't know unless you told me you didn't get it on the first go
https://news.ycombinator.com/item?id=42123879 this is an example of a guy who likes to use fancy words on the other hand
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...
nice
sui generis, bro just say unique
who doesn't like a little latin though?
yeah and if u lock in u understand about 50% of it
its not practical
an idiot admires complexity, a genius admires simplicity
simple as that
this whole sentence just makes me ugh
it's overly poetic for hackernews if anything lol
its practical in the sense if you wanted to exclude the uneducated as the target audience it works
mate shut up
the last one I did died
surprised you go outside tbf
well, I am a veteran of the US military so I got out plenty and played games with some other countries folks
i thought the army creates men not geeks
You wouldn't know now would you
from what im seeing it creates geeks
NONE of you are real. You only exist as figments of my imagination.
am i real
well, technically everybody here is just text
is this the response you want to go with now knowing that I can actually say what I want to someone without worry?
CafeBabe would like to have a word with you
it's not just text
it is
someone sure likes moving goal posts
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(...);
a bunch of python files.
no no you don't get it
yeah got it like this
We can go with geeks, but then you have to admit that geeks are overpowered in the US winning wars and conflicts etc 😛
yeah I fear there's no better way unless you want to do reflection or stuff like that
ah its not bad
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 🙂
I was thinking some more along the lines of how ItemMeta serializes
but that works too
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
nerd
you mean this?
Using a compliment as an insult really isn't a good look
I'm going to harvest one of my plants now, bb
let us know how it goes
ok I'll send a pic later
whats strains u growing
if it's the weed, can I have some
you just reminded me I also got to take care of my new plant lol
I wish I could have plants 🪴 😕 😔
just keep it under your bed
it should be fine 🙂
come to NL
https://myplantin.com/plant/1907 what is the name of this plant in english
in my country we just call it burrito
it has a somewhat distinct flavor, we use it for mate
Naw I'm joking I ain't smoke my GF does but I'd like to atleast keep another type of plant like aloe vera
Plus aloe Vera is useful
I am well aware, I have a few myself
never use it directly, always leave sitting in water overnight to remove the toxins
When my grandpa died we took his plants
They're super useful if you burn yourself
Also sunburns
aloe vera is good for the skin in general, it's pretty good
also cheaper than buying skin care products since they will just grow if you leave them be lol
I mean shouldn't hurt them
oh apparently it is also called burrito in english
well, in the long term they are lol. Also Aloe plants are far better then whatever is on the shelf because they tend to add other chemicals sometimes
eh, that's a common misconception but skin care products are very heavily regulated so they don't do funny business in them
its known by a few names in english
White Brush, Bitter herb, Horse Mint, Liquorice Verbena, Burro
we use it for mate here, just as a flavor herb
it has some medicinal property, don't remember which, my grandma does
on a side note, really recommend this channel to get information on how the latest skin care papers and how they're regulated, among other things: https://www.youtube.com/@LabMuffinBeautyScience
its used for anxiety and gastrointestinonal issues, as well as can be used as a sedative
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
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
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
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
Now I'm curious too
are transfer packets out
yes
declaration: package: org.bukkit.entity, interface: Player
Ok thank you
if i need to get random element from a set can i just take the first one ?
no
okay
I mean, is having javadocs for java and whatever is popular for kotlin not enough
they are separate modules I imagine so it'd make sense to have different docs for each one
I'd just prefer to not have 2 javadoc jars
no same module though
ah, you mean like merging javadocs and kdocs or whatever together
then how do i get random element from map or set
iterate over it a random amount of elements
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
so ... make a counter
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();
}
whatis that
umm okay
wonder if it'd be wise to throw if the collection is empty
where can i download intellij idea community edition?
someone any idea ?
bcs i could't fnd
it's on their page
wow
scroll down here
well ultimate is at the top
oh yeah
.
check the bottom one
oh 1m
ty
lol
thanks
its probably my tokyo night theme
that's my only guess
I take it back then
okay
you missed dubstep in the background and explanation of the steps in notepad, bad tutorial smh
I have a BuildTools one for that iirc
one sec
wait, why are the pages not using the full viewport
and the subway surfers gameplay
?howtopostathread
how could I have forgotten, I am a disgrace
uhhh its a weird privacy thing I use, but I've gotten used to it so I can't undo it
why would a privacy thing take away screen real-estate 💀
basically uses the most common aspect ratio
but I use the most common aspect ratio now
My old monitor wasn't
I would never, I care more about my screen real estate rather than a concise aspect ratio or privacy
the bigger the better
I mean I use librewolf so I'm pretty much already braindead
https://www.youtube.com/watch?v=JGFKVQX0xV4 The music is far too quiet
I really should remake this
what was this song called again
I tried to make a funny one like that but OBS is dropping too many frames since my laptop is too weak lmao
Iirc it's darude sandstorm
Throwback to the early 2010s youtube lol
Dreamscape - 009 Sound System
Provided to YouTube by TuneCore
Dreamscape · 009 Sound System
Track One Recordings, Vol. 1
℗ 2008 Track One Recordings
Released on: 2008-04-09
Auto-generated by YouTube.
that is no where close to being darude sandstorm
A Storm is Coming... 🌐 Sign up now → https://www.Storm25.world ⚡
Subscribe → https://bit.ly/SubscribeDarudeYT
DID YOU KNOW DARUDE STREAMS ON TWITCH?
Watch live streams on https://Twitch.tv/Darude !
‘VIBING OUT’
- Darude live mixing music and connecting with people!
Darude on Spotify:
https://open.spotify.com/user/darudevil?si=hbrB6AHqTySTVGD...
Dreamscape fuck
Yeah :( misremembered
Yeah happened after that whole discord viewbotting incident
love trance
I don't have that?
Oh.... it's because of some other thing I have :3
:3
instead of fixing it they just profit from it, classic capitalism
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?
single event
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
well they don't guarantee no ads on other platforms
well it didn't hurt anyone
as far as I know
its not like discord makes it difficult to navigate to the link itself
Hello guys i have kinda huge problem with my smp can i talk with someone?
?ask
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!
?ask How to fix lags cost by originall bliss smp plugin
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
So im cooked right

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
Spatially partition them :p
RTree :nodders:
epic
Minecraft conveniently already has a spacial partitioning system built in
Called chunks
Does anyone know good server hosting website on eu region where can i pay with paysave card?
They're basically the world edit regions. Seems overkill to partition bounding lol
Worldguard does it
what's even the point anyways? They're not always gonna be a chunk big, or multiple chunks box
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
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
Yea, still makes it needlessly more difficult lol
the cost to reward ratio is absurdly small
spacial partitioning is very performant
Long2ObjectOpenHashMap when
looping through all regions simply does not scale well at all
lol it's not looping through regions
unless you count getting a player's location & basing the check off that anyways
"Seems easier to just loop the triggers"
Yea, each trigger will have its bounds w/ are checked against the player's loc
I'm not like.. storing entire chunks or worlds
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?
(probably) not enough for it to matter
You'd need like what.. a few thousand? 10s of thousands?
Most likely not enough for it to matter lmao
Yea, cause the help is overcomplicating a non-issue
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
I'm going through their code literally right now
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
https://github.com/EngineHub/WorldGuard/blob/version/7.0.x/worldguard-core/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java?
More functionality than I need
private ProtectedRegion parent;
private DefaultDomain owners = new DefaultDomain();
private DefaultDomain members = new DefaultDomain();
private ConcurrentMap<Flag<?>, Object> flags = new ConcurrentHashMap<>();
Don't need any of this or anything using it
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
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
yes, but pulling a BVH setting is very trivial for a very high reward
Generic region api when
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
Binary vanilla hammock
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
i never said you need to use a library?
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
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
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
well, better is arguable but fitting most likely
^ Gonna add up more than just looping a small-ish trigger list
Gotta store which chunks a trigger inhabits, gotta loop through the radius on almost every movement, gotta find every trigger within that radius, then you gotta loop the triggers see if the player is even in them to begin with and then do whatever the trigger's supposed to do
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
Oh no I get why they suggest BVH, but I'm not maintaining plugins running on 1000s of servers with 10s of thousands of players combined so I don't need to optimize every little thing lol
For BVH to actually be useful one of 2 things has to happen
- A lot of triggers
or - 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)
I believe their argument was more on the lines of, why choose a suboptimal solution when the most optimal one is right there, given a fair chance. Then again, I also understand just doing a solution you're more comfortable with and already know the gotchas around, so really ends up being up to how cost-efficient each option is to you
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
Why would you need that
^ 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)
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
You just map a trigger to every chunk it is in, problem solved
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 🤷♀️
im using maven shade plugin, to make my java discord api working in the plugin? is it correct way to make it working?
In the time you did all of this you could've easily implemented a more efficient way to do it
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?
Except that it has made exactly 0 difference for the expected player count 🙂
Your expected player count is 1?
Definitely way less than whatever WG & such pull
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
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
For 10 players that is 8.8ms
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
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
That's very high for such a simple task
Yes, because there's a fuck ton of them at a single location
get the fook out of bed
3.8ms for 1 player using BVH?
take blanket
This takes into account actually checking each trigger & stuff like that
Just cause they're in a chunk doesn't mean they're in the trigger itself
Yeah, but it significantly reduces your required amount of checks
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
Is there an api to check player's view, like first-person or third-person yet?
That's actually fact, however putting all locations into 1 spot defeats the purpose of spatial hashing
That's not sent to the server
That's not a realistic test scenario
Yea, which is why I ignored it and only focused on the looping part lol
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
To be extra fancy you use a long as the key
To be extra extra fancy you use a Long2ObjectOpenHashMap
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
Getting a Chunk object will load the chunk, hence only its coordinates
well this is what ChatGPT gave https://paste.md-5.net/watamuyiko.java lol
Still need to re-implement other functionality I need though
Ig rip server if you populate that map from a database or something on startup
Want it done properly? One of you are gonna have to gimme a proper impl then
I'm not gonna do much better 😎
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
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
So, again. This ^
Alas PR or shut up does not work here, so that's good enough kek
This i guess? genuinely no idea and I've spent more time trying to figure it out than it's been worth, as I expected
https://www.spigotmc.org/threads/get-chunk-from-his-coordinates.376333/#post-3425205
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.
.teleport?
I think they're wanting vector subtraction to look at a specific point
teleport controls yaw and pitch too
Yeah they don't know the math 😛
share the code you have tried
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;
}
Way overcomplicated :p
Vector direction = targetLocation.toVector().subtract(playerLocation.toVector());
That's all you need
oh
thanks so much
could you explain how it works for the future
i'd appreciate it
This is just vector subtraction, a regular math concept. https://www.cuemath.com/geometry/subtracting-two-vectors/
thank you
How to hide scoreboard score numbers? Apparently it was added in new versions but I can't seem to find how to do it.
No API for it. I never finished it
Oh interesting
You have to use NMS :(
How is this called in Minecraft or what would i be searching for if i wanted to do that myself
Doesn’t Hygot support this, but not spigot
Smh