#help-development
1 messages Ā· Page 1497 of 1
Hey @wraith rapids, yesterday we talked about Anvil Inventory's and their problems in Spigot, and i fully switched to paper after a lot of hasseling and was hoping if you could point me into the right direction using Anvil as inventory in paper.
there is Player#openAvilInventory I think
tho for paper related questions, just hop over onto their discord
yea its was just because i talked about it to that guy yesterday and online the documentation is a bit scare but yea
not sure about that, there is a openAnvil tho but this takes an location and not a Inventory
Following this https://www.spigotmc.org/threads/tutorial-the-complete-guide-to-itemstack-nbttags-attributes.131458/ but using 1.8.8. I can't figure out what this (v1_12_R1) should be for the version I'm using
v1_8_8_R1 doesn't work and neither does v1_8_R1
there should be autocompletion when importing a class like that, but no succes?
No autocompletion
at all or just that?
Are you sure that you have the right jar?
1.8.8 R0.1 Spigot API
The server software, or something else?
server software, craftbukkit jar should suffice
I think it is known as org.spigotmc:spigot, but idk pre-1.13 artifact naming
I'm assuming I have to build it?
Correct.
Would the Spigot jar also work?
I think so, unless it is the spigot-api jar
What is the recommended way of obtaining the materials that are within a tag while still using "valid" bukkit API? I am currently using reflections on the org.bukkit.Tag class but this isn't the best way of doing that I recon given that datapacks can define those
nvm, Bukkit#getTag exists
is there some api to handle multiple config files?
There is the bukkit config API
you mean using this? https://bukkit.fandom.com/wiki/Configuration_API_Reference#Arbitrary_Configurations
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
yes
About how long does building normally take?
building like plugin building or placing blocks?
building the server
About 2 years
I am trying to make a permissions plugin in BungeeCord, however, I don't know any method to store and at the same time pull the information to the plugin, in this case, would I be able to keep updating the config.yml of the BungeeCord jar itself by my plugin?
yeah
How?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Thanks
is this a good example
for multiple config files?
Bungeecord
wut
they're developing with the Bungeecord api
so?
the one provided by that wiki article is a great start
this?
looks complex af
bukkit config API
yeah it's a mess
It is basically the same system as the normal bukkit config api
i mean i am a mess not the code
then again I use ConfigAPI
@dusty herald
You need to make sure you're in the class that extends Plugin
this is what I use in conjunction with that https://paste.lucyy.me/qiwomuyaka
Lucy's Pretty Pastebin
Really, I had forgotten. Thanks
ConfigAPI is for reading only with the exception of copying a file from the jar file to the server
not if you save it š
I so far have good experience with bukkit's API, it however shouldn't be used for writing
like I did in that code
but it cant write
JavaPlugin#getResourceAsStream
With Java 10's (I think that was it) InputStream#transferTo it should be easy to do
ConfigAPI pulls shit from the jar and adds directories and whatnot, makes it a hell of a lot easier for me
saves comments too
anyone know why I'm getting Unsupported class file major version 60 building my plugins on java 16 despite having gradle v7.0.2
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
I have it
sorry misread
it appears your server is not using java 16?
that's when I normally see that error
not running a server
trying to ensure my plugins build. https://paste.gg/p/anonymous/590ac22d9d3e46588ea9d14e35744982
build fails with Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 60 yet I clearly have gradle 7
š¤ I have no idea why it isn't compiling
I'm used to maven sadly, what does your gradle script look like?
So i am having a issue when trying to complie in 1.17 Java 16 on the dependencies.
it tells me the 'complie' on the dependency is not vaild.
show errors please
Java home is likely fucked
problem occurred evaluating root project ''.
Could not find method compile() for arguments [com.zaxxer:HikariCP:4.0.3] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
What does ./gradlew --version return?
I pasted the link
Is there an example I can follow to modify the permissions of BungeeCord's config.yml by my own plugin? Besides this step you sent me.
its set to 7.0.2-all
I have no idea, I've never tried to create a permissions plugin before
But it is possible?
ah sorry, well then some gradle plugin is outdated, likely uses ASM. Try rebuilding with --stacktrace active
oh my JAVA_HOME is not set that might do it
werid tells me its not set right even though in cmd it is right hmmmm
public static HashMap<VariableElement, String> chatColor;
public static void init() {
chatColor = new HashMap();
}``````java
UUID uuid = player.getUniqueId();
Ludicrousy.init();
if (Ludicrousy.chatColor != null) {
Ludicrousy.chatColor.put(uuid, "&c");
}```"uuid" in the last line of the second code block has red below it
(first one is where i set chatColor, second is where i set their value)
(also both of these are two different classes)
ur not talkin to me, right?
ok
what architecture do i need for java 16
What is the point of the āvariable elementā ?
so i can use variables as the key
i'm not sure what a variable element is tho
i thought it's what it sounds
Yea same error
Could not find method compile() for arguments [com.zaxxer:HikariCP:4.0.3] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Nah just use the String
Which stores their uuid
And then you can do Bukkit#getPlayer
you can use uuid.toString() I'm sure
Uuid can be stored as a string
i need a little help downloading java 16
yup it was the shadow plugin. updating to 7.0.0 works
@dusty herald, is creating a folder for my plugin, but I want to modify the BungeeCord's own folder with my plugin
What in particular
its asking for an architecture
UUID.fromString(String) if you need to convert a string to UUID
What model is ur computer
also complete loss there too sorry, I don't like modifying other folders in plugins ):
No problems, thanks
idk which one
Are you on Linux
no
did it and replaced the variable element with string, and also added the <String, String> to the second chatColor define thing, uuid still has a red line below it
windows
Near the bottom
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
š
That also works
what specific error does your IDE show you then, seems like it should be fine
ah it works, thank you
required type: String
provided: UUID
.toString() or cast it
i did do dat doe
Well then it would be a string
apparently, tis' not
Send the line of code with the red line
Ludicrousy.chatColor.put(uuid, "&c");```
That says you are trying to create a UUID from a UUID
oh
you gave a UUID
Anyone know how can i get head with skin value and set it in gui?
Your Map is setup with a String and you are trying to use a UUID
no, i did uuid.toString();
What and it still said that you gave a uuid ?
yee
yeah, no you didn;t
Cause that seems impossible
else if (cmd.getName().equalsIgnoreCase("chatcolor")) {
UUID uuid = player.getUniqueId();
uuid.toString();
Ludicrousy.init();
if (Ludicrousy.chatColor != null) {
Ludicrousy.chatColor.put(uuid, "&c");
}
}```
Learn Java
why are you saving the uuid as UUID if you're just going to turn it into a string?? what that wouldn't even work
š±
how different is the 1.16 code to 1.17 are there many changes
are you able to extend a vanilla entity in order to give it additional fields and such?
Thatās not the best way unfortunately- at least learn basics b4
i put String instead of UUID where the uuid is defined, now it has a red line at the bottom of it :P
you happy joch?
ok sorry that was sassy
So noone has an idea to make gui with custom head value?
What sorry - missed ur message
Np
What do you mean by value
a head with a specific skin?
i think they mean a slot
Yes
I have this value: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGNhYzk3NzRkYTEyMTcyNDg1MzJjZTE0N2Y3ODMxZjY3YTEyZmRjY2ExY2YwY2I0YjM4NDhkZTZiYzk0YjQifX19
I want to use it for gui
Yes i think
the uuid will always be type UUID, when you do
UUID playerUUID = player.getuniqueID()
you are defining a var named playerUUID with TYPE UUID, all variables have types, like int string etc, when you send the player a message (im asuming thats what Ludicrousy is) it turns it into a string
so theres no need to make another variable
i dont see a reason why you would make uuid a stirng
Wait no
Something like this
Ty
you're missing some java basics here. uuid.toString() returns a string so you're still just passing uuid. you need Ludicrousy.chatColor.put(uuid.toString(), "&c") or add some String uuidStr = uuid.toString() call somewhere
no red line, lemme check if it works
U need to pass that the url of an image I think
i was reading about multi config files
and this is the example
would that work just for the config.yml file?
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
Anyone here that has tried to upgrade their Bukkit/CraftBukkit/Spigot development environment from 1.16.5 to 1.17?
I'm getting the following error:
error: sha1 information is lacking or useless (src/main/java/net/minecraft/world/level/World.java).
I run buildtools using java -jar .\BuildTools.jar --dont-update, but have pulled all the master branches manually.
So far I tried to remove the work/ and Spigot folders and have buildtools create it themselves.
Actually, the whole log might be a bit more useful
I don't get it
Get what?
I want to use skin value not url
Sorry
Nah I tried a few times already
Oh i didn't know that
Just google it - there are a million and one examples
byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
So i have to put the skin url in %s ?
What
package com.mojang.authlib does not exist
Yes
I think so
How can i get url from skin value
Iām not an expert
Umm ya donāt
There is another way
I thought you wanted custom heads for a gui
for npc?
For heads
oh nvm
So I provided the way for an image
Yes?
You told me
yes that
Idk what should i ask for but i want to use skin value for custom head in gui
Hi, when I run BuildTools it always fails...
https://hastebin.com/alonomeyan.sql
Wheeee, I can continue my PR work now
Did you run it in a clean directory?
The directory is clean
(1.17) Using Bukkit.createMap(world) is giving me "Cannot read field "mapView" because "worldmap" is null" This worked with 1.16.4 but seems to have broken, and the docs dont suggest anything has changed, any ideas?
I had a simmilar issue, but my build dir was far from clean
There is a recent commit for that
Rebuild Spigot
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
Ludicrousy.init();
if (Ludicrousy.chatColor.put(uuid.toString(), "&c") != null) {
event.setCancelled(true);
Bukkit.broadcastMessage(player + "&c: " + event.getMessage());
} else if (Ludicrousy.chatColor.put(uuid.toString(), "&c") == null) {
event.setCancelled(true);
Bukkit.broadcastMessage(player + "&f: " + event.getMessage());
}
}```this does literally nothing, someone please help
thanks in advance
Kk, thanks
you need to add @EventHandler
and register the event
woah
you have no idea how many times I've screamed at my code because I forgot the handler
now I have a listener template for my dumbass š
all those things give me the error that package com.mojang.authlib does not exist
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
where do put handler
bro
š¤¦āāļø
send code
?paste
go learn the bukkit api
its not hate
Hello and welcome to TheSourceCode,
Here at TheSourceCode, our main objective is to have people learn to code alongside me. We are not professional coders by any means. But we have gained lots of knowledge throughout our years and we hope to share it with you! We hope to teach you something new and we hope you guys teach us something new!
you should watch his tutorials first
TSC is great
try to understand the structure
Wait I might be wrong about that, I can't find it, but I do think I heared it mentioned somewhere
someone?
Mappings
something about them idk
retrooper help pls
so.... it still doesn't work
did you watch the videos i told you about?
anyone know how to help?
something says it could be conflicting jar versions
what are you even trying to do?
I will give it a shot and see what happens
code maybe? or a bit more explained?
public static HashMap<String, String> chatColor;
public static void init() {
chatColor = new HashMap<String, String>();
}``` this is the main class
you want to know how to code without learning how to code
lmao
okay
and this is the commands class
else if (cmd.getName().equalsIgnoreCase("chatcolor")) {
UUID uuid = player.getUniqueId();
Ludicrousy.init();
if (Ludicrousy.chatColor != null) {
Ludicrousy.chatColor.put(uuid.toString(), "&c");
player.sendMessage("§aEnabled chat color!");
} else if (Ludicrousy.chatColor == null) {
Ludicrousy.chatColor.put(null, null);
System.out.println(Ludicrousy.chatColor);
player.sendMessage("§cDisabled chat color!");
}
}```
i know, i'm bad
what doe s Ludicrousy.init();
do
and an listener?
look above
this thing
Love the video or need more help...or maybe both?
š¬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! ā¤ļø
If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!
All code is available on Github:
...
lmao
public class LudicrousyEvents implements Listener {```this is the listener in the events class
that should be LudicrousyListeners
tutorial said to just put it as the file name
well there's very much in there š
so can anyone help?
how can that stupid thing find a repo again? i forgot about it
Does spigot ever publish the changes from version to version?
How do you get a tag from a string?
I want something like this to happen:
Tag<Material> tag = Tag<Material>.fromString(inputString);
Has anyone used NuVotifier as an API?
is there a way to create a hashmap with all values of particle. and set the boolean to a value in config?
like a next or builder
or smth
i dont wanna type every single value
ugh, i love how in 1.16.4 there was no obfucation on objects then in 1.17 there is
I'm getting the classic "plugin has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 52.0" error, how do I downgrade my compiler in eclipse?
(or better yet upgrade the server)
windows
for your server?
yeah
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
much appreciated
is there any special setup needed for building 1.17?
Failed to execute goal net.md-5:specialsource-maven-plugin:1.2.2:remap (remap-fields) on project spigot: Execution remap-fields of goal net.md-5:specialsource-maven-plugin:1.2.2:remap failed: A required class was missing while executing net.md-5:specialsource-maven-plugin:1.2.2:remap: com/google/common/base/Preconditions
Try deleting .m2 and the bt cache
Anyone can get stuff updated and added into spigot right?
no, you need to sign a CLA and yea
pff package net.minecraft.server.v1_16_R3 does not exist
Economy eco = PotFill.getEconomy();```Im getting a Cannot resolve symbol 'PotFill' when that is my main classname
they dont have the version anymore in the package so in example
net.minecraft.server.MinecraftServer
geol: the error changed to .apache.maven.artifact.resolver.ArtifactNotFoundException: Could not find artifact org.spigotmc:minecraft-server:csrg:maps-spigot-fields:1.17-R0.1-SNAPSHOT
The change you mentioned only affects 1.17
Ive got java 16 installed but im getting this error when trying to make spigot 1.17
The version you have requested to build requires Java versions between [Java 16, Java 16], but you are using Java 8
maven or gradle?
Check your JAVA_HOME
are you using eclipse or intelliJ
Ah nvm
im using buildtools, so idk
for some reason this is red
Ye, check JAVA_HOME
8 might be set still
I unistalled 8 fully and updated JAVA_HOME
no need for 8 anymore tbh
So how does one apply to help with spigot?
I don't know what I did, but anytime I build the plugin jar it only has the Spigot API
I've tried resetting the artifact settings and it still does it
What are you building it with?
bruh just changing spigot-api to spigot saved all my issues
Build Artifact in IntelliJ
Welp, nothing I can help you with either maven/gradle or bust
?paste
i'm trying to update my stuff to java 16 but i have this weird ass error where tools.jar seems to be missing
considering i have the jdk, not jre. I have the environment variable set to my jdk 16.0.1 directory, and i have my intellij updated to 2021.1.1 i really dont know how to fix this bug any more
did you update the project jdk and gradle setting jdk in intellij?
you mean setting the project sdk to something like openjdk 16?
gradle settings i havent checked out yet sec
although by the way tools.jar is actually physically missing from my jdk directory which i dont think should be the case?
hmm maybe 16 doesn't have it?
but i have 16?
16 yea sorry
and another guy i asked did say he did have tools.jar so im just very confused
you using java or OpenJDK?
although one website did say tools.jar shouldnt be there any more after java 9 but then why do i get the error that tools.jar is missing when compiling
isnt openjdk a version of java
my understanding its a bit diffrent
i tried it with other installations of java as well and same results
What does java -version say?
mhh weird
that's be work? I don't know something about new PacketDataSerializer in 1.17.
final ByteBuf buffer = Unpooled.buffer(6);
PacketDataSerializer pds = new PacketDataSerializer(buffer);
PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam(pds);
https://www.javahelps.com/2021/03/install-oracle-jdk-16-on-linux.html
This article helped me alot while installing
that would indicate its a jre instead right
or does it always say that when you do java version
Here is a new one for me
[Fatal Error] HikariCP-4.0.3.pom:2:10: Already seen doctype.
Trying to shadow jar a build and it fails
u using Windows Server?
yeah
Ahh the article is for Linux whoops
i could just try to reinstall the jdk again and see if that works
although it kind of appears like the jdk im trying to install is actually an jre judging by the way it acts
hmm weird
guys wat tf is this error...? i literally can't do anything wit my project
no errors in buildpath
all i did was swap out luckperms jars version 4 to 5...
im just trynna switch api versions ._.
did you update the build path/analyze dependencies
there should just be a button for analyze dependencies either in a menu or when right clicking idk
i havent used eclipse in a while
or just remove and re-add the dependency
i mean theres refresh but it didnt do anything
i removed luckperms entirely... still showing same error o_o
did you add it back in yet
no...
like
it should be throwin errors about unknown imports...
read th error message its weird af, wtf is an included .class file?
right now its throwing that error because it cant find the dependency you're trying to code with, removing the dependency shouldnt change that
ok added it back... same error
bruh this isnt the right error :I
something else's fucked up
oh ok
@hushed spindle ok i figured it out... i added th old version back in & it works cuz they changed the import
but
like
why cant it show me normal errors taht i can click on? -_-
could be a jar import issue or an eclipse issue
i click on that error msg & it sends me to line 0 which is a fucken comment...
yea nothings working rite 4 me today -_-
ill just have 2 find errors manually scannin files 4 red underlines
fml
Does anyone have a sample of using shadow jar 7 and gradle 7 with java 16?
can not get figured out
no but i swear 2 f***ing god i hope ur having better luck wit this java16 bullshit than i am
its fuckin hell bruh
how to change "tab" menu?
whoevr decided java16 was a good idea @ mojang needs 2 b thrown in max secorety prison
/rant
I had no issues getting the code setup for java 16, its just the gradle is my issue. So much changed
-_- rub it in will ye
istg i woulda broken somethin in me room rn if i didnt ahv a 4wk old cat in me lap š¤£
im just havin weird ass errors where the jdk is acting like a jre so i cant actually compile anything
oh dam ;-;
time to uninstall some stuff
geol: wiping the work folder ended up fixing it. somehow.
Do you have a sample of using a shadow? I am trying to use it and i am getting some werid errors
the only change I had to make when I updated to v7 is changing compile to implementation in gradle.build
did you have a node like this?
id "com.github.johnrengelman.shadow" version "7.0.0"
dependencies {
include('org.slf4j:slf4j-api')
include('org.slf4j:slf4j-log4j12')
include('log4j:log4j')
include('com.zaxxer:HikariCP')
include('mysql:mysql-connector-java')
}
}```
no I exclude
I don't know what I did, but anytime I build the plugin jar it only has the Spigot API
I've tried resetting the artifact settings and it still does it
IntelliJ
are you using build artifacts or mvn
Build Artifacts
your plugin doesnt export spigot
I built another plugin before and it was fine
spigot is a provided thing
it shouldnt have to export it
considering ur putting it on a spigot server
Okay, but how do I make it build the jar with my code?
yea cant get shadow to work
build artifacts will do that for you
you created a new jar empty with dependencies right
What
for your artifacts settings
Also, How do I fix this problem? ```
[ERROR] /C:/Users/eirik/IdeaProjects/Movecraft/modules/v1_17_R1/src/main/java/net/countercraft/movecraft/compat/v1_17_R1/IWorldHandler.java:[20,39] cannot access net.minecraft.world.le
vel.chunk.ChunkSection
[ERROR] bad class file: C:\Users\eirik.m2\repository\org\bukkit\craftbukkit\1.17-R0.1-SNAPSHOT\craftbukkit-1.17-R0.1-SNAPSHOT.jar(/net/minecraft/world/level/chunk/ChunkSection.class
)
[ERROR] class file has wrong version 60.0, should be 55.0
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath.
Happens to multiple classes
Tried changing the SDK to jdk 16, with no luck
You might need to update the compile target to 16
Since you are now binding into Java 16; a Java 11 compiler might not be able to understand J16 bytecode
So no one has any idea about shadow jar error:
[Fatal Error] '': Already seen doctype.
is there a way to ```java
getConfig().containsignorecase()
anyone know how i go about making player heads in guis load instantly? I tried adding them to a hashmap running async before the gui is opened but still no luck :/
what the f...
https://imgur.com/kQ4nJ7F
your problem is the repo's you specified. We would need to see your gradle build script to see why that may be the reason
cannot access net.minecraft.network.protocol.Packet
how i can fix this?
you are referencing the incorrect place for that class
while you might see that class in that location in the minecraft jar, in the server jar for spigot it is simply located in net.minecraft.server.(version).Packet
i.e?
Why shadowJar.include that? Implementation will automatically be shaded
Not the latest
Will Implementation include it in the jar build?
For shadowJar yes
Same errors still removing the shadowjar node
was it moved?
Whatās the error doccode
[Fatal Error] HikariCP-4.0.3.pom:2:10: Already seen doctype.
[Fatal Error] slf4j-api-1.7.30.pom:2:10: Already seen doctype.
Frostalf I believe they just ended up not using spigot mappings
Yeah switched to the mojang ones iirc
well that isn't part of spigot mappings
Tbf no clue I just know net.minecraft.server.version isnāt a thing in 1.17
ah so they stopped with the versioning of NMS
Yup from what I understand
which is great
well then its located in net.minecraft.server.Packet
help
unless they stopped with the relocating files as well
Those errors tell you anything @ivory sleet
DocCodeSharp do you use maven and gradle?
If I added custom NBT tags to an item, would they not show up in something like NBTExplorer?
the error you are getting is because of the maven repo's some how your maven repo url's are incorrect
if you on 1.13+, you can use /data get
1.8
oh.....
DocCodeSharp remove the dependencies in shadowJar
same errors
It shouldnāt be needed also did you declare the right repos?
@gaunt hatch https://jolbox.com/ is no longer a valid maven repo
@gaunt hatch also you specified jolbox twice
not that it matters anymore since its not valid anyways lol
yea i never saw that hahaha
Like you declared mavenLocal(), add mavenCentral() also
Yep
there you go, told you it was maven repo related š
Whenever u wanna declare a repo url mavenCentral is crucially needed
i remeber that in gradle 6 and it throw the biggest fit
now you know when you see doctype seen errors, its maven repo related š
Thank you
Yes i do, 15 years of coding and never seen that one error before. Seen it say like not found in the repo but that one was new
Yeah didnāt know it was considered a fatal error lol
what it actually means is that it attempted to look for it, but wasn't getting the correct document page for the repo where it should search
the best part o googles that error and i found NOTHING!! saying that lol.
Spigot help-development > google 
woo install is gone on gradle 7
https://discuss.gradle.org/t/apparent-dependency-resolving-problem/2004
@gaunt hatch go to the bottom user has it explained
Hello, During resolving dependency of āorg.apache.axis2:axis2-ant-plugin:1.6.1ā (and happens with others too) several fatal errors (see below) are shown by gradle (milestone-9). Despite that fresh downloads and the build is reported to be successful. There were no such things earlier. The closest thing I could find is: http://gradle.1045684.n5...
Frostalf do you use gradle or maven btw?
Maven
š
how to compile project artifacts like maven install?
what does this mean?
Vote listeners can be compiled by including Votifier in the class path. For example:
javac -cp Votifier.jar FlatfileVoteListener.java
Can't figure out on how to do it with intellij
gradle had install in 6 seems its gone in 7
if i'm compiling with maven i got this:
cannot access net.minecraft.network.protocol.Packet
Anyone have any ideas on what I did wrong here? Or, if I did anything wrong? NBTExplorer doesn't show the custom NBT tag.
private static void createBluePants() {
ItemStack itemB = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta meta = (LeatherArmorMeta) itemB.getItemMeta();
meta.setColor(Color.BLUE);
meta.setDisplayName("§9Fresh Blue Pants");
meta.spigot().setUnbreakable(true);
List<String> lore = new ArrayList<>();
lore.add("§7Kept on death!");
meta.setLore(lore);
itemB.setItemMeta(meta);
net.minecraft.server.v1_8_R3.ItemStack nmsLeatherLeggings = CraftItemStack.asNMSCopy(itemB);
NBTTagCompound leggingsCompound = (nmsLeatherLeggings.hasTag()) ? nmsLeatherLeggings.getTag() : new NBTTagCompound();
leggingsCompound.set("KeptOnDeath", new NBTTagString("true"));
nmsLeatherLeggings.setTag(leggingsCompound);
CraftItemStack.asBukkitCopy(nmsLeatherLeggings);
freshPantsB = itemB;
}
as I stated earlier obviously it is looking in the wrong place. So first lets get some more information, what mc version are you compiling for?
NBTExplorer entry for it
1.17
alright, is the plugin you are trying to compile even for 1.17?
or whatever it is you are depending on
if not, then your issue is a mis-match in versions due to NMS being different between 1.16 and 1.17
critically. I know
Well that sucks them removing maven from gradle 7 removed alot of key features they have not added back. That is a bad choice
How using nms ItemStack with spigot 1.17, I didn't found the class net.minecraft.server.ItemStack ?
1 second
net.minecraft.world.item.ItemStack
yup, it is
More complicated in 1.17 than 1.16
its better tbh
Oh no
cause the removal of nbt version any future update you do not have to worry about where it changed. If they keep it that way that is
I just stick with Maven. Mainly because if I need some kind of custom functionality I am free to add it with custom Maven Plugins š
š«. Good luck.
Yea the obvustion in 1.17 went backwards alot where in 1.16 it was great. it sucks now seems like the patchs did not update the objects the same
frostalf, any suggestions?
leggingsCompound.set("KeptOnDeath", new NBTTagInt(1)); can't see the tag when I have this, either
I assume they will fully transition the mappings eventually
Yea lol now i am stuck trying to find a way to update the local repo with my changes for core plugins. ugh!!!
~20% of my API-code was killed by new 1.17 NMS
if the import is correct, then either you don't have the correct dependency or your IDE just isn't picking it up.
i show my maven
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>system</scope>
<systemPath>C:/Users/Aniby/Desktop/BuildTools/spigot-1.17.jar</systemPath>
</dependency>
+<plugin> from 1.17 announcement post
why do you set a classifier tag?
instead of using a system scope tag, why not just install the server jar into your local maven repo instead?
shouldn't change anything, just looks better doing it that way is all
parse the message for numbers
In particular you may only use the mappings for development purposes. This means that you must only use the remapped-mojang jar for development and must remap your plugin prior to distribution.
From
https://www.spigotmc.org/threads/spigot-bungeecord-1-17.510208/
then why this no work
if(!(isNumeric(args[1]))) {
plr.sendMessage("Please type a number!");
return true;
}
float xp = Float.parseFloat(args[1]);
float curXp = plr.getExp();
plr.setExp(curXp-xp);
public static boolean isNumeric(String strNum) {
if (strNum == null) {
return false;
}
try {
double d = Float.parseFloat(strNum);
} catch (NumberFormatException nfe) {
return false;
}
return true;
}
gives me an NPE on plr.setExp(curXp-xp);
i use it like this.
are you converting String to Float and writing to double
use Doube.parseDouble()
use float instead double in try?
holy shit
thank you
lol
i copy pasted this from a website that used doubles
guesse i forgot to change that
NumberUtils.isCreatable(String)
from Apache Commons which is shaded into spigot, that method checks if the string is a number of any kind
idk what i should do with cannot access net.minecraft.network.protocol.Packet
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html
Am I crazy or is nothing displaying after LEGACY_STONE in the Material javadocs?
declaration: package: org.bukkit, enum: Material
@wet breach all im seeing is NumberUtils.isNumber
All LEGACY_... is deprecated
and its deprecieated
you shouldn't use it
that's not what I'm asking here
should tell you if there is an updated method then
seems apache commons might have updated their methods for such things lol
it is just you, there is more after that
try refreshing
refreshed multiple times, this is what's showing at the bottom of the list
numberUtils is deprecieated?
@somber hull not from what I can see it isn't
lectern is the last non-legacy one that shows
@lilac valve
ZOMBIFIED_PIGLIN_SPAWN_EGG should be the last thing on that list
I need any help with it. It wouldn't compile
cannot access net.minecraft.network.protocol.Packet
yeah idk if chrome is having issues displaying all of the elements, I can see a link to zombified_piglin_spawn_egg if I hover over the gray space to the left of the last deprecated
@wet breach there is StringUtils with isNumeric
that should work too
wait, but i still got an NPE
on here
plr.setExp(curXp-xp);
omg
leme see if im dumb
then in that case probably should validate the inputs on top of insuring you are not subtracting from 0 when a player doesn't have xp š
as well as making sure that the xp specified isn't larger then what the player has, otherwise you end up in the negatives as well
public static ItemStack createItemByte(Inventory inv, int materialId, int byteId, int amount, int invSlot, String displayName, boolean hideFlags, String... loreString){
ItemStack item;
List<String> lore = new ArrayList();
item = new ItemStack(Material.getMaterial(materialId), amount, (short) byteId);
ItemMeta meta= item.getItemMeta();
meta.setDisplayName(Utils.formatChat(displayName));
for(String s : loreString){
lore.add(Utils.formatChat(s));
}
if (hideFlags){
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_POTION_EFFECTS);
}
meta.setLore(lore);
item.setItemMeta(meta);
inv.setItem(invSlot, item);
return item;
}
}```Im getting a null pointer exception on this line invslot is = to 15
i am so not a fan of this update lol now i cant get maven-publish publishToMavelLocal() to work lol
Guess this is one of the few times where maven wins š
well I mean, can't really beat it just works most of the time
only times I have ever had problems with maven, is when some maven plugins had difficulties updating to new java versions
so previously in 1.16,
import net.minecraft.server.v1_16_R3.WorldServer;
was the way to grab the WorldServer import, however in 1.17, there isnt any version to grab there anymore, and im not finding any sources on any changes š
i see an alternative method that uses
import net.minecraft.server.level.WorldServer;
however im not sure if it references the same way. simply, i'm just trying to use addEntity(world)
That is correct
"This being said there are some important changes to NMS this release, namely that all fields have been reverted to their obfuscated form. This, along with the repackaging of NMS, are crucial steps in the highly requested process of transitioning to using the so-called 'Mojang Mappings' for development of Spigot itself."
See 1.17 post
The Mojang Mappings use server.level so it's not updated every version
Is there a way to disable player skin (so it shows steave or alex) without changing the name?
gotcha š
I saw some old post on bukkit about that and had something to do with packets
i wonder why they changed it like that and it went back to there obfuscated form.
I mean
It says
** This, along with the repackaging of NMS, are crucial steps in the highly requested process of transitioning to using the so-called 'Mojang Mappings' for development of Spigot itself."**
You can catch the packets that update the skin from the multiplayer minecraft servers and prevent them from making it but that would suck to do
yea but how is obfuscated object mojang mappings?
I found a critical issue with the new spigot release! Where do I report it?
?bugs
I feel a step that could have waited till it was compelted, but that is just me š
Darn
Just report it on the forums
No no
?Bug
oh right the pain of jira
i am stuck on getting publishing to work lol
I'm just laughing at how fast some of us plugin devs are updating their plugins considering it's been out... not even 24 hours
just ready to get on the grind yakno
Honestly messing with java 16 took the longest
just to avoid the sprawl of "pLz 1.17 sUpPoRt" i think it's worth it
Needed to jump to the beta 21-06 build of eclipse for java 16
Considering I've been working in Java 16 since it came out it wasn't to bad for me to fix up my few plugins
How would I search for a specific NBT tag in an item?
items are a little harder iirc, because the NBT's get wiped as they get picked up iirc...
may be confusing it with something else
The entity nbt will be
https://www.spigotmc.org/threads/tutorial-the-complete-guide-to-itemstack-nbttags-attributes.131458/
this may help
But not the itemstack
Only if the item and command or whatever are in the same class
I'm trying to make it so that when a player dies, their inventory is searched, and if they had an item with the custom NBT tag I added, then the item would be right back where it was
Like keep inventory, but only for one or a few items
NBTItem#setString(String key, String value)
NBTItem#setInteger(String key, Integer value)
NBTItem#getString(String key)
NBTItem#getObject(String key)
or
NBTItem#getKeys()
Which will return a Set<String> of all keys, which will be easy to iterate through.
stated by Oscaaz in thread: https://www.spigotmc.org/threads/get-all-nbt-tags-created-by-my-plugin.392133/#post-3529416
NBTItem isn't a thing
I was thinking check the item for the NBT tag
Because it's the same every time
Unless it's not there
anyone use maven-publish before to copy to local?
if(is.getItemMeta() is what I have right now, I can't process what would go after that
ah gotcha
if (proj.hasMetadata("Poison")) {
damagedEntity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 80, 1));
}
just something i grabbed rq
i'll show you how i applied the poison
if (ability == "PoisonShot") {
proj.setMetadata("PoisonShot", new FixedMetadataValue(plugin, true));
plugin.masterCD = 8;
plugin.cooldowns.put(PoisonUUID, plugin.masterCD);
ability = "None";
}
so whenever the item is generated, use the setmetadata line, put "Soundbound" or something
then read .hasMetadata("Soulbound") when you iterate through the table on your itemstacks
the quick and dirty way i can imagine saving it to the same exact slot position would be to write over the same metadata, like "Soulbound 27", then set it to slot27 and write it back to Soulbound
string comparison is done using String#equals not ==
This is what I have for generating the item
private static void createBluePants() {
ItemStack itemB = new ItemStack(Material.LEATHER_LEGGINGS);
net.minecraft.server.v1_8_R3.ItemStack nmsLeatherLeggings = CraftItemStack.asNMSCopy(itemB);
NBTTagCompound leggingsCompound = (nmsLeatherLeggings.hasTag()) ? nmsLeatherLeggings.getTag() : new NBTTagCompound();
leggingsCompound.set("KeptOnDeath", new NBTTagInt(1));
nmsLeatherLeggings.setTag(leggingsCompound);
CraftItemStack.asBukkitCopy(nmsLeatherLeggings);
ItemStack ItemB = CraftItemStack.asBukkitCopy(nmsLeatherLeggings);
LeatherArmorMeta meta = (LeatherArmorMeta) ItemB.getItemMeta();
meta.setColor(Color.BLUE);
meta.setDisplayName("§9Fresh Blue Pants");
meta.spigot().setUnbreakable(true);
List<String> lore = new ArrayList<>();
lore.add("§7Kept on death!");
meta.setLore(lore);
ItemB.setItemMeta(meta);
freshPantsB = ItemB;
}
yeah its an outdated line. but never threw errors at me so lol
yes it won't error, it may just not work at all
it definitely works
may just be one of those things where its soon to be depreciated
it works because you are lucky you are hitting the string cache twice here.
Is there any way to put an NBTTag onto an item that only has a name?
This is not how string comparison is supposed to be done and is just straight up bad style
^not disagreeing
okay xD
wdym
like a default itemstack?
maybe you are calling it on a string xD
Which mappings does spigot use for their minecraft server patches for 1.17?
I forgot to delete the old thing lol
server.level
internally spigot still uses spigot mappings
thx thought so š
maybe, just maybe, 1.8 is outdated and a pain to work with
tbh anything 1.13+ should just stick to PDC for these things btw
idk if that is applicable to you fatul
Iām not sure if this is the right place to ask, but I am trying to figure something out and need some higher up help. Iām trying to figure out how to disable vein miner for one specific player, and canāt figure out a solution (if there is one) can someone help me?
just trying to update my 1.16 PVP plugin to 1.17
still pretty confused with the mappings
you'll have to depend on the veinminer.jar and figure out how to capture when they try to veinmine
for example in usage of saber factions:
oh god the main is named Main
yeah haha
its my first plugin, but ive been working on it on and off for 2-3 years
lot of old stuff mixed with new
why is there an eventhandler in the air?
OMG YES!!! I got it to publish
For anyone having issues
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
repositories {
mavenLocal()
}
}
See Iām not well experienced in writing scripts. Iām learning to code but am brand new to it. Would I have to use something like the āscriptā plugin? And then disable veinminer for that specific player?
Does an event need an init?
Okay
i would recommend watching a few tutorials, it doesn't take much, you'll need to understand events at bare minimum like what i was talking about just now
CodedRed and TechnoVision on youtube have good sources of learning
you can think events as an action in the game
like BlockBreakEvent
BlockPlaceEvent, etc
Okay thank you man I appreciate the help, I will look at some videos and try to figure it out, thanks man
yw
i do it little differently
Why do Phantom and Slime not have a base interface called like "Sizeable"
public interface Phantom extends Flying {
/**
* @return The size of the phantom
*/
public int getSize();
/**
* @param sz The new size of the phantom.
*/
public void setSize(int sz);
}
are you referring to the different size stages of slimes?
public interface Slime extends Mob {
/**
* @return The size of the slime
*/
public int getSize();
/**
* @param sz The new size of the slime.
*/
public void setSize(int sz);
}
wth is the point of this
they felt like trolling
Cloning the item that is supposed to be kept should be safe, right?
How would I get the inventory slot it was in and put the item there?
auto import them
they dont use the v1_16_R3 stuff anymore
they just completely changed the package names
yeah i just didnt see it fall under the drop down list anywhere
^
(unless you use the Mojang maps)
yeah your right lmao
i did lose 2 of them in the process though
i guess GoalHurtByTarget and GoalSelector arent in anymore?. nope nevermind. its inside, goal.target
any info on other repositories besides maven central?
they arent supported
you have to handle that yourself
I recommend https://github.com/SlimJar/slimjar tho
for that case
if spigot already loads them from maven, what stops us from using it to load from literally different URL?
Wow, thats actually nice š¤
why use some 3rd party library just for that
if it has most of it under the hood already
Yeah it is
it can append to classloader in java 16 using agents, use a jarinjar loader
install, relocate, check hashes
for dependencies
a ton of stuff
noice, thanks for that
np
Uhhhh
I have a server that sends a PluginMessage to the bungeecord, is there a way that the Bungeecord can detect which server sent the plugin message?
not without the plugin sending that message putting the server in the message afaik
bru
how would I put the server on the message if I don't have that info
is there a plugin channel?
did you make the plugin that sends the message?
How can I check if an entity is x amount of blocks away from the ground?
just get the server name and apply it to the message?
uh yes, get the sender and get their server
I believe you should be able to get which server sent it, since pluginmessage channel uses a players existing connection to work
and MD_5 responded
oh nvm
event.getSender().???
md_5 the king
compare the block.getLocation.GetY with entity.getLocation.GetY
what does Player#setMaximumNoDamageTicks do? all the javadoc says is it "sets the maximum no damage ticks" which is really helpful
well
md_5
nodamage ticks are like when you respawn or spawn in, you can't be damaged. Use this to increase the time in ticks for how long they should have no damage
ah ok, I just keep seeing it where attack speed is changed (to be made smaller), so I'm really confused
it is probably used in other places
public static List<Block> getBlocksBelow(World world, Location startLoc) {
List<Block> blocks = new ArrayList<Block>();
int startY = (int) (startLoc.getY());
int endY = (int) (startLoc.getY()-255);
for (int y = minY; y <= maxY; y++) {
blocks.add(loc.getBlock());
}
return blocks;
}
World world = entity.getWorld()
List<Block> blocks = getBlocksBelow(define World as a variable wherever you use this, Entity.getlocation());
for (Block block : blocks) {
if (block) {
isGround = true
}
}
shit i misread it again
he wants to know WHEN an entity is amount of blocks away
š¤¦āāļø
can someone ask me about what I asked?
yes?
can you be more specific
oh your the same guy from earlier lol
5:03 PM] md_5: uh yes, get the sender and get their server
Jadss maybe give me a little recap
Why does playerdeathevent e.getEntity.getKiller return null?
@EventHandler
public void onDeath(PlayerDeathEvent e) {
System.out.println("Died");
if (e.getEntity() instanceof Player) {
Player p = (Player) e.getEntity();
System.out.println(p.getKiller());
if (p.getKiller() instanceof Sheep) {
if (p.getKiller().getPassenger() instanceof FallingBlock) {
System.out.println("Passenger flyinblock");
Sheep sheep = (Sheep) e.getEntity().getKiller();
e.setDeathMessage(p.getName() + " was slain by Dirt.");
}
}
}
}
sysout p.getkiller returns null
he wasn't killed by a player then
^
PlayerDeathEvent only registers when you get killed by a player??
yup

That moment when WE is not updated and you are thinking of just grabbin the code and updating it yourself
@fierce barn how would I go about cloning and giving that item back to the user, now?
I mean ItemStack implements Cloneable
Tho, is deathmessage modifyable in entitydeathevent?
unsure
item.clone()
SHt yea thats what I need to do
I should have said giving it back to the user
need to check if player was killed by a sheep with certain conditions
and then modify the death message
ItemStack clonedItem = new ItemStack(item.clone());
player.getInventory().addItem(clonedItem);
i believe
as far as putting it back in the same slot, you'll probably have to wiki that one. i cant give an easy answer rn
I've looked at about 20 different threads already
i'll see if i can help then
you dont need to create it new
After it gets deleted?
does 1.8 have this?
getItemā(EquipmentSlot slot)
Well, it doesn't have item
I think Fatul might reconstructed the clone to avoid CraftItemStack implementation but yeah that should work
And when I use ItemStack.clone() it gives me, cannot be referenced from static context
yeah its an instance method
Can't use item, though
oh
but you probably arent even looping for the item yet are you
and does it find the soulbound item?
?paste your code
Is there any possible way to modify a death message when player gets killed by an animal or any other entity under EntityDamageEvent?
yes by the death event
Yea but playerdeathevent works only if a player kills you
it always returned null when a sheep killed me
Yeah Nuxoria, technically you could just nullify the message in the death event and then use EntityDamageByEntityEvent to send the messages
did you check to see if it actually found the KeptOnDeath meta yet?
call invItem.clone() I assume
also getItemMeta()#equals(String) will always be false
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Inventory inv = player.getInventory();
event.getDrops().clear();
for (int i = 0; i < inv.getSize(); i++) {
ItemStack invItem = inv.getItem(i);
if(invItem != null) {
if (invItem.getItemMeta().equals("KeptOnDeath")) {
player.sendMessage(ChatColor.PURPLE+"Found Soulbound item!");
player.getInventory().addItem(invItem.clone());
return;
}
}
}
}
}
check if it'll send you a message to that step first
just to verify
also
player.getInventory().addItem(invItem.clone());
should work
So I should just check under playerdeathevent if killer is not player and then nullify it or wha? Cuz thats the only method from deathevents that have deathmessage method
its like PINK and DARK_PINK or smtng
nvm
Yeah I guess, it depends on how you want it to be
yeah just try that
remove the chatcolor though if you want lol. forgot to change it
tho still invItem.getItemMeta().equals("KeptOnDeath") is always false
oh it's not about that, just that you cant compare an itemmeta instance against a string
or I mean you can but they will never be equal
How can I fix that?
Well what are you trying to do?
Check if the item has the KeptOnDeath NBT tag
i showed him a method earlier but the crux was that hasItemMeta compares a string
which wasnt valid in 1.8 so it led here
none
so either go with nms or something like nbt api
Using nms for making the custom tag on the item, how would I use that to check the item?