#help-development
1 messages Β· Page 1834 of 1
It still doesn't do the damage I want it to do. Is that the correct way of changing the damage? e.setDamage(100); ?
how do I get the number of items in the player's inventory in version 1.8.8?
what's e?
event
Player#getInventory().getContent()
you would need to loop to determine all stacked items
loop over the inventory contents and add the number of items to some variable
show your full event listener code pls
how
you use a for loop
why do you need to get all items if i may ask
how to check if player don't have any item
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.
to check if inv is empty?
and now: idk if Inventory in 1.8.8 already implements Iterable
well you dont need to do that then
for(ItemStack item : inventory.getContents()) {
// Do stuff
player.getInventory().isEmpty()
ok so you grab the inventory
picks up inventory
then you look through every item in a loop
looks through every item in the inventory
and if the item you're looking at matches the item you wanna take out, you take it out
grabs stick and cookes marshmallows
gg ez
idk p.getInventory().getContents() exists
sorry
this is a different approach to how you are doing it, but you may have a simpler time if you use attributes and/or attribute modifiers
I'll look into that. I don't however think that is causing the isseu
private boolean checkInventoryIsEmpty() {
PlayerInventory inv = player.getInventory();
for (ItemStack i : inv.getContents()) {
if (i != null && !(i.getType() == Material.AIR)) {
return false;
}
}
return true;
}
?
the thing is that the if-statement simply doesn't run
again.., player.getInventory().isEmpty() exists
no, it's not the cause of the issue, just making you sure you know about attributes because they are useful if you intend on making custom weapons/armor
this is for new versions
ugh
Ok, that is something I'll look into right away
player.getInventory().getContent().length == 0
the guy
not in germany
X = height, Y = left/right, Z = forward/backwards
that's how it works in normal geometry
oh wait
yeah
quite a few other programs do happen to use Y as a vertical axis- a primary example would be 3d design/3d printers
x is length
X = left/right, Y = height, Z = depth (forward, backward)
sorry I was mistaken
anyway, Y is always the height
its like everywhere else
and in school when you pay attention in math π
shots fired
Yoo
wikipedia tells me I'm right too
What happens if i cancel AsyncPlayerChatEvent?
no msg gets sent
k
you cancel the sending of the message
you could kick them and remove the "Back to main menu" button
NoSuchMethodError :<
your book is dumb
^^
GodCipher you wanna help me translate my adventure game to english? XD
your adventure game?
it still has a thousand untranslated lines of text lol
link
this looks like one of those handy games "find the paper"
it's like monkey island in retarded
"find the hidden wood stick"
if you get stuck ping me and i'll help where i can, going to be afk for a bit soon though
why not a 3D mmorpg
maybe it's done differently in italy
but anyway we had people from 3 different countries, AND wikipedia, claiming that Y is usually height π
so it must your country / school that does it differently π
italy is whack
wikipedia is the best website on the whole internet except for pr0nhub
iirc y is up/down in opengl land, but not in direct3d land
Wikipedia often lies
ooooh microsoft sucks
that's why people like me exist to correct those lies
wikipedia is a good source
And fat moderators remove your edits for no reason
believe it or not but other "encyclopedias" always sometimes "lie"
wikipedia is just used by 1000 times more people so obviously you'll find 1000 times more mistakes there
I'm one of those moderators but I'm not fat, only 60kg for 185mc
yes, where's the problem?
in germany we would say untergewichtig
That's a huge risk
but in medicine it's called "so gerade eben noch im normal-bmi" lol
60kg with 185cm?
better than any private website
Yes, you can get ddosed
EVERY website you visit gets your IP
No thank you, is that the best way to change custom item stats?
But it doesn't leak it to everyone
haha why do people think ips are so dangerous
teacher always do the "dont use wikipedia as a source" - makes my own website with wrong facts
if you found any "errors" in wikipedia, feel free to correct them
Because yes, I plan on creating a lot of custom items
haha join my minecraft server and then i will ddos your computer !! lol!
Well
at least the one you had when you went to one of my websites
yeah some people think that's how the internet works
X, Y, and Z can be relative. If you were to rotate that graph 90deg up, your Y would then be height. This is why when you make the graph, you give the legend. Letting end users know which variable is tied to which axis.
here's my IP, go DDoS me
Do u allow it tho
That's very risky
go ahead
so, i got a list of all the materials, anyone knows an easy way to filter out all of the whole blocks?
Too late
(first time on spigot)
still online
sure
I'm almost asleep
Material has a method isBlock()
yeah, used that but things like pressure plates and buttons come up
@tender shard How long have you been coding MC plugins for?
use isSolid() too
e.g. Material.DIAMOND_PICKAXE.isBlock() -> false
Material.DIRT.isBlock() -> true
2018
why though lol
if(item.isBlock() && !item.isAir() && item.isSolid())
afaik yes
this is my if statement rn
noooo
oh wait
sorry
I was just wondering because you seem to know quite a bit about spigot and stuff
I didn't see the ! in front of isAir
maybe I just have too much time
this should work?
cringe
yup, but there's still some stuff that i'd like to filter out, like corals, amethyst, dripstone, banners
I will only go to sleep when you managed to fuck my internet by ddosing my IP
what is spigot?
Well yea, but the way I would do it is: get the PDC, if it is the item, change the damage of the event. Is that a bad way?
amethyst clusters i mean.
where the water comes out
then you will need to filter those out
thank you
Bro if that's hour real ip
You might be in serious problem
to say it in your language @hybrid spoke ITS A WASSERHAAAAAAAHN
pdc is good if you want to add stuff that isn't in vanilla, but attributes are good if you want to change attributes that are in vanilla
Yup, i know was just wondering if there's the ez way or i need to do that by hand
or WASSERKRAAAAAAAAAN if you're bavarian
read again, custom stats.
create a list of items you want to filter, use the stream api to filter
Yea, I thought that
you want to make sure if the items has X flag, not if its that item
^
I mean, I will be creating more custom stats than changing vanilla ones indeed
aight, thanks for help everyone, gonna go with this!
my bad, saw setdamage and figured Cosmic wanted to change the damage
The PDC data right? That was the thing I was doing
I did want to change the damage yes
but that is vanilla like you said
but I will be doing custom stuff in the future
TL;DR: PDC is for every data you want to save in an itemstack, entity, chunk, or even block, that doesn't already have any other way to save that information
does chunk/block have an PDC?
ya, so i'd recommend attributes and attribute modifiers for vanilla stuff and pdc for new stuff
Chunk yea
chunk has it since 1.16.3
Yea, I found that out already, but thanks for the info!
Block no
persistent data container π§
Yep, thanks for the help!
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/ @hybrid spoke @young knoll
it basically uses the chunk to give you a "fake" block PDC
so no, block doesnt.
np
it's possible to get a PDC for blocks, but it requires a bit of math and actually using the chunk instead.
mom can we have pdc?
no bobby, we have pdc at home
pdc at home:
Issues with Maven Multi Modules
does anyone here know how to update an itemstack in a players inventory without resetting it?
or is it just not possible
wdym with "updating"?
When you change an itemstack, it gets updated everywhere where it might be
for example change its lore
get meta, change, set meta
im trying to use the persistantdatatypes library but it wont work π₯² idk what i did wrong
when i change lore of an itemstack its not updated in the players inventory
which is what i want to avoid...
why?
because its expensive
where is it expensive
i put the stuff in the pom.xml and reloaded and restarted but it still wont work
if you do this thousands of times a second
mine?
yea
it gets expensive
what does not work?
everything with a bit of logic is expensive there
so i want to make it as efficient as i can
im trying to use it for storing stuff but it wont set
someone today claimed using @NotNull is expensive lmao
i imported it
idk
but its probably not possible is it
send your pom.xml pls
not really
okay now send the class where you are doing PDC stuff @earnest tulip
btw you should properly relocate my lib
wym
check your pom
anyway it's not important rn
should work anyway
Ill check your code
aight
what exactly doesn't work?
it wont set
player.getPersistentDataContainer().set(new NamespacedKey(getPlugin(), "Shulk"), DataType.STRING, "new ItemStack(Material.SNOW)"); //this line <<<<<<<<
everything else works
this does NOT look like what you're trying to do
Some blocks have PDC
?
you literally just store a string with java code
Block entities to be exact
TileEntities do
what do you want to store?
an itemstack? or a string?
an itemstack but im testing it as a string first
yeah obviously that's useless
you want to use DataType.ITEM_STACK
it DOES work
you currently stored "new ItemStack(Material.SNOW)" inside the player object with the key "Shulk"
mhm
you stored it as String
yesssssss
i knowwwwww
im testinggg itttt
ignore the itemstack
it wont work
even as a string
iiiiiiiiiiiiiiii loveeeeeeeeeeeeeeeeeeeeeeeeeeee marshmallowwwwwwwwwwwssssssss
idk what i did wrong
o you can now do player.getPersistentDataContainer().get("Shulk", DataType.String) to get that string
meeeeeee tooooooooooooooooo
ik but it wont set bro
erm I mean
i checked
a namespacedkey instead of just "Shulk"
it DOES work
show the code where you try to get the string
Also Iβm pretty sure itβs PublicBukkitValues
yes
sorry but I don't have to debug such lazy attempts
get the actual player's PDC
it WILL be inside
-_- how would that not show it
it IS called BukkitValues
see
and it works fine for me
dont be mean if u dotn know
I am not mean
then y u bully me
What
xD
Is it just called PublicBukkitValues on itemstacks?
welcome to #help-development @earnest tulip
im genuinely just trying to get it to work
seems like your first day here
BukkitValues is indeed correct
yeah and I wasn't rude or bullying anyone
it wont show ;-;
you always bully me
enter that command manually @earnest tulip
I get it
I used to do that, I don't do that anymore
but you know, backwards compat and stuff
huh.. a boolean will always be a boolean
fuk compatibility
in the method where you set the PDC value - get it right after setting it and check it
btw i would like to thank u as a member of the community for making such a nice plugin, im just sad at myself that its not working for some reason
ok
πΌ
what plugin are you talking about? π
i'll find you
urs silly
my address is on my websites: https://jeff-media.com π
neat
now you have my IP
nice bait
oooh you mean the library π
thanks π
but yeah if that doesn't work, something's wrong with your code somehow
hm
you probably have some command in your plugin right? gimme a sec and then add what I send to your commandexecutors code, just for testing
ok
Asterverse can you confirm that the code is actually running
Player player = (Player) sender;
player.getPersistentDataContainer().set(new NamespacedKey(yourPlugin, "test"),DataType.STRING, "test12345");
System.out.println(player.getPersistentDataContainer().get(new NamespacedKey(yourPlugin, "test"), DataType.STRING));
add this to one of your commands at the very top
it should print "test12345" to console when you run that command as player
obviously you'll have to replace yourPlugin with your plugins instance ^^
aight ty
btw i tested it with a regular Pdc string and it works
its just when i switch to the datatype.string
Oh yeah why arenβt you using the normal pdc string type?
it's exactly the same thing
exactly
which is weird
idk why its not orking
working*
let me try what u sent\
there is NO WAY that my library is at fault here
I do admit that I sometimes fuck things up - but I didn't this time π
Thatβs what they all say
yeah but you can literally see it's the same thing π
Iβm puzzled
why? how? do you need cuddles? :3
No just, why lol
I made a lib for custom PDC types
i tested it
anyways yeah if thatβs the variable value then it should work
But why do you have variables which delegate the default ones
and to have them all at the same place I also included refs to the exiting PDC types
it works with regular pdc types
are you 100% sure you get no console errors?
Because PeristantDataType is too long duhhh
i feel like i did somethign wrong in the pom but u didnt say anyuthing
from what I now believe is that you simply didnt shade the lib
i get nothing
from the console
but when i try the regular it shows
in the console
can you DM me your latest.log pls
yes
it's really too long lmao
tbh I made that lib to just have shorter names and then decided to add custom data types as well lmao
The name is good imo π
Elaborate
whether they are persistent or not depends on where they are stored
true statement is true
so it should be called DataType instead of PersistentDataType
?paste
I mean PersistentTypeSerializer would probably suit better
lol
yeah that's even longer lol
and it's still misleading
it's not persistent until it gets stored in a PDC
do i copy from the log into that?
yes
but well Persistent is imho necessary as it serializes and deserializes persistent types
yeah but the data types itself are not "persistent" in any way
The data types are not to be removed nor changed after a said instance
only the thing their contents are stored inside are persistent
The data types aim to be persistent tho
Itβs not like theyβre dynamic or provisional
as I already suspected @earnest tulip
You didnt shade my library
onnectionUtils.lambda$0(PlayerConnectionUtils.java:30) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1148) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(SourceFile:134) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1125) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NoClassDefFoundError: de/jeff_media/morepersistentdatatypes/DataType
at me.asterverse.origins.Traits.Effect2.onPlayerOriginChange(Effect2.java:92) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
... 28 more
Caused by: java.lang.ClassNotFoundException: de.jeff_media.morepersistentdatatypes.DataType
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at me.asterverse.origins.Traits.Effect2.onPlayerOriginChange(Effect2.java:92) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
... 28 more
[15:37:05] [Server thread/
aaaahhhh tyyyyyy
and as you can see there ARE console errors
did you actually use maven to build your jar?
yea
well then you probably did NOT have the maven-shade-plugin in your <plugins> section
one sec
i probably built it wrong or smth idfk
okay please explain how you built your .jar file
Probably a stupid question, but what is the advantage of using Maven to build the jar? I use the standard intelliJ thingy
im using intellij and theres a reload button in the top right of the window when u change the stuff in the pom, so i pressed it when i was done
thats probably the issue
im guessing
a ton of things.
- it handles dependencies. You don't have to add them manually
- It can shade them too (just see what we're talking about 10 lines above^^)
- Many more things XD
yeah but - how did you create the .jar file?
It also makes it easier for other devs to work on your project
exactly, because of No. 1 I sent
there is no "hardcoded" dependecy at C:\Users\yourName......
did i create the jar file? π³
what do you do to compile your plugin?
see this
i do the artifacts trick
yeah thats wrong, you weren't using maven to compile
see my screenshot
you need to double click "package"
ONLY, and ONLY THEN, maven runs
no problem
I was a noob in maven stuff too 2 years ago
someone had to explain it to me and it took very long until I understood everything
I actually ranted on github about how stupid maven is
but it was just because I didn't understand it at that time
https://github.com/JEFF-Media-GbR/ChestSort/pull/7 here's my rant against maven
xD
yeah but they explained it to me and now I never wanna go without maven EVER again
Is there a way you suggest learning all this stuff? Like a good YT channel or smth.
what exactly?
I know java, but the spigot API and everything that has to do with Plugin Dev
ah okay
sorry I have no idea. I learnt most stuff by simply trying and reading the javadocs
also by decompiling already existing plugins
SMALL plugins
Feel free to DM me or sth or join my discord if you need any basic help
yes you should get started with something very silly
e.g. sending a message to a player when they join
I can see some good practices that way maybe
yes and as said, feel free to DM me π
I know how to do that ofcourse, but it is for example the more intermediate stuff. I can work my way around most stuff, but my code will most likely be a pain in the *** to read
aaah okay
yeah just ask if you got any questions but tbh there's no "guide to master spigot api"
for example, I didn't know the PDC and I would work with DisplayName
displayname is part of itemmeta, no PDC needed
for PDC, I wrote a tiny blog post about it:
Yea, but as someone said, you can just change the item name in an anvil to get the modified damage
exactly. it was probably me who said that lol
this question comes up here about once per day
check out my blog post and let me know if you still got questions π
Reading that rn
im still having trouble, i take the jar file from the targets folder right
yes
i still cant get it to work, very confused
?paste your latest.log again pls
ok
and send it here please
yea
?paste your full pom.xml please
hm looks correct to me. please send your .jar file
thx
oh wait
is the shaded jar bigger than the other one?
in that case: you MUST use the shaded .jar
no its smaller
oof
I'll check the jar you sent
aight
anyone got any ideas how i can make a rideable enderdragon?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Entity.html#addPassenger(org.bukkit.entity.Entity) shoudln't this work?
declaration: package: org.bukkit.entity, interface: Entity
sure
I will get it fixed. there must be something wrong with your whole setup
probably because you only switched to maven now
give me like 5 min to set the github
starting to use maven can sometimes have the weirdest problems lol
yeah no problem, I'm online π
even if it takes 20 minutes lol
np
That is actually a good beginner tutorial on your blog @tender shard
(sorry for ping)
thank you π
oh I don't hate pings
if people don't like pings they should just change their notification settings
Yea, some people do, wasn't sure π
I'd love to add "(feel free to ping)" to my username like @ivory sleet does but I can't since I'm verified and now my username is bound to my spigotmc username lmao
a kinda stupid rule if you ask me
@ivory sleet is it possible for verified people to change their username anyway or have it changed by staff (on discord, not spigotmc)?
hmm I might take it up with md5, as proven you're active so having that adjacent to your name wouldn't be such a bad one
altho its just the "if they has it, why dont I get it"
it would be nice π I normally have "[EN/DE]" in my username so people know they can also talk in german to me, but that's not very important. I'd love to have some kind of "feel free to ping me" in my username though π
yeah honestly, if we had our own bot we could modify, I'd add some sort of label next to your name feature
IntelliJ has an option to upload your stuff
@earnest tulip
just make one
ah
ye, well its the part of getting it invited here as well
that would be awesome :3
indeed, anyways I will have a word with my higher ups, investigating what they think
just go to md5's address, show him some SHA256 hashes, he'll get unconscious and now you have access to his PC and do whatever you want
I do that every second thursday
lol
SHA > md5
thank you :3
SHA beats md5
yeah
md5 beats uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
I don't fucking know
your mom
π
oh no
I always respected this md spigot dude
but if he starts to beat my mom...
then I'd be upset
and stop respecting him
pls dont beat my mom @ md_5
finally, after 10 years
I know maven is a pain in the ass the first time
but now that it's working, you'll learn to LOVE IT
it wont bother me as long as i can learn
I want to say gradle now
but yeah do u make u a collaborator
I don't like gradle π¦
it's slow as heck THE FIRST TIME you run it
and it has a weird syntax
and it invents their own names for everything
Maven and Gradle are both shit.
e.g. "shadow"
oof
It's called Groovy, it was made by Apache and is a full language. Unless you use the Kotlin DSL, that is.
I can understand words like "fat jar" but "shadow jar"? whyyyy
Yeah kotlin dsl
@tender shard p.getInventory().addItem(new ItemStack[] { BowTNT() }); This is the syntax I found in a plugin. What do the {} do? That is something I didn't learn in school lol.
maven-shade-plugin
@tender shard shud i add u as a collaborator, i made the project private
it creates an array
sorry but π
?learnjava
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.
It does not originate from Gradle.
no thanks, not needed π
It initializes an array.
my libs are public, anyone can use them without any mentions
oh so u want me to make it public
yeah sorry mb lol
public*
nooo just don't worry
oh
do whatever you like with my code
It's the equivalent to creating an array of 1 size and setting [0] to that value.
how to get data id of a item? example, if material type is GLASS, the data, ex: 95:06
YOU DONT
'-'
ok
NOT SCIENTIFICALLY POSSIBLE!
Yea, I know arrays, but school is not that good in teaching us so that is probably syntaxt that is way to hard for our teacher to grasp
why do you need it?
i making a sell plugin
:)
sell items by command
Material.SPONGE.getId() would work
oh I feel you
unless it does not on 1.8
For example: ArrayLists was something they didn't teach us because that was too difficult syntax.
String[] s = new String[] { "Hello!" };
// OR
String[] s = new String[1];
s[0] = "Hello!";
@tender shard oh my bad, i think i confused u, i got the github project to work but the plugin still wont use the library
my bad
{ } is used to create arrays "on the fly".
like...
String[] manyStrings = new String[] { "line1", "line2", "line3" };
Oh yeah the amount of people who mix ArrayList and just arrays
any good class should teach the collections framework :p
True
Yea sure, I'm not an expert in that, but I'm sure that if they taught us that in a good way, they would be able to get us to understand the difference and use them in a correct manner
you should teach yourself Java as opposed to following the shitty teachings of your school
i gtg for a bit, thanks for all of ur help mfnalex
?learnjava
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.
LMAO fuck the german administration. it took them TWO MONTHS so I could even get an appointment to "not" inherit 50k in debt. But they only need 2 days to send me an invoice to pay 30β¬ for declaring to them that I don't want to inherit all those debts lmao. But yeah this is not the right channel to discuss this, I just had to tell it to someone lmao
Well yea, but there is this shitty coding thing in school, and that is the only way that I can study what interests me (and that I don't need to study a lot because I want to code myself)
you're doing it the only proper way
you're trying to get into MC coding
that's the best way imho
because it combines a game you like, and coding
sooooo keep it up :3
Yea, I have been playing MC for a long time now and I want to code. They taught us java as a first language so I thought, eh why not get into MC plugins
yeah that's awesome π
but please please please
do yourself a favor
use IntelliJ + maven π
unless you already do that
maven is fkin pog
it is
build systems are fkin pog
alright, I will definitely research that
I have a tiny tutorial about maven
Because I have 0 clue what that does instead of building a .jar file
read this pls
the sooner you start to use maven, the more you profit from it
If I add a command or an alias that is already in use by another plugin, what determines which plugin actually reserves the command keyword?
disclaimer: there's other good build tools like gradle. I don't like gradle, but that's my personal opinion. anyway - you won't do ANYTHING wrong when using maven.
the namespace
e.g.
yourplugin:yourcommand
anotherplugin:yourcommand
And I don't even know how a jar file is made because they don,'t fkn teach us anything relevant in our school. They are teaching PHP now...
But say they BOTH add the /test command. And the user executes /test. Which would execute? The one that appears first when sorting namespace alphabetically? Both?
yeah well
And the teacher is about as dead as that language, even though it isn't fully dead, but you get the point
I also don't know exactly how the java compiler creates a jar file
it's like... a driver doesn't know how to build a car. You just drive it
you don't need to know every detail ^^
my rule of thumbs: if you didn't code for 20+ years, don't even try to understand how compilers work
π
helooooo
what do we have here?
school teaching java?
that is the first time i heard it
You are correct my friend
Anybody got any idea on the behavior I asked about? The closest I can find on google is that its the plugin that is loaded first that successfully reserves the command. I'm thinking in that case I will need to have a loadBefore in my YAML for every plugin that I know has an equivalent command.
They went over Java, HTML&CSS, MySQL, PHP and Python
I'll check it out in 5 minutes
currently watching a very intensive breaking bad episode lmao
I spent a year taking a level 1 computer science course and it was literally scratch and really basic stuff that I learned in less than a month of self-teaching πΊ
Hahaha no worries man, GREAT show
Isn't that the definition of school?
Because it is def the same for me
I think my great great great grand diety may have
Lmao
man it just sucks to think about school teaching me c++ in a few more years
Is there any way to "naturally" spawn new mobs without hijacking another entity's spawn?
Our teacher was the one to state that MS word is the best IDE for programming
ikr!
REDUNDANT CHECK REEEEEEE where are my custom emojis lelel

I'm sorry am drink tonight
drunk high five 3οΈβ£
HELL YEH BRUTHA
Ohhh snap hahah good choice. I'm just drinkin some crap wine I had left from makin dinner
can someone help me im trying to include a api in my plugin using the jar
the jar is in the resources folder in the path
what API?
i included this in maven
<dependency>
<groupId>com.ericdebouwer</groupId>
<artifactId>PetDragon</artifactId>
<version>1.5.2</version> <!-- replace with the latest version -->
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/PetDragon-1.5.2-sources.jar</systemPath>
</dependency>
oh ouch
Ah such a shame you donβt use gradle
system scope
intelij seems to have no problems until i try to go and access the api class it just doesnt show up
stop blaming people for using proper build tools lol
Iβm sorry, itβs just so tempting
Lmfao the build tools wars begin.
maven > gradle
Living the life as a gradle enthusiast
anyone know how i could include the jar?
https://github.com/EricLangezaal/PetDragon/wiki#using-the-api heres this if it helps
Maven shade plugin maybe
maven can read XML files. gradle seems to be too stupid for that π
Or gradle 
Hot take, grade / maven whatever who needs it javac and blood and tears baby

please guys im just tryna get some help here idk what to do
Lol
properly install the .jar to your local repo and then use <scope>compile</scope>
MrPeters
Iβm having a special zombie spawn I want to listen to an event but only for that zombie, is it possible after all the conditionals to use the event in the same file and have it do stuff
Cant you use the shade plugin?
what?
sorry I don't understand
really wish I could use my thonk emojis lmao
Or maybe @magic dome maven add jars plugin would solve it
Yes itβs archived because google isnβt using maven any longer but itβs probably still valid
ugh that plugin violates everything was made for
Lol probably
isn't there a reason why <scope>system</scope> causes warnings?
Yeah
I mean yeah, sometimes(!!!!) it makes sense
but in 99.99% of cases just install the jars you need using mvn install
Gradle can read entire buildscripts made in complex scripting languages. Your argument is false and Gradle could be able to read XML and also writes it when doing Maven publishing.
I know, it was a joke
Maven can only read XML as the API is only geared towards it.
And XML is a terrible format.
TOML ftw.
ok so its seems to be including directories but none of the calsees are there... but when i look at the jar they are there sooooo
and it doesnt invent new things for stuff that already exists
and it doesnt need to download a huge 150MB wrapper from slow-as-hell servers everytime I clone a repo
everytime I clone some repo requiring gradle it takes at least a minute until gradle is done with its bullshit
maven just works because... I ALREADY HAVE IT INSTALLED
gradle insists on downloading itself every time again
buy better pc :)
We got like the same specs haha, you on a 5800x mf?
:D
RTX 2080 Super π
priced at a mere 3.5 k
Oh you got a fancy pants graphics card haha im still on the 1080ti
I needed it for MSFS2020 π
HAd to google that one haha I have heard good things about this new version actually
I played the old microsoft flight sim ages ago
tbh
MSFS2020 is the BEST flight sim ever
I used to have them all
X-Plane, old MSFS, ...
2020 is the best one for flying civ aircraft
I'm waiting on kerbal space program 2. They better have native linux builds, going to consoles scares me
Gonna be legendary for sure, no way they can mess it up
I learnt more in KSP about how space things work then in ANY classes
dont say that or they WILL mess up lol
but maybe #general
Dude same lol its amazing how it really clicks in your head when you can play it. Understand that everything is just equal and opposite. You put the energy in to get up into orbit, you fling yourself off the planet with a gravity assist, you just took away that much energy from the orbital system (negligible in planetary scale)
I like Gradle because it's easy to use and doesn't require me to write 30+ line files as part of a "simple" build configuration.
Yuh, and for people who say gradle isnβt declarative, it can be just as declarative as maven
ctrl C + ctrl V
Well then I still have to navigate over to my other projects to CTRL+C, then CTRL+V and change all the project-specific values, and I'm still left with verbose bullshit compared to the 5-7 line Gradle Kotlin buildscript.
'group:artifactId:version'
<group>group</group>
<artifactId>artifactId</artifactId>
<version>version</version>

I don't think Gradle's perfect, I just don't like Maven.
well everyone has their preference
Iβd say gradle belongs more to the solution set compared to what maven does
If I had the skills to write a buildsystem, I'd make one inspired by Cargo.
Disregard was being stupid
Can I check if a mob is spawned by a spawned?
Spawner?
yes you can
Is anyone aware of an API that lets you save a config yml file without removing the comments?
How?
No not really because yaml comments are a pain
id like to be able to update yml files in real time
well you can but in a limited way, i believe its only possible inside CreatureSpawnEvent
Comments can be placed and cluttered anywhere in a yaml. Theyβre not to be associated nor attached to any value nor node which makes it hard to track where the comments should be if you decide to change the format.
Iβm using that event
:)
perfect, use this ``` if (e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.SPAWNER)
{
} ```
Yeah i was just wondering, i developed a method that replaces a the line but I cant do indexing with it
like values organized like "Section.Data"
Anyways have you looked at eoyaml
it does have node comments
no could you link it?
So it KINDA supports comments
interesting
Iβll leave you with that. Best of luck.
I'm really confused on the Gradle vs Maven thing (mostly because of my lack of knowledge about any). Is it all personal opinion or is there really a better one?
Thanks man
pretty much personal preference for most yea
Ok
There is some objective facts to the matter @fervent gate
In a multi module project, gradle has been benchmarked and the conclusion is that itβs faster in that case
it is also objectively less verbose (verbose = many words/semantic terms)
An internal error occurred while attempting to perform this command
Hmm ok. I'll look into gradle then.
well shite
you got yourself a nullpointer at line 40
ok
when a slot is empty, it will return null. so you cannot perform getAmount()
if(i.equals(null)) return true; ?
nah use ==
sure, that should work
but
when an item is null
the loop will stop
is that what you want?
for (ItemStack i : p.getInventory().getContents()) {
filter null items
you really dont have to
or simply just continue
just use continue;
man I'm really glad I learned java before trying to make spigot plugins!
Donβt feel sorry
But instead learn and donβt forget (:
true
;)
:)))))
stonks
learn java, after, learn how to make spigot plugins β
make spigot plugins without learned the java: β
π§’
I am gonna be honest with you, I did code spigot plugins without knowing Java well, that doesnβt go without saying I put down the effort to learn java concurrently
yes!
i learn java trying to make any codes
oh imagine learning java in the first place bro
i use bash scripts!
:O
example?
for (ItemStack i : p.getInventory().getContents()) {
if (i == null) continue;
String Type = String.valueOf(plugin.getConfig().getString("Items."+key+".Item"));
Double Price = plugin.getConfig().getDouble("Items."+key+".Price");
int amount = i.getAmount();
if(i.getType().name().equalsIgnoreCase(Type)) {
items += amount;
moneyGanhar.set(moneyGanhar.get() + (Price * amount));
p.getInventory().remove(i);
} else return false;
}
?learnjava hmmm no one was using this command?
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.
do yuo understand what this will do
thx
spoonfeed LOL
try to understand though
yes
I'm really confused with Gradle and setting up the project. Instead of creating a spigot project, I created a gradle one, now I can't do things like "extends JavaPlugin" and such. How do I add these manually or is there something I am missing?
String Type = String.valueOf(plugin.getConfig().getString("Items."+key+".Item"));
why string#valueOf()
idk, i copied his code
int[] a = new int[]{1,2,3,4,5};
for (int i = 0; i<a.length;i++){
int element = a[i];
if (element == 5) {
continue;
}
out.println(element);
}
Here, we print every number in a except 5 @quaint mantle
Itβs statically imported 
hey
import static System.out; is possible iirc
Did I tell you?
no you did not
oooooo cool
I'll tell you
Tho itβs dangerous if you use it erroneously 
wat dangerous?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
static? performance?
I love you man, the code is working Ζ>
of course
Thanks to everyone who helped me.
People will think that the method is just an instance method but then it turns out to be a static function from another class
read this tho @quaint mantle
if they look at the code on GitHub or smtng
But what does hit performance is wildcard imports
oh
yes make sure to learn the code and not copy paste the spoon feed!
Altho not during runtime
thx
But they take some extra as opposed to just import what you need explicitly
if u come back tomorrow and go "what does continue do again" I'm ignoring you :kitten_thumbs_up:
I learn java knowing the basics of English and translating the words I don't know :_:
'-
Yeah, which country are you from?
Brazil =)
π§π·
itβs a shame we donβt have Brazilian Java
;;;
