#help-development
1 messages · Page 1307 of 1
i want the command they use in game to be the same as the plugin name tho
figured it out, you can remove it in PlayerCommandSendEvent
Hi, is there a built in way already to support hex color coding?
This seems to be the new standard, but it's been a while
Yes, but I mean in regards to how I implement this support for my plugins
I see some Regex stuff but it can't be that complicated anymore right?
is there a way to write llbit's nbt api into buffers? (which bungeecord natively provides like others inside DefinedPacket)
i think md5 bungee colors already support aforementioned format, but if you wna do sth more compact like &#aabbcc then a simple regex or character parsing should do the trick
I'm not quite sure what you are talking about. Currently I also use the ChatColor.translateAlternateColor but this is only for the default color codes. So in case my users want to use full on hex color coding, I need to use Regex? No existing funtion?
yea so ChatColor is from bungee chat thingy thing, as freestyler said, users may use aforementioned format. But if you wanna provide a custom format then thats on you. I should say there are a good set of libraries that do this for you more or less, for example you could utilize minimessage.
Alright, I'll have a look. Thanks for looking into it!
best of luck :)
Thanks 🙂
where?
try restarting inteliJ maybe
Also, you are sure hte version you are using actually exists?
I did several times
<!-- https://mvnrepository.com/artifact/com.ticxo.modelengine/api -->
<dependency>
<groupId>com.ticxo.modelengine</groupId>
<artifactId>api</artifactId>
<version>R3.2.0</version>
</dependency>
How do i get the minecraft version in format 1.MAJOR.MINOR?
and why is there no simple function for that yet
does getBukkitVersion not exist in ur fantasy land?
literally returns the bukkit version and not the minecraft version
wat abt getVersion
i cant wember
Bukkit#getVersion returns the version but with the following format: (MC: <version>)
so you'd have to parse the version out of that
(do note, Javier has a Ko-Fi link in his bio, support is not free, please donate)
I've only ever gotten a few donations out of that but thanks for the shoutout lol
getServer().getBukkitVersion().split("-")[0]
been using this but not sure that works for everywhere
does that work everywhere and on every version?
the getVersion method has existed before Spigot was made I believe so you should be fine
you can parse it with regex, or with apache commons' StringUtils: StringUtils.substringBetween(Bukkit.getVersion(), "(MC: ", ")");
alright
okay thanks
Spigot has a custom classloader or something like that right? I'm trying to load Javalin and it's saying class not found but I've checked the dependencies and I'm pretty sure it's there
r u using softdepend or anything of the sorts
not sure
I have the dependency build.gradle.kts as an implementation dependency. I have the dependency jar downloaded and it's being included in the build as far as I'm aware
Pretty sure I ran into this issue before and I had to switch classloaders or something but I don't quite remember
how are you trying to load it
just importing the class and running functions from the class
confirm that the classes are actually in the jar
like unzip the jar with winrar or whatever and physically look inside
Make sure you are actually running the grade build and not IntelliJ’s default build
And that you have something like shadowJar to bundle the dependency
im running gradlew build
whats shadow jar and do I add that somewhere in build.gradle.kts
So how does shadowjar affect like the plugin entry point
I'm a bit confused (I'm new to java)
shadowjar just includes the dependencies you want to include in your jar
so the classes will be available at runtime
some dependencies are provided by the runtime, like the spigot api; other dependencies you need to bundle into your plugin itself, creating a "fat jar" of application + dependencies
So I added it to the plugin block of build.gradle
but I seem to still be missing steps
its rude to call them fat. Its not their fault
run minimize to trim that extra fat
lol
has anyone actually asked the JAR what he feels? If he is comfortable in his skin, I don’t see a problem.
have you ever seen a jar over 100mb live past 30?
my jar is trying to bulk up and it still needs help
i don't quite remember how to set it up with gradle, something something tasks { } somewhere
best look up a guide or wait for one of the kotlin/gradle/di enthusiast pinknames to answer
got it. well I have a direction for this at least
another option, if your dependency is on maven central, is the spigot library loader
in your plugin.yml you can define a list of dependencies for the server to download at runtime and provide to your classloader
this keeps your jars lightweight, but iirc only maven central is currently supported for getting the dependencies from
i also vaguely remember it having some kind of issues with kotlin, but "issues with kotlin" has a simple fix of not using kotlin
Hi. I need to use StructureGrowEvent to prevent tree growth in certain situations and to do that I need to find the location of the original block (sapling) from which the tree grew, the event however provides only getLocation() and getBlocks() methods with the first method's description stating Gets the location of the structure. which is non-informative. Do you guys know whether getLocation() points to the block at which the sapling once was or if the first block returned by getBlocks() is the one?
try it and see
i'm fairly sure it points at the sapling, i remember doing something tree growth related before and having to test this out
specifically it's the sapling that triggered the growth, so for e.g. huge spruce trees it's the one sapling among the 4 that gets bonemealed or procs growth naturally
Okay, tyms<3
Hey, do u know how to dont have commands like this cmd:cmd ?
i search on internet but idk how to have only /jobs command and not /jobs:jobs
this is my plugin.yml
i would start with the problem i have
I BAUGHT VULCAN AND FORGOT TO LOGIN PAYPAL IDK WHERE TO DOWNLOAD
crazy
Set send namespaced to false in the spigot.yml
thanks, this option is for multiples plugins with sames commands i asume so ?
yes
i tought it was a plugin side config, thanks for helping
please help
on the spigot page?
Hello all, I have a java related question related to upcasting. What is the point of upcasting, I dont see how its useful when a subclass' objects already inherit that of the superclass.
Does anyone know how I can check if any command, even like non plugin related commands has been executed?
PlayerCommandPreprocessEvent
i don't remember the last time i've upcast anything
probably some generic type stuff requires upcasting
What in the unholy hell
is there a reason why you're using gson directly instead of just using the yml api that spigot provides
and doesn't gson accept a typetoken directly, without having to call getType on it
to be fair gson is quite a bit nicer than the bukkit config api for serialization
DFU Codecs 😊
i've survived on linux for three weeks now without hopping
decided to stay with gnome though
i like its fast file search
plasma search seem to suck
modded a top bar a bit with dash to dock to mimmic workflow i've had with startallback on windows 11
bob uses .json because it aligns well with datapacks, be like bob.
honestly i dont know any plugin which uses .json apart from very old versions of factions plugin
with massivecore
Yml is for config files I thought
Works for both if you want
yaml is a superset of json, so valid json is valid yaml
though i do find parsing json with the bukkit config api a bit silly
Isn’t json faster
you shouldn't be doing disk io on the main thread anyway, and off the main thread the difference is negligible
{} and [] are used to define inline dicts and arrays
e.g.
map:
list: ["of", "strings"]
is equivalent to
map:
list:
- "of"
- "strings"
and is also equivalent to ```yaml
map: { list: ["of", "strings"] }
So should I use yml
and is also equivalent by quoting the dict keys to
"map":{"list":["of","strings"]}
which is now json
yes, valid yaml isn't necessarily valid json, json is very strict while in yaml there are 100 ways to do any given thing
As long as it doesn’t involve tabs
No comments in json 💀
“_comment”: “kek”
☠️
^ software world if javascript didnt exist
wdym yes
so real
you wouldnt be typing this without it here you fool
you can shit on javascript as much as people on karl marx until they realize that before socialism, such things as minimum wage didnt exist
wow we went from 0-socialism in record time
I mean I guess, they would probably invent something just as annoying if js wasnt there
This is the dumbest take.
Just because something happens at the same time as something, doesnt mean its related.
Both ice cream sales, and drowning incidents, increase during the warmer seasons. Doesnt mean they are related.
well there were labour protests and activism prior to this that made this happen. Sure karl marx didnt got involved in this ofc lol, but those things are related to socialism, since socialism is a policy which take priority of the workers and people over conglomerates. The outcome of this kind of socialism were drastically different when comparing west to east, with west favouring socialdemocratism and east being more radical than west. saying this that karl marx didnt inspire this kind of activism would be an understatement. He didnt had involvement, but his ideas were carried on in 20th century, especially after great depression
i'll stop here, since i dont want to get banned by almighty md_5 for politics
😭
dude what the fuck are you on about
hey question, how do i get this listener to not trigger again when cancelling this event?
@EventHandler
public void onUseAbility(PlayerItemHeldEvent event) {
int newSlot = event.getNewSlot();
ItemStack abilityItem = event.getPlayer().getInventory().getItem(newSlot);
ItemStack weapon = event.getPlayer().getInventory().getItem(event.getPreviousSlot());
event.getPlayer().sendMessage("playeritemheldevent triggered");
if (AbilityItemTemplate.isImmovable(abilityItem)) {
event.setCancelled(true);
Bukkit.getPluginManager().callEvent(new UseAbilityEvent(event.getPlayer(), weapon, abilityItem));
if (AbilityItemTemplate.getCooldown(abilityItem) != -1) { // if the item has a cooldown timer
event.getPlayer().getInventory().setItem(newSlot, cooldownItem);
Bukkit.getScheduler().runTaskLater(instance, () -> {
event.getPlayer().getInventory().setItem(newSlot, abilityItem);
}, 20L * AbilityItemTemplate.getCooldown(abilityItem)); // 20L = 1s
}
}
}```
hacky, but why not a Map<UUID, Long> for triggers, every X ms?
or store the item, check if item was same as last
oh yeah decent idea
yeah a version of that worked, thanks
YOU'RE SO FUCKING WELCOME
Language.
Java
Dependency 'com.sk89q:worldedit:6.0.0-SNAPSHOT' not found Dependency 'com.sk89q:worldedit:6.0.0-SNAPSHOT' not found Dependency 'com.sk89q:worldedit:6.0.0-SNAPSHOT' not found
Anyone knows how to fix this I installed a plugin from github and im trying to compile it and no matter what i change in the dependency nothing seems to work.
<dependency> <groupId>com.sk89q</groupId> <artifactId>worldedit</artifactId> <version>6.0.0-SNAPSHOT</version> <scope>provided</scope> </dependency>
well is the repository provided?
or is it a local repo
if its local, youll need the jar locally
how do i check idk anything about this type of stuff.
<!-- WORLDEDIT --> <dependency> <groupId>com.fastasyncworldedit</groupId> <artifactId>FastAsyncWorldEdit-Bukkit</artifactId> <version>2.6.1</version> <scope>system</scope> <systemPath>${basedir}/lib/FAWE.jar</systemPath> </dependency> <dependency> <groupId>com.sk89q</groupId> <artifactId>worldedit</artifactId> <version>6.0.0-SNAPSHOT</version> <scope>provided</scope> </dependency> this is the whole dependency
then why are you trying to do it?
okay so you need a local jar file, I dont imagine they provided it for you.
🤦♂️ get it and then add it.
in the project folder?
i cant find a compiled version of this plugin so im trying to do it myself
You can’t find it compiled you say..?
What’s the plugins name
I figured out how to do it thanks i was just stupid bruh 😭
I think someone’s trying to skid a plugin 🤔🤔
Gonna tell us the name of the plugin?
Prison Core
heyy, one question, Bukkit#getPlayer, get the player in a list, or load something sync?
In memory lookup
getOfflinePlayer is what loads from disk.
okok tnx
only if the player is offline though
Pretty sure that’s obvious given the word Offline
the usercache is in memory and getting offline player by uuid/name checks that first
you hit the disk only if the player's not been online for around a month so their usercache entry is expired, or, if getting by name, network io
Hey i don't know where to ask, but i'm currently making a resource pack for my minecraft server in 1.21.4 there i have a custom model which loads but has no texture, the model is just black and i can't get the texture of the model working thats what's currently in the texture slot in the model json
{
"format_version": "1.9.0",
"credit": "...........",
"textures": {
"texture": "uv_map/taser_loaded"
},
"elements": [
and i have the taser_loaded.png file everywhere in my texturepack already because nothign works
it usally should search for assets/minecraft/textures/uv_map/taser_loaded.png but there is that file but still theres no texture
Open logs and send the error
oh actually can you also show the rest of the model
Oh no ok, I remember now
Did you add the uv_map directory to the block atlas @pure elbow
what is block atlas?
You need to have this file in your RP and add one entry with your directory
you don't copy all of it, just add one entry
Otherwise minecraft will not load any textures from your directory
Oh thank you but i randomly got it working without the atlas? 😅 using "minecraft:item/taser_loaded"
well if you moved the texture to a vanilla directory, then it would work, yes
yeah i just use the minecraft folder in my RP
-# which btw I despise lul
Hey where can I request custom plugins i can pay
?services
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/
give me all of your money
dm me ill buy ur plugin instead
lol
why did you use systemPath?
just remove systemPath and replace <scope>system with <scope>provided and add the proper FAWE repo and then it'll just work
Do you guys have a custom logging class for debugging?
I just thought it would be nice to be able to disable certain classes from printing for the purposes of turning on certain classes to print when debugging
i go into the class in question and do replaceall from //system.out.print to system.out.print
they double as comments about what the code is doing when commented out 🤡
log levels
that + per-class/feature/module loggers to adjust the levels on is probably the way to go
having one logger doesn't help in a big project because when you bump it up to the debug level you get a wall of text from 25 modules and your logfile becomes 50 megabytes instantly
😔
Hi, does anybody here know of a place where I can steal code for Bezier Spline ?
I remember having code for that
🙏
That's certainly a name :D
Thank you
pretty sure I stole this off somewhere
or used AI to write it
dunno it's been years
Hi. Is there a way to listen to all block events? I tried doing that by listening to BlockEvent but it's abstract and doesnt have handlers list
The question would be: why
What exactly is MinecraftKey and is it related to NamespacedKey?
is it basically just namespacedkey but only for the minecraft namespace?
I didn't want to do NMS, but it is seeming I need to for one specific thing
which is item cooldowns (like, on the visual item in your hotbar)
Honestly its kind of weird spigot api doesnt have a setItemGroupOnCooldown method or something
Item group?
Yeah there’s a cooldown component now
That allows you to specify a namespace key for a group, all items with that same key will share a cooldown
Oh that's neat
Ugh I spent a bunch of time looking for it and couldnt find it
alas
Honestly idk how i missed it
Yep that was a pointless sidequest lmao
but sadly it doesnt show the cooldown animation
I replaced my nms code with the setCooldown function and it shows the animation just fine
hmm then maybe I messed something up 
Is your item in its own namespace group?
or is it just a cooldown on the stick item (for example)
it sets the type's cooldown
you gotta use nms for cooldown groups
@pseudo hazel
hmm okay
The docs says it prioritizes the CooldownComponent's cooldownGroup if it exists
The docs could just be wrong, I havent seen that with spigot yet though
Read the javadocs
Smh
It was specifically modified to affect cooldown groups not too long ago
By someone with this same issue
It didn't when I wrote this 2 months ago
you probably didn't notice the ItemStack overload that was added last year
Nah even the overload didn’t work with the component at first
Hence
no you don't
it did tho, the documentation for it was wrong but the implementation didn't change since then
why rely on names to begin with
question, how would i go about making a player invunerable without losing a mob's aggro?
Parse their name, set it to whatever you want it to be
set the attack damage to 0
neato, ill try that
thanks
But wouldn’t you have to look up their name from the api
To find the right name
Cancel damage events in order to prevent knockback
what do you mean?
if they are on the server, you should have their name. If you are just wanting to fix casing in the names its not hard to do, but you do need to parse their name to figure out which letters need to be fixed
Oh
neato dorito, ill try that too
is this in creative?
because they shouldn't be able to dupe items like that
the bug?
or do you mean just generating ghost items, because that's a non-issue
So its like that. Basically by clicking items into their inventory and perfectly disconecting their router it messes with the packet timings between client and server
allowing them to dupe
well
the server has total control besides creative mode
so one of your guis is waiting a tick or something
and that introduces issues and race conditions
I've seen it in other ways where they have a sell button that gives you drops
and you can click on it like 5 times and fire them all at once
and there's nothing stopping that
Im telling you whats happening
All I know is packet delay client allows duping...other devs have suggested I put in cancel events that check to make sure client matches server
I've been deep into menu internals for the past few months
I can provide the plugin src its open source and you can take a look if thats posssible
Throw the link in here I'd rather procrastinate and check this out
mkay. little more info also
This is networks a addon to a larger plugin called Slimefun4. In networks theres 3 items with this dupe glitch. Network Monitor, Grabber, and Pusher. When placed these blocks show you all the blocks around it. Then you select which block the machine interacts with. Because the data is saved in this button menu, if a player takes items out and desyncs packets (to my knowlage) they can obtain the items over and over again. Here is the open source srcs
Slimefun4 https://github.com/Slimefun/Slimefun4
Networks (the problem comes from here) https://github.com/Sc268245/Networks
I'd blame slimefun / not using synchronized tickers for this
dunno enough about slimefun and this is insanely abstracted
with a pretty derp menu system too wow
How do you reccomend i make a fix
any fix no matter how bootleg
seems you are going to have a lot of fun
jesus why 😭
I think the easiest solution is to record inventories when interacting with inventories
and if they disconnect, just put it in a DB to apply that inventory to them when they reconnect
should solve the duping problem with those things until you find a more appropriate fix like changing the entire code possibly lol
time would be better spent just figuring out a way to easily reproduce the dupe
well, can't just have nothing though
pretty easy to develop such a fix I proposed which leaves them more time to figure out where its going wrong
I mean, the dupe is pretty specific, they could just not save the inventory if they send too many packets at once like those hacked clients are doing by delaying packets
but either way, I do not believe it is that hard to trace this issue even if it comes from slimefun, unless it is actually a vanilla issue which in that case then one would be deep in the sauce
I am not familiar with the stuff they linked nor looked at it so couldn't really say how hard or difficult it would be
who can modify vulcan for me dm me
Har Har Har another slimefun/networks dupe
The solution is not to use networks
It's almost surely some form of threading issue since the networks motto is "everything is async"
Guys is this a bug? ```java
@EventHandler(priority = EventPriority.HIGHEST)
public void onProjectileHit(ProjectileHitEvent event) {
Bukkit.broadcastMessage("1");
Plot affectedPlot = null;
Block hitBlock = event.getHitBlock();
Entity hitEntity = event.getHitEntity();
if(hitBlock != null) affectedPlot = PlotManager.getInstance().getPlot(hitBlock);
else if(hitEntity != null) affectedPlot = PlotManager.getInstance().getPlot(hitEntity);
Bukkit.broadcastMessage("2");
if(affectedPlot == null) return;
Bukkit.broadcastMessage("3");
Projectile projectile = event.getEntity();
if (projectile.getShooter() instanceof Player player) {
Bukkit.broadcastMessage("4");
if(ProtectionUtil.canPlayerAffect(player, affectedPlot)) return;
} else if (projectile.getShooter() instanceof Entity entity) {
Bukkit.broadcastMessage("5");
Plot entityPlot = PlotManager.getInstance().getPlot(entity);
if(ProtectionUtil.canPlotAffectPlot(entityPlot, affectedPlot)) return;
}
Bukkit.broadcastMessage("6");
event.setCancelled(true);
}```
I thought I can bypass it but it doesn't seem to work, the block still gets activated: java projectile.remove(); event.setCancelled(true);
What exactly is the problem
As shown on the photo, the whole logic is sound and when a player is not permitted event is set to be cancelled, however as you can see on the attached screenshot the arrow still actually activates the pressure plate
And when I made this adjustment it didn't help as much as I thought it would because the arrow disappears so the pressure plate isn't being held but it's still activated for a short burst of time
are you certain it is actually triggering. It might be a client predictive rendering]
yes, i've checked with a piston and the block actually moves on two clients
listen to whatever event fires when the pressure plate is pushed and dump the stack trace and see which code path is reaching that
good idea, i'll do that and get back to you
there are a bunch of different arrow related events, so it might be that you have to cancel a different one
could also be a bug; we'll see
seems reasonable
Yeah that's it
I can try and do that
I honestly don't see anything useful in that stack trace, but I'm probably just inexperienced
it's not useful by itself, but it lets you pinpoint what's going on in nms and then step back/forward from that and find which events happen before/after
using obfuscated/spigot mapped server makes it quite a bit more ass
but eyeballing from the fact that the event triggers under Entity rather than anything arrow related, i'd guesstimate that the entity interact event is right
@Override
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!level.isClientSide) {
int signalForState = this.getSignalForState(state);
if (signalForState == 0) {
this.checkPressed(entity, level, pos, state, signalForState);
}
}
}
i may have bad news
I wonder if removing the entity in the hit event would work
Or if it would still trigger for a tick
iirc they tried that already and it seems to trigger for a tick
I used EntityInteractEvent and cancelling it works
odd, i don't see that being fired anywhere, but good that it works
I wonder what's actually getting cancelled when ProjectileHitEvent is cancelled. Maybe it works on entites?
Probably
I'll make an issue on github, let some smart people give it a thought. edit : nvm haha
the conditions for hitting things and triggering the pressure plate are a bit different
for pressing the plate, it just needs to be inside its bounds
but since it has no collision shape, being inside its bounds doesn't trigger the hit event
ohh
the hit event is triggered when the projectile would, with its current velocity, overlap with the block's collision shape
so i think in theory if you angle the arrow right you can trigger the plate without hitting anything
alright that actually makes sense
ill keep the ProjectileHitEvent for the target block
Thank you very much for the help guys!
How do i stop players from changing the case in their name when logging in
Why are you using names to begin with? Just use uuids
I dont use names but is there any way to stop them from doing that
Sounds like an offline issue to me
They like rewrite the login packet and change some letters to be uppercase
No its on online servers
And why does that matter?
If you use uuids
I didn't know a player was able to do this in an online environment 🤷♀️
Yea for example you can change poopguy20 to be like POOPGUY20 without actually changing your account name
That is news to me that you can do that
Hmm weird, anytime I've messed with login packets, I've never been able to pass encryption
I guess you could parse their name and just set it to whatever you want
well, the client sends login start packet before any encryption is enabled I guess
so I guess the client can change the name in that packet without it breaking something horribly
I just mean when I get to the encryption, for whatever data I changed, it just freaks out and doesn't know what to do -> times out
Aaah
Also, oddly enough it seems whenever you even just listen to playerPreLoginEvent or whatever it is, prevents all players from connecting
anyone know of any tutorials or ways to create book GUIs or just make books w/ pages and stuff to display information with some clickable text
Ask chatgpt
Components exist tho so it’s quite easy
you'd think that would be a bigger issue with the hundreds of plugins using that event
I'd say it works quite well
poopguy 💀
Is there any way to get the height of the entity without spawning it?
No because the height of an entity depends on its world state
i.e. is it sneaking? Is it a marker armour stand? Is it a baby?
Is there any method in NMS for this? I need to get the height of the entity in the "default" state without being sneaking etc
Mmmm, wonder if the entity snapshots let you do this
Eh we don't have any way to create a default entity snapshot though
Oh and it doesn't provide you an Entity instance. So no, there isn't. You would have to do this with NMS. You could create an NMS Entity and get it from there
you can create an Entity without adding it to the World
2slow
I'm talking about API :)
the API which lets you create an entity without adding it to the world
Oh there is a World#createEntity() huh
although the nms EntityType does expose its default AABB, no?
im on 1.8
good luck
gg
Idk take a look at NMS' EntityType and see if you can spot anything there. Though last I recall, the answer is probably no
I'm going based on 10 year old knowledge though
can i create an entity on nms to get the height on 1.8
alright
ty
😼
upgrading a pc in 2025 is so damned expensive
I just spent 3k euro
which if md5 is reading this that's about 3 trillion australian fake currency
actually I think it's enough for me to do a decent holiday in australia
were you still running 3090's
yeah
no joke I fully maxed it out on what it can do
feels like most of my time spent on my pc in the last month had the pc averaging like 80% use
I mean most of your money's going towards toying with AI
that's most family's disposable income
crazy shit
what else would you need a 5090 for
video editing?
buddy that's what I hear and then I see people dropping more than that in getting drunk and buying collectibles wihtout that being counted towards disposible income
been doing a whole lot of video editing and will be doing a lot more of it
streaming, had to stop because my pc couldn't cope anymore
unity (game engine) since I gave up on godot
blender
local ai
some mass operations on data
oh yeah fusion 360 and slicers have also been getting to be a pain
question, can i retroactively edit the delay of a task that has already been fired?
Don’t think so
not really, no. Workaround would be to use a repeating task and only do the thing on a certain condition
or you could cancel the previous task and fire a new one
alright then >:T
You could use a repeating task that counts down a number and does something at zero
Then you can edit said number to edit the delay
no i think theres an easier workaround to what im trying to do
i was just trying to make it look better
would be helpful to know what that is so we can provide a better solution 😛
This is how I would do it: https://gist.github.com/JavierFlores09/96aecf1cd7621db871f57ebd7bd8729c
that doesn't account for time that has already passed
they didn't really specify whether they had to consider that kind of thing
but it could be done just by adding another reschedule method which does the math
Oh uh i have a task for turning ability items into cool down items and then reverting it after some time, and I was trying to make a method that would put all abilities on cool down or increase the cool down temporarily for any abilities that were already on cool down prior
I just did this with putting item types on a vanilla cool down, it does the same thing anyways
But this is really cool and I will be putting this in my back pocket for a rainy day
cuz idk what that is
Save time that action successfully occurred, compare against current time, see if the difference exceeds your expected duration
now - lastSuccess < cooldown = still on cooldown
I did write a crazy little abstraction for abilities at work and it takes into account cooldown reduction and whatever so I can't give a clean example 😔
went a lil too cray cray
There's also the vanilla cooldown system if you wanted to be really cool
neato taquito, ill see if i can use this somehow
burrito dorito
?cooldowns
Hmm not what I wanted
Oh no wait that is it
thought it was a forum post not a wiki
and this is why you'll be spending 50% of your income in 2040 on ozempic
@tender forge
Hi guys! I want to modify Spigot sources and build them then (1.21.5), how?
Run build tools, edit source, build it
depends on what part you want to modify, you may have more or less steps
Ok, I ran build tools. I will keep you updated
if you want to modify the spigot-api or spigot-server classes, then you can just clone it with buildtools and then build it with the --dev command flag
Mostly non-API server optimizations
if you want to modify the actual minecraft classes however you'll have to rebuild patches and maybe add the class with dev-imports.txt
most of that process is explained in the Craftbukkit readme, so once you are done with that then take a look at the Craftbukkit readme
as long as you don't acidentally post the minecraft code, it is fine
So I can post the jar only?
you can post the patches that you made to the minecraft code
You mean I can post everything but the net.minecraft?
Ok bet
you can't post the jar though
why?
because that contains minecraft's code, and that's the illegal part
that's why buildtools exists
How do I share my project with the world then?
you would have to clone buildtools and make it pull from your repositories or make a bootstrapper system like Paper did long ago
I think ill do the buildtools thing
Thanks :P
Ima tell my friend he cant upload the jar and all
But how are all these things legal? https://hub.spigotmc.org/stash/projects/SPIGOT
that only contains the API classes, the Craftbukkit classes (which are wrappers around minecraft internals) and patches around internals itself, but no direct minecraft code reference anywhere
Ok ill just make my changes, build it and then just ask smb in this discord for help posting it
How to build it btw?
java -jar buildtools.jar --rev 1.21.5 for starters, it'll clone all the repositories for you to modify
you can with java -jar buildtools.jar --dev once you've made your changes
or running the maven tasks manually, depending on what you're modifying
Its recommended to use the jar?
I thought you can just do java -jar buildtools.exe --dev, right?
the exe isn't a jar so you can't do it that way
if you use the exe then you can use the GUI to enable the dev option probably
I am just used to the jar since I've been using it before the GUI existed
But its just make changes and use the .exe?
I also began with the .jar
sure, that works for the time being. Just remember to rebuild patches (via rebuildPatches.sh, you'll have to use git for windows bash cli to run that) if you make any modification to MC internals
What are you changing anyway
Entities only rendering when they have to and more
They already only render when they need to?
Only when being looked at
Also rendering is controlled by the client
we'll see
There's little reason to hide an entity from the client when they're not directly looking at it
Only real reason I can think of is for anticheat purposes
And then you really could just use the api
Im just trying to save every little CPU % I can
?
I only made it just not send to clients
Im stuppid
Btw it will reduce client-side lag I believe :P
Negligable amounts and will introduce more issues such as entities showing up late due to ping
[ERROR] Failed to execute goal on project craftbukkit: Could not resolve dependencies for project org.bukkit:craftbukkit:jar:1.21.5-R0.1-SNAPSHOT: The following artifacts could not be resolved: org.bukkit:bukkit:jar:1.21.5-R0.1-SNAPSHOT (absent): Could not find artifact org.bukkit:bukkit:jar:1.21.5-R0.1-SNAPSHOT in minecraft-libraries (https://libraries.minecraft.net/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, C:\Users\gijs\OneDrive\Documenten\Ember\apache-maven-3.9.6/bin/mvn.cmd, -Dbt.name=dev, -P, development, clean, install]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:1042)
at org.spigotmc.builder.Builder.runProcess(Builder.java:967)
at org.spigotmc.builder.Builder.runMaven0(Builder.java:936)
at org.spigotmc.builder.Builder.runMavenServer(Builder.java:905)
at org.spigotmc.builder.Builder.startBuilder(Builder.java:672)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)```
Don' t depend on bukkit
Depend on the spigot-api
Oh wait that's BuildTools
ye
youre editing craftbukkit without building bukkit first
you probably want to edit spigot
Hi.
I'm making a self-serve player plot plugin and I could really use some feedback on griefing protections. If you have some free time and like to play around in Minecraft, I encourage you to check out the details on the forum: https://www.spigotmc.org/threads/are-you-up-for-a-challange.712890/#post-4903147 Thanks in advance ❤️ 
Hii I'm currently solo developping some server plugin, focusing on unique gameplay. Could use some help testing and creating new stuff! Dm me if you interested👀
Is it possible to control the color of the sky?
yeah
idk if biomes can
but worlds can
?services
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/
I'm not sure how it is for worlds
I dont think I was editing craftbukkit?
oh its biomes
Unpacked worldgen files from https://github.com/slicedlime/examples - misode/vanilla-worldgen
I only want to edit spigot
What is the namespace key format for structures?
NamespacedKey.minecraft("structure/igloo") returns null, for example
Well, it returns null when running:
Structure structure = Bukkit.getStructureManager().getStructure(structureKey);
Okay so i've figured out the correct formatting for the key (as an example) is "minecraft:igloo"
public static void generateTestStructure(Location location)
{
NamespacedKey structureKey = NamespacedKey.minecraft("igloo");
System.out.println(org.bukkit.generator.structure.Structure.IGLOO.getKeyOrNull());
System.out.println(structureKey);
Structure structure = Bukkit.getStructureManager().getStructure(structureKey);
if (structure == null)
{
structure = Bukkit.getStructureManager().loadStructure(structureKey);
if (structure == null)
{
System.out.println("Structure does not exist");
return;
}
}
else
{
System.out.println("Structure found");
}
generate(structure, location);
}
Okay, so here is the relevent code to the "issue" i'm having. I am trying to load a structure from code manually (for my plugin's datapack that I will be making later, but I wanted to make sure I had the structure code functional first so I am not doing 2 new things at once and making my life more difficult)
Anyway, structureKey and the igloo namespaced key are identical when printed, but when I attempt to get the structure in structuremanager or load it, both return null. Which is weird imo. So, thoughts? Why isnt this working?
Also, for sake of completion, I did a test where I did
structureKey = (org.bukkit.generator.structure.Structure.IGLOO.getKeyOrNull());
and it has the same problem
the structure manager does not operate with worldgen structures, but with structure files, like the ones with the jigsaw block, think of it like schematics
Ah, I see. That makes sense. So I would need a datapack with custom structures in it to do this
are there any structures in vanilla that are structure files? I don't think so right?
Stash is leading me to believe you can easily get a reference to any structure, custom or not:
you can get a reference to a worldgen Structure, yes, but all you can do with them is call World#locateNearbyStructures or something like that
you can't "place" them
despite the fact that you can with the vanilla /place command lol
hilarious
Weak
¯_(ツ)_/¯
aren't some or most worldgen structures quite similar to the structure files?
i haven't really looked into the internals but i was under the impression that mojang uses jigsaws and the same structure system to generate like woodland mansions and basic structures like igloos
Interesting note
well yeah there's no option but to do it that way, since to get a chunk to a certain level it can require adjacent chunks to be at some lower level
It's just odd how they specify versions and restarts as if there was a case you'd take this long to generate a single chunk
if we required all chunks to be at the complete step before shutting down, we'd end up generating an infinite number of chunks as each chunk would require its neighbors to get to a lower step, which would then have to be processed to the complete step
the point of the note is that you'll have to account for things like the server version being completely different when a step runs; you can't assume that the previous step was reached under the current environment
Why can't I assume that? When a vanilla world is generated, it's just using default params anyway
I guess I don't understand the case of it taking so long to generate you'd literally be generating chunks of the same world in different versions
I'm pretty sure that was a change made for the deep slate update i forgor its name
it's not that it takes long
the one that made world gen deeper and higher
it's that the steps aren't all run at once
suppose that bob walks into chunk A
this means chunk A needs to be fully generated
in order for chunk A to be fully generated, it needs some information from some adjacent chunk B, which forces chunk B to be partially generated until the step where that information is available
e.g. terrain but no blockpopulators or decorations like trees
unless bob walks into chunk B, chunk B is never fully generated
it gets saved to disk partially generated
5 years later alice logs into the world with minecraft 1.35.1 and goes to chunk B
Is a partially generated chunk what most people would call a corrupted chunk?
no
Hmm
like the note says, chunks are generated in steps
e.g. first heightmaps (terrain), then carvers (caves), then blockpopulators (ores, trees, flowers)
It's quite confusing... how and more so why would a player be able to walk in a partially generated chunk anyway? I would think a "valid" world's chunks are all fully generated before the world is actually handed off to the server
anything in the player's view distance and a little farther is fully generated before being sent to the player or drawn on the screen
if it isn't, then it is made to generate
So the steps process is just for efficiency purposes
partially, but also because a chunk can need information from adjacent chunks to generate itself
e.g. structures
look at the graph in the link i sent
I am
you can see that for a chunk to generate to the "complete" level, all of its adjacent chunks need to be at some specific step or higher
this is because it needs information from that step to figure out what to do
and that adjacent chunk then in turn can need information from some lower-yet step from its adjacent chunks
and so on until the step no longer needs any information from adjacent chunks
I'm relating this to shuffling a deck of cards, the generation follows a proper shuffle as it were, one card on top of the other lol
for example, the light step needs to know where light sources are in adjacent chunks to figure out what light levels each block should be
so before a chunk can complete the "light" stage, all its adjacent chunks must reach the "initialize light" stage
and so if we didn't have generation broken down into steps or stages, we would have an infinite loop or a paradox where, for a chunk to generate (calculate light) it first needs its neighbors to be generated (to find light sources); but the neighbors would require the chunk to be generated first, to do their light calculations; and you have a gridlock
I see
I've been trying to get more knowledgeable about world gen... still need to learn more about perlin, but recently I've been focusing on wfc
hi guys, do you know which event is triggered when entities such as boats and item frames are destroyed by explosions? because I checked and it isn't EntityDamgeByEntityEvent in the case of TNT Minecarts exploding
I'm sure you could find the cause of death from EntityDeathEvent or EntityDamageEvent
and do a check there
Yeah I though about it but I though I'd ask because if there's an event already firing then I won't have to map two events together (it's not that it's hard, I just don't want to add unnecessary overhead)
Well im pretty sure you'd just need to listen to EntityDeathEvent
Check if the entity dying is a boat or item frame, then check the damage source
no because i have to check whether entity was permitted to explode it so i'd have to map it with EntityExplodeEvent unfortunetaly
wait
DamageSource source = e.getDamageSource();
for an EntityDeathEvent
You can get the causing entity from a DamageSource object
mn i thought DamageSource is just an enum but it has the causing entity
yeayeah
im just tweaking im sorry lol
thank you for the help ❤️
Np 🙂
bc its dead already 
can i just like set hp to non zero?
I'm having an issue detecting when exploding tnt minecart does damage to boats and item frames
do you know how to detect that along with direct causing entity and cancel it?
Can't you just do EntityDamageEvent, then check to see if the entity would die?
Doesn't work
Doesn't trigger for item frames
There's of course HangingBreakEvent but it doesn't work for boats
maybe ill have to use this along with VehicleDestroyEvent
well yeah so it also doesnt work
that's weird honestly
I'll try the HangingBreakByEntityEvent at least
the HangingBreakByEntityEvent also doesn't trigger
and the listener is definitely registered
just to be sure ill completely delete the plugin to make sure i ah ve the correct version, however modification date says its already the correct one
it's really werid cause HangingBreakByEntity doesn't trigger but HangingBreakEvent does
even though i'd say it's an entity cause break because it's tntminecart
but alr
i can at least work with that
but i still have to handle the boats somehow
ok so the boat one may have been my fault
cause i've made en error in some other code
If we're working on a protection plugin, check out the townyadvanced repo for item frames and boats
Guys, if I do a spigot plugin will it work with paper and vice versa?
Getting it right is very finicky
It won't necessarily work vice versa. I think all or at least most spigot plugins work on paper, but paper has some functions which spigot doesnt have and if the plugin uses them it won't be backwards compatible
however you can circumvent that by using paper-only features only when your plugin detects its on a paper server
It's a bit more complicated and unreliable now since they hard forked
Many major plugins like abovementioned towny have had to drop spigot support altogether
so what are they supporting if not spigot? asking out of curiosity
they came to the same conclusion i did it seems, they just go with HangingBreakEvent
I have a problem with this part of the code if (e.getAction() != Action.LEFT_CLICK_BLOCK) return;. I want to be able to use the item to hit the anvil like a blacksmith, but it understands that I'm breaking the anvil when I hold it for more than half a second. I have to click very quickly to prevent this from happening.
How do I solve this?
try BlockDamageEvent
my hot take:
if something is declared in a way that's duplicated across multiple files but is prone to future changes and and can be easily searched and replaced, it shouldn't be abstracted into its own utility static method or field.
by abstracting declarations you lose flexibility which can cause tech debt in long term.
either case if you do extract it under a method you're just moving a problem into another place, by duplicating method names instead of the actual code.
worst case is when you extract it and then your code is semantically tied to unrelated behaviour
Unfortunately it didn't work
The problem still happens
Paper, of course, as it's the super-majority
oh why didn't i think of that lol
i would love if paper just contributed patches to NMS via sponge's mixins instead
that way you could load it to fabric server
i want optimized paper server without bukkit api
@EventHandler
public void onBlockDamage(org.bukkit.event.block.BlockDamageEvent e) {
Block b = e.getBlock();
if (b == null) return;
Material anvil = b.getType();
if (anvil != Material.ANVIL && anvil != Material.CHIPPED_ANVIL && anvil != Material.DAMAGED_ANVIL) return;
Player p = e.getPlayer();
ItemStack inHand = p.getInventory().getItemInMainHand();
Integer v = inHand.getPersistentDataContainer().get(RepairIT.Keys.REPAIRIT, PersistentDataType.INTEGER);
boolean isRepairIt = v != null && v == 1;
if (!isRepairIt) return;
Location center = b.getLocation().add(0.5, 0.5, 0.5);
double range = 0.2, bestTool = range * range, bestMat = range * range;
ItemDisplay toolDisp = null;
ItemDisplay materialDisp = null;
for (Entity ent : b.getWorld().getNearbyEntities(center, range, range, range)) {
if (!(ent instanceof ItemDisplay d)) continue;
ItemStack s = d.getItemStack();
if (s == null || s.getType() == Material.AIR) continue;
double dsq = d.getLocation().distanceSquared(center);
if (s.getType().getMaxDurability() > 0) {
if (dsq <= bestTool) {
bestTool = dsq;
toolDisp = d;
}
} else {
if (dsq <= bestMat) {
bestMat = dsq;
materialDisp = d;
}
}
}
if (toolDisp == null) return;
PersistentDataContainer pdc = toolDisp.getPersistentDataContainer();
Integer count = pdc.get(RepairIT.Keys.HIT_COUNT, PersistentDataType.INTEGER);
int next = (count == null ? 0 : count) + 1;
pdc.set(RepairIT.Keys.HIT_COUNT, PersistentDataType.INTEGER, next);
b.getWorld().playSound(center, Sound.BLOCK_ANVIL_PLACE, 1.0f, 1.0f);
int max = inHand.getType().getMaxDurability();
if (max > 0) {
Integer cur = inHand.getData(DataComponentTypes.DAMAGE);
int nex = Math.min(max, (cur == null ? 0 : cur) + 1);
inHand.setData(DataComponentTypes.DAMAGE, nex);
}
if (next >= 5) {
Material matType = (materialDisp != null && materialDisp.getItemStack() != null)
? materialDisp.getItemStack().getType()
: Material.AIR;
int repairBy = RepairIT.CONFIG.getRepairAmount(matType);
ItemStack tool = toolDisp.getItemStack();
ItemMeta meta = tool.getItemMeta();
if (meta instanceof Damageable dmg) {
int cur = dmg.getDamage();
int newDamage = Math.max(0, cur - repairBy);
dmg.setDamage(newDamage);
tool.setItemMeta((ItemMeta) dmg);
toolDisp.setItemStack(tool);
}
if (materialDisp != null && !materialDisp.isDead()) {
materialDisp.remove();
Location particleLoc = b.getLocation().add(0.5, 1.05, 0.5);
b.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, particleLoc, 10, 0.1, 0.1, 0.1, 0.0);
}
pdc.set(RepairIT.Keys.HIT_COUNT, PersistentDataType.INTEGER, 0);
}
}
}```
that's a long method haha, give me some time to process that
@static quiver you don't cancel the event anywhere
my bad lol
is that the reason???
well the player starts the mining animation, otherwise called damaging the block, so the BlockDamageEvent is triggered
you do your logic and then at some point you decide you want to cancel that animation
so you do event.setCancelled(true);
and the player stops mining the block
i think
alr thx man
I started learning java less than a week ago
oh well then that's a pretty decent code for one week actually
I was very good at Skript (a Minecraft plugin that lets you program with a much simpler language), and Skript has an extension called SK-reflect, which is for using Java within Skript in some parts, so I'm not a complete beginner, but I started using pure Java a few days ago.
@static quiver I'd recommend you get yourself familiar with good coding practices early on, as it will save you very much time unlearning them later on and make your code easier to debug
thx
Ok, i'll take a look
And I also recommend the book "Clean Code" by Robert C. Martin
don't stress about getting it all memorized and all right in your code immidiately after reading, but keep them in mind and gradually you'll see the value of clean code and make the right habits
Thanks, I'm going on a trip and I wanted to buy some books to study when I'm away from the computer..
Ok, thx for the advice
Good luck bro ❤️
i name my variables with letters of the alphabet like its minimized by default
noooooooo it didn't work
@EventHandler
public void onBlockDamage(org.bukkit.event.block.BlockDamageEvent e) {
Block b = e.getBlock();
if (b == null) return;
Material anvil = b.getType();
if (anvil != Material.ANVIL && anvil != Material.CHIPPED_ANVIL && anvil != Material.DAMAGED_ANVIL) return;
Player p = e.getPlayer();
ItemStack inHand = p.getInventory().getItemInMainHand();
Integer v = inHand.getPersistentDataContainer().get(RepairIT.Keys.REPAIRIT, PersistentDataType.INTEGER);
boolean isRepairIt = v != null && v == 1;
if (!isRepairIt) return;
e.setCancelled(true);
make `Bukkit.broadcastMessage("numbers in order"); after every conditional and before the first one and see whether you actually get where the event is supposed to be cancelled
is there any tutorials for making a custom event bus in java
nvm i see, i found something like this: https://www.laggner.info/posts/lightweight-eventbus-in-java/#️-the-eventbus-class
maybe you'll find it useful
@rare ether But what does it mean?
Like
I understand what's going on
but am I supposed to cancel the event after the 5?
you're supposed to cancel the event wherever you want
so if you want to cancel it after you determine isRepairIt is true than do it
what these numbers tell you is how far does your logic actually go before it returns
But that's what I did
can you send me that fragment again up to cancellation but with the broadcasts?
@EventHandler
public void onBlockDamage(org.bukkit.event.block.BlockDamageEvent e) {
Block b = e.getBlock();
if (b == null) return;
org.bukkit.Bukkit.broadcastMessage("1");
Material anvil = b.getType();
if (anvil != Material.ANVIL && anvil != Material.CHIPPED_ANVIL && anvil != Material.DAMAGED_ANVIL) return;
org.bukkit.Bukkit.broadcastMessage("2");
Player p = e.getPlayer();
ItemStack inHand = p.getInventory().getItemInMainHand();
Integer v = inHand.getPersistentDataContainer().get(RepairIT.Keys.REPAIRIT, PersistentDataType.INTEGER);
boolean isRepairIt = v != null && v == 1;
if (!isRepairIt) return;
org.bukkit.Bukkit.broadcastMessage("3");
Location center = b.getLocation().add(0.5, 0.5, 0.5);
double range = 0.2, bestTool = range * range, bestMat = range * range;
ItemDisplay toolDisp = null;
ItemDisplay materialDisp = null;
for (Entity ent : b.getWorld().getNearbyEntities(center, range, range, range)) {
if (!(ent instanceof ItemDisplay d)) continue;
ItemStack s = d.getItemStack();
if (s == null || s.getType() == Material.AIR) continue;
double dsq = d.getLocation().distanceSquared(center);
if (s.getType().getMaxDurability() > 0) {
if (dsq <= bestTool) {
bestTool = dsq;
toolDisp = d;
}
} else {
if (dsq <= bestMat) {
bestMat = dsq;
materialDisp = d;
}
}
}
if (toolDisp == null) return;
org.bukkit.Bukkit.broadcastMessage("4");
PersistentDataContainer pdc = toolDisp.getPersistentDataContainer();
Integer count = pdc.get(RepairIT.Keys.HIT_COUNT, PersistentDataType.INTEGER);
int next = (count == null ? 0 : count) + 1;
pdc.set(RepairIT.Keys.HIT_COUNT, PersistentDataType.INTEGER, next);
b.getWorld().playSound(center, Sound.BLOCK_ANVIL_PLACE, 1.0f, 1.0f);
int max = inHand.getType().getMaxDurability();
if (max > 0) {
Integer cur = inHand.getData(DataComponentTypes.DAMAGE);
int nex = Math.min(max, (cur == null ? 0 : cur) + 1);
inHand.setData(DataComponentTypes.DAMAGE, nex);
org.bukkit.Bukkit.broadcastMessage("5");
}
if (next >= 5) {
org.bukkit.Bukkit.broadcastMessage("6");
Material matType = (materialDisp != null && materialDisp.getItemStack() != null)
? materialDisp.getItemStack().getType()
: Material.AIR;
int repairBy = RepairIT.CONFIG.getRepairAmount(matType);
ItemStack tool = toolDisp.getItemStack();
ItemMeta meta = tool.getItemMeta();
if (meta instanceof Damageable dmg) {
int cur = dmg.getDamage();
int newDamage = Math.max(0, cur - repairBy);
dmg.setDamage(newDamage);
tool.setItemMeta((ItemMeta) dmg);
toolDisp.setItemStack(tool);
org.bukkit.Bukkit.broadcastMessage("7");
}
if (materialDisp != null && !materialDisp.isDead()) {
materialDisp.remove();
Location particleLoc = b.getLocation().add(0.5, 1.05, 0.5);
b.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, particleLoc, 10, 0.1, 0.1, 0.1, 0.0);
org.bukkit.Bukkit.broadcastMessage("8");
}
pdc.set(RepairIT.Keys.HIT_COUNT, PersistentDataType.INTEGER, 0);
org.bukkit.Bukkit.broadcastMessage("9");
}
}
}
Looking to paste something? Try a code block or one of the following websites:
- https://pastes.dev/
- https://sourceb.in/
- https://mclo.gs/ (best for server logs)
yeah but what we're trying to achieve is to see whether the code actually executes where the cancellation happens
and it does so since it doesnt work the issue is somewhere else
for now i'd leave the broadcasts and add the cancelation back
Will cancelling this event prevent the block from breaking ?
yes
the javadocs says so
If this event is cancelled, the block will not be damaged.
yee
oh ye I guess it does
Do u guys have any idea of what i should do?
wait is your issue the fact that the event is ran only once ?
It runs multiple times, even if i just click
but it runs only one time if i do a super quick click
can't you just do cooldown on the hammer item whenever it hits ?
like the ender pearl type cooldown
with component?
I don't remember how the thing works
I hadn't thought of that, I'll try.
Here, there's a use cooldown, but I don't think it works for left click
Ok so: give it the duration you want, give it the cooldown group for your custom item (I assume)
And then you can trigger it with API from your event
I think
if it doesn't fully stop the left lick, you can just check for the cooldown in that event ig
@static quiver Just do a separate EventHanlder in the same listener class
and let the thing you were using previously handle only the sound and things you want to happen an the beginning
and BlockDamageEvent strictly for cancelling the mining
I don't see the need for two separate event listeners here
I'd just do one and create mulitple methods that then handle the things instead
But why have more logic in a listener that triggers 15 times per second?
That's where the logic should be minimal
the other event listener will still triger tho
yeah but once
just because you cancel it doesn't mean it won't work
cuz he'll use a different event that detects just the left click
(unless you specify ignore cancelled I GUESS but meh from me)
these are different events bro
Well you didn't say that, ok sure
i said it here
but ok, sure
The cooldown thing worksss
if (p.hasCooldown(inHand)) return;
p.setCooldown(inHand, 20);```
That's all I did (and add the cooldown to the mace attributes ofc)
That's what my plugin does
neat
i remember someone making something very similar to this before, but i think it was purely a cosmetic animation that played when you used the "crafting stations" like the anvil or the crafting table, not something you actually interacted with
it was also balls deep into nms so it worked for like 2 major versions and was then abandoned
Is there a way to run certain parts of your plugin on startup then do the rest of it postworld?
onload maybe, i don't quite remember
but you can't do most plugin related things at that point
don't do that
what the fuck
check pins
blocked.
nah bro why waste time typing event when you can just use e and unlock god tier obfuscation skills for free
Variable names should be descriptive to minimize the amount of mental gymnastics needed to read code
The idea is that you can look at it and immediately understand without prior knowledge that "e" stands for "event" and not "evangelist"
that p stands for player, not pizza
b can be block, balance, broke
It's like you all are talking in another language to me. 😆
write clean code
why not just name it "regionBlocks"
b should stand for butts
or boobs
or boners
Player spiderman = avengers.getPlayer()
im gonna name all my variables after spigot members
b for blade
md, illusion, xpdz
Hell yeah
spiderman.launchProjectile 💀
It's troll code ngl
yeah cba I'm doing other work
tf is cba
can't be arsed
Hmm, anyone here know when datapacks are loaded?
Lol damn
paper has some sort of datapack and registry api but it's only for paper-plugins which are kind of different from bukkit plugins and kind of annoying to work with in some respects
you can reload datapacks if needed for some reason
not all registries are reloadable however
Sadly
I don’t think any worldgen ones will reload
They should make /reload restart the entire server :)
At runtime
how do yall do fancy messages?
i dont want to do "§4§l[§3PR3F1X§4]§7 " + message all the time
maybe i could use mixin to inject into the player.sendMessage method, cause im making everything for my own needs and everything myself anyways
or a StyleHelper class with static methods to make the messages pretty, but thatd add boilerplate
Jumped down a small rabbit hole to basically allow me to have my datapack im working on for my plugin inside my jar file
How’d that work out for you
Don’t think it would work for any fancy worldgen stuff
Unless you did some registry hacking
Ah, but it does
Basically I have it check a custom file I have in the datapack called datapackinfo.json
if the version is out of date it overrides the datapack thats in the world for a new one
and restarts the server
(also if the datapack doesnt exist)
so it does work with worldgen
How does it restart the server
Except almost no one uses that
Well considering this plugin is for my server only
its fine
Mostly its just meant to make deving more convenient
It took me awhile to get working though so idk if it was worth
if i want to display custom graphics in the world, what is my best option to do so? Assume they're pieced together from smaller graphics
Text displays or item displays
Hmm, /place structure works for my structure, and bukkit is seemingly able to find the structure (Bukkit.getStructureManager().getStructure(structureKey) is not null)
but, structure.getPalettes() is an empty list
weird
Well I figured it out!
As it turns out, /place and getStructure reference different things
because of course they do why wouldnt they
getStructure references the nbt file directly and /place refers to a .json file
im tired
You need to use loadStructure(key)
ProtocolLib question, Is there a good way to look up what StructureModifiers go with the data structures listed on the Protocol Wiki page? For instance, how do I read the "Array of changed slots" field for this packet in 1.21.8? https://minecraft.wiki/w/Java_Edition_protocol/Packets#Click_Container
ProtocolLib wraps the nms packet, not what it gets encoded to
Look at the nms packet class and then see if you can find a wrapper for it
You might not have wrappers for it, in which case IIRC protocollib has an automatic wrapper thingy
I'd recommend packetevents atp protocollib has been unreliable since 1.20.5 imo
Far longer then that lol
I'm trying to understand why VSCode says methods are undefined during development
I get stuff like "The method getBlock() is undefined for the type BlockBreakEvent Java(67108964)"
but other methods on the Spigot API are working fine
VSCode 💀
?
Do make sure you have it set to use Java 21
Yeah of course, I only installed Java 21 because I develop for 1.21.7
Why not .8
The place that I'm working with uses 1.21.7, it's not much different
I think I'll probably try running some maven commands, maybe 'mvn clean install' failed. It doesn't seem like a Java issue
bump
use minimessage
If you use p*per you don't have to do all this
💎 Looking for a professional Minecraft server setup?
I specialize in custom server development, plugin configuration, and unique setups tailored to your community. Whether it’s survival, skyblock, minigames, or a completely unique idea – I can bring it to life. 🚀
👉 DM me if you want a polished, lag-free, and fully customized Minecraft experience!
?services and don't post into multiple channels
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/
sorry Sir
my services are professional stable ms server of any type lifesteal or headsteal or simple it depends on you and also i can make custom plugin for you
Again, this is NOT the place for this
which channel
not discord, forums
as the bot linked
ok thanks
Professional stable ms
but then Id still need some Helper class for adding prefix and stuff, so whats the point of adventure?
what
💀
||sendRichMessage||
bit of a necropost from our old conversation, this strategy broke for some reason for me in 1.21.8, specifically with the SET_CURSOR_ITEM packet, as remapping its outgoing item will cause a weird duplication glitch.
what outgoing/incoming packets are you remapping?
im reaaaally confused now. sendRichMessage is not a thing in spigot and idk how it would help
ah yes it is just for p*per
like my issue is, that I don't want to obscure my code with all the chat formatting like adding a prefix at every sendMessage using a static variable or sth
Just make a helper method to send your messages
You don't need a whole library to avoid one method call
- ClientboundContainerSetContentPacket
- ClientboundContainerSetSlotPacket
- ClientboundSetCursorItemPacket
- ClientboundSetEquipmentPacket
Have you tried those in 1.21.8?
can someone explain this warning, please?
location of system modules is not set in conjunction with -source 17
Creative mode cloning yeah
you use PDC to track if an item with client-sided lore was cloned
I honestly just do my menus with NMS rather than having to emulate and replicate every vanilla behavior atp
How are you guys feeling about npcs?
Feels like a npc ngl
yeah lowkey an npc
Hii, do you guys maybe know how to cancel redstone ore lighting up when player stands on it?
iirc that's playerinteractevent with the PHYSICAL action type
okay i see tysm
ok so im having issues preventing it, i check before with broadcasts and the conditionals pass to the end correctly: ```java
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(final PlayerInteractEvent event){
switch (event.getAction()){
case PHYSICAL:
handlePhysicalInteraction(event);
break;
case RIGHT_CLICK_BLOCK:
case LEFT_CLICK_BLOCK:
handleBlockClickInteration(event);
break;
}
}
...
private void handlePhysicalInteraction(final PlayerInteractEvent event) {
if(!event.hasBlock()) return;
final Block blockBelow = event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN);
if(blockBelow.getType() != Material.REDSTONE_ORE) return;
blockBelow.setBlockData(Bukkit.createBlockData(Material.REDSTONE_ORE));
}```
canceling the event also didnt work
it may be because the redstone ore gets lit after this event has passed, but there's no event triggered for that in spigot api
or it may be because im dumb
Wouldn't the block from the event be the ore

