#help-development
1 messages · Page 684 of 1
seems like I only dreamt that this annotation existed
because I cannot find anything about it
Maybe the annotation had chicken wings
@Noveride("ClassName")
only thing remotly similar I found is @OverridingMethodsMustInvokeSuper which is more or less the opposite
man fluid sims in blender are substantially slower than I thought they would be
and, uh, unstable
blender in general is hard to use
eh I don't find it hard to use
I've just never done fluid sims before
well, I never actually tried anything beyond observing that they work more like
Fluid sims?
'because you clicked this plus instead of that plus that looks identical, you created a new tab instead of creating a new material' - Cpt. Disillusion ca. 2018
it's been 5 years
blender doesn't look the same since then
that being said managing materials correctly is still a skill I've not fully mastered
You have been disillusioned
I love and hate blender
it's a great piece of software for something that is entirely free
that's a cool dismissive way of putting it
they named it before registering the domain
and then the domain they could've put a paid software on was already taken
you think the blender corporation has just sort of failed to realize that people can download it for free decades after release?
you know they could've just gotten a different domain if that's even a legitimate issue
asking about memory leaks, spark can help finding them and how i can identify them? (im just wonder because tps are low around 18.60 im hosting everything on my pc and playing with it)
and how i identify them like the 100% one or don't know
low tps can be a million things
you don't know for sure that you have a memory leak unless you observe it happening
i fixed one where armor stand not loaded would try tp so that's one
but not sure for the others (if they exist)
for me seems not to be the case (1.19% the plugin on the total 19 TPS using enchants even heavier ones and pets and everything using)
0.75% CPU (Process)
Seems for me being good so i don't have to fix anything
what's the best way to make things "regenerate" i'm wanting to regenerate lots of blocks and i dont think i should use multiple runnables, i could make a timer map
something like that
that has expirable keys
like each block will have a 5 second timer or something like that
You can download it from steam for free
i'd probably use a list (or stack or however this FIFO thing is called again) of RestorationData, where RestorationData is just an object that holds a date object and list of blockstates to restore at that date
And a single scheduler that runs every tick and goes through x blocks from that queue
yes
well I wouldn'T use a map, you will always only need the first entry of that collection
or at least not an expiring map
yeah okay, i'll do FIFO
basically like that, more or less, yeah. I came up with this
do note that you'll have to store and restore Inventories separately from BlockStates
ye 🙂
Right, this isn't working.
In my project, I have two modules that are the core for everything to work: core and core-nms. Those two have a basis in 1.19-R0-SNAPSHOT and they have code shared all throughout the versions of my project.
Then we have the various modules for every version... Now, this used to work, and I used to be able to use mvn clean install package + grab all of the jars and they'd run fine, but ever since i came back the unsupported version error is coming up on 1.7.
I have core and core-nms on java 17 and my 1.7-Spigot on java 8, and of course they're incompatible. Is there a way to get them to run again?
(I lost all my previous configurations due to a pc wipe and the github repo was... push --force'd. I know, that was stupid, and I didn't foresee the consequences. I wanted a clean commit history because it was a mess and I didn't really have a commit pattern back then)
you cannot have core on java 17
neither core-nms
and that runs every tick correct?
if your stuff must run on java 8, then all the shared modules and the NMS-specific modules must be compiled for java 8
I can run lower java compiled code on higher right?
yes sure
I always compile for java 8
that means my stuff works on java 8 and newer
Alright, thank you then! I think I know what to do next (Will take a bit of reformatting though)
you'll have to simply change target and source to 1.8 in your pom.xml (or in every module's pom if you went the dirty way)
1.8 minecraft right?
no. 1.8 for java 8
Oh wait what? I don't have any definition in my POM for java versions though
I didn't even know that could be done
you declare the java target/source level either in the properties section of your pom <maven.compiler.target>, or directly in the maven-compiler-plugin
you MUST have it declared
otherwise it wouldnt use java 17
Nevermind, I am stupid, I do have it declared
Yep,
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>```
I'll change that to 1.8
you can do that in the parent pom, and then remove the properties section in ALL your submodules
then you don't have to change it a hundred times
Hmm, but I'm importing a new api version in every version (1.7 through 1.20), won't I need to compile them in their respective java versions?
no
Ah, that's good
well for the NMS modules i'd set the source and target to the same that the NMS dependency uses
but core MUST be on the lowest java you wanna support
so TL;DR:
Set source and target to 8 in the parent pom, then get rid of it in all submodules, except for submodules that are on mc 1.18+ you set it to 17 (only for the NMS module for those versions)
Yep... that worked and everything is now ok
Ah...
Mind if I bug you for a bit? I'm confused on some things
np
On one thing actually that then relates to others
neat, right so
On my project structure in each module I have the module SDK option, which I assumed was what set the compiler version for the version I'm developing on...
But now I was enlightened to the target and source versions on the POM...
What are their differences?
The SDK version defines which java version is used to run maven - you can use your latest indtalled for all modules
Jdk 17 can easily compile sth for java 8
I typically set the project SDK to the highest possible, and source/target to the lowest version the plugin/module/jar must run on
I see... Then when using Maven we set the JDK version to run maven, and then the target and source versions actually control the java version that the classfiles are compiled in?
Is BountySeekers the parent pom?
Yes
If so its enough to change JDK there since you‘ll typically run mvn only on the parent
No, the language level must be same as source/target
Eg if level is set to 17 you can use records but then you couldn’t compile that to run on java 8
Ah I see that makes sense
because J8 doesn't have records
so changing it up is pointless
basically "language level" is IJ's version of source/target and "project SDK" is which JDK IJ uses to actually start maven
TL;DR:
- set <maven.compiler.target> (and source) to 8 (or 1.8, it's the same, weird naming scheme) for ALL module pom.xml's, except for modules that use MC versions that use java 17+
- but keep the project SDK at 17+, otherwise IJ and maven cannot access the NMS dependencies for MC versions with java 17+
That makes all the sense.
Thank you!!!
np
shouldn't you have to do it like:
since .poll removes the first element
he gets value inside of while
yes ik but it would still remove it, no? if i put poll inside the while it doesn't work since it removes the element
doesn't matter if it passes true or not
doesnt it run for once?
i meant the while loop
i mean it does .peek every tick to check if its null and the timer is true
oh sorry idk how but i saw it like System.currentTimeMillis() <= millsNow in the while loop
Someone that can help with boosted yaml?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
idk i forgor
Yes
You'd create a folder with regular Java I assume
@kind hatch tbh double spaces can die "old English" is damn right
What events are triggered for the Interaction entity? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Interaction.html
Is it PlayerInteractEntityEvent for right click,
And EntityDamageEvent for left click?
yes
Oh wow, alright haha cool 👍
why does this give error?
there is no attack inside getHandle
Why are you using nms
i just saw this in a spigot help thread
Cant you just call pl.attack(other); and be done?
what was the date
you can also, on livingentity do damage and use player as damage source
oh yeah
if thats the goal
april 3 2023
strange
sorry april 3 2021
what is your goal
to simulate a player hit
with arm and everything?
declaration: package: org.bukkit.entity, interface: LivingEntity
I tried updating my Plugin from 1.19.2 to 1.20.1 by running BuildTools with Version 1.20.1 and then changing every "1.19.2" in my pom.xml to a "1.20.1".
But it doesn't work, i get "Cannot resolve org.spigotmc
1.20.1-R0.1-SNAPSHOT".
Why, what am i missing?
are you using nms
yea
dont you need an argument like -remapped or something when building?
Are you using the specialsource plugin for remapping?
i have
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
so it should be remapped
--remapped *
^
when running buildtools @ember estuary
i'll try
how to ray trace entities?
From another entity or in general from X to Y
from a player
worked, ty
found out World.rayTraceEntities
public LivingEntity getTargetLivingEntity(Player player, double maxDistance) {
Location start = player.getEyeLocation();
Vector direction = start.getDirection();
World world = player.getWorld();
Predicate<Entity> filter = entity -> entity instanceof LivingEntity && entity != player;
RayTraceResult traceResult = world.rayTraceEntities(start, direction, maxDistance, filter);
if (traceResult == null) {
return null;
}
return (LivingEntity) traceResult.getHitEntity();
}
Something like this
tysm
Luckily it's not that many.
hey, is there an event that triggers when doing the pick block action in survival? i need to cancel that because it moves an item in my inventory which i don't want to move
PlayerHeldItemChange?
doesn't that only trigger if the slot the player is holding changes? picking block doesn't make the slot change
- the only parameters this event gives me are the both slots, but i need the item before picking in the main hand of the player and cancel if some display name equals something
im referring to the PlayerItemHeldEvent if that's what you meant
yup, tested it, PlayerItemHeldEvent doesn't fire if you use the pick block action to swap some inventory item with the held item
?paste
https://paste.md-5.net/etiseyoxos.java
Having a slight issue with my code.
If a user closes the spinner while its spinning, the gui attempts to reopen it as it should.
However, this results in the animation not working, and for items to be able to be pulled out of the inventory and such (however this is reverted after the gui is finished).
Is there any reason this may be doing this?
There is no error code, as this is a visual bug it seems.
try calling player#updateInventory()
also use ThreadLocalRandom.current() instead of new Random()
Where should I add this, inside of each time the menu updates an item, or after reloading the inventory?
Is it more random or is there just an issue with new Random()
no need to instantiate a new Random every time
if you have a way of telling if the menu was reopened, call it after its reopened
Gotcha
but just try calling it first, im not sure it will solve your issue
but it's the first thing i'd try
this.menu.menuCloseEvent(e -> {
if(spinning){
p.openInventory(this.inv);
}
});
Ill assume i should call it after this then first, that doesnt work ill try soemthing else
tty
however
also are u checking for reason when closing?
No, its just checking if that specific menu is closing
well doesn't that infinitely loop then?
No
lol ok
Sadly thats not working, even after placing updateInventory inside of generateSlots()
It shows the last frame that was generated onscreen after reopening, and ceases to function
Im starting to think this might be an issue that I may not be placing this in certain places
Ill do a double check thru that
That didnt fix it either, hm
Can i do .contains(player) on a Set<OfflinePlayer>, or will that give unexpected results when the player relogs? Or does it compare by UUID maybe?
you're much safer just using a Set<UUID>
Of course, but then I'd have to load the respective offline player for every uuid thousands of times
lol
That fixed it, i have an issue still however, but I have a cheaty solution to it
ive had this happen
but im not sure this is the proper solution
¯_(ツ)_/¯
it works but feels sketchy
Ive done it before as well, just didnt think it would be the solution
you can also keep a weak reference to the player instance directly if needed, just make sure you dont do anything with it after they've left
whats the other issue tho
Just a small issue I had with my inventory fw, just fixed it
Whenever the menu closed, it disconnected the other events I made
So it could only run onClose once
interesting
Ill create a custom function called Disconnect for whenever I want the inventory to actually
disconnect from events
this.menu.menuCloseEvent(e -> this.menu.disconnect());
Actually, maybe I wont.
protected HashMap<Inventory, Consumer<InventoryClickEvent>> cEvnts = new HashMap<>();
protected HashMap<Inventory, Consumer<InventoryDragEvent>> dEvnts = new HashMap<>();
protected HashMap<Inventory, Consumer<InventoryCloseEvent>> xEvnts = new HashMap<>();
Do you have any idea if this will cause lag eventually or anything?
Lets say that in total, 10k inventorys were generated, with events
And none of them cleared
Will this harm anything or no
I restart my server automatically every 12 hours so if thats a factor hopefully thats ok
wtf
why are you doing this
have a
YourInventory.class
Old code from a year ago that im too lazy to edit
I was planning on making another managment class for this stuff
As that way its not doing this
bro wtf
Yeah, I am rn
I spent 3 days fixing my enchantment code, and my item managment
I didnt think it was that bad however tbh
@Builder
public class CustomInventory implements InventoryHolder {
private final UUID uuid;
private final Inventory inventory;
private Consumer<InventoryClickEvent> onClick = $ -> {
};
private Consumer<InventoryCloseEvent> onClose = $ -> {
};
private CustomInventory(UUID uuid, String title, int size) {
this.uuid = uuid;
this.inventory = Bukkit.createInventory(this, size, title);
}
public static CustomInventory create(Player player, String title, int size) {
return new CustomInventory(player.getUniqueId(), title, size);
}
}```
and u can use toBuilder in lombok builder to do this
.onClick($ -> System.out.println("click"))
.onClose($ -> System.out.println("onclose"))
.build();```
huh ok
hello how can i make my player invicible for like 2 sec?
apply invisibility for 2 secs with particles disabled
player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 2, 0, false, false, false));
i thought they said invincible
tbh
its mispelt so either way
i cant fuckin read
me neither
If you are talking about being invincible not invisible, you can set the player to be .setInvulnerable for two seconds by using a Bukkit Runnable
how?
Tons of ways, you can make it a command, register for a EntityDamageEvent, etc.
ye i know
Im stack with one think. I want make plugin witch will allow to disable/enable recipes. But problem is you cannot realy disable recepie in spigot If Im correct. So that means, you need get all default MC reciepies and save them somewhere. Thats issue for me 😄 How could I do that? I just cannot move, kinda can´t figure out how to and where I could save recipes.
but i want to be invicible when i make a command
pretty sure you can just disable recipes by eating the result in the crafting table result slot
Player player = (Player) sender;
Since you are the sender, you can directly call .setInvulnerable(true);
Just use a Bukkit Runnable to make it last for 2 seconds, and ensure it terminates after two seconds
didn't work in 1.8
:c
you can always be really basic and just apply resistance 255 for 2 seconds or smth
why are you making a plugin in 1.8 if i may ask
Fair point, the ideas I said was just came to thought first
You can also just do potion effect like Emerald said
That should work for 1.8
CraftItemEvent, set result to air
to disable
or just e.cancel, don't remember which or if you need to do both cancel and set to air
Yes that what I can do. So how can I prevent learning the recipe? I want them to be not visible in recipe book. I was making this plugin while ago and there were some reason why I need to remove the recipe.
i think theres an event for when a player learns a recipe
you should be able to just cancel that if appropriate
if not god help you lol
or whoever knows nms in here
Oh probably I know reason. It was because the gamerule doLimitedCrafting will not allow to learn recipe true command as well.
I’m sure nms is practical in some uses but I don’t see the use case lol
i’ve never used it any plugins i’ve ever made in like 6 years
welll if you cant cancel the event normally it still exists in nms
which you would be forced to do in some cases to stop specific events
gotchya
I think just save recipes somewear would be best just to reanable them. Idk how and where lol 😄
what’s your issue? you can’t cancel the crafting of an item?
I was making this while ago... and I decied this will be best solution for some reason. I want to not show recipes in book (witch player cannot craft) and prevent them learning of them. They will be able to learn them but not basic MC style.
I see. A few different ways you could go about this but I would do this; setup a database and whenever someone attempts to craft the item, make sure they’re in the database. If they’re not in the database, simply cancel the event/set the item to air. If their name is in the database then let the crafting occur as normal. You can add players to the database whenever they complete a quest. This is a good approach because you can track many different recipes and what not. Furthermore, if you want to make it even more efficient you can load the players & their data when the server starts!
If you don’t want to use a database .json is another great option 👍
Or just a yml file
Probably going to do that way. I guess there were some issues whit this way. But thanks for now.
How would I check if a given Recipe is an instanceof CraftingRecipe? I'm running into an instance where I'm doing recipe instanceof CraftingRecipe but upon runtime it would say noclassdeffounderror for CraftingRecipe. The subclasses, ShapedRecipe and ShapelessRecipe work fine. This is likely a Java thing I'm not familiar with, but I cannot seem to find much information about it.
why not just a permission / pdc tag lol
cause that’s boring and won’t teach you anything
seems like a horrible solution tbh
you'll either have a file with thousands of player entries or thousands of single files
do you know when it was added? The server i'm testing on is 1.20.1, although jar is likely not up to date. Plugin is with 1.20.1-R0.1-SNAPSHOT
how about hundreds of files with hundreds of entries?
good tradeoff
August 1st
it's always funny when people are relucant to use the player's persistentdatacontainer to store a player's persistent data
is there a way to save particles which have been spawned with #spawnParticle ??
as entities that is
No
they dont exist
Particles are client side
ah
spawning a particle is just sending a packet - so all you can do is to store the parameters you threw into spawnParticle to spawn them again later on
my goal was to save a list of particles and delete them when I spawn the next batch of particles
to avoid players spawning too many
in that case, all you can do is to spawn less in the first place
You are correct, and it appears you are the author of said commit too! Took me a minute to find spigot commits, and when I did it only mentions PlayerRecipeBookClickEvent so had to dive into the commit itself to see 😛 Thank you!
well there is sorta a minimum that I need to spawn, but its already optimized, so I will just rely on them despawning quickly
The client does have a built in limit for particles
Yep
btw in IJ you can just click on the author name next to a class or member and it'll show you line-by-line who commited that when
you can also search the commit history directly in IJ with keywords
what kind of command registration this is?
also there is no command secion in plugin.yml
any idea how can i make this plugin work? (well commands for now)
Looks like some kind of command framework
I don’t use any so idk what one at a glance
ACF and cloud are popular
definitely not ACF
well i need this plugin to work again
then just check the pom.xml or build.gradle for dependencies and you know what it is
i've no errors
then you're already done
the plugin is running
but the commands are not working
i've tried to register one in plugin.yml, nothing happened
well check the import name for BukkitBrigadierCommandSource and you'll know what it is
:trollface:
I will probably use permissions. Im not sure yet. Its going to be roleplay server so every player could have more character so every character can craft something else. Best solution would be some file where I will save witch recipes can character craft and on char select discover them to make RecipeBook accurate. But will need some work arround to make some way to lear recipe. Because If I cancel PlayerRecipeDiscoverEvent thats not allow learn true command as well.
any idea?
it's not like that really changes anything, it's basically converting between a couple of types, constructing the packet and pushing it through the netty pipeline which happens in its own thread already
it's some paper API stuff
why not just use the player's PDC
recipes will be based on character not on player thats why
I meant, use the PDC to store the "character"
it depends If I will .yml file like this or PCD?
chadID:
allowed-to-craft:
- apple
just ex.
json >
I already made plugin witch have value where is character stored. Plugins will be connected.
what ever is example 😄
for that I'd just use permissions
permissions:
myplugin.craft.apple:
myplugin.character.something:
children:
myplugin.craft.apple: true
then you assign myplugin.character.something to a player
unless that is supposed to be configurable, then sure use yaml, but still do not create one file per player or store any player data in yaml files
If its a public plugin then i would probably go for permissions.
This allows easy hooks into your plugin by simply granting/removing permissions.
Blocking recipes like this can honestly be done in a few lines of code
I just want to make RecipeBook accurate so probably best way to achive that, Is just discover all recipes onCharSelect
one json file with a player object that holds all the data you need, why go through all that pain when there’s such a simple solution at your fingertips
because the json file is the pain and using the PDC is just only line and does not require blocking I/O
If you want to sync the recipe book then you will need to use packets as the server
sends all recipes to the client when it connects.
Yea, but is not displaying recipes witch player can´t craft
I guess but once you learn how to properly use json there’s no real reason to use anything else like pdc for that much data, feel like everything’s safer in a json file
at least for me
one json file per player requires one blocking file I/O per join and results in 50,000 files after a few months if you actually have a few players. and many of those will change daily, so your backups will take forever, too, and stuff. it's just annoying. there is simply no reason to go through the hassle of creating a json file per player if the PDC was literally made for stuff like this
This is what I want kinda 😄
one file
why would you need 1000 different files
just one file for the entire network and preload the data, maybe periodically save it
I mean... the same goes for PDCs honestly. The server just does the async IO for you when loading the players data.
That would be bonkers
and then you want to read a file with 50,000 player's data where each player can have like 100 entries? and then keep that in memory? so you have 5 million in memory entries?
yeah but it does that anyway, so no big deal in adding a tiny thing there
why reinvent the wheel with a huge json file lol
I don't have any commit information, not really familiar with all that I'll be honest. 😅 It just decompiles the class file from the dependency, could be why there's no commit messages but could be wrong?
or with 50,000 tiny ones
I dont think the server will be that big 😄 there would be like 200 chars max in dream so 😄
idk i’ve used one json file multiple times and had no performance issues even on larger networks
i didnt say it will automatically create performance issue, I just wonder why you claim it's so much better or easier than PDC
because PDC data is handled by the server automatically, allows you to store basically anything, and you can get/save data with exactly one line without any additional file/loading creating yo uhave to do yourself
I’m just more comfortable with it, not necessarily saying PDC is worse. To that end I also am comfortable with PDC and just don’t see the use here.
Wait... So I should be still able to have all recipes in recipebook? Proably Im not having all there becaouse I set gamerule doLimitedCrafting to true.
I guess, maybe I just prefer doing it the hard way then lol
I’ve found it easier in the long run tho especially when working with lots of data
I honestly think PDCs are best used for tags or for storing data in chunks, entities, blocks etc.
But using one file for all your player data is the naive beginner approach for smaller servers.
You'll learn over time that a single file for all your data is just a bad idea overall lol
^
and one file per player is also annoying, imagine a big server doing daily backups through SCP or SFTP and it has to transfer ten thousand of tiny files, it becomes extremely slow
zip it and clip it. Who does file by file backups 🙂
for incremental backups, e.g. rsync/rdiff
i got daily incremental backups of the last 3 years, imagine how much space it'd take if you'd have to save a new 500mb file everytime just because one file inside has changed
I like using one file per player 
i did that too until people complained about their backups taking forever now and it's not in my power to tell them how to backup their data so I avoided doing that in the future
I guess it just boils down to who you’re making the plugin for. I’m sure if you were making it for a specific network things would be different from something such as a public/premium plugin.
the player .dat file changes everytime they play anyway, so why not use that to store player-related data
myeah. Cleanup issues for example. Admin removes plugin and is left with half a meg of permanent appendix on their player files.
Interesting, mind elaborating? I’ve never had issues using one file but I’d be open to learning why it’s a bad idea.
yeah that's the only real downside I'd see
- Single point of failure. Corrupt or deleted file and you lose your whole data set
- Reading and parsing the file could take a while. If you want to get only a specific part of it you have to read the whole file to find it, then do that again and again and again for every time you want another specific part of the file. Or read it all into memory and you're suddenly using a lot more memory than necessary
and if you save one player's data, you'll have to write the whole 500mb file
I usually load and update the data locally and don’t touch the actual json until i’m saving, shutting down, etc
But yea I’ve never even thought of your first point lol
then you'll keep thousands of data entries in memory that you don't need until that one player from 7 years ago joins again
Would also be my answer.
- It scales horribly because you need to keep all your data in memory, slowing down your
startup times and clogging up your memory over time with data from players that havent
been online for 2 years. - The total data loss problem with one file
- Admins managing one file that is a couple MB in size is a horrible experience if they want
to manually delete or alter a players data.
The only upside of one file is its simplicity.
You dont have to understand IO because you can just load everything once.
yeah but they do big brain things
never realized how useful super and superclasses are
until a week ago
and my god am i loving it
anyone know how i can make a discord bot that works with a plugin?
i could put stuff into a database and just check every now and then if I need to run anything but I was wondering if theres a simpler way
You've only just scratched the surface, my friend
Using id "io.papermc.paperweight.userdev" version "1.5.5"(gradle) and i got kinda the same. The structure and all of that is the same, but ::execute and ::requires, provides CommandContext<Object> and not CommandContext<CommandSourceStack>
?whereami
ye im not here to talk about paper tho, just answered his question
Oop is great lol
yeah
also, random question
does privating an event like InventoryClickEvent prevent it from registering properly
Bukkit.getServer().getPluginManager().registerEvents(this, Main.instance);
This is being ran, however, the actual event isnt firing
So im curious if that setting it to private may have been an issue
Nah
feel like we're missing code here but it shouldnt
@EventHandler
public void drag(InventoryDragEvent event) {
if(event.getInventory().equals(this.inv)){
onInvDrag.accept(event);
}
}
public InventoryFW(String name, int rows) {
Bukkit.getServer().getPluginManager().registerEvents(this, Main.instance);
this.inv = create(name, rows);
}
Revamped class I made for an inventory framework
seems fine so idk
super just calls the constructor of the parent class
Im aware
I have classes like enchantments or items that do the same thing but without issue
So im very confused right now
Hm so I was right, seems that setting public void drag to private void drag prevents it from running at all
I wonder why setting it as a private doesnt let eventhandlers function
Oh that will do it lol
I just didnt want outside access to that direct event
Was using consumers instead so that the function looks like so:
this.onInvClose = e -> cancelTrade();
I assumed that implimenting listener would allow it to view it
Since technically it has direct access to the class
no, I private them all the time
Only exception is that it must be public on bungee
Strange.. it only works when I unprivated them
Is there a way I can check if a specific ItemStack exists? I want an item to only have one copy in the world.
Okay, I guess I will suck it up and use persistent whatever
but that would be incredibly inefficient
what's other things i should learn like FIFO, LIFO, ect?
wanting to know most of them
Would I be better to learn how to create custom inventories using spigot or just use a library to handle it for my WIP plugin?
Sounds good - will do
Does block.breaknaturally() trigger any events?
will the PlayerToggleFlightEvent call even if the player isnt allowed to fly? so when he double presses space?
I believe not for PlayerToggleFlightEvent
im looking for something like double jump so i though this would work
The way people do it is just by setAllowFlight -> ToggleFlightEvent -> set flying to false, setAllowFlight to false until reaching ground
and applying a vector
okay, but how big should the vector y be?
Up to you
what is regular jump velocity?
No clue, try numbers out
this is what ive done, it works you can jump inifnitely, but how can i make still take fall damage?
You need to setAllowFlight(false)
And then check for PlayerMoveEvent, see if the player is on the ground and setAllowFlight(true)
i will add counter, which will do this when certain amount of double jumps is donme
How do I can get Display entities by raytrace?
uhh I doubt they have a hitbox
RaytraceResult is null when I raytracing close to it.
Is there a reason for when I kick a player when inside of a PlayerJoinEvent it doesnt show the kick reason to them?
p.kickPlayer("Server is under maintenance.");
Or am I doing this incorrectly
java.net.SocketException: Connection reset
Create 1 tick delayed task
Now its only showing it half the time
Sometimes its that error, soemtimes not
i dont think display entities have a hitbox
Lol just turn on whitelist and change whitelist message
java conventions go brrr
I wanted to make a /lock command
How can I make one of my plugins a dependency for another? I need to use some methods from it.
in your plugin.yml
Does that grab the jar file from the plugins folder?
you still need to add it as a dependancy through maven / gradle
okay but how do i still make the player take fall damage when fly ended
this just makes it so it loads after whatever it's dependent on
Specifically what will this command do?
Okay, so how would I add it as a dependency in maven?
toggles /lock allowing only certain users to join
and yes i realize that its the exact same as whitelist, but i want the MOTD to change, and the max players as well based on if lock is on or not
what plugin do you want implemented?
It's something I wrote myself that is not published on the Spigot website
oh
you gotta use jitpack then
for maven
if you want to make your project into a dependency without hosting it yourself
So I can publish it on JitPack or publish it on Spigot if I want to use it as a dependency in another plugin?
Okay, thanks!
np 🙂
I usually just install my plugin in local maven lol
Would you mind explaining how to do that?
I don't remember how that's done right now and I'm not home to check it, sorry
No worries
add maven-publish to your gradle plugins
publishing {
publications {
maven(MavenPublication) {
groupId = 'org.gradle.sample'
artifactId = 'library'
version = '1.1'
from components.java
}
}
repositories {
mavenLocal()
}
}
and add this to your build.gradle
makle sure to replace the groupId etc.
Okay, I used jitpack to add it as a dependency in my pom.xml. However, I can't seem to access the methods in my classes even though they are public and static. The only way I found to access a method is to do something like Util util = Util.method. Otherwise, it doesn't even list the methods when I try to use one. Does anybody know why that is and how I can fix it?
hi i need help
with scoreboard update
public class scoreboard implements Listener {
private Plugin plugin;
public void setPlugin(Plugin plugin) {
this.plugin = plugin;
}
public void updateScoreBoard(Player p){
int playersonline = Bukkit.getOnlinePlayers().size();
ScoreboardManager manager = Bukkit.getScoreboardManager();
Objective obj = manager.getNewScoreboard().registerNewObjective(ChatColor.YELLOW + "Lobby", "lobbyscoreboard");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score przerwa = obj.getScore(" ----------------");
przerwa.setScore(4);
Score przerwaa = obj.getScore(" ");
przerwaa.setScore(1);
Score nick = obj.getScore(" Nick: " + p.getDisplayName());
nick.setScore(3);
Score onlineplayers = obj.getScore(" Gracze online: " + playersonline);
onlineplayers.setScore(2);
Score site = obj.getScore(ChatColor.YELLOW + " www.playgroundhc.pl");
site.setScore(0);
p.setScoreboard(Objects.requireNonNull(obj.getScoreboard()));
}
@EventHandler
public void scoreboardCreate(PlayerJoinEvent e){
Player p = e.getPlayer();
updateScoreBoard(p);
new BukkitRunnable(){
@Override
public void run() {
updateScoreBoard(p);
}
}.runTaskTimer(plugin,0,100);
}
}```
scoreboard is not updating after other player join
how to fix it?
i wrote this code real quick for the double jumping, is there any way to make it not cancenl fall damage
since now it cancels any fall damage
My guess would be to set allowFlight to true a tick after the player touches the ground.
Also, don't use Player as a map key, use UUID instead. And don't forget to clear it when player leaves.
So is there just zero events for TNT now?
I tested like 10 different events and none of the let me know if TNT is unloaded, where the TNT moved, what entities the tnt applied velocity to idk
so the cause of my problem is in the PlayerMoveEvent?
I think so.
The event probably gets called before the player hits the ground and takes damage, so setting allowFlight to true disables the ability to take falldamage
but i check if the player is on ground
that information is controlled by client, it could also be sent together with the move packet
it could also very easily be spoofed :d
i think there was a /solution/ at some point, like casting to Entity or LivingEntity w/e instead of calling it directly from Player
i say "solution" bc it was still pretty meh at best
so what if i check if block under the player is not air?
player on slab, block right under can be air
that will most likely set it to true prematurely as well
For fun
damn masochist
Fair, but id recommend making plugins based in 1.14+
As there are heavy differences between those versions
okay but now how do i wait a tick so i can set it to true
scheduler
bukkit scheduler
runTaskLater
BukkitRunnables
ohh
Is there an efficient way of storing custom placed blocks other than a conf file
I was using that
if i were you id also add some kind of flag to store if the player is double jumping. cuz rn ur gonna do that stuff in moveevent every single time the player moves on the ground
iz feri bad
But i meant like, storing its location for retriving it
Lets say i have a cobble gen for example
And even when the chunks unloaded i want it to generate
Yonow
Lets say its just pdc value inside the block called cobble generated, i right click the block, gives me the cobble stored and sets the val to 0
well right now ur gonna create runnables in an insane speed
thats rlly bad
I want it to add 1 consistantly no matter what
like thousands of runnables being created for a few players
do offline calculation
you do NOT want this
if i make one and just run the timer?
Huh, good idea
say, players have hundreds of generators, 1 in each chunk.
you would have to have each chunk loaded to add something to the pdc
that.. woud kill the server
Ill just store the last ms it was right clicked
i'd do this @distant wave
And calculate how many multiples of 10 seconds passed
Ah
yes
but that doesnt prevent the player from not taking the fall damage
👍 ty for the help
no but it does prevent you from runnign code in move event when not required
Wait u just wand no fall damage
i want fall damage
honestly i woulnt even mess with this ground shit. id just add an arbitrary cooldown to the jump
and not mess with move event at all
Doesnt that exist already
you mean it would just wait 10s before you can double jump again?
after you run out
yea for example
can also be shorter cooldown obv
i could set it for the time you would fall normally
that's gonna be rounded to a second, not ticks I think
do milli / 50
I THINK, I am not good at math
incorrect, it's just millis/50
ah ok
this shows everyone i suck at math
👍
Are the sync scheduler's tasks executed at the start of a tick or at the end of it?
Like: java void mainHeartbeat() { Server.executeMinecraftStuffAndServerLogic(); scheduler.executeTasks(); }
or
void mainHeartbeat() {
scheduler.executeTasks();
Server.executeMinecraftStuffAndServerLogic();
}```
or is it in-between?
is creating an Anti Storage ESP really that complex?
use a Thread.getStacktrace to find out
Hi there
We are a UK-based digital agency looking for a Minecraft plugin developer for one of our clients.
25hours/ week
Fully remote from anywhere
Java programming knowledge
Being responsive
Definitely paid job
Are you interested?
Please dm me or send your cv and any Minecraft plug-in you built to my email mo@tribes.agency
idk how storage esp works, I don’t see why the server would proactively send storage contents before a interaction event is fired
yoo wass dat
?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/
yeah wrong channel
doesnt show content, shows the conatainer itself
oh yeah I’m fucking stupid
LOL
yeah that’s not really difficult
in fact it’s built into paper™️
smh
?whereami
ooops my bad
or throw an error
and then look the line with a deobfuscator
but I wanna know whether the server logic or the scheduler is executed first in the tick method
how can i make the slots of the shops smaler in shopguiplus
you mean the amount of slots?
yeah
Bukkit.createInventory
i only fint the amount of slots for the main gui but not for the shops
you mean villager trades?
and then you can manipulate it's size or the type it is
no if i click on a shopcategorie how many slots it have
can you be more specific?
you now i can make /shop than i come to the main gui where i see all shops if i click on a shop i get into anothe gui how can i chnage the slots from the other gui
Player#openInventory
and have different guis
some of them can
or well, they can show a snapshot of what was in their when it was last opened
(auto open all storage blocks in clickable radius and cache their items, render, recache after X ticks)
what do i use for ActionBar?
Can you explain better ?
Message or smth.
Guys is there any better way to replace internal placeholders?
Other than replace chain
I have a placeholder object that does its magic
I think yes but you’d have to manually implement that
I would consider some sort of lookup table
Can you please explain how you done it or send the code
Please does anyone know why this is happening?
iirc smithing tables merge/move nbt
So I guess your output item gets overriten ?
That really sucks
I bet you could edit the output item in this event
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/SmithItemEvent.html
Not sure about it showing in the output tho
I'll look into it, thanks for the help
yeah this
That's what I thought
return string
.replace("{kills}", String.valueOf(data.getKills()))
.replace("{killstreak}", String.valueOf(data.getKillStreak()))
.replace("{best_killstreak}", String.valueOf(data.getBestKillStreak()))
.replace("{deaths}", String.valueOf(data.getDeaths()))
.replace("{kd}", String.format("%.2f", data.getKillToDeathRatio()))
.replace("{cooldown}", generateTime(ArenaManager.getRemainingTime()))
.replace("{name}", name)
.replace("{balance}", String.valueOf(Math.round(VaultHook.getServerEconomy().getBalance(player))));
This was my old code, is there any better way to do internal placeholders?
Snakeyml has been here for a while, it's just that it has been updated in 1.19.4 iirc
is there any project on github that used this
so i can understand the code better and use it
Google your question before asking it:
https://www.google.com/
i know all this
but i just dont know how to implement it
all those individual things you mentioned
i know how to use them
i dont know where and how to start @quaint mantle
alright i have this now what
i dont get what you are wanting me to do
if you got a code
please send it
ok
Spoonfeed hell naw
if i get a code i dont just copy-paste it
i asked for help and got a class
which i dont know what to do with it
so you mean having a class for each placeholder?
This mf ai generated
i literally dont know what to do
Not so quick question:
Is it possible to have multi-version MC support in a single jar without needing to use reflection?
Cause I've seen things being done with maven modules, but that seems like is meant for creating jars for different versions, rather than one jar for all versions.
use jdk 8
thats it 🙂
To ur question, yea its possible
but when you work with NMS you need modules or reflection
And to ur statement below yea some do, some have just one jar
I just realised that only one thing would break, so I'll just add a config that works for the various versions instead.
Good luck :)
you can do regex
and some magic
with stringbuilders
look at how papi does it
https://blog.jeff-media.com/maven-multi-module-setup-for-supporting-different-nms-versions/
you'll end up with one .jar that supports all versions you implemented
Hi there! Today I’m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show th...
Eh, you can go a bit more in depth
The general idea here would be to have a multi module project and shade all modules into one jar.
It is just impotant to make sure that only one of the modules classes get loaded onto the classpath.
This can get a bit tricky but can be achieved with a factory pattern which chooses an implementation
based on the detected spigot version.
I'd use generics or something
for placeholders
Takes a bunch of effort though
But allows you to do some nice things like registerFixedPlaceholder(new Placeholder<Player>("name", Player::getName))
or something
Takes actual effort to write a full string processing system that has placeholders n shit
I would use a tree based approach for your tokens. Using one replace call for each placeholder
scales horribly. Here is an animation i made a while ago. Ive used this approach for chat filtering.
Java has a tree set
Remember that racist banana and the filter I made to stop it from saying the N-Word? A lot of developers have been asking me if they can use the filter, and now you can! I hope it helps!
Find the filter here: https://rapidapi.com/mike.nichols/api/phonetic-bad-word-filter/
Join the discord server here: https://discord.gg/kgy88uJ
Merch! https:...
this dud
Are you... familiar with PlaceholderAPI?

This plugin has been established for a decade now
public interface StringProcessor extends Function<String, String> {}
Makes it more compatible 🙂
ehh
I've been avoiding that
Makes it a bit more annoying to document and reverse-engineer
Oh interesting, why? Ive tried to do that where possible
You're applying inheritance to omit the method and override the type
why the hell does MC complain about server.properties not found on first run? it's supposed to create it lol
what is the issue tho
I don't think there's any scenario where a method would require a Function<String, String> and you'd pass a StringProcessor
Or well
Ive seen this problem a few days ago from someone else. This looks weird af
I don't think you should pass a StringProcessor on a method that requires a Function<String, String>. It'd be smarter to just require a StringProcessor in the first time
it also created the file just fine, it seems like it try/catches to load the file and then creates it in the catch block instead of just checking if it exists normally
Yes but you can make everything more modular by expecting a Function<String, String> in your backend and then pass a StringProcessor.
let's see
I wouldn't say that's more modular
It's like saying that you can make your code a lot more modular by just using Object everywhere
No that is not even close to a good comparisson
Function serves as a general purpose interface, making a distinct interface makes its purpose clear
yes
it also makes javadoc annoying as you'd have to document the class itself rather than the method
Its purpose is exactly the same as a Function<String, String>.
Behaviour should be generalized and not specialized.
Like take this interface. Would it be appropriate to omit the method and just extend BiConsumer<T, CommandContext>?
I wouldn't say it's a good design decision
But hey that's just me
I think that would be very appropriate unless you add additional constraints to this class.
Adherence to common interfaces is desireable. Same goes for integration with Java streams and other Functional Features.
Why would you remove interoperability with existing java libraries.
The one thing i can understand is the concern about reduced clarity in some regard.
Ah and you cant evolve anymore.
done
am I supposed to report it to spigot too? I mean it's obviously a vanilla issue but probably won't be fixed until 1.20.2 or 1.21
Imagine having a pipeline where multiple Function<String, String> are used and you need to
create a ton of anonymous classes for it
TextProcessHandler
.with(someProcessor::handle)
.with(anotherProcessor::handle)
.with(thirdProcessor::handle)
.build();
Instead of just passing the classes directly to it.
TextProcessHandler
.with(someProcessor)
.with(anotherProcessor)
.with(thirdProcessor)
.build();
I can't imagine a context where you have a Function<String, String> rather than a StringProcessor instance
Unless it's being provided by an external api
Except that external APIs generally don't provide you function objects
Those do exactly the same thing. I would not expect a StringProcessor but a Function<String, String> in my internals.
This way you could use any class from any library which implements those standard java interfaces.
With StringProcessor you need to create specialized classes. But i get the readability argument..
Its valid
We've just got different standards ig ¯_(ツ)_/¯
In this point we do ig
I haven't seen a single java class that implements Function<String, String>. I wonder if there's a dedicated interface for this somewhere in java std
Its not a primitive so i doubt it
For primitives you got IntUnaryOperator (Function<Int, Int>)
Oh yeah 🙂 good catch
In my point of view the interface has exactly the same functionality
unless you add additional constraints to the implementation. So i would inherit them.
What if there comes a day where I want to add a context parameter or something
Time to rewrite all internals? 
We can run with the argument that at the moment the interface provides idential functionality to Function<String, String> but in the future it may be revised
Hi ! im trying to create a project but i have a problem, i get thjis error while "package" the project: Unsupported class file major version 61
. i'm shading and using Reflection btw
your project java version is higher than your server java version
My server java ?
Follow the open closed principle. Open for extension, closed for modification.
Then you can extend your old code as you whish later on.
whatever you are using needs java 17
Make sure your project SDK is set high enough
you do not have java 17
i m using java 17 actualy
uninstall all other java from your system
and i tried with java 19
What steps did you take to ensure compilation with java 17?
i'm tring to "package" my project
uninstall all other java from your system
Ok and how did you setup the projecto to use java 17?
Did you specify a maven source and target in your pom.xml
Damn md is fast today - already got fixed within like 10 minutes
my maven looks like this :
Meanwhile my SPIGOT-7118 still stands unresolved
make a PR 🙂
don't wanna give personal information ty
?paste it
Duude
ban this guy
Update maven-shade-plugin to 3.5.0
You need a higher maven shade version
fk, sniped
alex why are you up already anyways
99% of my posts here are „use 3.5.0“
Actually, were I to sign the thingie, who would have access to my personal information ?
I needed coffee and the coffee machine isnt in my bedroom
lul
Only md
oh my bad*
They gonna feed that information to the birds and broadcast it through 5g directly into the chem trail fuel
So it would not be like publicly searchable then ?
Its ok if you dont want your personal information on the internet
no its not public lol
I wouldnt post my info with a megumi pb as well 
I'm making a custom fishing system. Is there a way to disable fishing? Like, remove the fish particles and prevent the bobber from lowering when it catches a fish
Hm, play around with cancelling the different PlayerFishEvent.States in the PlayerFishEvent and see which correspond to the biting etc.
You can also set the bite chance on the FishHook
There is a ton of API around the FishHook. Play around with that.
BITE is when the bobber goes down, but idk about the fish particles
I guess you can set the lure time to a very high value to prevent a fish from appearing
I don't quite understand how to implement request waiting. For example, a player has sent a command that does something to another player, and he needs permission from this player to execute this command. In this case, how do I create a request, wait for a request, execute a command if the request is approved or cancel if rejected or the waiting time has expired?
Maybe anyone have some example?
MD already fixed it
Create a manager class, create a request class. Map players to a Set of requests. Check with a scheduler for expired requests.
When a player sends a request you add the request to the manager and inform the other player.
he fixed it like 5 minutes after I opened the jira issue lol
You can use dates or a unix timestamp. Whatever feels appropriate to you.
But you need to check it either way.
anyone german ?
how can i change the slots in shopguiplus in the categories not in the main menü
Most people? I can only think of you, me and old man elgarl
is this a development question?
if we knew we woulve answered you in #help-server
chloe, lynx, many more but I always forget
germans definitely have a large %age on this discord
Isnt lynx swedish or something
and also a shit ton of people here have "de.something" i ntheir package names lol
oof
I have a feeling that this dude might be german too
yeah I'd rather learn C++ instead lol
this facts
ImIllusion is purtuguese, idk if that counts
Huh?
Nah that's very basic lol, I'm french I'm used to nouns having a gender
portugal, france, basically the same country
What's purtugese ?
😐
Basically neighbors right
You mean spain and france...
The set rule is learn the genders
no I mean portugal
You mean... belgium and france?
Just because the language is similar doesn't mean it's the same country lmao
no
i said it because imillusion often sends emojis of a red wine glass and a baguette
and that obv refers to france
Nice
I am scared of german people
import java.*
This felt like Americans saying Europe is a country
You saw that too?
Funny Americans
That video is everywhere
Ah...
you know what's funny? playing ?trivia geography with americans in #bot-commands
Ahah good idea
One time I was in a public VC with a friend and these two Americans join and start talking about American politics 💀
Any Americans here tryna place Listenburg on a map ?
We just DM'd eachother for a bit then left
How would that work?
it's like tnt run
how to make java plugin in skript /s
But you slide ?
no friction
That works, ty!
easy to slip
Oh god
That actually existed a while back
I don't remember where I played it though
It was really fun
Acceleration is better on packed ice tho
boats
no actually
it's marginally better on blue ice
I like how you went
Packed ice has better acceleration, but blue ice has better max speed
"boats that can jump"
...
"HORSES"
tomato tomato
Oh then I remembered it wrong
what if we put some boats in the middle of the track just to f with people
or make a dual layer arena
like 2 blocks thicc
what would the 2nd block do
fuck I wanna write tnt run for shits n giggles now
bet it takes like 15 seconds to write that game
I wonder if I should make a queue that ticks every 5 ticks or something
or just use move event
and what's the best way to cache positions so I'm not setting air to air
on player move
if player is standing on BLOCK and block under is TNT
wait 5 ticks
remove block under player 5 ticks ago
remove block under block under player 5 ticks ago
if player y is less than 0
eliminate player
that's the logic for it
it's really not that complex
@echo basalt ^
No need to cache
just check the block under
There edited
or you could do it the old classic way and let the pressure plates handle the tnt ignition
If it's with ice it won't fall
ice?
I've just started developing plugins and I am very confused anout something. I'm using Spigot version 1.20.1 when developing a plugin. How can I ensure that the plugin I'm developing can work with lower or higher versions?
Compile against the lowest version you want to support
oh and don't forget to set api version to 1.13 in your plugin.yml