#help-development
1 messages Β· Page 37 of 1
oh yeah thanks
and do i need to add the shade code from website to pom.xml?
not if you are using libraries in plugin.yml
if you want to shade libs into the project yes
and i use it only on top in the maven-plugins or sth like it shown on website
oeh uh how can i let gson know what it should deserialize when trying to deserialize my custom class? TypeToken?
or for every dependecy
If using libraries in plugin.yml just set all of them in yrou pom to provided or compile scope
^^
Also, not sure if you just copied straight from the website, but the configuration should be changed according to what you are doing. i.e changing the relocation pattern to include the package from jackson dependencies and you probably don't need the excludes section either
Foo targetObject = new Gson().fromJson(json, Foo.class);
oh serialize
private void writeJSON(ItemStack itemStack) throws IOException {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
FileWriter writer = new FileWriter("itemstack.json");
writer.write(gson.toJson(itemstack));
writer.close();
how can i fix this error it is going through try/catch
Are you catching AssertationError?
Trap means that you are making something null when it shouldn't be null
or it is ending up being null when it shouldn't
in this case, ItemStack
i want to remove 1 item that player right clicks
hmm i think i need a TypeAdapter
code view helps us you know
you should be using the inventory click event
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
early returns please π₯Ί
you are using the incorrect event in this case
linked the relevant api above for you
but i don't want to remove clicked item in inventory but right clicked in hand
public void givenArrayOfObjects_whenSerializing_thenCorrect() {
SourceClass[] sourceArray = {new SourceClass(1, "one"), new SourceClass(2, "two")};
String jsonString = new Gson().toJson(sourceArray);
public void givenCollection_whenSerializing_thenCorrect() {
Collection<SourceClass> sourceCollection =
Lists.newArrayList(new SourceClass(1, "one"), new SourceClass(2, "two"));
String jsonCollection = new Gson().toJson(sourceCollection);
i hate that theres no goto statement
would be so useful in loops and shit
for control flow
we have labels
why no goto
its also reserved
Cause good code doesn't need it 
you are thinking of a different programing paradigm
is a CraftingInventory the grid, result, player inventory and hotbar?
uhm i still think i need a TypeAdapter, to let it know not to serialize the player field and take the AtomicReference::get instead of the playerdata field
posted the fields above
public void givenIgnoringAField_whenSerializingWithCustomSerializer_thenFieldIgnored() {
SourceClass sourceObject = new SourceClass(7, "seven");
GsonBuilder gsonBuildr = new GsonBuilder();
gsonBuildr.registerTypeAdapter(SourceClass.class, new IgnoringFieldsSerializer());
String jsonString = gsonBuildr.create().toJson(sourceObject);
if you have have control over the source
you can use an annotation instead
public void givenUsingCustomDeserializer_whenFieldNotMatchesCriteria_thenIgnored() {
SourceClass sourceObject = new SourceClass(-1, "minus 1");
GsonBuilder gsonBuildr = new GsonBuilder();
gsonBuildr.registerTypeAdapter(SourceClass.class,
new IgnoringFieldsNotMatchingCriteriaSerializer());
Gson gson = gsonBuildr.create();
Type sourceObjectType = new TypeToken<SourceClass>() {}.getType();
String jsonString = gson.toJson(sourceObject, sourceObjectType);
annotation
if the source class has an annotation, it will use that to filter it out
instead of looking for the field specifically
also i now recall how i once solved the same issue in a datapack.
One scoreboard objective is crafting a specific item, and you can use that value to determine how much score to deduct, granted you needed 1 scoreboard per craftable item
it could be more optimal in cases where you might have multiple fields of the same object with differing values
what annotation?
solution was removing , 1 after Material.PAPER
so there's a scoreboard criteria for crafting an item that keeps track of how many of said item was crafted, yet there's no event that can detect this?
I don't remember, that isn't one of the things I had saved
as I don't use annotations at all
in a ShapelessCrafting ingredientList, does it contain multiple of the same entries?
it can
user looks like this in json mmmh
Unreadable
Even cat is disappointed
He's antisocial but he also has to be in the same room as you or he cries so loudly
π€
Kinda like when I see JSON
bruh do i really need to write a typadapter now for one field :/
literally to get the value out of a AtomicReference
"island"
You're giving me ptsd
From when I was writing my skyblock core
believe it or not but i wrote that by hand
interestingly, crafting a FireworkStar is neither a Shaped or Shapeless Recipe
what gives?
also my java is rusty
if(r instanceof ShapedRecipe s){
e.getView().getPlayer().sendMessage("Shaped");
quant = (int)(new ArrayList<ItemStack>(s.getIngredientMap().values())).stream().filter(i -> i.getType().equals(Material.DIAMOND)).count();
}
Not sure why this doesn't work to find if a recipe used diamonds
πΏ
why why why why why
does it send the message
yep
so its just me not remembering how to use streams to count map values
what is not working, does it always count 0?
causes an error
what error
wait wtf why cant i snipping tool the error
oh i never verified my account
or smth
at diamondtracker.diamondtracker.handlers.DiamondListener.lambda$diamondCraftListener$0(DiamondListener.java:70) ~[?:?]```
lol just copy paste raw text then
this was in console lol
think so
huh
smh
or do like i != null && i.getType() == Material.DIAMOND as a condition
god i wish there was a better method of reloading plugins
/restart is a good one
i already do that
alright i cant paste the result but know that it worked lol
now next problem
what kind of recipe does a firework star use?
because its neither shaped nor shapeless
so i cant filter it using
int quant = 0;
Recipe r = e.getRecipe();
if(r instanceof ShapedRecipe s){
e.getView().getPlayer().sendMessage("Shaped");
quant = (int)(new ArrayList<ItemStack>(s.getIngredientMap().values())).stream().filter(i -> i!=null).filter(i -> i.getType().equals(Material.DIAMOND)).count();
}
if(r instanceof ShapelessRecipe s){
e.getView().getPlayer().sendMessage("Shapeless");
quant = (int)s.getIngredientList().stream().filter(i -> i.getType().equals(Material.DIAMOND)).count();
}
you know what screw it nobody is gonna be crafting fireworks
anyways
now the next problem is figuring out how many items a person actually crafted
Why atomic?
public void saveHives() throws IOException {
File file = new File(cadiaBees.getDataFolder().getAbsolutePath() + "/hives.json");
file.getParentFile().mkdir();
file.createNewFile();
Writer writer = new OutputStreamWriter(new FileOutputStream(file, false),"UTF-8");
Gson gson = new GsonBuilder()
.registerTypeHierarchyAdapter(ItemStack.class, new ItemStackSerializer())
.registerTypeHierarchyAdapter(Location.class, new LocationSerializer())
.disableHtmlEscaping()
.setPrettyPrinting()
.create();
gson.toJson(cadiaBees.hiveManager.getCustomHives(), writer);
writer.close();
}
this is my gson save
quick question, how do i get the string of a minecraft_id from a material?
append minecraft: to the front lol
and lowercase the material
if you want "clean"
oh, it all matches?
if im not mistaken.
cause material ids are strings now instead of numbers
minecraft:diamond_sword would be DIAMOND_SWORD as a material
Hello, I have a problem with the plugin.yml I can solve it, there is nothing I can do, the error continues. someone help me please.
cuz multithreading
error?
i see...
yes I will send in your private some prints of the error
send it here
?paste
gson badass
i thought it would use my custom typeadapter to serialize a field but it doesnt ;/
That's a block 
only seems to work for whole objects or smth
@carmine nacelle I'm not able to upload the images here
Usage: !verify <forums username>
or ?paste for the error
Old question. Why i can still moving item in gui.
brah so i add <scope>compile</scope> in maven (for a dependency) and then do mvn package but it doesnt add that into th efinal jar
mvn install?
Wat how is mvn install gonna fix it
im not sure if i even need it lmfao
do you know the difference between install and package 
doubt it
Are you shading it into your jar?
i did include the shade plugin
wondering why i needed volatile playerdata π€
im only loading it on one thread π€
sk
?paste the code next time makes it easier to read and figure out
Some time ago there was an Issue or PR (I don't remember which one) to replace the Material Enum to better distinguish Items and Blocks. Is that still something that is planned for the Future or is that scrapped
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Help:(
oh and i use intellij to package it if that helps (using the maven tab)
The only reason it wouldnt fire is if the inventory isnt equal to the gui inventory
Ahhhh why is your package names capitalized
I don't know how to do it, looking at the photos I sent, you can't tell me how to put the main?
Also this seems to be the issue
missing the description line
just use idea's built in Spigot template lmao
its nice
Oh I bet you they're compiling it without the plugin.yml
Could not pass event AsyncPlayerChatEvent to Chat v1.0
org.bukkit.event.EventException: null
maybe that too
I've done it quite a few ways. As check title, getClickedInventory. Do you have a way for this?
pretty sure description is required tho
Naw
I understand, I'll try to change here, I'm taking a course to learn for 2 days only
checking the title isn't an accurate method of comparing guis
I'd highly recommend learning java first.
java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0
Is there any way..
Fix your regex lmfao
^^
i dont remember if i used that in plugin
yes, but unfortunately, here where I live, there is no one to teach, nor paid, nor free, and I've looked for several courses on the internet but I don't know if any of them are good.
"regex"
Some time ago there was an Issue or PR (I don't remember which one) to replace the Material Enum to better distinguish Items and Blocks. Is that still something that is planned for the Future or is that scrapped
hmm
I don't remember if I did regex
exception complains about invalid regex
π€
There are plans to make instances for existing enums instead of expanding further
that breaks compatibility
Still happening. Ideally every enum will be replaced by something more data driven to allow
more modularity.
Something thats sadly super underappreciated in the Minecraft World
There is plenty of free stuff online where ever you live.
Do you have a link to that Process on Jira or Bitbucket?
can you recommend me some??
Internet
?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.
I'm sure there are plenty of Portuguese tutorials as well
?paste
also wtf
if(quant > 0){
Scoreboard data = plugin.getServer().getScoreboardManager().getNewScoreboard();
data.registerNewObjective("data", ("minecraft.crafted:" + r.getResult().getType()).toLowerCase(), "");
plugin.getServer().getScheduler().runTaskLater(plugin, ()-> {
int size = data.getObjective("data").getScore(p.getName()).getScore();
removeScore(p, size);
data.getObjective("data").unregister();
}, 50L);
}
My objective here is to:
- set up a scoreboard
- get the score of the player on a crafting x item
wha
capital letters in configs 
that code looks cursed
thanks? ig? xd
no problem
cuz your regex is fucked up
Ah found it, looked for a PR in Spigot while it was in the CraftBukkit Repo
that code is too cursed for my eyes π₯Ί
You're using it raw which could be exploitable asf
In the end still no one gave me how to solve it. Even if it's just a suggestion π’
You're missing an inventory event to cancel or you need to check better
Add debug messages and see whats wrong
Log stuff
there's only like 2 tutorial videos for spigot in particular in portuguese
.replaceAll("%player%", "name") it will replace all "%player%" in text with name ig?
source: I watched half of the first video
read
If VERANO did it I believe anyone can tbh.
verano is spanish
org.bukkit.event.EventException: null```
What the heck is this error
@vocal cloud I've tried to fix it but the error remains https://prnt.sc/wbvxt6qKx2oM
whats wrong with it exactly?
Your jar is probably missing the plugin.yml
Lbozo
or gradle
wait what
not using package management in general
??
bozo means B1tch in my lang lol
Then watch them in english. Thats the language you will mainly encounter when programming.
I should write a logging tutorial jeez the amount of people who's problems are solved by logging.
based
and deutsh!
the plugin.yml folder is there in the image as you can see
languages are xenophobic π‘
True but many young devs can't speak english
And even if they can, some concepts can be better understood in their native language
I'm not going to be rude but read your error
whats wrong with itt what am i doing wrong?
@latent dew you arent exporting the plugin.yml in the artifact
just because its in the project doesnt mean it will auto export
It's sad that countries like Brazil have tons of young talent but they're limited by the language barrier
Then lets all speak esperanto. Only the asians will have a hard time with it.
Even though they're shooting themselves in the foot by not learning english
right, and how do i do that?
let's all speak latin
(it was a joke btw)
and maybe summon a demon to fix our code for us
The language of the internet is English.
yes
if you can speak english, it is
File > Project Structure > Artifacts >
whats wrong with this code?
add the plugin.yml file to output artifact.
whatβs the error?
I can assure you that most minecraft gamers that don't speak english end up playing on spanish servers
Mostly because spanish servers are better made
ok i'll try
cap
comparing to portuguese / brazilian servers
?paste
bruh
naming package as Chat π€‘
We've been over this. What line is giving the error.
uh yeah thats the thing why is it throwing exception π€‘
sheesh yall are too harsh on newbies.
iβm on mobile so paste the error
and what does replaceAll do
if the first character is 0
it does replaceAll("+", "")
but + is a regex character
I think, more importantly, replaceAll isn't what they want.
then just add a \
Or if it is they need to escape it
Either use replace or escape the char
i think thats what they want
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.network.chat.IChatBaseComponent.e()" because "this.d" is null
code caused:
Scoreboard data = plugin.getServer().getScoreboardManager().getNewScoreboard();
data.registerNewObjective("data", ("minecraft.crafted:" + r.getResult().getType()).toLowerCase(), "");
java 7
replaceAll should really just be renamed to replaceRegex
replaceall is for like..wildcards i think? never used it.
Replaces each substring of this string that matches the given regular expression with the given replacement.
is there an issue with my scoreboard creation?
this.d is null
is there an event for block move?
or any way to output when, from where and to where was a block moved by piston?
PistonPushEvent
or is it PistonExtendEvent π€
is throwing an error
because an internal nms variable is null
that will totally fix bukkit's api
why are you using an nms method to make a scoreboard?
bukkit
?jd-s

Use the search bar
yes but there is written Called when a piston extends and i expected something like when block is moved. i will look into it
i see there is a list of blocks moved
i missed that. thanks
@carmine nacelle how do i export the plugin.yml here https://prnt.sc/sdUfqKa39Zsa
Please use a package manager 
BlockPistonExtendEvent
BlockPistonRetractEvent
or
is maven a package manager
i assume so
Let them find it in the docs π
enemy doc users
Then teach
why is it replaceAll there then?
but then I grew brain cells
How to read javadocs the musical
does it something different?
i still have issues reading docs sometimes..
I should make a whole spigot tutorial series in portuguese
where it's just a clear voiceover
go for it
with white noise at the back
You should. I'd listen to it. Not like I'd understand it but I'd listen 
based
idk why people keep saying they'd watch my content like
masochist mfs
People like my voice apparently
people say I sound hot
i'll be honest i have no idea how to make one otherwise
no the middle one
Thank you to everyone who helped me over these last days with my issues. I've now finished the plugin I was making, and I actually quite like plugin making. Felt like I owed a thanks :)
middle of the screen
i just picked up spigot to day dont @ me
using the spigot api ofc?
but I just listen to my recordings and crumble into a ball
and start spinning on the floor
like a beyblade
beyblade beyblade
if you just learned spigot donβt use nms π
nms is pog wdym
Everyone did that when I made the video for Verano a while back https://youtu.be/MzdHLbcvpCk
aight lol
not for the beginners ??
fuck nms
oh
nms is gangsta
ngl I only setup mojmaps like 3 weeks ago
bruh
been doing nms until then purely based on obfuscation and common sense
moj maps are the way to go
chad moves
vivian
you know
that if you make a pom.xml or build.gradle
your ide prompts you to convert the entire project to a maven/gradle project right
what about it
intellij might be a little dumb sometimes but it's still smarter than us
sir the plus button
to the right of that one
i use maven
there are like 4 of those
Better yet
You can select maven and it'll just do it all for you
uh, this may be a dumb question but how do i register a new scoreboard
that screenshot is so cropped idek the steps to get to it
intellij artifact manager π
i love maven
Right click on the project folder
maven so sexy
It's at the bottom
I'm currently in a rust project so it doesn't have maven as an option
i mean
also this @real blaze https://www.spigotmc.org/threads/tutorial-creating-animations-scoreboard.139286/
its easier to start with this than guiding to use a completely different thing aint it
Well, get over the big hurdle now then later
bro you gonna compile with ant??
It's easier to just do shit properly than to teach them how to workaround a crappy solution
the poor man cant find the plus button u think he can figure out maven?
Make me a portuguese tutorial already
fucking hell mike
imma buy full nitro just to spam crazy frog emotes to scare your horny ahh

smh
@carmine nacelle https://prnt.sc/3_4O3R_M6xSW here yes?
Scoreboard data = Bukkit.getScoreboardManager().getNewScoreboard();
data.registerNewObjective("data", ("minecraft.crafted:" + r.getResult().getType()).toLowerCase(), "");
the second line still causes an error
and im still clueless as to why
Vivian I swear to God
what did i do now
I think someone else did something
Teach them to use maven not that evil.
alright, so note
("minecraft.crafted:" + r.getResult().getType()).toLowerCase()```
is attempting to replicate
minecraft.crafted:diamond_pick``` - diamond_pick being variable
well maven is obviously better
except for big ass projects
@carmine nacelle @vocal cloud https://prnt.sc/3_4O3R_M6xSW here yes?
How Big is Big ass though?
try it
latina
kekw
Just use eclipse at that point. JDT is super nice
notepad++
big enough to build several minutes
Not really powerfull but at least useable
Ah, so millions of LOSC
Yeah, in that Case you should use make
my problem continues https://prnt.sc/fhAFcwt55WUF and I already added the plugin.yml https://prnt.sc/cLIajLcCSAWb
Lines of source code
who tf says losc
uh anyone?
Im on mobile okay
me too
Use a package manager like maven.
It is pain to write anything because of stoopid autocorrect that is half German half english
Ja ja ja
Meh, that is a User error
Jaaaaaaaaaaaaaaaaaaa
Their Main Class does Not exist
LMAO cancelled
Or at least it is Not what is defined in the plugin.yml
i swear to drunk im not god
π©πͺ
what is it π
Oh god Just use JDT
there u go hes interested @vocal cloud
no
If you do Not know how JDT works you are truely lost
Well If you know maven it is better
Im making a plugin that supports multiple versions, but also depends on WorldGuard. How would I use a certain version of WorldGuard for diff versions of Minecraft? Would I have to depend on multiple versions of WG and then just make different implementations for what I need to do for each Minecraft version?
This is making me want to make a switching to a package manager video
Depends on the Project layout
hi guys i need help? pls dm
do it
At worst Just use Method handles
no balls
That is Not how you get help
Angry German Noises
NEIN
guys i have a question
how can i post a plugin in spigot
There is a command for that iirc
?sendhelp
?call911now
why
because someone stole her ass
wat
https://www.youtube.com/watch?v=Aoac2QR0Rb8
can someone help me remake this with citizens and mythicmobs?
If you have an idea contact me on discord: ArchiTheCoder#2209
All credit for the idea to @Hypixel Server for Minecraft
Huh
?howtopostathread is the only Thing a bit Like it
We're not here to write code for you.
We would need one for resources though
I gotchu
Only with workarounds
All events are called but none are cancelled.
That is the baseline of Downloads by Bots I assume
help my plugin wont build im using specialsource-maven-plugin but it says this [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.062 s [INFO] Finished at: 2022-08-05T01:19:27+10:00 [INFO] ------------------------------------------------------------------------ [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
Oh.
Add the Attributes to the PDC and apply them on the Block place event
Adding resources is so easy lmfao.
it worked on my main pc btw
is there easier way to check if player is clicking sword?
All of those .equals dont work
That wont work if the sword has enchants, lore, displayname..
Yes, don't understand why @lament sorrel cant Figuren it Out themselves
They do?
Read the warning with those .equals please
The real problem is here. But why?.
i cant find any way to do it

you're comparing an itemstack to a material.
Ah right
ily

No!
i just needed the link
Use enchantment Targets my dear
but thx
Longer though. item.getType().name().toLowerCase().endsWith("sword")
And more useless 
how to hinder performance 101: toLowerCase
i forgot to add .getType() but is any better method ?
all it does is kill performance in this case
endsWith is relatively fast
Beware of the tΓΌrkisch locale bug
substring
Performance is for weak PCs
ig3
You need to Pass a non-system locale
Objective obj = data.registerNewObjective("data", ("minecraft.crafted:" + r.getResult().getType()).toLowerCase(), "");
Why the flip does this line not work i dont get it
i'm very new to java, wondering how i would create a file to store coordinates set by a command
just checks if the array range [length - target.length] -> [length] is equal to targetArray
with some length checks as well
File x = new File("d");
x.createNewFile();
"A short story".endsWith("story") -> "~~A short ~~story" equals "story" -> true
Ah createNewFile
i just posted my plugin how do i have 2 downloads
oh, what was it again? π
staff?
And bots
ou yeah but it is just a chatplugin
Nah staff do Not respond that quickly
so?
i understand
changed return type of a method
we've found cracked versions of paid plugins just labelled "test"
oi
it's stupid mfs like me
bots
those tend to happen when we add api and spigot catches up

it stoped at 4
no need to be overly hyped
no one cares about a chat plugin
this dudes flippin out thinking ppl love the plugin let him be happy
Hello, I am looking to modify Paper 1.12.2. Can someone help me?
Thank you for your kindness.
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
I want a free Kid-knee
might wanna read that again
my pizza never arrived
?eol probably doesn't exist, but applies too
apparently displayname cant be left "" for whatever reason
how ridiculous
Internal mc issue ig
put a space between " "
But might make more Sense If we knew the Error message
hi i cant get this to work pls help pl.sendTitle(ChatColor.RED + e.getPlayer().getName(), ChatColor.RED+ "tagget deg!", 20, 40, 20); i code 1.19 tag me
5 downloads
bump
so i have delayed a task by 50L and i thought that meant 50 milliseconds / 1 tick
20 tick = 1 second
idk what to do now everything is working but im receiving null
u got a null check before all that?
if u click an empty space the item is null.
but im getting that error when im clicking sword
is 50L not 1 tick?
50 is 2.5 seconds
oh
yea it isn't in millis
unless im stupid
i thought
20ticks is 1 sec
pls help
?reload
also i think ive found the dumbest way of identifying how many crafts a player did
since CraftItemEvent is no help
what command did you run?
the run button in intellij
why is this code not running
@EventHandler
public void onDamage(EntityDamageEvent e) {
System.out.println("player attacked!");
}```
because you didnt register the event listener
i did
?paste your pom.xml pls
if you are running a maven goal, it needs an actual goal to run i.e package
also use a logger instead of sysout
you either didn't register it, or there are console errors you ignored
if(quant > 0){
final int q = quant;
Scoreboard data = Bukkit.getScoreboardManager().getMainScoreboard();
data.registerNewObjective("data", ("minecraft.crafted:minecraft." + r.getResult().getType()).toLowerCase(), "t");
p.setScoreboard(data);
plugin.getServer().getScheduler().runTaskLater(plugin, ()-> {
int size = data.getObjective("data").getScore(p.getName()).getScore();
removeScore(p, size * q);
data.getObjective("data").unregister();
}, 1L);
}
Essentially it creates a new scoreboard with objective of 'craft x', then reads it 1 tick later to figure out how many of x item did player craft
that looks good. in the maven tab, click on lifecycle -> double click on package
I think your run configuratoin is just running mvn and not mvn package or something similar @near night
ok will check
Someone tell me why my first statement in InventoryClickEvent returns true.
that worked thanks
hmm looks almost right
ah we got a new exception
lmfao
i registered a typeadapter and it doesnt seem to use it :/
general question Fourteen, what is that random "{...}" for that has "writer.name(...)" and so?
^
in this case, it does absolutely nothing
it's basically only there to limit variable visibility / scope
lets remove it lol
mye
I don't see any other reason why it would ever be useful inside a normal method
hm, didnt know that
my internal representation looked like this so it helped me a little to write the code
you can also do stuff like this
public class MyClass {
final String name;
{{{{{{{{{{
name = "mfnalex";
}}}}}}}}}}
}
if you're bored
that sounds like a great idea
im confused by the exceptions
fair enough
guys can i get help? I'm trying to make a 1.17.1 server, i've updated the jdk-17.0.4 and when i start the BuildTools bash script nothing happens
it asks me the version. I put 1.17.1 and then it shows Press any key to continue and bye
yes
HUUH
buildtools doesn't ask you for any version
it either builds what it considers latest, or you specify it using --rev
you use some weird interactive script that someone wrote, but not the official one
i'm using the one from here https://www.spigotmc.org/wiki/buildtools/#running-buildtools
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
@echo off IF NOT EXIST BuildTools ( mkdir BuildTools ) cd BuildTools curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar set /p Input=Enter the version: || set Input=latest java -jar BuildTools.jar --rev %Input% pause
just run this manually
java /path/to/BuildTools.jar --rev 1.17.1
java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module @33af8c0a myes
the folder is the same even when i wrote this command
does it show anything if you enter java -version ?
nope
your java is somehow fucked up
should i reinstall it?
can't hurt
lemme give it a key then
idk what the problem is, but if java -version does not show ANYTHING, then something is extremely fucked up with your java installation :/
what version of lombok are you using?
bro it's been 4 minutes calm down
and what version of java?
java 17 wasn't even released when lombok 1.18.8 was the latest
try upgrading lombok to 1.18.24
java 17 was released in september 2021, your lombok version is from may 2019. soooo I guess this is the problem
Hi what do you think which approach is better? To have one global event listener for list of objects, or event listener per object?
i'd use one listener that then passes the event to your objects
well it depends on the amount of objects you have
are you using maven?
?paste the complete maven log pls
are you using intelliJ?
I'm using this approach, question was only from curiosity
just run mvn clean package or whatever you use to compile. then, when it's finished, check on the right side of the console. click the uppermost thing, then copy/paste everything from the console output
?paste
that's impossible
it'll either tell you that there is no such command or the version
nothing showed up when i typed the command
i had to reinstall java
now it works
hopefully the buildtool thing will work too
meta.addEnchant(Enchantment.ARROW_DAMAGE, 255, false);
meta.addEnchant(Enchantment.ARROW_KNOCKBACK, 1, false);
this will one shot entities right
like vanilla ones
Does anyone know why this isn't working ?
https://paste.md-5.net/asewiyexep.java
whenever i type the word "testing" the idea is to add this to the custom config file:
test:
test:
test:
- "testing"```
or at least something similar with this sorta stair-case approach
smh
Hello just getting started iwth ProtocolLib in 1.8, I want to create a basic action bar sending system but it doesn't work corerctly, I have a Null Pointer Exception
@Override
public void send(@NonNull Player player, @NonNull String message) {
// send action bar with protocollib
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
PacketContainer packet = new PacketContainer(PacketType.Play.Server.CHAT);
packet.getBytes().write(0, (byte) 2);
packet.getChatComponents().write(0, WrappedChatComponent.fromJson(message));
try {
manager.sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
}
The fact is, I'm using the latest version of ProtocolLib in my gradle, and latest plugin in my server even if I'm using 1.8
What do you advise me please ?
yikes
copilot better π
1.8 doesnt have an actionbar api?
no
dont have copilot
1.8 sucks so hard, it doesn't even have api for action bars
Too old! (Click the link to get the exact time)
ye and not in the good way huh
hmm i'm not getting a remaped jar from this https://paste.md-5.net/zevemihaju.xml i get
3 files not 4
I don't need lectures about how i should use OOP, i just wanna know what mistakes i've made for since its not working
event is also registered correctly so its not that
Bukkit.getServer().getPluginManager().registerEvents(new message(), this);
if i want to control the speed at which wheat grows using api how would i do it
bump
tf
why r u doing this
for action bars
i wanna cry
wtf
no
it does
lmfao
i get this
1.8 is no longer supported (since years now) and nobody plays that version anymore. Update.
Hi,
I am currently working on a spigot/bukkit plugin and have problems findig a up-to-date worldeddit api example code/tutorial/doc for loading in schematics.
Can somebody help me?
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("This message will be in the Action Bar"));
"nobody plays that version anymore" you have your statistics wrong
1.8 is extremely famous lol
I have to, in 1.8 version
you dont have to
Not really. Its a vocal minority. Its a bubble.
i told yo uwhat to do
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("This message will be in the Action Bar"));
I know right, but I don't have the coince
no
well 1.12.2 was less complicated and more fun
but its not the best
frankly all the versions suck
oh god another 1.8 argument
we should get a bot to just shut down the channel if it gets mentioned
anyone?
Hi,
I am currently working on a spigot/bukkit plugin and have problems findig a up-to-date worldeddit api example code/tutorial/doc for loading in schematics.(1.18.2)
Can somebody help me?
protected package
Versions that are more used than 1.8:
1.19.1
1.19
1.18.2
1.18.1
1.16.5
1.12.2
Each of them.
Index for middle inventory item?
what
hotbar*
TextComponent(java.lang.String)' is not public in 'java.awt.TextComponent'. Cannot be accessed from outside package
is it 4?
is there a way to protect specific blocks instead of preventing all explosions near them? (like the image yk)
wrong class and import
Yes. Go through the block list in the explosion and remove them from there.
net.md_5.bungee.api.chat.TextComponent
oh cool, didnt even know it had a block list
Required type:
BaseComponent
Provided:
ChatMessageType
90% of hypixel
are 1.8 users
bru wat
what event should I use? neither of these have e.getList or e.getBlocks or something
pls help
well whatever
public static void sendActionText(Player player, String message){
PacketPlayOutChat packet = new PacketPlayOutChat(new ChatComponentText(message), (byte)2);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}```
jes but for api @lost matrix
how would i check if wheat is fully grown or not?
Why my condition does not work, when I held an arrow in my hand
ya
cast it to Ageable and check age
check the age lol
Iβm trying to create custom names by placing invisible armor stands on top of players, but I donβt want a player to see their own name. Would it be more efficient to send fake armor strands to everyone in the server except one, or spawn a real armor stand but cancel the spawn packet for the one player?
bump
you cant check if an item in hand is fully grown, check the blockbreak event
It cannot found PacketPlayOutChat
Click on "Documentation"
What the first purpose of my first question lol
@EventHandler
public void diamondClickListener(InventoryClickEvent e){
Inventory inv = e.getClickedInventory();
if(e.getCursor().getType().equals(Material.DIAMOND) && e.getView().getPlayer() instanceof Player p){
if(markDiamond((Player)e.getView().getPlayer(), e.getCursor())){
p.sendMessage("found on cursor");
e.getCursor().getItemMeta().setLore(List.of(ChatColor.GRAY + "Owned By:" , ChatColor.GREEN + p.getName()));
}
}
}
So Im trying to set this so that upon clicking an item to set its lore, but this doesnt seem to work
ignore the inv i was testing something
the meta you get from getItemMeta is a copy
ah
you have to run setItemMeta afterwards
Bump
how would i get the location of the nearest armor stand with a tag so i can make a compass target it, i get the targetting part, im just not sure how to get the location of the nearest armor stand to the player
and it needs to be constant, so if the player moves close enough to a different one, the location changes
@tardy delta that not work π’
can I check if a player died to the void in PlayerDeathEvent?
I believe the world object has a getNearbyEntities method
check if the blockstate of the broken block in the blockbreak event is ageable and check age
you would just have to check every tick or so (or when the player moves)
?jd-s
get last damage source
oh awesome! thanks
what method?
this is a /repair π
not a event
repair the item π
you can also pass the method a filter directly so it saves looping through every entity returned
im the one that asked about ageable
You need to iterate over all possible stands in the world and check for the distance squared to pick the closest. Every second should be fine.
lol
ah check instanof Damageable then (take the right one)
import org.bukkit.inventory.meta.Damageable;
?
Ah yeah, 7smile7 is correct, if you want the closest and you don't know how close it is, then yes you'd need to loop through all
ye i believe
The ItemMeta not the ItemStack
oh okay thanks
if you took a look at the docs you wouldve seen it extends itemmeta
I did not know
that work! thanks
Why my command goes beyond that? when I have a block in my hand, the blocks have no durability π
It says that it is full, in durability but normally it should have stopped before and say that this item can not be repaired because it does not extend from Damageable
Bumpity bump
damaging items is weird
Those methods are deprecated for a reason. Change it.
Cast the ItemMeta to Damageable
World#notifyAndUpdatePhysics``` anyone know how work flag in this method? π
what is PotionEffect max amplifier?
255 iirc
It works well, I want to know why my block passes the verification of the item is an instance of Damageable
If I cancel EntityDamageByEntity will they still take knocback?
it seems to be impossible to detect whether a diamond was used in a crafting recipe for a firework star
Thats not a spigot method
NMS π
No. If you want to have knockback then you need to set the damage to 0.
How to install NMs in 1.8 ?
check if the matrix contains a diamond?
BuildTools
1.8 is no longer supported. Go and search in old forum posts from half a decade ago.
?1.8
Too old! (Click the link to get the exact time)
matrix checking is no bueno for my use case
is no what?
Ok different question, bump
Check if the crafting matrix contains a diamond
wait, does CraftItemEvent give a crafting inventory prior or after a craft has occured?
bump
Events are fired before something happens. This way you can cancel the action.
If it was afterwards then you would have to roll back which would be stupid.
you know what thats pretty true
When I'm trying to install with Gradle, I have this issue :
[18:55:25 INFO]: [WorldEdit] Disabling WorldEdit v6.1;no_git_id
[18:55:25 ERROR]: Could not load 'plugins\PluginTemplate-1.0-SNAPSHOT.min.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: main class `org.arobase.plugintemplate.Main' does not extend JavaPlugin
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:74) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:331) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:254) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:293) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:767) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.Bukkit.reload(Bukkit.java:556) [patched_1.8.8.jar:git-PaperSpigot-445]
Caused by: java.lang.ClassCastException: class org.arobase.plugintemplate.Main
at java.lang.Class.asSubclass(Class.java:3640) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:72) ~[patched_1.8.8.jar:git-PaperSpigot-445]
... 15 more
[18:55:25 INFO]: SubClassFactory parent ClassLoader [org.bukkit.plugin.java.PluginClassLoader]
kinda dumb of me tbh
Both. and get the blockList
it's #blockList()
oh cool thanks @lost matrix @tender shard
your main class is not a JavaPlugin
it must extend JavaPlugin
I can't get NMS support?
Again: No support for 1.8. This version is horribly old and should not be used.
It's not my choice
I said you recently
it is
?paste org.arobase.plugintemplate.Main then
nms is a wildland. 
Ill take a short look at it.
It's doing that after I'm putting this :
implementation "org.spigotmc:spigot:1.8.8-R0.1-SNAPSHOT"
public final class Main extends JavaPlugin {
Did you add the mavenLocal() repo and run BuildTools?
?paste the full org.arobase.plugintemplate.Main then
I don't want to use build-tools because I'm not alone working on this plugin
Damn that's not that lol
What would be the bst way to get a list of every material obtainable in survival?
then adjust your plugin.yml to use the correct main class, lol
Then you cant use nms
bruh in this setup, gson::toJson would use the typeadapter no?
private final Gson gson = new GsonBuilder().setPrettyPrinting()
.registerTypeAdapter(KingdomPlayer.class, new KingdomPlayerAdapter()).create();
public void savePlayer(KingdomPlayer player) {
File playerFile = getPlayerDataFile(player.getUniqueId());
String json = gson.toJson(player, KingdomPlayer.class);```
As I said, the error comes up when I putting spigot
ye 7smile7 used your forum post kek
Can't I use protocol lib or something else ?
int quant = (int)Arrays.stream(e.getInventory().getMatrix()).filter(i -> i != null && i.getType().equals(Material.DIAMOND)).count();
well thats a oneliner
I dont even know what you are trying to achieve. But there is no reason to use plib if you are stuck on one version.
and as I said, paste the class I asked for, or you won't get any replies. The error clearly says that you set "org.arobase.plugintemplate.Main" as main class, and that this class does not extend JavaPlugin
for loop lol
Only dealing with packet
Satisfied ?
it is
there are no imports, there isn't even a package declaration
ghkjgh
alright, you do you, I won't spend time to help you if you refuse to accept any help
It's not that, it's just that the error is not located in my main file
I really appreciate your help, but as I said, it's not that
public boolean containsDiamond(CraftingInventory inventory) {
return Arrays.stream(inventory.getMatrix()).filter(Objects::nonNull).anyMatch(item -> item.getType() == Material.DIAMOND);
}
If you just want to check if any where used
nah needed it for one single function, but thanks!
How are you going to fetch the nms sources if you dont use BuildTools?
Do you want to throw a jar into the project and distribute it?
yeah that looks indeed correct, but your error / console stacktrace cleary says that it's the problem. maybeee.... is your plugin .jar like 30 mb in size?
8.5 mb
When I'm using Protocol Lib, I can use Packet
open it with winrar or similar. did you accidentally shade the Bukkit API?
if so, your main class extends your shaded JavaPlugin class, not the one the server is running
Yes but you cant use the spigot dependency in that case. You need to use spigot-api
so they both have the same name (its possible because every plugin has its own classloader) and then it says weird errors like "it doesn't extend MY javaplugin class"
I am pretty sure that you somehow shaded the bukkit api
when i type "@Override" it says it cannot resolve symbol, any ideas on why this might be happening
They are using "implementation". Of course they are shading it in. But thats not the problem.
He doesnt even want nms so he shouldnt use it in his build.gradle in the first place.
jdk not properly setup for your project.
implementation "org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT"
hmm alr ill see if i can fix that at all, it seemed to be working because all my block break events work and everything else but @override doesnt
Like that ?
Yes. But remember: This wont give you access to any nms classes.





