#help-development
1 messages · Page 1280 of 1
And via plugins
And chatsentry
He using
Bruh i dont want illegal stuff i just wanted to give their old password
@fathom dirge
and for what purpose?
I have my public lifesteal server
Whats the purpose of needing to give someone their password? Have they forgotten it?
Not random people first i verify them
Like from when they join it show ip address of wifi or internet
To give them back their pass
I just looked through their code and i can tell you with 100% certainty that the passwords aren't stored, only their hash value. So no way to get that old value unless you look through old logs where they logged in/ registered their password
How to see logs
Why do you need to give them their password?
Did they forget their password?
ServerFolder/logs
If they forgot their password, then you can just change it for them?
There is not showing
But how i verify
Why do you need to verify?
The logs folder should be in the same folder your server.jar file is located
Bro if someone hack their account get try to change from us
?
So, reset the password
You're completely making some bullshit up right now
there is no genuine excuse to need to retrieve someone's password
Yeah true
Has someone forgetten their password? you reset it.
You're clearly up to something if you cant provide a decent answer
@mortal vortex are you idiot
Some randoms guys come to say reset my password without confirmation that doesn't his account
And a random guy asking for someones password without confirmation isnt bad either
"idiot"
k
any good, free dependencies for making npcs in order to avoid nms?
depends
if you just want NPCs that don't move, Lib's Disguises is usually a good option
i want npcs that move
otherwise, you could meddle with Lib's Disguises + MobChipLite or Citizens
neither option is fun to work with
Why don't you use mythic mobs
it supports human npcs?
Yeah it supports everything
Mythicmobs + libs disguises is good
You can also use model engine for custom NPCs
Like custom models with texturepack npcs
i just need players w skins
not really, no
would mythicmobs just be for the movement
if so, how easy it is to move entities in comparison to say, MobChipLite
seems like they just wrap a ton of the pathfinding stuff as well
idk i just know mythiccraft has the best plugins
i mean from their wiki alone
ull see the quality
mythic is trash
but libsdisguises is definitely a good fit
you can use mythic for the mob ai if you don't want to do anything complicated with it, like just have it wander or stand still
I looked at its API the other day and I was expecting something more given the praise you gave it tbh
it isn't bad, but definitely could be in better shape
for anything more complicated you most likely want to control the entity yourself with the goals or pathfinder api
it's the least polished and most error-prone "large" public plugin i've ever used
and this includes slimefun
almost everything is broken or finicky in some way and the api documentation is in chinese
I recommend just using Citizens
Citizens API is just painful
🤷♂️ Haven't found it that painful to work with
i've never used it because i begrudgingly use mythic for my npcs
since all they do is stand around
one of these days i will switch to something else however because even at this mythic sucks ass; the npcs randomly duplicate as mythic loses track of them and spawns new ones
That’s their fallback?? Just spawn new ones
I can't blame them too much for it, dealing with NPCs is just annoying
well it's not exactly intended for npcs or half of the other things people use it for, but you can get something similar by creating a spawner with a spawn limit of 1
but I do understand the frustration
Interesting
unfortunately in the area it is meant for, that is custom mobs, it basically has a monopoly
i say unfortunately because it's ass to work with api wise
https://github.com/InventivetalentDev/CompactNPCLib someone wants to give a go updating this, I'll forever be thankful
i've written a few addons and it's like having sex with a cheesegrater
Well now why do you know what that feels like o_O
obfuscated-nms tier "what does this do" "what is this" -> decompile and look around aimlessly until it starts making sense
I started working on wind mechanics for the frisbee physics, attached a vector to every chunk of the “arena” issue is that without a legit wind system, every chunk has a wildly different vector… should I just suck it up and make a proper system?
something something layered perlin noise
Eek
I was trying to avoid perlin for now until I felt like rewriting the generation
it's fairly simple in principle, you're already doing one layer of perlin noise (without interpolation) basically
what you do is you look at the 4 nearest chunks, get their random vectors, weigh them so the closest one has the highest weight, take a weighted average them
Ah yeah that would work
I mean as far as I can tell, just a simple vector applies some nice looking wind effects
i.e. you add a second wind vector to say every 8th chunk. and then you take the nearest 4 of those, weigh them again, and add average with the 4 from the first layer
In terms of the frisbees flight anyway
I need to do bounce mechanics too smh
Well “skip” mechanics
just averaging the nearby vectors doesn't solve the problem that adjacent chunks will have wildly different vectors, it just makes the transition smoother
adding more layers means that the vectors are more locally coherent, i.e. the vectors in adjacent chunks are more similar
As it stands right now, you can throw about 6-8 chunks max so that actually sounds perfect
mmm i guess it depends on how noticeable the wind is
if the wind has a large effect and every chunk the frisbee goes through tosses it wildly in random directions, hitting anything is probably going to be impossible
Well when I turn up the impact, the disc gets crazy to say the least lol
I found a nice number for the outcome of the effect, being like .2-.7 multiplied by the frisbees initial vector every tick
Well not multiplied, rather applied based on initial throw direction against the wind direction
Skip physics though… I have a couple parts to this, based on the hyzer (angle) of the disc you’ll have more chance of the disc skipping off the ground on its first impact, basically have to write something like
Angle X * Velocity = skip power
Skip power * impact vector = final skip power
ApplySkip(finalSkipPower)
Still have to implement the angle modifier in the throw mechanic though
uhm, im doing black holes but its kicking players because flying is not enabled, i disabled gravity for them, is there somethin i can do or does the user have to enable flying on the server?
Attach the player as a passenger to a display entity and then just move the display
iirc that's a vanilla server feature that can be disabled in server.props or something
I assume it’s intentionally disabled
all it does i think is check if the player is not grounded for x seconds and not falling and kicks them
i think quite a few servers have it disabled because proper anticheat plugins exist and it has had odd false positives of players getting kicked when they stand on beds
that said the proper anticheat plugins will also most likely kick the players for flying or at least rubberband them back
Then yeah just put the player on a display entity
this'll add a bit of latency to the player controls (and you'll have to listen to the player input event to move the display around) but i suppose that does work
Visually will probably be smoother as well
I figure if you’re in a black hole you’re not doing much moving anyway lol
Guess it depends what black hole is to kmys
there's the option of uh adding the levitation effect, but you can't really control how fast the player ascends with all that much granularity
How did you disable gravity
I don’t know if the normal setGravity method works for players
But the attribute does
it worked
oh
yeah it owrked
idk how to do the mob riding thing, seems complicatd
Given that the player could move, I guess you could just let them do what they can until a point where you then attach to a display to visually display them getting sucked in lol
It’s not, how do you modify the players movement when they’re in the field of the black hole?
Cuz it’d be the same thing just to a different entity
But the player is a passenger so they also are moved with it
But then they can’t fight it
.
There’s probably a point where you can’t
yeah, using vectors is better cause player can move in the opposite way to slow it down
you can listen to player input and move the display accordingly manually
True
but this adds a little bit of latency and has other issues, like disabling knockback
That would be the complex part
But it probably wouldn’t feel as natural
You know what a natural black hole feels like jish?
i think slightly trudgy movements inside the field of a black hole is probably fine, but the knockback is an issue if the minigame includes pvp
Yeah
I visit them all the time
I’ll have to take your word for it lol
alternatively, don't disable gravity but add the levitation effect with a level proportional to the Y component of the movement vector you want to add
but gravity only works upwards
Teams should work
oh.. i never used teams idk how that works
if you want the player to go down faster you can just apply a negative y velocity to them
/team modify lalala collisionRule never
thsi thingy? what do i do
if you want the player to go up you apply a levitation effect to them
but you were talkin about gravity effect
levitation
oh
as an alternative to setGravity(false)
can you add 0 levitation effect so player just levitates in place?
I still recommend the attribute
i don't think so, but you can remove and add it every tick or every few ticks so the player approximately stays in place
Assuming you are in modern version
that said the attribute/actually allowing flight for the player (with a slow movement speed) might be better at that point
that's basically zero-gravity and you can move in 3d
whats the difference between that and Player.setGravity
but why doesnt the anti-fly system check if a player has gravity turned on
i used that and it works
i can show you my code
Because it's bad
Maybe it checks the attribute
what about anti-cheat plugins
are they usually also 'bad'
and kick players when they gave gravity disabled
One would hope not
ill test the attribute waittt
if (closestEntity == null) {
onlinePlayer.setGravity(true);
} else {
Location entityLoc = closestEntity.getLocation();
Vector vector = entityLoc.toVector().subtract(playerLoc.toVector());
vector.normalize().multiply(0.1);
onlinePlayer.setVelocity(vector);
onlinePlayer.setGravity(false);
}
also thats the code
it happens every 5 ticks
Isn't that going to be the same strength regardless of distance
Because you normalize the vector
i assume closestEntity only refers to the closest black hole rather than any arbitrary entity
yep
it only works if theres a black hole in 6 blocks distance
so its just sucking the same speed i guess
small black hole
it kicks me when i use the attribute too
rip
so should i use the attribute over setGravity?
if it doesn't help, no
yay
you can try allowing and enabling flight for the player and setting their flight speed to something small
wait you could do that 😭?
oh i didnt understand .
Is it normal that Bukkit#getEntity(uuid), returns null when doing that in the cosnumer that world#spawn() offers?
return world.spawn(location, TextDisplay.class, textDisplay -> {
textDisplay.setBillboard(Display.Billboard.CENTER);
System.out.println("Is entity null? " + Bukkit.getEntity(textDisplay.getUniqueId()));
});```
yes, the entity isn't spawned yet
the consumer runs before the entity is added to the world
why would you use Bukkit#getEntity there though
its purpose is to allow modification before spawning the entity
its purpose is for me to throw an exception in it and then catch it with a try-catch wrapping the spawn call, as a hack by which I can instantiate an entity without adding it into the world, without depending on nms
this is what it was added for
Just for debugging this time, but I had an other method that I did call after this consumer, that used the entity instance from the class, but might just use the entity instance from the consumer then
lol
no wait, the uuid
the method did then use Bukkit#getEntity
I hated that method
So I will change it, it just looks better also
wilmer, your textDisplay IS the Entity which will be added to the world. Its not there yet so you can;t fetch it
I can't imagine that actually works
someone should probably open a bug report about that lol
i will burn your house down
I couldn't care enough to open it myself, so you're safe
Yeah, I believed it was something like that. But its fine if I change text and things for it in the consumer right (With the instance from the consumer)?
that said, isn't it easier to just spawn the entity through nms, it should just be an addEntity call
Yes modify in the consumer
Thanks 🙂
anything that doesn't involve world state is safe, like i don't think you can teleport it in the consumer; but anything that only changes the entity itself is fine
That's what EntitySnapshot is for :c
It went through a while ago
or is that the one that doesn't let me get an actual entity instance that i can modify and pass on to protocollib to send entity update packets
You can
neat
Hey, I'm trying to load a world with only certain biomes for a gamemode I'm developing, how would you do that? I also don't want to generate any oceans, but they are generated despite removing the ocean biomes.
but can you even add players to many teams at the same time ?
doesnt seem a good aproach then
i just did vehicleMoveEvent
and teleported it bakc lol
yes
how
No that doesn't contain the state
Location location = block.getLocation();
World world = block.getWorld();
BlockData blockData = block.getBlockData();
block.breakNaturally();
world.spawnFallingBlock(location, blockData);
i did this
doesnt work
You might need to use NMS
oh
I don't really see an API method for it
then i dont want
then
how to break it exacly like in creative, so the items from chest drop, but the chest itself doesnt?
You can do it with spawnFallingBlock no?
declaration: package: org.bukkit.block, interface: Block
I don't see a method that takes the block state
Looks like Paper has a method to set the block state though
Spigot does not
You can just listen to the EntityChangeBlockEvent or whatever it was called
just do /summon smh
but this also drops the chest??
tfw commands can sometimes do more than the API
true
yeah it just destroys it like in survival
i dont want to dupe the chest so it has not to drop
has to not drop
I believe you could store the broken block pos temporarily in some set and then listen to the block drop event thing
there may be better way
i think ignoring it and just breaking entire chest will be better (not spawning the fallin block) cause the falling chest blocks are invisilble anyway
thatll be easiest
falling chest blocks weren't invisible last I checked
ye that was fixed I believe
could be wrong though
wait, version ?
Does it? I can’t find it lol
declaration: package: org.bukkit.entity, interface: FallingBlock
.0?
yes
or what version exactly
oh
but why would you be on .0 💀
i dont know
is there a list of blocks that can contain some items inside ?
if it's a client rendering issue the client version matters
then 21.5
- usually, assuming no protocol hacks
declaration: package: org.bukkit.block, interface: Container
oh thats an interface
do i just block.getState() instanceof Container?
yeah
Do note that getState can be a bit intensive to run since it has to copy a bunch of data
closed as Working as intended on the bug tracker 💀
just try to minimize the usage of it
You could say so, yes
why
BlockData is kind of a Block snapshot
how can I cancel the book and quil gui opening when clicking a book as I did canceled the interaction event but it didnt work? I found closing the inventory worked but then there was a flash of the book gui
but i was able the close it? so there isnt a way to remove the flash?
The client accepts the close inventory packet for all inventoryies and menus
even the pause menu
wait thats actly usefull
if you don't want openable book & quill then you can use the item_model component on some useless item
assuming you're on some latest version
literally how
I don't see any actual use case besides malicious
what versions support that if you know?
Does anyone use paper here?
this is a spigot discord server if you want to talk about paper join the paper discord server
Didn't know they had one 💀 thanks
thank you
How can I disable players from hitting if they have a bow in their hand? They can still shoot the arrow, they just can't hit a player with a bow in their hand.
did i broke type checking in intellij or smth
im using guava's loading cache and i want to cache null values also so i use Optional<> wrapper around objects just to cache null values, but i dont want to fire up cache loading mechanism for the first check since there might be already cached value
is the optional null or its contents null
optional
getIfPresent returns @Nullable T and T is Optional<Password>
this sounds counter intuitive from optional perspective to return null instead of empty optional
but its just how guava is laid out
basically i want to fire up cache loading mechanism only and only when optional doesnt even exist, otherwise read the value from the cache
if the cached optional is empty i want to invalidate the cache key to refetch the value
i want:
- Invalidate
Optional.empty()(of typeOptional<Password>) ifcache.getIfPresent(id)is not null - If
cache.getIfPresent(id)isnull, fetch that value. - If
cache.getIfPresent(id)is notnulland fetched value is notOptional.empty()use that cached value in the method instead
i guess i can evade this warning by calling calling cache.get(), instead of cache.getIfPresent() twice by praying that implementation is not dumb enough to not notice reoccurring calls
but i guess it wouldnt work because if i call it twice i need to invalidate the cache somehow and that would call back the database twice for the same null value, if for the first time values wasn't cached
performance
i think the issue is ur checking if the optional is null, which should always be false
u need if optional.isPresent
or ifPresent whatever
no you dont get it the returned value from cache.getIfPresent is nullable, and i've set the cache's generic parameter as optional
intellij just freaks out because it looks weird to do comparison with optional
but its completely legal in this case since i need to check whether optional object itself is null, i.e if the cache even held any value before
ah
seems a bit odd to use an optional here instead of the actual type, but if u see the vision go ahead
@Override
public boolean login(UUID id, String password) {
Optional<Password> optional;
try {
optional = cache.getIfPresent(id);
// This is needed since Optional itself is nullable from cache.
//noinspection OptionalAssignedToNull
if (optional == null) {
optional = cache.get(id);
} else if (optional.isEmpty()) {
cache.invalidate(id);
optional = cache.get(id);
}
} catch (ExecutionException exception) {
throw new AuthenticationException("Failed to check existence of authentication entry with id: " + id, exception);
}
Password validator = optional.orElseThrow(() -> new AuthenticationDoesNotExistException(id));
return validator.validate(password);
}
this seems to do what i need i guess
i love caches
right now
until i won't
🥲
but do i even actually need these checks? i mean login is not an write operation it shouldnt invalidate cache
cache.get() is more than enough imho
what even is the purpose of using an optional here
to represent non existant user authentication state
i lazy load whole user object on isRegistered() method call via the guava's cache
and then i reuse that cached object inside login method
saves sql bandwidth
i fail to see the usefulness of an optional here, you aren't really considering optional being a valid value so, why make it one in the first place?
or the usefulness of using getIfPresent either
look, i do have isRegistered() method which checks inside the database if user is registered or not by grabbing whole user object and putting it into cache, then inside login() i dont need to call database again since the object which was retreived via isRegistered() is already in the memory, thus i use Optional<> here. isRegistered() might result in empty optional if the user is not registered
hey. im pretty new to NMS and im getting that error when compiling, does anyone have answer to this? "cannot access net.minecraft.network.protocol.", im using
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
but in either case, if it isn't in the cache or if it's empty, you're just recalculating the value, and if that returns empty, you're throwing an exception
i am not asking what isRegistered does or how it works for optimization purposes, i'm just questioning the use of an optional in a cache
that code example i've provided is kinda incorrect i've simplified it in to this:
@Override
public boolean login(UUID id, String password) {
Optional<Password> optional;
try {
optional = cache.get(id);
} catch (ExecutionException exception) {
throw new AuthenticationException("Failed to check existence of authentication entry with id: " + id, exception);
}
Password validator = optional.orElseThrow(() -> new AuthenticationDoesNotExistException(id));
return validator.validate(password);
}
since login is readonly operation it shouldnt invalidate cache for no reason
cache is guava's LoadingCache
that looks slightly better, although I would throw the exception in the cacheloader and simply return the Password value when it's valid
that's low level repository class im handling the exceptions within AuthenticationManager class
what i'm saying is that you can make the CacheLoader for that specific cache throw the exception
yes but then it wraps into UncheckedExecutionException
unwrap it?
i want to maintain initial exception type for interface contract
why tho, that might incur instanceof checks for getCause() for no reason you can just place it outside cache scope
sure
you do it that way i suppose
i just wouldn't
if i know only one kind of unchecked exception can be thrown, then it's gonna be that
i don't see the benefit in using an optional
but if it tickles your braincells, go ahead
👀
can i just do this
Entity entity = world.spawnEntity(location, EntityType.FALLING_BLOCK);
instead of world.spawnFalling block?
like whats the difference
oh cause the falling block can have some data
, material
??
Yes
can i make furnace minecart invisible ?
Not sure, try it
You can definitely hide it with the hide/show entity api
what is that
Player#hideEntity
Is there a way to change the title of a player's inventory?
The only way you can do this is by removing the inventory title on the user's lang
also your gui's a pixel off
yee i know xd
Sounds easy, thank you
now I can't unsee it
well its obvious xd
it's so noticeable fym
much better
I thought it was just a rounded corner from the preview
Actually it was 2 pixels off
sorry had to do it
When I open a chests inventory manually (using block state) it triggers the animation- is there any way to open inventory (not a snapshot!) without the animation?
you could get the BlockState's Inventory and just do Player#openInventory directly
Thats what Im doing
Isn’t that what they just said they did
yeah it triggers the animation for some reason
didn't think that would trigger the animation
does just calling Lidded#close cause the animation to bug out?
I don't think there's any way to open the inventory without triggering the animation other than cloning the inventory view or something
I did try that but it didnt seem to have any effect
what about a tick after
that's one way to do it, but if you're willing to intercept packets then maybe there's a NMS method you could call for it
Well, I would use packet events to deal with packets, but I’ll have a gander into nms as well
Guys how do I set up worldguard properly? It seems like a bunch of plugins do the same thing and I cant figure out how to assign people in each plugin etc… i use LuckPerms for perms, WorldGuard for spawn protection and essentialX for commands
What exactly are you asking?
You mean with the API?
nono
i mean I have to set up the permissions for each group but it seems like every plugin overlaps with each other someway
This is #help-development
plus luckperms doesnt allow me to remove minecraft vanilla commands
if you want to remove a default allowed command give them the permission set to false
so i need to go to help-server
and i did, through the web editor
but that doesnt work, i set permission minecraft: false which logically should set all childs to false
thats not how permissions are formatted
but i still can use /tellraw, and vanilla commands
you would want minecraft.command and set the field to false next to it not using a colon
it was just to set a point, I did do it through gui
there is also a chance that minecraft perms dont get auto expanded with a star
ex it should look like this on the gui
yeah i know, i tried both minecraft.* and minecraft
and make sure you saved/applied it too
mh lemme try again then
yeah that too, since im w bungee i had to set up a mysql container to share permissions, i though that was a problem but the connection worka
And i am part of the default group
do you have op by chance
in most cases op will override it
would it be "smart" to remove op from everyone and handle everything through lp?
ye sorry ill move there
ill answer u there
yes, always work with the least amount of privileges required for any given role
ie. no one should have more permission than they will need, u can always modify it later of needed
yeah i figured, i just made default get rid of all permissions, and member will just use the one he needs
intellij im gonna be honest i dont give a shit that im for (int i = 0; i < list.size(); i++)-ing instead of for (Type name : collection)-ing
maven smh
i am workin on the shittiest algorithm known to man rn
i tried making a project with Gradle Kt DSL and i couldnt get the Application plugin to work properly
bosh
smh
didnt seem to launch in the right spot still
About to start a game design project for class, before I pick libGDX, does anyone have any personal issues with it? Like reasons I should avoid it?
Dont want to jump ships after I'm hours deep into it, would prefer to know of any issues it has before getting started
so glad i watermarked it then
I'm trying to disable logging of two of my plugin's commands. The command is logged in the console... {PLAYER} issued server command: /{COMMAND}.
I tried setting up a filter in the plugin's logger, but the command gets logged anyway. I want to disable it ONLY for my plugin, ONLY for '/register' and '/login' commands.
My current attempt:
private void setupCommandLoggingFilter() {
getLogger().setFilter(new Filter() {
@Override
public boolean isLoggable(LogRecord record) {
String message = record.getMessage();
return !message.contains("issued server command: /register") ||
!message.contains("issued server command: /login");
}
});
}
Youd need to filter the whole server log4j logger
How do i get the whole server log4j logger?
Bukkit.getLogger()
'getLogger()' is marked unstable with @ApiStatus. Internal
I'll try this
Creating uis is painful af otherwise ots fun
I got this error when running Build tool
seemed that it cannot accthat the maven installation :l
although mvn already exit
Looks like they deleted old maven from the server
I'll change the url, but you can set M2_HOME
I wonder why you just get the latest version automatically 🤔
LATEST_VERSION=$(curl -s https://maven.apache.org/download.cgi | grep -oP 'apache-maven-\K[0-9]+\.[0-9]+\.[0-9]+' | head -1) echo "Latest Maven version: $LATEST_VERSION"
Just tried a tick after, and many ticks after and no luck. Thanks for your help!
Thank you 🙏
would need to send that packet and set the number to 0
and then every 4-5 ticks
you would need to listen for that packet going out
and just modify it
as long as it is 0 the animation will not happen
the number represents the number of players looking in the chest
np
So PersistentDataContainers you get directly from PersistentDataHolders can hold PersistentDataContainers. Is there a way for me to instantiate one of these containers? The actual PDC class is an interface and I don't know how to find what proper class the one I'm looking for is.
I want to store a new sub-container on an existing one
declaration: package: org.bukkit.persistence, interface: PersistentDataAdapterContext
Big thanks!
if you're making a PersistentDataType, you can use the adapter context from the method params of the fromPrimitive/toComplex methods
if not, then you can just take it from an existing PersistentDataContainer, however I'd encourage to make a custom PersistentDataType if you're trying to represent a class as a PDC
@fallow storm ^
reason is that a custom PDT encapsulates the serialization logic into a single class, which makes it easier to handle
oh wow intellij's terminal rendering had improved in recent versions
no more flickerry mess
nice
its as fast as native conhost
wow
now that i think off. isnt shading like a bad practice in terms of java development. i mean you can just load the libraries externally, by supplying .jar files and executing jar file by using runtime class path flag inside CLI: java -cp "libraries/* -jar app.jar
paper imho already does something like this where you declare dependencies inside plugin.yml and then it'll autodownload the dependency for you and put it inside libraries folder, that way you can reuse the same lib across different plugins, not sure if spigot does it
kinda cool
Not everything is on maven central
Also some plugins like to work on versions before 1.17
does spigot itself allow to specify custom maven repos?
No
🤔
if you don't package it then you can't be sure it will be in there one way or another
or that it will be in there with the version you want
shading guarantees you have the things you depend on in there in your own terms, unmodified
just run distJar inside gradle project and it will autozip everything under lib/ structure
you dont even need to have headache with launch scripts gradle autogenerates that for you
windows
Jars are meant to be portable and I don’t know if having to download a separate libs folder is really easy
And then what would you do if it’s like a plugin
let the server software load the dependencies from repository online
just like spigot does
If anything, downloading and loading dependencies is an anti pattern
how is that anti pattern
Not only is it discouraged, but it’s actually against Maven TOS
shading isn't a bad practice at all
you can reuse the same lib across different plugins
it is just a form of distribution, the more well-known term is fat jars or uber jars
shading is kind of waste of space
What if you have many versions?
What do you do
that's the static vs dynamic linking dilemma
Yeah
you specify specific version
And then… what?
i'tll load that specific version if it didnt had it it will fetch it
now, that is an anti-pattern
yeah lmao
if two plugins use same version apache commons why does it have to shade the same shit
the issue isn't that... it's if they are different versions
you should never ever be loading deps at runtime if anything
well, never say ever
lol, then bukkit plugins are antipattern
they are
it is discouraged however people do it since it is convenient enough for the end user that one can deem it worth the hassle
Yeah
the reason runtime dependency resolution is frowned upon is simply because it obscures what is required for your program to actually run at its full capabilities
that's what build systems are for. to declare runtime and compile time dependencies and build the packages which depend on them
declaring them at the build level isn't runtime dependency resolution anymore
this discussion tbh is worthless, there wont be any definite answer anyways. it it was we wouldnt have .exe installers, different package managers on linux and .AppImages or snaps or flatpaks
unless you do something like gremlin does which makes uses of the build script to declare them, but even that is more or less questionable design-wise
.dll/.so vs .lib/.a debate
I personally don't see worth on trying to save space just for the sake of it, nowadays it is free so unless you are in a constrained space or a dumb runtime that will attempt to load everything at initialization, it isn't worth the hassle
Well you are constrained on space with spigotmc
you arent constrained by spigotmc
just dont host it on there
or provide your own url
wow they really upped the bar for that huh
ig that's partly why md introduced the libraries block
eh, it's bad UX
most end-users don't know how to use github
i have an actions that autobuilds so i'd prefer if ppl just downloaded there
even if you direct them to the releases page, they get confused as to why there's a zip on the download options
i hate uploading JARs
thats true lmao
if people dont know how to use github they shouldnt host their own servers
unless they're private
Can’t you link the download directly
you can't, i've tried
Even if you get the link to the direct JAR
It just redirects to the release page of that JAR
some proxy things
most people using spigot are hosting servers for their friends
anyone hosting a server seriously starts from somewhere, not necessarily by knowing how to use github
you don't need any GitHub experience to host a server
if you have actions artifacts then you probably could link them with https://nightly.link/ for better UX
i wonder what file format should i use for my custom minestom server
im thinking of toml
but yaml and json seems fine too
wait holy shit
that's really useful lol
it's better than trying to find the artifact on the actions tab, if anything
I know how to use github and I get lost myself there lol
Actaully i cant use nightly link because I don't use upload-artifact in my workflow
well, use it 😛
otherwise your actions won't have any linked artifacts
I've seen some setups which use semantic-release-bot instead which is fine if you want all your builds to be permanent but it kind of clutters the release tab if you don't do semantic commit messages properly
I use some random plugin https://github.com/PulseBeat02/mcav/blob/master/.github/workflows/tagged-release.yml
i just checked the repo and its unmaintained lmao
so that's essentially just the semantic-release action but worse
Yeah
well, it at least doesn't clutter the releases tab by allowing you to just make all your releases the latest one
hey, as people say, if it works ¯_(ツ)_/¯
thing is it doesnt provide a direct link
maybe i should just use a separate ci platform
to do everything lol
ive used circleci in the past but its ass
i should selfhost a jenkins instance
just use github actions upload-artifact + nightly.link
setPermission doesn't exist
Now that’s a godclass
I can't imagine writting that much code without trying to abstract it out
not that they wrote it all, but still
anyhow, if you want to check for permissions, you have to check if the player has the permission at the call site
in this case, you'd have to listen to the item craft event and check if the player has the permission for your recipe, if they don't then you can just cancel it
Does not having a recipe discovered disallow you from being able to craft it? If so you could listen to the recipe discover event and then cancel that instead. However I am unsure of whether that's actually the case
ah yes, hardcoding data in source code, so fun
what is SlimeFun even about
I know it has some kind of custom storage format which is a bit lighter than the normal one for minigames but that's about as far as my knowledge of it goes
you're thinking about the slime world format which is unrelated
think of industrialcraft but as a plugin
slimefun is more like an attempt at replicating some popular tech modpacks as a bukkit plugin
iirc they used armorstands to store data and it'd corrupt every othre day
to varying degrees of success
and it's all hardcoded
it isn't too bad that it is hardcoded to be honest
unacceptable
it means that it can be machine processed if someone gets annoyed enough about it
like, you could just parse the java code and convert it to a file format and then just modify the code to read that file instead, wouldn't be particularly hard to write a tool for
I assume that after you get all the hardcoded data out of the way, the rest of the code is way more digestable, though I haven't really looked at it
personally i don't mind the recipes being hardcoded since doing them in a non-source file wouldn't benefit for linting or autocomplete or anything else nice
but imo the recipes shouldn't all be hardcoded into the same class
I mean, you can defintely get all those benefits with the right format, but you'd have to create a scheme and the such so yeah, I get it
eh, if it is hardcoded, it hardly matters
it definitely matters, locality is important
they could use some help of indentation and comments to make separation clearer, but other than that
if you have a finite amount of recipes it doesn't matter
I assume they allow you to add your own, but yeah
also having it as a format allows one to keep adding them fast as well, while having them in code means recompiling which can be annoying for something so huge
currently the item definition, i.e. the recipe, item stack, and behavior are spread in three different places; this class, the SlimefunItems god class, and then the SlimefunItem subclass for that item, respectively
this is ass
if it were up to me, it'd all be in the latter
Ig that's where locality would indeed matter, the fact that the class is so huge means that the code takes longer to compile lol
not just compile but to find or do anything with it
if it were me it wouldn't be anywhere because it'd be getting anonymously initialized from config files but that's just down to how you want to scope things
not a fan of god classes
all of this said, I can't really shit on it
i can and i will and i have done so and will continue to do so
they're fine if you have a finite project that does X thing and will never need to do anything more
it is very straight-forward code, even if not up to my standards
some1 mentioned god code and im piqued
I prefer straight-forward code rather than heavily abstracted code that takes me making diagrams on paper to understand
I have some AI projects that just do one very linear task, basically a glorified script
it's just a dump with a single java class doing the entire thing
this would probably be a case where AI could help massively, though I doubt any current model has big enough context window to handle it lol
I remember seeing rumors that siri would be able to take user inputs and make shortcuts out of it
no more AbstractFactoryFactory?
more input tokens means more money spent
gemini is free but yeah it costs google more
and boy
Inversion of control is my enemy
I just get the biggest smile on my face every time I make a 1 mil token request to google
I love spending their money
I will never understand the obsession with that pattern
i'm a bit doubtful as to how long these free services will last but we'll see
oh I'm sure they won't
doesn't seem like a very good business model
I'm maximizing their costs as much as I can right now
local llms dont seem fast enough to code yet
throw more gpus at them and they'll become faster
tbf though
give is what
20 years?
and everyone might have a top of the line model enterprise gpu in their desktop
but at that point you're better off just leasing compute
less accessible to low end computer use of like students and stuff who really deserve the ai
plus 20 years of ai improvements
i'm looking forward to the asic's
On a desktop local is doable 96GB or 128GB RAM
imo, fast forward 10 years and a lot of people will be able to run claude 4.0 thinking on their desktop
which would already be enough for a lot of things
prooobably
(i'm talking in terms of equivalencies)
no joke claude 4.0 is already smart enough to make for some really interesting games if you just had free tokens
har har har
but it's also insanely expensive
I think I have over $100 in api costs using it over the past 3 or so months
you've just got to optimize your usage and not send it 1 million token requests
already have
not enough
Optimize your usage to 0
sure, judge something you know nothing about
try harder
that seems reasonable
Idk how to get my agent to do a task for x time
that's not how LLMs work, you give it a query and it replies, one time
you can make it chain in on itself if you want to
ive got it to chain enough to make a README of a codebase
but that's just basically getting it to talk to itself and then putting an arbitrary end point
that's one thing i think inference providers should work on more, better integration of function/tool calls
it was accurate but pretty short
i think the openai realtime models did something like this but they were far too expensive at base for it to be useful
most models only get 8k output tokens
even gemini which has 2 mil in
which is a major weakness
for a lot of stuff it simply is not enough
Yeah individual files never seem to get up to production size from prompting
i think this is mostly a limitation of the infrastructure the models run on rather than the models themselves
I think it's both, models don't like it when they can talk for too long
that said some frontends clearly have workarounds for this already
claude can write 5 full classes of code with each more than 8k tokens in a single reply while the api can't
you're referring to claude code?
the thing is that this isn't really intrinsically any different from what we already do with them
sure, mildly
take for example an openai function call
all it really does is append some new tokens at the end of the context and then resume inference
there's the disadvantage that if it goes in the wrong direction you're just going to waste more time
but that's about it
I mean it's basically how deep research works and that's usually kinda fine
I wouldn't say it's faster at finding what I was looking for than I am, but I can just be working on something else while it's digging
also reminder we might already be in one of the best eras of AI because we don't have built-in ads in them yet
that's going to be something else when every platform has built in ads and you AI girlfriend really wants you to go out and buy a verification can of dr pepper
💀
I mean
autonomous street cleaners already exist
and you can watch gemini, claude and uh
grok?
playing pokemon right now
yeah super fascinating to me
my test for them is to see which chemical compound is their favorite
chatgpt is the only one which wasnt a duplicate of the others but anyway the cool thing is them making creative decisions
What would be the best way to receive one way inputs from a player. I was thinking of using conversations as all I need may be a input, int or such like that? but unsure of how retrieving the information after the conversation ended or timedout
i guess they're mostly utilitarian
what's your favorite chemical compound
myrcene
personally i'm quite partial to water
caffeine
after all i'm 80% water
today myrcene, tomorrow morphine
and i'm the best thing i know
i know them all i love chemistry
so water is at least 80% good
you like chemical compounds? name every chemical compound
could you elaborate
public Prompt createIntConversation(String question) {
return new StringPrompt() {
@Override
public String getPromptText(ConversationContext context) {
return question;
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
}
};
}
Since when?
I'm using a GUI libary its just a lot of passing classes back and fourth and its a lot more work rather just asking for a simple int or input.
it's been broken for a while now, something something signed messages
I swear I’ve used it post 1.19
or that's what I've heard to be fair, I haven't actually tested whether it actually works or not, maybe it just implodes under certain conditions
yeah, not particularly hard to be honest, it is one of these novel APIs from Bukkit which just didn't receive much love with the time
GUI libraries absolutely suck for this kind of model, yeah
most GUI libraries expect you to make an immutable GUI, so once it goes out of that then you're shit out of luck
if you want just text input, anvil GUIs usually are fine
would also have to wait for spigot release
Sign GUIs too but they're kinda annoying in that they have to be within range of the player otherwise the sign GUI doesn't show
Issue is with the one I'm working for has an issue with anvil stuff so I just decide to have one main ui. it passes new values to it and updates it
I can smell that being very fast
Don’t quote me on that when it isn’t though
Would you perhaps have the code for that and is it local to each player?
I mean, just listen to the chat event
^
then build up your abstractions as you see fit
the issue with using chat for input is that it breaks the chat chain so ideally you'd use commands but welp
Chat chain?
it is a thing internally, whenever you report a message it sends the whole chat chain
Ah
then again, I think that stuff doesn't work quite well on spigot? Or so I've heard so it is more or less a non-issue, for better or worse
Idk I’ve never seen any issues in my test server
I don’t even know if anything is signed
Couldn't I just use a command
you could indeed
to trigger it
/reply whatever you may desire
When they click on the GUI item it uses /triggerinput Int then have it use a timer to receieve an int input
usually going from GUI to chat is quite unergonomic
choose one or the other
what is it that you're actually trying to do anyway, we're discussing the solution without knowing the problem
what is that you have to input
Stuff like name, interger related information, etc. I only need and input and int as the anvil gui for this library is not made very well and the creator documentation is a big vague on how to use it
couldn't you just use Spigot's API for the anvil gui
nowadays it just works with MenuType API I believe
i don't recall having issues with the conversation api, though i'm on paper and in offline mode
You probably shouldn’t use the conversation API either way
is there something wrong with it?
I remember helping people having issues with it, however I don't remember what the issue actually was so it might just have been people using it wrong or whatever
it's been a while since anyone has asked anything about it
there's nothing particularly wrong with it, just hasn't received much love
i.e. you can't really parse components with it and the like
but for basic stuff it is fine
it is a bit awkward to use but it's still marginally better than listening to the chat event or something manually
can the client even send components in chat?
i thought it was a plaintext string in the protocol
they can't send components directly, but usually people allow that by parsing format
i can just toss it into the minimessage parser or whatever if i need to, i think i already do that for player-placeable holograms
or no i think i use books for those
the one way they're allowed to send components is via tellraw but that is just awful for users lol
mmmm
seems like set group works
.
im thinking rn. aren't plugin config files with sensitive database credentials are kind of security hazard?
sure you can say nobody will reach plugins directory and steal that info
but you're storing passwords and other connection details in plain sight, hoping that some plugin exploit wouldnt allow you to read specific text files
one exploit to the plugins folder and bam your server data is completely leaked
filesystem access isn't any less difficult to get than e.g. being able to get the environment variables/system properties
you could maybe serve credentials from a microservice or something but all that really adds is security by obscurity
I already answered with what you have to do
.
if you can access the plugins folder you pretty much have an RCE waiting to happen
well dumping memory is harder to read than persistent credentials
ppl can upload a plugin and load it
then access the credentials in memory
or make a heapdump and upload to some server for later analysis
i guess you could set up a tunnel or a virtual private network in addition to the database credentials, and/or set up the firewall on the machine running the database so that only the minecraft server/plugin can connect to it
making the credentials useless
but yeah, by the time you get someone with filesystem access you are already fucked
even if you use environment variables nothing's stopping someone from loading maliious code and reading those
there's legit nothing you can do if someone acesses your file system
to be fair there is a difference between read and write access
read access could be much easier to get through some exploit in a plugin
I mean, just serve credentials through ephemeral methods then encrypt it like any authentication service would do
but my gut tells me it'd be just as easy to get read access to system properties
Ephemeral methods as in commands or console input if you can manage to do that in spigot console
only alternative is to run everything in memory straight off a image and dispose the VM after execution
still vulnerable to heapdump analysis
Heapdump analysis would be useless since it’d be encrypted
ppl are gonna reverse the encryption at some point
i mean ideally the credentials aren't the only line of defence to the database; you'd have a private network, or have it on the same physical machine with all ports closed, and a firewall
Just use a strong encryption algorithm and you’re good
muh quantum computers
Otherwise we’d be all fucked with all the database leaks that have happened over the years
crazy ass firewall and user management system
I believe following the standards web sets for auth is good enough
even if you have S3 creds you'll likely get blocked because it isn't coming from a specific IP
or domain or whatever app
Makes me wonder if one could make something like Clerk or Auth0 work with Minecraft plugins
Without having to interface it through some bs middleware REST API or something along these lines
Though I guess all these services offer is in fact just a glorified REST API with their SDKs so no way around that
but it reduces the risk of getting it exposed for example accidentally or through read excploit. RCE's require more knowledge about the server overall. Its just good practice to not save such things in .env or config files in either case since then you can easily revoke access or centralize management of credentials by external means, like through secrets manager
Is there a way to do an instant callback with a method?
maybe he wants CompletableFuture which is completed instantly
a completablefuture is completed instantly if you do it in the same thread
though at that point you just want a Consumer
CompletableFuture#completedFuture(U value)
sometimes you need glue code for async calls
fair enough
https://gist.github.com/AvocadoVR/be52e91b223779eafc53c64e17a922b9
Using the CreateConversation method. I'd wanted to callback the value if of course they responded.
just use a CompletableFuture
I was extremely confused by your naming convention by the way
Yeah, I was about to change it lol.
i bet he's c# dev lol 😄
not really about minecraft, but what frameworks do modern java applications use for their ui?
its the opposite for me
D:
if i see pascal case i know its class/interface/record
in c# you have no idea
Swing, JavaFX
afaik Intellij uses Swing
JavaFX is kind of a bootleg react MVC but with OOP approach
@flat lark I feel like you're just recreating Brigadier
AWT -> Swing -> JavaFX. AWT is the most low level lib which Swing builds on top, and JavaFX build on swing on top
iirc
okay, thanks :)
is there a reason you couldn't just use commands, I feel like you could wrap the conversation around commands so you could take advantage of brigadier validation
although you couldn't take advantage of the client-side auto-completion that way but alas
AWT is basically "return me native UI, pls" kind of low level lib in java, meanwhile swing exploits that lib to render its own controls to make it look in OS independent way
JavaFX doesn't build on top of Swing
I'm not entirely sure what you mean I'm not too versed in spigot functionality and networking is another ball game I haven't even understand yet lol
it doesn't really matter then
iirc implementation wraps around swing but i may be incorrect
there's some parts of it that has compatibility with Swing but that's about it
reason is that people were too used to Swing at the time so they had to provide some level of "backwards compatibility"
i guess you're right gpt tells me it wraps around AWT and not swing
nope
still wrong
found correct info on oracle site
@flat lark this is just a way to do it, so you don't necessarily have to do it this way but it keeps it simple enough:
public <T> void createConversation(
Player player,
String question,
Function<String, T> parser,
Consumer<T> action
) {
UUID uuid = player.getUniqueId();
if (awaitingInput.containsKey(uuid)) {
awaitingInput.remove(uuid);
player.sendMessage(ChatColor.RED + "You had an unfinished input, it has been cancelled.");
}
player.sendMessage(ChatColor.WHITE + question);
awaitingInput.put(uuid, input -> {
try {
T value = parser.apply(input);
action.accept(value);
} catch (Exception e) {
player.sendMessage(ChatColor.RED + "Invalid input. Please try again.");
} finally {
awaitingInput.remove(uuid);
}
});
}
then you can do:
createConversation(
player,
"Enter a number:",
Integer::parseInt,
number -> {
player.sendMessage("You entered: " + number);
}
);
javafx has its own abstraction layer for OS controls called Glass
it doesnt use AWT for low level stuff
basically just shade javafx if you need to render stuff
is this java or kolin?
java
java
I was so confused by the :: making me seem to diff to me
its just static method reference
like passing function delegate through parameter in c#
method reference, stuff java 8 introduced to make the language a bit more functional
the other one is a lambda, but you probably already know that
yeah
Yeah, I'm going to use your method as its very better than mines!
weird, it should be able to infer there
just do (String input) -> {}
no, uuid, (String input) -> {})
probably doesn't need the parenthesis around the parameter but eh
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
var player = event.getPlayer();
var uuid = player.getUniqueId();
var callback = manager.getCallback(uuid);
if (callback != null) {
event.setCancelled(true);
// Run on main thread
Bukkit.getScheduler().runTask(plugin, () -> callback.accept(event.getMessage()));
}
}
this is how you'd integrate it to the chat event, you'd have to make a getCallback method in the ConversationManager which is just a getter for the map
you may also want to add a parameter to that method for timeouts and what not
i wonder if there's any attempt to try to provide bukkit api support in minestom lol