#help-development
1 messages · Page 912 of 1
Gotcha haha
ive never used a debugging feature in the past like 15 programming languages ive used except print
No worries, that's why I was so confused... that's just gonna spam your console D:
true
true
true
etc etc
That'd be a fun log to sort through
Try moving it into the if(below.compare) body
I don't think it will do anything but hey who knows... I've had issues where moving a single line fixes all of it
i mean its fine the player isnt on fire i have to code that
never used gdb?
nope
player.setFireForDuration doesn't achieve that?
yeah but first i have to detect if the player should be on fire and set them on fire lmao
Order of events should follow correctly then... odd how it only prints false
Perhaps try a helper method that'll print based on if the player if fired up or not...
oh no I mean itll print true but my method for checking if the player should be on fire sucks
ill be standing 70% in the fire and its not the block below so its false lmao
yeah I will
but
my math isnt on point
im apparently looking at blocks in unloaded chunks
while trying to loop over the nearest blocks
😎 👍
How in the fuck did you do that?
🤷♂️
public static boolean isOnFireNearby(Pos centerPos, int range, Instance instance, BoundingBox boundingBox) {
int centerX = (int) centerPos.x();
int centerY = (int) centerPos.y();
int centerZ = (int) centerPos.z();
for (int x = centerX - range; x <= centerX + range; x++) {
for (int z = centerY - range; z <= centerZ + range; z++) {
Pos pointPos = new Pos(x, centerY, z);
if(instance.getBlock(pointPos).compare(FIRE)) {
return true;
} else {
System.out.println(instance.getBlock(pointPos));
}
}
}
return false;
}```
how to math tutorial
nah its good copilot figured it out ong 💯
copilot...
i have a question about yaml config.
can I set an object with a space in it? eg.
homes:
home1:
world: "world"
x: 0
y: 0
where home1 would be eg.: "home 1" with a space in between e and 1
if I use set, and the path contains a space, will it automatically resolve to:
homes:
"home 1":
....
?
I would say it's a better practice to just use _ as spacing indicator
Iirc yes its possible hut I'd not do that tbh
Anyone a clue why this is erroring?
Pretty sure you have to add the enchantment after the fact of creating the itemstack
👍
ie:
The error happens because enchantment mending is a void method that holds all the properties of mending when creating a new itemStack only needs to take a material
ohh
Something cool you can do is create an itemstack method that will ultimately serve as a custom item of sorts... within this method you can customize a lot about this item... just gotta have some fun with it
shaded dependencies?
Yes?
no clue what that is
Dependencies you shaded into your jar
dependencies that are in maven?
It's already fixed.
He's new
👍
yup
and uhh my brain hurts
my plugin dont work and its not erroring
Send code
Code block or what you prefer?
?paste
send the link after you finish the paste
I bet you didn't put the command in your plugin.yml
if (player.getInventory().containsAtLeast(new ItemStack(Material.IRON_ORE), 32)) {
if (player.getInventory().containsAtLeast(new ItemStack(Material.GOLD_ORE), 32)) {
Both of these are incorrect
What is it suppost to be?
I don't think you use containsAtLeast, nor do you check for a "new" itemstack. The new modifier implies that you are creating a new itemstack which is not what you are trying to do. In the case of you wanting to check if the player has a certain amount of items, you can iterate through the player inventory using a for loop that will let you go through the whole inventory and find items that way
in the case of the inventory having iron ingots then you can apply mending to them that way
Is there a way to improve tps by turning off light of redstone?
But if it loops thru all items wont it add mending to the entire stack im just trying to add a new item that has mending
So you just want the iron in the inventory to get mending?
That wouldn't really improve TPS at all you'd be flipping a bit that does legit nothing in the grand scheme of things. The client does the actual rendering the server sees no benefit from you disabling this client side feature
Your code looks fine. It will check if a player has at least 32 IRON_ORE items in his inventory, and then add a completely new mending iron ingot.
Yes i know but it does not do that
Debug it
That's the issue, is that it looks fine but it doesnt work lol
he's new
yh
Also, @zinc moat you have no debug statements in the paste you sent
oh
Step one:
alr im adding try catch things
You don't need that
Do what i wrote and 100% dont add any try catch "things"
Just a simple println will be fine
There's no reason to debug with try catch especially when it's something this simple
It explains a lot
Also it's not specifically for debugging
oh
try catch is used to catch critical exceptions at intricate positions in your code.
It is used to handle fails gracefully. In your case it wouldnt even print anything to console because you are
not producing an exception.
It can be used in much more complicated processes, ie: where data should go or be handled based on certain scenarios
If you want to improve Redstone tps you'd have to rewrite the server and see if you can make any performance short cuts
so smthing like sout would just do it?
But when you create something like cycle with 2 observers, I think it really hurts tps to turn on and turn off light of redstone every second
That's perfect
Well yeah but it's not the light doing that lol it's the clock
That's all you need for debug statements tbf
You're running through that circuit like a couple times a second
Hmm, you're right it's impossible to change this thing without rewriting game code
That's bound to be somewhat slow
You're looking at a symptom the (light) of something that actually happens (active / deactive blockdata )
eh?
If you got iron, then it should print to console
So i got iron more then 32 and it does not print
but it does not
Hmm, you're right, thanks for explaining
Ok so the function of the command is to do what? Is it supposed to only take a single iron from a stack and apply mending?
its not fully dont yet it justs gives you an iron with mending
That's my point, what is it supposed to do when it's done
uhh its like an auto compressor plugin so it checks if the player has 32 of a item and "compresses" it
Compresses it into a block?
no into an item
That item being (material + mending)
yeah
hello i have a problem, i can't access to the InitialHandler class in my bungeecord plugin
So then basically I believe you still have to iterate through the player inventory to get the materials in order to check if A: it's at least a stack of 32, and B: it's an item you want to be compressible. After that, you just do the same logic for giving the player the compressed item, and remove the original stack of items
InitialHandler con = (InitialHandler) event.getConnection();
yeah that was the plan
how do i loop thru an inventory tho
let me find an example
i think it would be much easier to loop thru an inventory and just remove all the iron and change the iron to iron with mending
That's the point
hi i wanted, to set custom item in mythicmobs, to after all, set it as a drops in one of my custom mobs in modelendinge, but when i'm using /mm items import name
i can see an error in console, (it has custommodeldata, and custom name) what can i do in this situation to set it right?
The implantation you currently have only adds a single iron with mending, as well as keeps the original items haha
yeah i know its a test if i'd work i'd make it remove iron + give it
Please can someone help me!!
i have a problem, i can't access to the InitialHandler class in my bungeecord plugin
import net.md_5.bungee.connection.InitialHandler;
but i have the bungeecord-api in my classpath
i think this is not the place for bungeecoord
it is
People know bungee here, just gotta be patient
do anyone know how to help me in this?
ima expirement real quick
nope
for (ItemStack item : player.getInventory().getContents())
This should iterate through every item stack in the players inventory
Hello, is it possible to somehow disable the chorus flower growth logic?
look at the documentations i guess
so like
if getinventory
that code here?
also what does : do
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
That's what defines the for loop as an iteration through player.getInventory.GetContents
So you're checking ItemStacks (in) : player.getInventory.getContents
If you don't know a programming language you're gonna have a very very very hard time coding a project in that language, let alone with a library
?NuclearKatIsHelpingMeAndIappricateHimVeryMuch
Give a man a fish,
When I tried coding a mod without knowing java I quit very quickly
?YouWhereABeginnerOnceTooSoIthinkYouShouldStfu
Then I learnt java and now it's fine
Beginers don't have the ability to think rationally
Ok?
This is a very good example of that
The deeper you are into a subject, the more rational you think regarding to it
Sometimes it's best for a beginner to receive a bit of support at the beginning in order to introduce them to new concepts and processes to encourage further development of their knowledge
If you get anoyed so easily just ask the owner or sum for like a seprate channel for beginners and intermediate coders
Then you'll end up teaching them java
It's fine if the person at least briefly understands what they are doing. This person does not have the concept of for each loops
Why do you think I said "a bit"
I'm not going to spoonfeed him an introduction to java
OH MY GOD
I just didnt know what : meant my bad next time ill just figure it out myself instead of asking a little bit of help.
I learnt for loops before java lol
You won't need to figure it out if you just learn a language
You don't read a book in a foreign language and go around asking what every word in the book means
And then you won't understand some nuances of it (equiv. to syntax sugar in prog.)
But when you offer a little bit of patience and support it allows them to learn more from what you're trying to help with. Not only that, it can be easily saved for future use and what not. Another point is just that physiologically a person is more inclined to learn a subject when other people around them are interested and willing to at least point in the correct direction... You don't have to feed the man or even teach him how to fish, just fish with him
Just learn the language dude. At least the basics
You'll find yourself coming here much less frequently
A good thing to learn is: googling
If you can google, you don't need a support channel
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Not updated :cope:
But you proceed to treat is as, you're not allowed to ask questions when you don't know anything about the subject which is just wrong... They should always be allowed to ask questions... Yes they should probably use their own search engine first but the point is just that you shouldn't shoot someone's question down by saying "learn java"
Eh it's a place for a lot of stuff
But not learning langs lol
I remember a discussion ongoing in this channel whether existing was a violation of OCP
I know, like I said, use your search engine first but don't just be an ass and tell any beginner to go learn java... that's very condescending and utterly demotivating
Just put it in a nicer way man
"Hey there are places that are better for learning so and so"
That's all it's gotta be man
Whenever I got told to learn java I watched a yt video about java till I understood the subject, if you get demotivated and go away, then thank god you did we don't need people like that coding lmao
Ofc. I'm not saying that someone would literally quit, but it's not fun to have someone just shit on your question with "You don't know java go learn idiot"
Coly how I'm going to bed
Welcome to Gboard clipboard, any text you copy will be saved here.
It's not like that, it's more like "Hey, you should learn java before doing this"
"hey we're going to get technical and we need someone that understands what we're saying"
Another point to take into consideration, is just the simple fact of someone might be learning java through minecraft framework...
Learning through doing is only valid if you at least know the syntax
I definitely did not learn java through bukkit lmao
Same..
I definitely did
But I did have experience in other langs before so it's ok ig
Same again
Yeah same
Yes that is true, I took the codecademy java course before trying plugins.
Yup you did the right thing
hi guys yall still arguing or something?
Again, the person should obviously try to learn the language but sometimes instead of being a dick, you could always just be nice and offer the support that you're willing to. ie: offer the links and again, just be nice about it
I see so many people getting into it after asking simple questions and it's kinda sad
Nobody is being a dick
Perhaps not now, but I see it allllll the time
Because that's how it has to be
There were some spontaneous aggressive statements here and there in this convo but overall more or less civil
Why does it have to be that way? It seems like most of you just don't have the patience to offer a little support which I get, it's probably below your skill level by like 5 years but we all did start somewhere and the more support that can be offered to those who are starting, the easier it's going to be on everyone considering most people here don't like those beginner questions
Because we don't want to have people coming for java questions every 5 minutes, eventually re-asking some questions and being an absolute idiot with tons of xy problems and similar stuff
I don't even know what the context of the discussion here is but there is a big difference between being new to programming and being new to the spigot api
people here are generally fine with helping you even with the most basic spigot api questions imaginable
Well it's fine if there's 1, maybe 2 questions that are related to the very very basics of the language. Any more than that and you are now obligated to visit ?learnjava to avert crises
they are not fine with teaching people how to program line by line
Valid
EXACTLY
we don't expect people here to know how an itemstack works but we do expect you to know how to use just about any class in the api by looking at its documentation, with maybe just a couple of exceptions
I understand that but it doesn't always have to be "You don't know the language go learn idiot" Which is 90% of the cases when it comes to beginners trying to ask something... At least from what I have seen
yeah and 90% of the time those people get told to go learn java, as well it should be
If I understand you correctly you argue that we should be less negative to people who attempt to learn java via these questions
You are right, there's often no need for negativity, but I didn't see much negativity in the convo anyway. What is the argument about?
It's 100% the way it should be. My point is just that it doesn't have to be said in such a condescending / rude way every single time
what is happening
Nothing much
and I'm sure that if you were paying professionals to help you you would get better customer service, but you are asking people who just volunteer their time on free and open source software and thus are at the mercy of whatever response style those people have the patience to give you, if any
and these are the same people that see this same question show up many, many times a day
for years
So then it goes back to the etiquette of "if you don't have something nice to say, don't say it at all"
that's not how it works
Why not?
NuclearKat, at least in this particular instance the individual denied the VERY neutral offer to learn Java. There was no negativity, just a ?learnjava thrown in the conversation. No rudeness was sparked until a bit later on
why would it be
You as a person can make it how it works
So I rest my point here I guess
clearly you observe that it isn't
Same as everyone else
thus it isn't
On the fact that the argument kinda stemmed from nothing
The change can't come from me yapping about it obviously, but it's just so sad to see it happen all the time
I think we're lucky in the first place that there is a place you can ask questions for this api and that is generally well-versed enough and populated enough that you can usually get an immediate answer to most basic questions 24/7 free of charge
nothing about the current setup is guaranteed
Bru wtf
I mean this channel is for help, if you’re not willing to help then don’t be here
I'm not going to refute any of your points because they are all solid. Again, it's just so sad that beginners can't even ask something without getting yapped at to learn java
100% they should learn the language before messing with an api
But again, it doesn't have to be brought about so rudely
@zinc moat Im sorry for any rude behavior here, it shouldn’t be the case, even in the case of being a beginner
Thanks
its fine
im just a little sad that people dont help and are rude in a help channel
but NuclearKat is really helpfull!
you are more than welcome to go open a new discord server called christian-spigot where you can enforce your own etiquette and staff it with your own people and have the utopia you seek, and not be at the mercy of the state of mind of whoever is online at a given time in spigot's help channels, and let me tell you you can take cmarco with you, he would love that
lets calm down
That's disappointing
I'd be very happy if you take cmarco tbh
what?
Magma, drop it
@zinc moat fine if I share the first thing you messaged me with con?
sure
This is the reason I started yapping @ivory sleet it happens all too often
ugh well, id appreciate if you talked to us discord helpers instead of making a fuss about it here
drop it
Good idea
I was too involved tbf
yea, well in any case, lets just start from fresh
hey guys I just came over from bukkit, what is spigot about and is it compatible with 1.4?
Again, disappointing
1.4? or 1.14?
Its a joke
well usually projects start from 1.0
minecraft old as hell 💀
Sometimes before 1.0 too
I remember a time when there were in-game player npcs
and no survival mode on servers
oh
infdev was before that
Ithink
that doesn't sound right, was prealpha before infdev?
it's been a while
right
oh right yeah
that would've been 2009
I remember playing minecraft around when the economy crashed
So you remember playing it today?
yeah i know most of those versions but i thouth after all of those it was 1.8.x
my stock porfolio indicates that the economy did not, in fact, crash today
matter of fact nvidia's out here acting like Atlas carrying the entire thing
idk
This means another day of making more money 🙂
btw
if you ever get enough money, recommend getting a catastrophe bond 😛
might as well bet on them apocolypses
Hi, I am trying to make a parent class Configs, that would have a register method, where it puts it's child classes to a List<? extends Configs> and my thoughts were to make Main.configs.add(this); int the parent register method and then just run register() in constructor of each child class. But the problem is, that in the parent class, I can't put this in to the method, because it doesn't extend the class. Is there any way how to do it? My code looks something like this (I'm just testing it out)
https://pastebin.com/L84C4aD2
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Don't make it static
use just a List<Configs>
and this ^^
:)
oh it's really that simple? Thanks
dont think config should be plural
the static doesn't really bother me at the moment, it will be private after all, I was just testing it
in general Tada Collection<? extends T> means you only read of said collection
and ? super T would mean you only write to said collection
oh I see
yeah, there is much more to it, but in ur case, that "idea" is enough I think?
:), well if u ever need a deeper explanation, just ask away
Hi ,anyone good with nms , 1.20.4?
trying to spawn body of the player
but the Remove does not work
it needs a argument
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
Looks like it takes a List<UUID>
whhat
Depends on what you're doing and where the race condition is
you need to pass something
into the packet constructor
its underlined in red.
uh what do i do in a situation where just a small part of the code is too big to show in chat to explain my issue
?paste
^^
what type of ops?
ideas?
is ur cache just on heap mem? Or do u use sth like redis?
You forgot to remap
i did
then that’s fine insolublemouse?
https://paste.md-5.net/jomuhicale.java
and
https://paste.md-5.net/yuzazavowe.cs
so basically my issue is, it's adding the activators to the activators hashmap (i can tell cuz it's working) but in this part of the code
for (String ac : activators.keySet()) {
try {
Activator activator = (Activator) Class.forName("missing.plugins.executablepets.activators." + ac).getConstructors()[0].newInstance();
inventory.setItem(slot, activator.toItem());
slot++;
if (slot >= inventory.getSize()) {
break;
}
} catch (ClassNotFoundException | InvocationTargetException | InstantiationException | IllegalAccessException ignored) {}
}```
it's not updating and showing the added activator thingi even tho it exists in the map
even if i close the menu and reopen it cuz maybe it didnt update it still isnt showing up
?nms
:,)
does anyone know a per player worldborder api that can also shrink over a set period like the normal worldborder?
?
you haven't remapped
you need the specialsource plugin. check the link ^
i added it , and reloaded maven and builded the new versions
but its still send the error
how do you compile?
that's correct. and which .jar are you using?
This one
?paste your whole pom
this breaks it
https://blog.jeff-media.com/how-to-make-maven-automatically-put-your-plugins-jar-into-your-test-servers-plugins-folder/ read this on how to change the file name
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
do NOT change it in the shade plugin
quick fix:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<finalName>MyJarName</finalName>
</configuration>
</plugin>
then remove the finalName from your shade plugin
then mvn clean package and it should work
np
???
ups wrong channel
i think this can be solved with just appending one operation after the other?
like if u have a completablefuture
myea
for instance
CompletableFuture.runAsync(() -> {
//get
},executor).thenAccept(() -> {
//save
}).thenAccept(() -> {
//get
});
ofc u prob by ALL MEANS want to lock while doing the database calls
well when u do the database stuff
because u wouldnt want two threads writing at the same time
I mean ofc, thats in general fine if u rely on some database
but then, if u wna use a flat file impl u'd wna lock ofc
start a db transaction
refuse to support anything other than S3
yeah, the code I wrote above is wrong as well isnt it, it takes a consumer
myea looks fine
hm
anyway you might wanna lock even if u're using a databse backend, like lets say u wna write if and only if no threads are writing - like doing stuff optimistically and not enforcingly
I need to reorganize this package
well thats when u care about availability (for mc, prob not needed)
for the database stuff?
I mean I would recommend having like, at least a fixed thread pool of n threads where n is the amount of available processors
cached thread pool 
I remember hearing about an issue where high player spikes managed to exhaust the fork common pool
and like horrible latency n stuff
yeah altho its common u might overload the pool if u're doing io w it, so then u'd need to restrict it by other means like with some AQS
or just use a diff pool
not really
but I would advice so
I mean when u involve state, u do wna ensure memory visibility across threads
(which u get automatically, by using certain locks that guarantee memory visibility)
yeah I mean ideally u'd wna have some input measurements of the hardware available or resources so u can define the constraints of the thread pool more concretely
lol
thoughts on item nbt being removed
finally :PPPP
PDC is gone? Good thing I use lore for data storage
ah yes my favorite
LMFAO forgot to add recipe ingredient
guh
using chatcolor as hex
PDC won't be going anywhere I'm assuming lynx has plans to fix it
its not
NBT is not removed
its just in a different format
if its even broken that is
well threads sometimes save outdated values of variables locally, and compiler and jvm can optimize things by reordering which order variables are written to and read from
these "optimizations" can make a program behave incorrectly in a concurrent environment where state is accessed from multiple threads
I was just joking. Well the lore part is still true though but that has to do with cross-plugin compat BS
you can do cross plugin compat with PDC 🥲 provide an API with tags or just make a namespacedkey using NamespacedKey.fromString
if you work with older versions put the PDC in the same place as in the newer versions
Yeah but the older plugins still store everything in lores, so I'd need to automatically refractor all lore data to PDC; meaning I'll eternally have code I cannot really touch; not making the situation any better
But the plugin is too dead anyways for anyone to care
Conclure is one of the more concurrency-aware persons around here
terrible curse
I can only git blame myself so generally I don't use it heh
finaly finished my first ever spigot plugin 🥲 the worst is ahead though
I gotta make the plugin page
niceee tho :>
a big W for finishing something
its small atm but I figure I'd start small or I'd never finish it
its in kotlin too :P
I finished a plugin but I can't test it because protocollib doesn't work on 1.20.4
still?
this is why I just use NMS lmfao
Remapped is amazing
I avoid it anyway I can
plus I have a script to autoupdate versions
that's how NMS is for the most part unless you're touching stuff that gets changed a lot
I haven't had to update my code since 1.19 and it was just a field to method change
most of my stuff works back to 1.17, but I only support 1.20.4 :P
just run my upgrade script and make sure nothing exploded and boom I'm done
its harder to use lol
Not in my experience
have you ever use remapped?
I used protocollib, but like, its nice sure, tho some of the names of the packets were outdated
so it was hard to navigate
I did a little a while ago
which is why im pro nms and netty at this point
if you just need to send packets too there are pretty nice NMS methods for that already
makes life easy as hell
yea
no
packet constructors are much more straight-forward then checking whether the first int or the second int is entity id etc etc
git blame just shows you who added what code
@Override
public void broadcastTotemEffect(@NotNull final LivingEntity entity) {
final var livingEntity = ((CraftLivingEntity) entity).getHandle();
livingEntity.level().broadcastEntityEvent(livingEntity, (byte) 35);
}```
oh, no more like people saw who pushed the code that broke production (on github)
and it was me
so I got blamed
but its also a git command
a swedish mc server, back in the days
almost, tho I stepped out before officially becoming one
it was another network, but i applied to xfun is what I meant
then idr why I didnt take the job, well thats that
@EventHandler
public void onZombieSpawn(CreatureSpawnEvent e) {
Entity entity = e.getEntity();
if (!(entity instanceof Zombie)) return;
e.setCancelled(true);
Zombie zombie = (Zombie) e.getEntity();
System.out.println(zombie.getLocation());
Zombie newZombie = (Zombie) zombie.getWorld().spawnEntity(zombie.getLocation(), EntityType.ZOMBIE);
newZombie.setCustomNameVisible(true);
newZombie.setCustomName(ChatColor.RED + "Custom Zombie");
}
https://paste.md-5.net/jomuhicale.java
and
https://paste.md-5.net/yuzazavowe.cs
so basically my issue is, it's adding the activators to the activators hashmap (i can tell cuz it's working) but in this part of the code
for (String ac : activators.keySet()) {
try {
Activator activator = (Activator) Class.forName("missing.plugins.executablepets.activators." + ac).getConstructors()[0].newInstance();
inventory.setItem(slot, activator.toItem());
slot++;
if (slot >= inventory.getSize()) {
break;
}
} catch (ClassNotFoundException | InvocationTargetException | InstantiationException | IllegalAccessException ignored) {}
}```
it's not updating and showing the added activator thingi even tho it exists in the map
even if i close the menu and reopen it cuz maybe it didnt update it still isnt showing up
why does this produce stack overflow? It happens on the line where I spawn the zombie into the world
How doe, isnt the code only running once?
When the creaturespawnevent runs
Oh lmao im actually dumb
yeah
Ofc
I'll try messing around with spawn reasons
Yeah Im testing the spawnreason with an if statement now and no errors, thank you
bruh the TAB plugin doesn't support translatable components
this whole update is in shambles
Lol
was planning on releasing an update tomorrow where I localized every message in the server
quick fork TAB
I mean I don't update spigot
but I presume md won't just overlook it 
its just a patch to the DFU
go look at net/minecraft/util/datafix/fixes/ItemStackComponentizationFix.java
ffs
yo chat whats the mathematical difference between the width and depth of a boundingbox
one's x one's z
you basically just patch the PDC conversion there from root level nbt into the custom_data dc
it's not as bad as i was anticipating tbh
this is gonna be a fun night
@eternal night md probably won't be having a fun time updating this 
he wont xD
yea well
the items are the chill part
when they get to entities shit will go fucking nuts
the amount of custom data bukkit/spigot/paper store on those 
or block entities
delicious
yeah this is why I'm making CabernetMC
exactly for this reason smh smh
how do they really update them all at once
I doubt they update them all at once. There is likely some degree of latency
if I had to guess some form of redis cache subscription
do I check if two things are in the same world just by using equals method?
the player and a Location object
if u wna check whether a player and a location is in the same world you’d first call
getWorld() on the player, and then compare that to getWorld() from the location
is there anything like a map that can have 2 of the same key?
yeah exactly
What do you mean by that?
they stagger them
a key that holds two values?
like saving "test" with "blah" and "test" with "idk" in the same hashmap
generally move players around so that they're in the same game type
"test" being the key
you’d need some sort of Map<K,Collection<V>>
a Multimap
^
k thanks
Guava has HashMultimap, perfect for u as it handles creation and destruction of the underlying collections
I am confused though right now, the location object is used to spawn an item frame using packets
but I just saw that I never tell that packet in which world it should be 🤔
Locations can have a World
yeah but my packet doesnt have that information
For the metadata:
no place to set the world
so I am kinda confused
how is it going to know where to spawn?
or will it always spawn in the world where the player is located when receiving the packet?
Because this is sent to the client
The server should check which clients it is sending to as its relative to the client for world
what happens if someone switches world? will it unload the entity on the client?
More likely the client will ignore it since it performed a world change
wdym?
Not all packets are processed by server and client depending on their age and what actions have happened
I dont like synchronized
for one its not compatible w virtual threads
for another
I’d advice using ReentrantLock, or maybe a semaphore?
its good
yeah w reentrant lock u get fairness, try lock methods, lock interruptibly and uninterruptibly
very gucci stuff
Also other packets get sent on world change too. So lets say the entity does spawn after world change. The chunk packets would cause the client to remove the entity because according to the chunks sent to the client it doesnt exist as well as some other update packets
well u get that almost w semaphore also, but semaphores are better in their own ways
their name certainly sounds cooler
I am talking about the state that the player already received the packets in the normal world and everything working fine and then afterwards the player going to switch world, its going to just "delete" the entity right?
typically u do sth like:
lock.lock();
try {
//code
} finally { lock.unlock(); }
and then even if code inside that scope throws an exception, -
Yes
Finally runs
It would remove it from the client. But the entity would still exist in the world you spawned it assuming you spawned a real entity and not a fake one
wdym
I am talking about a fake one though
I mean
try {
} catch (){
} finally {
}
Then its just gone
if its checked you should have it propagate upwards w the method signature
thanks
yea
finally is that strong
and it needs to be
in that case it’d execute after (iirc)
Finally executed at the end of the block regardless what happened
They are handy for cleaning up connections
And some other things
Yea well they’re handy for cleaning up no matter what happens

You can still catch exceptions and have a finally. Should always catch exceptions and do something when possible about it.
i mean I do something like:
void method() throws StorageException {
lock.lock();
try {
actualMethod();
} catch (GoofyException e) {
throw new StorageException(e);
} finally {
lock.unlock();
}
}
storage exception is checked
but it can be unchecked also
And conclube shows a nice example of such
If u prefer
only thing is to not catch Exception
or well unless u have good reason to do so
return inside the try block
Ah do the unlock in finally because if finally is reached nothing should need the lock as we are out of the code block now
Anyway insoluble
I don’t think you need to lock around the cache
like you probably wanna decouple the cache, from the actual database stuff
All the database stuff should do is to either take a data object and write to it from reading the database, or take a data object and read from it to then write to the database
the cache stuff should be responsible of loading up a user data object based of an identifier (like uuid), additionally it might put it in some map since u wna be able to access it later
How can I check if a CommandSender is a player?
instanceof I believe
Anyone have any good spigot GitHub links to projects that are very good to look at for beginners but not super basic
Why does my cursor disappear when I type in intellij? How can I fix it?
like the pointer or the I
trade system
look at any basic one
the entire cursor goes invisible until I move it again
how can i damage the player like if an entity damaged him with the inmunity frames and all of that
Did you press insert? Sometimes it also glitches when u alt tab. Or did you perhaps by mistake toggle VIM?
Update: author told me to write my own shit
It is very likely I may have accidentally pressed a keybind of sort, how can I disable all of those?
even after u pr’d?
Sounds about right D:
I never alt tab, I always just change windows manually.
Lol I just read the issue
“Feature requests are closed”
if (e.isShiftClick()) {
if (e.getSlot() > 0 && e.getSlot() < activators.get(activatorString).size()) {
Collections.swap(activators.get(activatorString), e.getSlot(), e.getSlot() - 1);
setMenuItems();
}
} ```
this isn't moving it up, there's no errors in the console, am i missing something here?
I don't even have VIM installed.
Did u maybe press like insert?
nope
Hmm thats weird then
i tried putting a debug print inside and it's not printing it
It makes my cursor fat when I press insert
Im gonna restart my pc and see if it fixes
like a square?
idk
nope didn't fix
That means it’s not reaching/passing your conditions.
weird
oh wait is a map not ordered correctly cuz its entries is a set
oh bruh
it is
linkedhashmap exists thank god
I didn't know joshua bloch was god
how do i move a key up in a linkedhashmap and move it down as well?
for example
"A": 1
"B": 2
"C": 3
i want to move C up so it'll be
"A": 1
"C": 3
"B": 2
Use a sortedmap
then?
Use keyset() or values() which returns ascending order
i dont want a specific sorting, i want to move a whole value directory
also the value isnt an integer
You really shouldnt need to move something in a map itself. As this is can be an expensive operation
So you just do such things on returned values
Sortedmap facilitates this. Otherwise use a linkedhashmap if insertion order is important i guess.
insertion order is important i just need a way to move the value up if i want to
You will need to iterate over the map and manually dump into another
ye at this point ive been working on this simple collision detection for like 5 hours bruh ```java
/* For reference */
public BoundingBox(double width, double height, double depth) {
this(width, height, depth, /offset/ new Vec(-width / 2.0, 0.0, -depth / 2.0));
}
public boolean intersectEntity(@NotNull Point src, @NotNull Entity entity) {
return this.intersectBox(src.sub(entity.getPosition()), entity.getBoundingBox());
}
public boolean intersectBox(@NotNull Point positionRelative, @NotNull BoundingBox boundingBox) {
return this.minX() + positionRelative.x() <= boundingBox.maxX() - 5.0E-7 && this.maxX() + positionRelative.x() >= boundingBox.minX() + 5.0E-7 && this.minY() + positionRelative.y() <= boundingBox.maxY() - 5.0E-7 && this.maxY() + positionRelative.y() >= boundingBox.minY() + 5.0E-7 && this.minZ() + positionRelative.z() <= boundingBox.maxZ() - 5.0E-7 && this.maxZ() + positionRelative.z() >= boundingBox.minZ() + 5.0E-7;
}
/* my actual code */
for(Pos firePos : getNearbyFires(player.getPosition(), 1, player.getInstance(), player.getBoundingBox())) {
BoundingBox fireBoundingBox = new BoundingBox(1, 1, 1);
var inside = fireBoundingBox.intersectEntity(firePos, player);
System.out.println("inside" + inside);
}does anyone know why `inside` is always fucking completely just garbage 😭 🙏 2/4 block faces are true and 2/4 are false for example
This returns true
Pos[x=2488.0, y=72.0, z=1682.0, yaw=0.0, pitch=0.0] (Fire Pos)
Pos[x=2487.2477273989675, y=72.0, z=1682.527185211678, yaw=-96.659515, pitch=56.08326] (Player Pos)and
This returns false
Pos[x=2488.0, y=72.0, z=1682.0, yaw=0.0, pitch=0.0] (Fire Pos)
Pos[x=2489.516695224516, y=72.0, z=1682.569168189597, yaw=86.72293, pitch=82.06115] (Player Pos)```
with the player's boundingbox being [-0.3 : 0.3] (minx, maxx) [0.0 : 1.8] (miny, maxy) [-0.3 : 0.3] (minz, maxz)
the math aint mathing anymore
Wouldnt that be accurate?
Half true and half false making a whole
idk man im trying to check if im standing in a fire and if I stand on 2 out of the 4 blocks near the fire block (except the 4 other blocks on the diagonal i ignore those atm) it returns true for 2/4
this is apparently true for example (I dont think it is buddy but whatever the math says)
I mean you are on half the blocks?
on the other sides i can literally be in the block and itll return false
Why aren’t you using the built in bounding box stuff
I actually cant do anything this is so annoying. Please help
limitation skill diff
It doesn’t come back after moving the mouse again?
it does
?
(im actually using the minestom api but im quite sure this is a mathematical skill issue)
It is
The cursor turns into that tiny line where you’re typing… so that’s just base os functionality
There is some numbers or assumed numbers that are not correct
no way it's default, when you type it goes away?
You should output each stage of the equation
thats actually part of the API im not sure if I should be changing that 💀 🙏
im not too sure what the role of the 5 is
Eh I’m pretty sure that’s default for most os
it does it for you too
i assumed it was some mathematical rule for boundingbox calculation lmfao
Maybe the api is flawed. Never a such thing as a perfect api lmao
It depends where you want the boundary of the box to be at. But also certain things in mc are measured from different spots
For example 4 blocks share a corner coord. But if you want the center of a block its measured from bottom right of the coord if i recall
with one of the True cases for example ```
Pos[x=2507.0, y=72.0, z=1662.0, yaw=0.0, pitch=0.0] - Fire Pos
Pos[x=2507.4823801380167, y=72.0, z=1661.3185049153367, yaw=-1.6994896, pitch=86.026634] - Player Pos
ResultPos[x=-0.48238013801665147, y=0.0, z=0.681495084663311, yaw=0.0, pitch=0.0] - Substraction Result```
ill update it in a sec with the other steps
ah this equation is so complicated god dayumn
Lol
Not even sure why you need this complex math for something so trivial
Just surround the fire with a bounding box. Check if player is in the bounding box
The fire itself is only so large. And if you want them to still get like burned for being close, adjust the bounding box out accordingly
On spigoot it’s literally just BoundingBox.of(block).overlaps(player.getBoundingBox())
:p
Yeah
thats literally what im trying to do buddy 😭
im just trying to check if the player overlaps with the fire's bounding box
someone told me fire doesnt have a bounding box but thats another story
Well it shouldnt be that hard, or need complex math even if you wanted to do it manually
I am pretty sure it does as it used to be considered a block. But the box for the fire is like larger then the fire itself
But regardless you can just make your own for it
well to be fair i tried to make a boundingbox bigger than width 1 height 1 and depth 1 but then i dont even know what the fuck happened
i ended up having issues like 3/4 sides would always be true and 1 side would just never be true
Ah the problem with using 1's
am i not supposed to use 1 for a 1 by 1 block 😭
No just in math when you do some calculation 1s and 0s cause issues is all
also it seems my issue is with specifically java boolean p6 = fireBoundingBox.maxZ() + positionRelative.z() >= boundingBox.minZ() + epsilon;
well maybe more than that
double epsilon = 5.0E-7;
boolean p1 = fireBoundingBox.minX() + positionRelative.x() <= boundingBox.maxX() - epsilon;
boolean p2 = fireBoundingBox.maxX() + positionRelative.x() >= boundingBox.minX() + epsilon;
boolean p3 = fireBoundingBox.minY() + positionRelative.y() <= boundingBox.maxY() - epsilon;
boolean p4 = fireBoundingBox.maxY() + positionRelative.y() >= boundingBox.minY() + epsilon;
boolean p5 = fireBoundingBox.minZ() + positionRelative.z() <= boundingBox.maxZ() - epsilon;
boolean p6 = fireBoundingBox.maxZ() + positionRelative.z() >= boundingBox.minZ() + epsilon;
System.out.println("p1" + p1);
System.out.println("p2" + p2);
System.out.println("p3" + p3);
System.out.println("p4" + p4);
System.out.println("p5" + p5);
System.out.println("p6" + p6);```
this is the code im trying atm and it seems p6 is returning false when it should be true or true in cases it should be false 🤔
how to use z axis tutorial 🙏
the full example would be java Pos[x=2505.0, y=72.0, z=1681.0, yaw=0.0, pitch=0.0] - fire pos Pos[x=2505.2872937165994, y=72.0, z=1682.5240348120838, yaw=-178.15439, pitch=61.100857] - player pos inside => false subResultPos[x=-0.28729371659937897, y=0.0, z=-1.5240348120837552, yaw=0.0, pitch=0.0] p1true p2true p3true p4true p5true p6false
Weird you are using such large floats lol. Why we using an epsilon in here? Is it for if they are diagonal?
I still dont know why using 5.0000000 is being used either
it was part of the OG formula and i didnt question it
i could try nuking it
lemme cook
honestly if its because of the diagonal im just banning players who diagonally step into fire atp
Lmao
to be fair i replaced it with 0 and i dont even see changes bruh
Too difficult with just a phone
alright thank you 😭 its already been 7 hours i can spare some more dont worry lmao
Lol
sounds like maybe u want to use a TreeMap instead
where there is a notion fo natural order
already figured it out with linkedhashmap
Ah that would work too. Forget about them trees
nice
also for reference here's a more detailed example of a false positive java Pos[x=2489.0, y=72.0, z=1673.0, yaw=0.0, pitch=0.0] Pos[x=2488.315463502017, y=72.0, z=1673.488163720621, yaw=-84.227356, pitch=63.528667] RESULT -> true subtraction -> ResultPos[x=0.6845364979831174, y=0.0, z=-0.48816372062105984, yaw=0.0, pitch=0.0] FireBoundingBox [minX=-0.5, minY=0.0, minZ=-0.5, maxX=0.5, maxY=1.0, maxZ=0.5] PlayerBoundingBox [minX=-0.3, minY=0.0, minZ=-0.3, maxX=0.3, maxY=1.8, maxZ=0.3] PositionRelative [x=0.6845364979831174, y=0.0, z=-0.48816372062105984] p1true p2true p3true p4true p5true p6true
Is there a way I can get a list of all the children of a ConfigurationSection ?
the way I have my config set up is that you're supposed to add an arbitrary amount of entries to a ConfigurationSection
ConfigurationSection#getKeys(false)
what kind of entry is this?
afaik, it's a key then an Integer[]
but there's no option to get an int array
yea i'll just map it to an int array
I also need to parse an Identifier to a StatusEffect
It took me so long to learn collections, but man I am glad.
I could do all of that in 1 map call but I think it's cleaner to do it in 2
thats a lot of streams
What does this do? Get 2 effects from the config list?
I don't work with streams all that much.
Collections are very, very fast, so fast that it can process a list of like 4 thousand objects in milliseconds
i mean yeah
but the memory overhead and just operational overhead is still noticeable on streams if u go far enough, dont think it affects u here tho but point given
parses all entries as their name, and their 2 integer list settings and turns it into a list of status effects
so it turns an arbitrary amount of those potion effects into a list of them
I'm always looking for ways to improve, if I send you the code would you be down to make it better?
Well you're saying that it can be improved
I think personally the code is a bit complicated
like in those streams a lot of things happen
less lines = bad
I prefer a much more readable line then 1 long long line that you have to scroll to see the end
matter of fact, you can make a whole class in 1 line if you wanted
well I think it highly depends on whether few or more lines is bad or good
feel free to make it better in any ways you see possible, and then explain to me what you did to make it better.
final List<PotionEffect> effects = config.getConfigurationSection("Punishment Effects")
.getKeys(false)
.stream()
.map(f -> Map.entry(NamespacedKey.minecraft(f), config.getConfigurationSection("Punishment Effects")
.getIntegerList(f)
.stream().limit(2L)
.toArray(Integer[]::new)))
.map(f -> new PotionEffect(Registry.EFFECT.get(f.getKey()), f.getValue()[1], f.getValue()[0]))
.toList();
too much time
This is literally my very first time making a plugin
I have like zero knowledge on the API
well you did ask me what I thought could be improved
yea fairs
but the format has little to do with the api
anyway I'd probably have limit(2) on its own line
and make it consistently indented
IDE automatically does that inner indentation
goofy ide
do people usually put their permission node configurable in the config file or not?
people with some resource pack experience, this code works for setting my offsets for armor stands
private void setDisplay(Map<String, Object> textureReferencesClone) {
textureReferencesClone.put("display", Map.of("head", Map.of("translation", List.of(
-modelSpaceOriginOffset.getX(),
-modelSpaceOriginOffset.getY(),
-modelSpaceOriginOffset.getZ()),
"scale", List.of(MODEL_SCALE, MODEL_SCALE, MODEL_SCALE))));
}
but it doesn't affect display entities, anyone have any idea of what the key might be for display entities?
what would it look like?
here's my plugin.yml rn
name: dangerlevel
version: '${version}'
main: me.wclient.dangerlevel.DangerLevel
api-version: '1.20'
(I use a really funny method using reflections to bypass manually adding all commands to plugin.yml)
yeah I just register straight to brigadier myself
but its not favored
never
i asked it once
it gave my fail-proof failing code
this is my inheritor class, and I just access the commandMap in the server and register them
It doesn't get much easier to make a command then what I have
where do I add in the thing for permission nodes?
is there just no equivalent for display entities? I can't tell if I can't find the documentation or if this is just something that doesn't exist
well I can't find it anywhere so I'll just assume it doesn't exist I guess
hm
feels like this might cause issues
wdym by this
resource packs have a display property that allows you to align models so they fit an entity
mmm interesting
and it's keyed
didn't know that
so like if you use the head key it will allow you to re-center where on a player a helmet will be
(or an armorstand or I guess also a mob of player-ish size)
I use that for FMM and I finally narrowed down my issue to the fact that display entities are either not using that key or not using that system at all
which might be a big problem for rotations if that is the case
I'll have to test it
Does metadata stored on a player persist after death?
or does it clear when they respawn
I don’t have the answer to that specific question but id assume there’s some data that persists after death
pdc data persists
just use PDC
metadata API is leaky anyways
?pdc
Im asking because I want to know if it does not to use it :P
I know it's cleared when a server closes but i wanted to know if it does on player death
the problem with metadata isn't that it isn't stored but rather it isn't cleared
Yea yea, i know. i didnt plan to :I
They call me the collections guy.
this turns in to
i see one collection
most of it is stream api :,) (counting w the code from before also)
this
wclient seems dangerous
what do you think of my expertise in streams
well its not any faster than the counter alternative
for loops
while loops
but yea its convenient
Not always the most memory efficient though
Streams are most useful when you're using concurrency
personally, I can't see it being a insane memory problem, especially since my plugin is very simple
Yeah. Most scenarios, it's not a big deal
I'm honestly having more fun then anything making this plugin
at startup
its fine to loop through a set of boostrappable components w a stream or so
hugw W
how could you tell
The one thing I'm kind of dreading is making the placeholder for the danger of the player
its also kinda sad that u cant specify a custom executor for the parallel streams, as far as I know of
I'm not sure how to even start with the placeholders
or well, "custom fork join pool"
you "can"
if the current thread is a FJT it will use the pool of the current thread
common pool otherwise
but yeah not really a custom executor
but a FJP
after all, the point is a divide and conquer approach
yup
Can someone please send me a tutorial for using placeholder strings in a plugin
Well no, because I would like to allow support to put the player's danger on TAB, Scoreboard, and in chat
ah u wna write ur own placeholder api extension?
Just to use a singular placeholder?
yea i want people to be able to use ie. %danger-level% as a placeholder, and it then becomes whatever the player's danger actually is
you'd pretty much need to write a papi (placeholder api) extension for it
Yeah I mean I guess i'm willing to do that
u basically need to override a couple of methods
Well hold up
I have never made a plugin before, so I kinda need to follow a tutorial or something
Do new snapshot's ItemStack Components deprecate PersistentDataContainer API?
I found that trying to find examples of functionality (similar to what you need ofc) helps loads when trying to figure something out
nope
Oof
it fits in the custom tag
So this gives me no info how to set it up, it jumps straight into making it, but no set up
I got really scared reading the news 🦦
yea no u're good
its mostly them just having their shit loaded and validated eagerly
By the way, I would like to contribute/expose some methods
I was previously told how to
oh
What do I need to add to my gradle file
its at the right nav bar
like i have no idea
I just can no longer find the source of how to do so
like create a PR?
Yeah yeah
Also take note of examples you like or think you'll come back to, you never know when you might just forget the simplest of things
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
Yes!
where can i put in my placeholder expansion identifier so people know what it is, but cannot change it?
There is the papi ecloud
nah imma just put it in config.yml
?
Wants to know where to put an unmodifiable string prefix.
Decides to put it in the config where everyone can change it.
🤔
does string.substring(0, string.length - 1) return "est Strin" given string is "Test String" ?
try it and see
man i can't be bothered
🤷
I had to do that crap like 2 million times in my CS class and I still don't know fully
java online compiler
nah it's 1
No
It just moves where it's stored internally iirc
Dont worry about it I'm sure md will have fun fixing everything xD
Yea the custom tag should be fine
No it gives Test Stri
The top bound is exclusive and your subtracting 1
So if I wanted to make my own rank system plugin, would I have to log each user on the server in a database to their assigned rank or would I just have the ranks setup in the database to where I can grant such and such user on my server a rank without needing to append their username to the database..?
inclusive exclusive by convention:)
Peppers 🌶 🌶
Step 0 is to consider luckperms
Step 1 give up use luckperms
No one here is going to help you with ranks if I wanted to suffer in hell I'd rather wait till I die no need to do it when I'm alive
Nah the mongodb and storing each user granted a rank and by default on join the basic rank isn't hard at all