#help-development
1 messages · Page 377 of 1
NamespacedKey key = new NamespacedKey(this, "Revive Token")
ShapedRecipe recipe = new ShapedRecipe(key, reviveToken());
oh
The namespace is your plugin and the key is something you imagined.
It has to be all lower case and can not contain spaces
But close
Doesnt it replace spaces?
I'm actually not sure if it does
i think it errors
bUT
NamespacedKey key = new NamespacedKey(yourPluginInstance, "revive-token");
Possibly but better to not rely on it
Cannot resolve constructor 'NamespacedKey(everything, String)'
Impor

ShapedRecipe recipe = new ShapedRecipe(key,reviveToken());```
t
Did you import?
This would only work while you are inside your JavaPlugin class.
Ah
But dont just put this in your JavaPlugin class pls
To Register the namespace to
xd
Keyword this refers to the class the method is currently in
NamespacedKey key = new NamespacedKey(plugin,"revivetoken");
plugin is standed for the main class
There you go
injection
yay me learning
I will do it and i will fucking so it again
wat
ill load it
smile
I'm gonna buy this 9 buck course lol for the memes
You wanna take a look at it?
No
no errors
Check console
ill show full file
Whats the course about?
lines 42-45
remember when we specifically said
its not my main class
Oh yeah
import SpeedSMP.everything.everything;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public final class Main extends JavaPlugin implements Listener{
@Override
public void onEnable() {
// Plugin startup logic
saveDefaultConfig();
new everything(this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
this is my main class
and dw about main name
lol
ill fix later
Ok I want to clarify ethan
When people say
Don't put eveything in your main class
They mean, split stuff into different files
Not make a new file and put everything there
this plugin is made for 1 person
This section would be interesting as im planning on releasing my first premium resource soon
Just for the future
I mean really depends on how large plugin is. If its just only for a custom item or recipe then it wont hurt anything as plugin isnt large amyways lol
its like a lifesteal plugin but instead of hearts its speed
Where is that one from
What category
Final Advice
dont fret
I wanna give it a look too
but any idea why it aint working?
I have a plugin that does that 1 sec ethan
Best advice for managing sales. Dont ignore your clients and learn paypal policies in regards to chargebacks which will help you to respond to them and not have paypal side with consumer
alr (no ping)
also i know this may be basic java but everything i tried aint fixing this
private void unregisterCrafting() {
Iterator<Recipe> iter = Bukkit.recipeIterator();
while (iter.hasNext()) {
Recipe recipe = iter.next();
if (recipe.getResult().getType() == Material.COPPER_BLOCK) {
NamespacedKey key = new NamespacedKey(this, "copper_block");
ItemStack copperBlock = new ItemStack(Material.WAXED_COPPER_BLOCK);
ShapedRecipe copperBlockRecipe = new ShapedRecipe(key, copperBlock);
copperBlockRecipe.shape("CCC", "CCC", "CCC");
copperBlockRecipe.setIngredient('C', Material.COPPER_INGOT);
Bukkit.addRecipe(copperBlockRecipe);
iter.remove();
}
if (recipe.getResult().getType().name().contains("BED")) {
iter.remove();
}
}
}
I did that when I wanted to remove some recipes
And add a new one
NamespacedKey key = new NamespacedKey(this, "copper_block");
ItemStack copperBlock = new ItemStack(Material.WAXED_COPPER_BLOCK);
ShapedRecipe copperBlockRecipe = new ShapedRecipe(key, copperBlock);
copperBlockRecipe.shape("CCC", "CCC", "CCC");
copperBlockRecipe.setIngredient('C', Material.COPPER_INGOT);
Bukkit.addRecipe(copperBlockRecipe);
I dont see anything different to this than mine
I know what the line is. What is it
That a custom item?
You're gonna need someone with more experience to help you then
line 130
Wait for smile or frost
What we doing?
Was about to ask
Crafting recipe with custom item
NamespacedKey key = new NamespacedKey(plugin,"revivetoken");
ShapedRecipe recipe = new ShapedRecipe(key,reviveToken());
recipe.shape("ABA","B B","ABA");
recipe.setIngredient('A',new RecipeChoice.ExactChoice(speedCapsule()));
recipe.setIngredient('B',Material.DIAMOND);
line 5
Nothing to it other then replacing output with custom item instead
No you dont
That didn't work tho
the output is also a custom item
and one of the inputs is
they are all itemstacks besides the diamond
Some more code pls
thats all the code
The code on top looks right
Ah i see
Pretty sure they know plugin licensing lol
Forst we understand. We're just evaluating how it looks
If you don't need it I won't send it to you
I would be surprised with someone like 7smile7 knowing what they do and not know licensing lmao
Most of it is self evident stuff
Alright the registering looks fine. Do you have any exceptions in your console (When the plugin enables for example)
Except the stuff that comes out of nowhere
I'll reload again.
Never reload
Nope.
Never
.
?
Like how to use JSON 
i'll restart;-;
always restart
Uhm ive watched the preview. Nothing too interesting there
Alright boys I'm heading to bed. 4am. Have a good one see you tomororw
ok so when you check if your plugin is enabled /pl its there and its green
Maybe i should make my own udemy course for jvm intricacies and how it can relate to your code
Make an advanced one
Ikr look how many sales that one has

It's just teaching you basic java under the guise of Spigot
Making a course that big is still very time consming
It's over 18 hours of 1080p video
Quality > Quantity
Quandaledingle
I 100% bet you I could make a wiki that would have less quantity but 100% more quality. It's of course easier and better to just sell this stuff
Use sticks instead of your custom items and try the recipe again
aight
Like for instance the amount of objects in a class or the size of objects cab cause your class to not be inside heap space and instead fragmented between heap and some other slower memory space and this be the source of your lag or why your code isnt performing as expected. There is only two ways to fix this. From user side increase object space per thread which means more ram consumed on thread generation or restructure your code to not have this happen
recipe.setIngredient('A',Material.STICK);
recipe.setIngredient('B',Material.DIAMOND);
Question is: What is the target group for such a course
wsg guys
I'm listening
Ideally someone like you really
Where you already pretty versed but just not might be aware of some things like that
Custom recipes huh
yep
123
456
789
Did you actually compile and copy your newly compiled plugin in your plugins folder?
yes
Change the result item to a simple vanilla item as well then
My guy the sticks need to be in the corner
@halcyon hemlock wdym
You seem pretty well versed in regards to java coding wise then most. And only thing i could recommend for such people is learning jvm things that adversely affects your code but isnt really widely known or isnt really a easily searchable thing to learn unless you knew something beforw hand
XD
omg
LMAO
it worked
XD
but it didnt owkr for the otehr one
Drunk science over here
the other custom item
ABA
B B
ABA
fr
new RecipeChoice.ExactChoice(speedCapsule()) seems to not work
and yes i did the right placement
Clear your inventory and give yourself a new clean capsule
yes sir
What i explained is one example of a niche thing most wont really know. The other thing is, is nulling out objects you dont need anymore
Do they stack?
While in general everhthing says it isnt required they are correct but it doesnt mean you shouldnt do it either
they odnt
but i dont check the nbt
i check if unbreakable
soany food thats unbreakable
is yk
The main reason for nulling out objects you know you wont use again or are just done with is it lets the gc work faster
?
cause i add the number every time
its set in config.yml
because
i dont want it to stack
RecipeChoice.ExactChoice checks the whole nbt component
Instead of the gc trying to figure if it should or shouldnt gc something nulling out your objects just saves time on the gc doing that 
how can I make a item not stackable than?
Make it unique
If the nbt data does not match 100% then the recipe doesnt work
^
so how can I detect
with my settings
or should I just figure out how to make it unstackable
and revert my progresws
and someone said to do that I need nms
wait what?
You might be progressing into the area where you have to implement your own recipe stuff. Like instead of the server validating the recipe for you. You would do that yourself. Which requires more work on your part
wdym
This is a very intricate problem.
You have 2 choices:
- Write a custom crafting system which checks for specific item
properties. (Pretty complicated) - Fetch the outgoing ItemStack packets and add lore lines in them (Very complicated)
@quaint mantle you say I can make it unstackable easily?
which could solve everything?
Remove the lore line and check if the recipe works (it should)
You can listen for crafting inputs and validate yourself if what was put in is correct. You dont have to use the api for that. The advantage is you can basically use any item even if they dont match exactly because you said it is allowed
The problom with it being stackable is it takes the entire thing when consumed
The disasvantage is a lot more code lol
Try harder 😄
yes sir
Manually place back in their inventory the amounts that were unnecessary
That one is not too complicated actually. You just need to find out when to cancel the event and when to manually subtract items.
If you can obtain the count and item, then you know how many needs to go back in their invebtory
Cancelling the consume event and decrementing the consumed item should work as well
i cancelled it before
Yeah that works too
but icant subtract
The way i explained doesnt require cancelling anything
So use which ever way you prefer
p.getinventory().remove(speedcapsule, (event.getItem().getAmount() -1))
Instead of removing add
ItemStack item = event.getItem()
item.setAmount(item.getAmount() - 1)
something like that
ill be back when I finish
Let the items get consumed keep track of what they had or what was required and instead you add to the onventory
For the way i am talking about
you cant add or remove a specific amount?
Well this could result in the item being added at the beginning of the Inventory
You just want to remove 1 of the consumed item, right?
yse
You can add however many items you want to their inventory given they have space for it
I am aware
Then i would strongly recommend this:
@EventHandler
public void onConsumer(PlayerItemConsumeEvent event) {
event.setCancelled(true);
ItemStack consumedItem = event.getItem();
consumedItem.setAmount(consumedItem.getAmount() - 1);
}
My way i explained to use an analogy is if you owe me $10. But instead you gave me $20. All i have to do is give you $10 back. I didnt subtract anything because you gave me all what you had. If that makes sense. So in regards to what i was saying. If all the items are being consumed just allow it, but you return however many was too much. This isnt really subtraction per say lol
uhh it did not take the item
This one is also viable but you cant target a specific ItemStack in your inv. Besides that, the result is the same
@EventHandler
public void onConsumer(PlayerItemConsumeEvent event) {
event.setCancelled(true);
ItemStack consumedItem = event.getItem();
ItemStack removalItem = consumedItem.clone();
removalItem.setAmount(1);
event.getPlayer().getInventory().remove(removalItem);
}
Im getting memory mapped files vibes from you... Are you the mem mapped files guy?
Yes i am
😄
Didnt work?
nope
e
and yes ill remove the % after this
What version are you on? This only works for 1.14+ iirc
latest
Add some debug messages
alr
event.setCancelled(true);
event.getItem().setAmount(event.getItem().getAmount() - 1);
p.sendMessage("u hungy?");
Well the message after the removal line gets sent so something is weird here
Lol
Hm... Delay it by one tick
hi
uhh you mean like scheduler?
im beginner programmer
You could also just manually consume the item too
Spigot is not an incredibly good place to learn java
You dont want the glass bottle or yoy do?
good place to fix errors
I dont
Bukkit.getScheduler().runTask(plugin, () -> consumedItem.setAmount(consumedItem.getAmount() - 1));
precious we dnot spoonfeed
You cancel the event then and then remove item and apply effects
Yes this delays by one tick
oh
what's spoonfeed?
default?
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Yes tasks run earliest at the next tick
Couldnt you just manually do it? Lol
Let me try it out myself...
frost but what if the player has glass bottles already in their inv?
7smile need the main class again?
Cancelling the event stops it
but wdym manually than?
So what you do is cancel the event when they drink potion. It doesnt stop the animation but it does stop the glass bottle problem
After cancelling you remove potion from inventory and then you apply the effects it is suppose to have
You can detect that because its still inventory
what if they have multible :hehe:
Just because you cancel the event doesnt mean you cant use the event to get what is in their hand
Event doesnt stop being useful just because you invoked cancel
But how would the event know what to remove if we cancel?
7smile you almost done with that test?
Because you use it to get where item is at and then you use inventory api or player api to remove the item from the proper slot
And the exact amount?
Sure
Probably inventory api as it would have the methods you are in need of including subtracting and removinf
^
This works
@EventHandler
public void onConsumer(PlayerItemConsumeEvent event) {
event.setCancelled(true);
ItemStack equippedItem = event.getPlayer().getInventory().getItem(event.getHand());
equippedItem.setAmount(equippedItem.getAmount() - 1);
}
Honey works as well
7smile7 gave you the code 
😮
What are you working and why do you have so much spigot time 😄
Method invocation 'setAmount' may produce 'NullPointerException'
would you be mad if I put not null 🙂
I am a tire technician
Do a null check
its just nullable
And i work for jbhunt and i dont habe much work tonight lmao
It worked!
Dont use notnull for things that can become null outside of your control
Its not a memory leak
wait what?
It will throw errors if it is bull but hide that it is because something else made it null
Noice. But thats pretty far away from programming, right? Did you consider getting a software dev job
or do you not want to mix hobby and work.
ima try to find some bugs
Notnull is for if you ensured it cant be null and if it is something very terrible happened in the jvm and we should just stop anyways
Assert is kind of the same but slightly different. Both have differing uses where they are supposed to be used
ah
well tysm for the help!
you deserve discord helper role
you too 7smile7'
its 2 41 here so i'm gonna call it a day
have a good one
I dont want to lose my hobby. Also i dont like the idea of working in a place where i dont have freedom or working under some leadership that fails to understand
So i stick to freelancing
I have had some decent freelance jobs before. I at one point sub contracted with phoenixNAP
For their customers where their contract prevented them from providing support
oof
So like ovh for example. Servers are cheap because no software support
ah shoot we back at it again I was doing a bug check and
Many dont know os is still software so it includes that too
Thats the normal minecraft behavior. Fixing this can be a bit complicated.
Bro you guys are still going with the crafting stuff
Well phoenixnap had contracts like that, and where i came in is instead of their customer support saying we cant help they referred their customers to me instead
tomisan spigot is for nolifers only
And i got to charge my own rates
well im off to the gym now, see ya guys
cya
Cya later
yk what i dont care if theres glass bottles in the crafting grid
no plugin is perfect
AND IM BACK AGAIN 😉
the the revive token
it can craft becaons
beacons
how can I make it specificly NOT craft beacons
(im addicted to spigot)
the way you can tell this is a revive token is because of the unbreakable tag
ping me while im sleeping
idc
cancel CraftItemEvent when the crafting inventory contains ur custom item i guess
intelliJ drunk? how does List<T> clash with List<T>
u gotta make it return List<Invention>

Its most complaining of your return type
type erasure
guys
so you gotta be explicit
I got an interface that declares getInventions() returns List<Invention>
so how can the above thing be wrong lol
List.of doesnt return List<Invention>
at least not in the first place
type erasure fucks things up just like this
so your return has to be explicit or your class generic
In order for a method to be a valid overiddeb method you have to return the same kind of object as well
Otherwise if you dont you get a method clash from your inplements
Godcipher knows what they are talking about and my phone is just hating me with all these spelling mistakes
Think i need to recalibrate the touch lmao
You are both confused, if the method body would be the problem, intellij wouldn place the red underlinings there instead of under the method return type
Btw File -> Invalidate Caches fixed it
Well i couldnt see what you were returning
I stated as such
A big box over your method isnt helpful sometimes lol
and still is that one of the annoying issues with generics
but why would it matter
you were asking why it complains if both are the same
we couldnt see it
"trust me bro"
if intellij already complains about the red part, the green part is completely irrelevant
it complained that "List<Invention>" is not the same as "List<Invention>" declared in the "Inventor" interface, although it was
then i understood that wrong
If I have an event that's getting called twice each time when it shouldn't
How can I make my eventlistener pause for less than a second so the second one doesn't do anything
what event is it
Dumb third party event
DonationReceivedEvent1
From crafting store
Getting called twice identically each time
had the same problem there
that fixed it
it's not a plugin, I tried to turn a simpsons episode into some code lol. and they were talking about the inventor of the walkie talkie and were confused because he attended a convention with a girl who's not his wife
Not a player tho
I mean I guess I can attach it to a player
Aren't events processed async?
just cancel the CraftItemEvent if any of the items in your crafting matrix is your custom item.
public boolean isMyItem(@Nullable ItemStack item) {
if(item == null) return false;
if(item.getType() != Material.NETHER_STAR);
if(!item.hasItemMeta()) return false;
ItemMeta meta = item.getItemMeta();
return meta.isUnbreakable();
}
@EventHandler
public void onCraft(CraftItemEvent event) {
for(ItemStack item : event.getInventory().getMatrix()) {
if(isMyItem(item)) {
event.setCancelled(true);
return;
}
}
}
not your exact solution, just an example
Yeah I just noticed for a second I thought it was a spigot method
Because you have to return same object type as the super does otherwise its not a method you are overriding. I was going based on what godcipher said as i assumed they knew what it was you were returning. Sometimes not important in what exactly the message says but what the code looks like and i just couldnt see that because of you big message box
only those which are supposed to be
by giving the correct groupid, artifactid and version
What if I make this event run in a separate thread and pause it for 10 ticks
Not all of them
and List<Invention> is not the same as List<Invention> or what
Whatever I'll just use the `triggeredRecently
obviously it is the same as the super class, that is even written in the message I sent
I couldnt see the return type specifically. Just because the ide tells you something doesnt mean it wont compile
the quick fix suggests me to use "List<Invention>" instead of "List<Invention>", so it's quite obvious that it's the correct return type
Ides are not always smart
couldve also been an import issue ¯_(ツ)_/¯
but it wasnt
All i am saying is i just couldnt see your code exactly is all. I trust what i see from the code not what the ide wants to tell me lmao
Indeed
In other news its boring tonight at my work
Like 2 trucks out of 200 needed tires
Still have 3.5 hours left of work
so ur out of work? haha
cant u just work ahead then?
In a way i guess this js true. Ironic really
Yes but tomorrow the trailers out there may not be the same ones for tomorrow
ah right
And i rather not bring a trailer in for tires and then turns out it needs 10 other things done
yea where i work we dont get that haha
there is always work
at least i have not yet found a day where i had nothing to do in the 3 years ive worked here
Doesnt help i have a crap ton of truck tires right now with no trucks to put them on lmao
Tire container is full so i have like 5 stacks of tires just sitting in the tire bay because no where to put them
time to annoy myself again:
I have approximately 200 truck tires and 100 or so trailer tires
Thatsss alot of tires
Trailer tires will get used up quick bit with no trucks needing tires its going to take like a week of waiting for trucks needing tires
fuck obs
Its dumb
Isn't that like if you "forked" paper but easier?
It broke q load of spigot plugins
is it normal that the "update dependencies" button in intellij doesn't do anything when using gradle?
Alex it's like day 3 of these gradle issues
I think gradle knows you're the maven master and doesn't want to work with you
I convert a different project every day
none of which has properly worked so far, though
Somehow gradle gives you issues every day lol
And somehow, different issues. which is crazy
not only me, everyone got the same stupid issues. however this is an intellij problem
this why maven good
obviously maven is better
ebic would disagree
oh he actually knows it's true, after all he probably knows how much hours he wasted converting maven projects to gradle, probably taken him 5 hours of his time, while saving 37 seconds
not even then, gradle has meanwhile received an upgrade and now your build.gradle isn't compatible anymore
What project you working on rn alex
MorePersistentDataTypes
What you adding to it
a build.gradle lol
bruh lol
unfortunately gradle init always gets rid of the proper repo to publish to
Give me like 6 days and ill pr it
Your missing the other publication stuff, and login
what other publication stuff? that's exactly how the docs describe it, see here: https://docs.gradle.org/current/userguide/publishing_maven.html
Look at epic spigot lib or better item config
EpicPluginLib doesnt declare any publishing stuff
but it also wouldnt be needed since it uses maven
and EpicSpigotLib, i didnt find anywhere
what the fucking hell
ALL OF THIS is required to make gradle upload a tiny .jar?
lol
That is for 2 repos
however how is this different from what I sent? except that you also declared the username / password
It has the shadow(MavenPublush)...
So get the non shadow stuff from maven publish
I did
here
just like the docs say
here
it is here
the publishing { } section
Dont need version, groupid or artifact id
Then put the maven section under the from components.java
where is that from?
cant you just send the actual link pls lol
because when I google "maven publish" it obviously doesnt show any gradle stuff
but according to the docs, the exact you send is only there to override group id, artifact id etc
which I don't want to
still doesnt work
I get it that I could get it to work by using random other task names, but why can't I use the names that are explained in the docs? https://docs.gradle.org/current/dsl/org.gradle.api.publish.maven.tasks.PublishToMavenRepository.html
Use publish and see if it works
like, if the docs call it "PublishToMavenRepository" and the actual name is "publish", then "build" could as well be "eatDogShit"
nope:
If it doesnt leave gradle alone and ill pr it when im home
Execution failed for task ':publishMavenPublicationToJeff-media-publicRepository'.
> Cannot convert URL 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/' to a file.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
that's when I do "gradlew publish"
Ill pr it when im home, in the mean time stop trying to convert gradle
why? I am doing everything exactly as explained in the docs
The docs are wrong most of the time
i dont like the general idea of "you always just gotta copy/paste from someone else because the official docs are always wrong"
Which i can agree. But both me and alex though are accustomed to mave and love the verbosity of it that makes it clear
like, how is one supposed to know that it has to look like this:
while the docs state sth completely different
ItemStack item = new ItemStack(Material.BOOK);
ItemMeta oM = item.getItemMeta();
ItemStack iM = new ItemStack(player.getItemInHand());
if (iM.getItemMeta().getDisplayName().equals(oM.getDisplayName())) {
...
} else {
....
}
It is always false, anyone?
Yeah, but the name is the same
btw you should not use weird variable names like iM or oM
Probably if you are not accounting that displayname can have colorcodes
print out the name
K, I try
There is another method you can use to get the name that doesnt include color codes
There aren't that many good ways to compare if the item is a custom item
It's a bit annoying tbh
pdc
simply the best way
yeah, comparing items by name is always a bad idea
lores, nbt tags
Ok work, I'd fix.
Ty
PDC is the only proper solution
Or just compare item objects and not strings
#isSimilar also an option
That'll apply to any item of the same no?
No
if (iM.getItemMeta().getDisplayName().equals("Hi")) {
...
} else {
....
}
why create another itemstack only to use its name.. just input a string like above
why check the name of the item in the first place?
That wasnt what i meant lol and i was going to say it does matter what it is you are doing that dictates which might be more ideal
yea debatable. but just tryna help on the issue he is having :S
Yeah, I'd fix.
My error was very easy to fix xD
Thanks
ok. but again, you shoulnt use the name of an item to make it unique or a "custom item"
should be using pdc tags
Okk, thanks
Alex when's the intelliJ gui plugin coming
when intellij fixes their docs that explain how to write intellij plugins
i once tried, the docs were of a totally outdated version
so obviously everything was wrong and I didnt understand anything
@regal scaffold maybe I found a workaround to their shitty docs
RIP, that's outdated too
- chatgtp does know the way
XD
well yea its learned from the shitty docs no? haha
just update to a still supported version of worldguard that's available in their repo
wdym?
What's broke about their docs?
using the current docs, that is
well, the first thing is how to even add a new wizard type. Couldnt find that in their docs
not right now, right now I only used the builtin "IDE plugin" project template
however I dont see ANY tutorial in this "quick start guide"
it tells about the general structure about a plugin etc, but not really any example on how to setup the workspace
the class that chatgpt mentioned definitely doesnt exist anymore
i could ofc check the source code of the minecraft development plugin but I would rather see it explained in the official docs
also why the heck do people call it a "requirement" when it's optional
I am now trying to extend "ModuleType" as per the IJ docs but already stuck there.
also why mention something required that installs automatically 😄
all they say is I should "derive" my custom module type from the existing class, giving no information about where I should obtain e.g. the builder from that I am supposed to return from that class. do I write that myself? can I use any existing one?
yeah it's a pretty weird page
from what is explained in the docs, this should be enough for a IJ ModuleType. I highly doubt it's true
fun fact: intellij plugins must not contain the name "plugin"
which is a bit weird because this plugin's only purpose is to create spigot plugins, so obviously it wants to have "plugin" in its name
plug-in 
@regal scaffold if you know anything about IJ plugins, pls enlighten me. I have added exactly what the docs say, which is I created a custom ModuleType as seen above, and I added my moduletype to my plugin.xml. Still, when doing "new project", nothing's there
another funny thing is: their official example plugin ( linked here: https://github.com/bulenkov/RedlineSmalltalk/blob/master/src/st/redline/smalltalk/module/RsModuleBuilder.java) extends JavaModuleBuilder, but this class also does not exist anymore
https://github.com/JetBrains/intellij-plugins here are up to date examples
I know a bit but I can't right now cause I'm trying to do something odd
I'm trying to fork CraftingStore to add an event that I need but I reached a point where if I add my method to their interface I need to create the methods for all 4 of their versions cause they have them separated....
So idk what to do
I don't really find anything about "how to add a new project wizard" there
most plugins from that list don't even have a plugin.xml file o0
for real, how does one learn to do intellij plugins when every existing information about it is outdated
I just wanna know how other people managed to learn it without proper sources of documentation
Hi all, It's been years since I was doing any kind of plugin development.
Does anyone know a good template I can pull to start?
wtf is wrong with kotlin
the arrayOf method seems to be one of the funniest things ever, wtf is that
Kotlin was a mess made to fix a mess
Doest sponge inherit module wizard thingy
obviously, otherwise the second screenshot wouldnt work
I assume so, you can probably just cast that
Dk why it's erroring in ide, fully valid code lol
nope
it's kotlin
e.g. this:
e: file:///Users/mfnalex/IdeaProjects/MinecraftDev/src/main/kotlin/creator/MinecraftModuleBuilder.kt:123:17 Type mismatch: inferred type is Array<BuildSystemWizardStep> but Array<ModuleWizardStep> was expected
it's just kotlin being stupid again
and that's what happens everyone when you think "consiseness" is more important than declaring the proper types lmao
Thank you, I've got something sorted and compiling now. Do you know the best place for where I can find the docs on different events? Specifically I'm looking for some kind of ContainerChange event to listen to all changes to a chest.
working for me
well, if you do it like you do its not, you have to cast
lmao funny
?jd-s
You can look at compiler source or plugin sources
Not saying that is easy or even ideal
see, isn't that a huge joke lmao
typical kotlin bullshit
Love the infinite screens
alright, i admit this is stupid
weirdest thing I've seen today lol
I also still don't understand how to create a new intellij project wizard
I followed their tutorial 1:1 and it just shows this instead of my custom label.
InventoryMoveEvent seems good, does anyone know if this also handles things like,
- Player add Item
- Player remove Item
- Player break Chest (Moves to world)
- Player drags item out of chest (Moves to world)
in kotlin you could just do, val array: Array<ModuleWizardThingy> = arrayOf(...)
to silent cast it
works fine for me
its generic type issue
if that'd be the problem, then why does it get fixed by adding more objects to arrayOf
because kotlin decides type under the hood if you didn't specify it explicitly
funny lol
if you have just 1 type, it will assume that supertype
yeah explains it, typical kotlin bullshittery
also thanks for this totally useful error message intellij
yay, only took like 3 hours
another nice error message
Today I really hate IJ + gradle
another reason why IJ is a bad joke
anybode knows the awt equivalent of swing's JFrame?
oh I'm stupid, I meant a JPanel
Gradle speed
Hey, how would i go about making animated armorstands?
Do you know Java?
runnables
I'm not sure
Yeah mostly
then you need to decide what type of animation you want
just the stand itself, or a set of stands
what kind of animation do you want? just move teh stand around? or move it's arms etc?
Move stand around, wanna make a crate animation when opening it.
But probally gonna move arms too
I know how to move the body parts, but not the whole armorstand
ok, well moving is not hard, it's simply a case of deciding where you are moving to and progressively teleport teh stand in small increments over time
If you are using the normal scheduler and teleporting you can do 20 animations per second.
if you need a higher rate than that it's a little more complex as you need to use packets
All this works for 1.8.9?
probably but you'll not get 1.8 specific support here
Anyone have nice Color Util for Components, to easily transform HEX colors and more?
Hmm fair
MiniMessage
finally
Hey guys, trying to install a dependency on my pom.xml but gets an error.
mvn install:install-file –Dfile=Downloads\FILE.jar -DgroupId=group -DartifactId=artifact -Dversion=version -Dpackaging=jar
Error:
The parameters 'file' for goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file are missing or invalid
--
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix '–Dfile=C' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Laivy\.m2\repository), central (https://repo.maven.apache.org/maven2)]
you didn't fill in any of the required parameters to install a jar to your local repo
file name, group, artifact, version
i filled, i just changed the values to give an example
?paste
can't help you with "examples"
sorry
i tried with mvn install:install-file –Dfile=Downloads\oraxen-1.152.0.jar -DgroupId=com.oraxen -DartifactId=oraxen -Dversion=1.152.0 -Dpackaging=jar -X
another person who has to install oraxen manually because their uploading to repo is still broken :X
xD
Code: https://paste.md-5.net/emiduvufeb.java
Exception: https://paste.md-5.net/owutuxizey.sql
Why would it give me this exception? I don't even use this method in my code and also it refers to a weird line:
} catch (FlagConflictException e) {
the command looks correct
your .jar doesnt match the source code. compile it again, do a full server restart, then check the exception again
this
or are you using an obfuscator or anything
it's automatically compiled by IntelliJ every time I run it
no
delete the .jar before compiling it
and try again
are you not using maven? o0
I do
then make IJ run mvn clean before package
how? xd
where it says "mvn package", change it to "mvn clean package"
You're not using maven 💀
You're building an artifact rather than using maven to build the jar
Which probably means the new plugin jar isn't placed in the plugins folder
it does
Use maven to build your jar rather than that artifact
ChatGPT solved my problem.
xD
what was the issue
it gives me a fixed command mvn install:install-file -Dfile=libraries/oraxen-1.152.0.jar -DgroupId=com.oraxen -DartifactId=oraxen -Dversion=1.152.0 -Dpackaging=jar -X
apparently its the \, needs to change to /
xD
tried that now
nothing changed
I get the same stacktrace
Don't use that run config to start the server
I don't
and delete the old plugin jar and make sure the server is stopped
when building with maven
I did it
yeah try again, see if the stacktrace changed
btw how do you copy the file to the server dir?
did you do that in your maven-jar-plugin declaration?
tried that, nothing changed
CTRL + C / V
you let intelliJ run the spigot server but you manually copy the file? o0
that's a weird workflow
no
when I tried to do that using Maven Build directly
I copied it manually
but normally I just let IntelliJ build the artifact directly there
and run the server
automatically
?paste your pom pls
looks good. if you manually stop the server, then copy over the file, then start the server again, and if this is actually your source code, then it should be impossible to receive this stacktrace
btw you can also make maven save the file in your plugins folder
tbh I still think he's copy pasting the same old jar every time
I also think that
also make sure you don't have two jars of your plugin in the plugins folder
decompiler output: https://paste.md-5.net/zuhumucimi.http
I don't
it's exactly the same as the code that I've sent
it doesn't change
k
and do this
I mean, the line number MUST change if you add a new line to the code
So the error is comming from ChunkBlockPlaceRestrict
oh right lol
it happens
definitely the most advanced CSV parser out there, EVER, lol
oh you solved the intellij plugins
last time I checked this channel you were throwing hands at it because of bad docs
yeah the documentation was, as always, outdated or just plain wrong
yeah I had a similar experience recently
I had to look into other plugins to see how it actually works
that really sucks
although I still wonder, how anyone is supposed to know how it actually works
good code doesn't need documentation
© nobody
🥲
I remember working with a scuffed API where params would sometimes be called var1, var2 and shit
some methods had random names like a8M3shit
and it was an actual api
not like nms or smth
fancy
anyone knows a good XML library for me to read custom XML files and deserialize them into my custom objects?
I do NOT want any "automatic serialization/deserialization" such as XStream, I wanna have control about how it works myself
the main thing why XStream sucks because it doesn't support any lists or anything, or at least their docs don't say anything about it
Is there a way to fix that? I'm trying to convert an Object (it's a list) to a List:
List<String> blocks = Arrays.stream((Object[]) value)
.map(element -> (String) element)
.collect(Collectors.toList());
java.lang.ClassCastException: class java.util.HashSet cannot be cast to class [Ljava.lang.Object; (java.util.HashSet and [Ljava.lang.Object; are in module java.base of loader 'bootstrap')
Before that I have this check:
value.getClass().isArray() || value instanceof Collection
if it's a list, why do you cast it to an array?
cause I can't use streams
otherwise
you cannot cast a List to an array
how do I use streams if I have an Object?
please explain again which type "value" actually has
Object
you don't
region.getFlags().get(flag): [dirt, grass_block]
ok
class: class java.util.HashSet
just cast your object to HashSet, then you can call stream on it
like that?
List<String> blocks = ((HashSet<?>) value).stream()
.map(element -> (String) element)
.collect(Collectors.toList());
yeah, although you could also just directly cast it to HashSet<String> instead of casting each element
List<String> blockTypes = ((HashSet<String> value).stream().collect(...)
IntelliJ tells me that it's not recommended
doing .map(...), then casting every element is doing the same thing, just more complicated
why do you need a List anyway? Can't you just use it as Set<String>?
I can
ty
It works
np
Hello I have a problem:
Object worldname = main.getConfig().get("warps."+message+".world");
World world = main.getServer().getWorld((String) worldname);
config.yml :
warps:
box:
==: org.bukkit.Location
world: world
x: 9.703408588152502
y: 65.0
z: 10.69579578168919
pitch: 3.3000607
yaw: -44.550293
Caused by: java.lang.IllegalArgumentException: Name cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.getWorld(CraftServer.java:1139) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at be.thedrewen.yttrium.commands.commandWarp.onCommand(commandWarp.java:42) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
... 19 more
also not sure u are using correct path
your config does not contain any value called "warps.<message>.world"
what
if you serialized that as location, get it as location
yes
I said that your config doesn't contain any value at the given path
hence it returns null
@Override
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
if (sender instanceof Player) {
Player player = (Player)sender;
if (args.length == 0) {
player.sendMessage("§6[§eYttrium§6]§4Oups...La commande est §6/warp §e{nom}");
}
if (args.length > 1) {
player.sendMessage("§6[§eYttrium§6]§4Oups...Le nom du warp ne peut contenir que 1 éléments.");
}
if (args.length == 1) {
StringBuilder message = new StringBuilder();
for(String part : args) {
message.append(part);
}
Object worldname = main.getConfig().get("warps."+message+".world");
World world = main.getServer().getWorld((String) worldname);
player.sendMessage(main.getConfig().getInt("warps."+message+".y")+"");
Location location = new Location(world, main.getConfig().getDouble("warps."+message+".x"), main.getConfig().getDouble("warps."+message+".y"), main.getConfig().getDouble("warps."+message+".z"), main.getConfig().getInt("warps."+message+".pitch"), main.getConfig().getInt("warps."+message+".yaw"));
player.sendMessage("§6[§eYttrium§6]§e Téléportation en cours...");
player.teleport(location);
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);
}
}
return false;
}
then you throw null into "Server#getWorld(String)" so it throws an NPE
this code is so wrong
also why do you have two arguments that are both called msg/message ?
also string builder for array lenght 1
yeah that also makes little sense
I am a beginner
plus you already saved location in config
the "msg" variable should be called "label"
you can just use get() and cast it to location
what's the purpose of using a StringBuilder if you already checked that your "args" has a length of 1?
or use getLocation()
okay
but that'll error out if the world is not loaded
I try
ah didn't know that exist
final Location myLocationFromConfig = myPlugin.getConfig().getLocation("path.under.which.i.saved.the.location");
Tanks It work
that's a test method
obviously
new Constructor 
is there any rule that I missed which states that test method names must both be misleading, way too long and also violate existing naming schemes?
who cares
Ok I noticed the method name lol
lmao
idk I just feel that this method name hurts
I would have called it "testYamlParsingWithNestedObjects()" or sth lol
or "üüaaagh()"
You're wrong. just remove the _ and the method name gots perfection 😎
I don't think so, for example the weird "when" prefix, or the fact they mention it's about a "JavaObject" when basically everything in java is about java objects
what else would it be if not a java object
I mean, what else would it be? a C(++) template/struct?
makes little to no sense to mention this specifically
is it normal that gradle gives no useful output even when running gradle test --full-stacktrace? o0
anyway, found the proper stacktrace in the html file. anybody know how to fix this?
Stacktrace: https://paste.md-5.net/yepahisudi.cs
build.gradle.kts: https://paste.md-5.net/adiyevanez.cs
Test class: https://paste.md-5.net/oteyimirav.java
I followed this tutorial on how to add tests in gradle: https://docs.gradle.org/current/userguide/java_testing.html
are their docs outdated on that too o0
is there actually ANYTHING correct in gradle's docs?
note: it also fails to run when my @Test method is completely empty
I cant figure out to get the item in the main hand. How do i do this?
?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.
you already know how to get the item in main hand, it's Player#getInventory()#getItemInMainHand()
