#help-development
1 messages ยท Page 100 of 1
and it works
but then when i do that a second time
it doesnt work/the server crashes
lmao im compiling a gradle plugin right now cause i have the source code. ive never used gradle before so what configuration should i add here?
Why not?
Gradle
Windows
I've deleted worlds while the server was running before.
and what here?
im using linux
Windows allows applications to delete files that are in use.
does the plugin use shadowJar?
is that like a gradle thing or smthng?
For example, my IntelliJ automatically copies my build jars into the plugins folder, even if the server is running.
Hm, explorer sure as hell does not
either shadowJar or build as command
linux allows for deletion in cases where windows doesnt
i'm wondering why i can still query to my sqlite database while the file is deleted?
Yeah, users can't really manually do it afaik, but software definitely can.
how tf does Component work in 1.19 NMS Remapped?
does anyone know why ACF's registerCommand is suddenly printing a AuthorNagException, although it never did so before? https://paste.jeff-media.com/?a5b33120f39ff3d8#GM2uMSTigcRdEiYqfE5UecEQLbYeY6Rw9YhEdzSNCQ1
Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.
yes thats what i thought
what class do you mean? net.minecraft.network.chat.Component?
isnt that an interface?
well NMS ArmorStand requires Component for its name
but there isnt any TextComponent/BaseComponent
you usually use a MutableComponent, e.g. Component.literal("my name is jeff")
alright i think it kind of worked, now any idea where that gets compiled to? lmao
project directory/build/libs/ iirc
what results? the stacktrace?
Thanks ๐
Seems like it wants you to use Timings.of instead of new CustomTimingsHandler?
but I dont use any timings
Hi, I have a problem with my code. I want to cancel event when a player doesn't have the permission I want but it doesn't work here's my code
(I don't get any message in my chat since I have to get one and the debug message)
I just do acf.registerCommand(myBaseCommand)
@EventHandler
acf bug maybe?
and 0.5.1-SNAPSHOT is the latest ACF version
I thought that using acf-paper should work fine on paper lol
It kinda looks like it's Nagging itself lol
and respect java naming conventions
OOOH yeaaah I really need to sleep lmao
oh
well here's the stacktrace
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
For sure it's working now, thank you ๐
Well then I've ran buildtools and taken -api out of the artifact ID
It still doesn't work.
it's still like this, and with -api, CraftItemStack doesn't exist
you need to run BuildTools to get 1.17.1 spigot.jar
WorldCreator worldCreator = new WorldCreator(worldName);
getServer().createWorld(worldCreator);```
I did
doesn't look like you built the correct version
java -jar BuildTools.jar --rev 1.17.1
i wanna avoid DataHolder.something isntead i want something
btw think about using "mojang mappings"
class would have to be static right?
you can just static import the something method
import static my.package.DataHolder.something;
mfw package in package 
are you sure you're using the proper remappings?
w/ BuildTools ran with --remapped
also using md5 Maven Build
?paste your full pom.xml
ooh I forgot to change that build thiiing
in lines 36, 38, 51 and 52 use 1.19 instead of 1.18.1
I just copy pasted it from my other project
btw you manually changed the outputDirectory in line 53
that's not a good idea
you should use the maven-jar-plugin to change the final output .jar
aaand why isnt that good?
like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<outputDirectory>C:\mctest\plugins</outputDirectory>
</configuration>
</plugin>
because you might have other goals / executions / plugins that alter the .jar made by the specialsource plugin
only the maven-jar-plugin should be reponsible for moving your final .jar
right thx.. changed it
perfect :3
put ! before this
your world folder has a "session.lock" file
try shutting down the server, remove that file, then see if it now works
i know
im trying to do this without shutting down the server
yeah so where does it come from if the world isnt already loaded?
k so
after a server restart everything works fine
i unload world
i load world
(it works)
i unload again
load again and Exception
after unloading/loading once i can restart server and it works once more
but the second time it always fails
that's weird
[20:20:38 INFO]: unloaded
[20:20:43 INFO]: Preparing start region for dimension minecraft:map
[20:20:43 INFO]: Preparing spawn area: 0%
[20:20:43 INFO]: Time elapsed: 93 ms
[20:20:43 INFO]: loaded
[20:20:47 INFO]: [Multiverse-Core] World 'map' was unloaded from Multiverse.
[20:20:47 INFO]: unloaded
[20:20:52 WARN]: [Plugin] Task #10147 for Plugin v1.0-SNAPSHOT generated an exception
java.nio.channels.OverlappingFileLockException: null```
what's the difference between spigot-api and spigot?
the api only contains the api
the other one contains the whole server source code
including the implementations of the API (CraftPlayer, etc) and the NMS classes (ServerPlayer, ...)
hmm wondering, in a deque or any doubly linked list, is the head the tail if theres only one elem?
I would assume so
I see. The API is... just everything on the javadocs?
exactly
mhm
i see ty
basically the spigot API are only "interfaces", no implementations whatsoever
okay so deleting session.lock just before loading fixed the issue
i still have no idea why it was even an issue in the first place
wait nvm
What does running BuildTools actually do?
yea pretty sure it only exists because spigot is not allowed to give you a direct download link to it
due to legal issues iirc
Yeah you're not allowed to distribute Mojangs code
Does anybody know how I can do something to every class that extends a specific kit?
What I want to do is to put every Class that extends the class Kit in a list. Does anybody know?
its not impossible to do, but yeah, to avoid reflectively getting them, add some registration
I wrote a tiny post to clarify it https://blog.jeff-media.com/bukkit-vs-spigot-api-vs-craftbukkit-vs-spigot/
isnt reflection for registering stuff acceptable?
since it only happens once on startup
its just gross
you shouldn't need to reflectively get all extending classes for a kit plugin, when its likely all in their project anyways
sounds like a fucked up design but easily possible
- get all class names from your plugin .jar like this https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/ClassUtils.java#L122
NOOOO
- Class.forName them
- check if those class extends your other class
Don't do it
make them just use a registry
- Rethink your life choices and dont do it
I see, thank you
?paste
PaperAPI has it though ๐
yeah but they asked for spigot ๐
the nms class is called net.minecraft.world.entity.ai.goal.Goal
Thanks
i just wrapped it (goals, navigation control, ...) in interfaces myself so I can use it "without NMS" on spigot-api: https://github.com/JEFF-Media-GbR/JeffLib/tree/master/core/src/main/java/com/jeff_media/jefflib/ai
Avoid writing the same code over and over again - use JeffLib for your Spigot plugins! - JeffLib/core/src/main/java/com/jeff_media/jefflib/ai at master ยท JEFF-Media-GbR/JeffLib
It may be ugly but I was too lazy to call register on like 70 classes
No
well
yeaa i once had a plugin where i had to register like 80 classes too. i used annotations there
and just found all annotated classes
and if you have NMS questions, people here will answer it
but there are no javadocs or anything for NMS
you can do that if you use spigot, of course
which one I sent you isnt a class
the GOal thing?
as I said, spigot-api does not include any NMS
It's not in the api
you have to use spigot instead of spigot-api
I literally wrote a blog post about spigot vs spigot-api like 10 minutes ago lol https://blog.jeff-media.com/bukkit-vs-spigot-api-vs-craftbukkit-vs-spigot/
no
unless you're on an extremely old version
what version are you using?
run buildtools
then read this pls: https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
no
the blog post wouldnt have 100 lines of text if that'd be all you need
time to use maven then
Gradle?
Then you have to run the specialsource plugin manually
why?
Or learn how to make ant run arbitraty jar files over your build
Okay then you gotta translate the specialsource plugin part into some kind of โexecโ thing that runs it manually
Its explained in the 1.17 announcements how to run it manually
You can also use the obfuscated names if you prefer that
But then your code will break on every update
And methods woll be called โaโ, โbโ, etc
still dont rlly understand why mojang obfuscates at all
https://stackoverflow.com/questions/1965055/pass-a-command-line-argument-to-jar-in-an-ant-script you can use this to run the specialsource jar directly
only to release a map
Size
does it rlly make that much of a difference?
Or zip discs for those who were old enough to still remeber those lol
most ppl got terrabytes of storage
It may also be a legal thing to help protect copyright?
sweet christ lol
idk
You should rather use the one from your maven repo
1 sec
the .jar you should use is
~/.m2/repository/org/spigotmc/spigot/1.19.2-R0.1-SNAPSHOT/spigot-1.19.2-R0.1-SNAPSHOT-remapped-mojang.jar
or 1.19 or whatever
don't forget that you still must remap it manually after you compiled your .jar
second post, headline "NMS"
basically, download this https://repo.maven.apache.org/maven2/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar
and then run this (with 1.17 adjusted to your actual version) on your .jar after you compiled it:
java -cp $HOME/.m2/repository/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT-remapped-mojang.jar net.md_5.specialsource.SpecialSource --live -i $PLUGIN.jar -o $PLUGIN-obf.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-mojang.txt --reverse
java -cp $HOME/.m2/repository/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT-remapped-obf.jar net.md_5.specialsource.SpecialSource --live -i $PLUGIN-obf.jar -o $PLUGIN.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-spigot.csrg
or switch to maven and let it to all those things automatically for you
but as said, you can also put this in your ant script somehow, I sent you a link above
$PLUGIN.jar is obviously your plugin's jar name
here
~ is your home folder
the .m2 folder might be hidden
(It is)
C:\Users\YourName
show hidden files hehe
it's also not hidden for me
i wonder why md_5 didnt upload the newest specialsource to central
yes
no?
Husbandry involves breeding?
you should now see the Goal class if you properly added the remapped .jar to ant
well just a tiny example, this will make all freshly spawned zombies move to 0, 64, 0
public class Test extends JavaPlugin implements Listener {
private static class MyGoal extends Goal {
private final Mob myMob;
public MyGoal(Mob myMob) {
this.myMob = myMob;
}
@Override
public boolean canUse() {
return true;
}
@Override
public void tick() {
myMob.moveTo(0,64,0);
}
}
@EventHandler
public void onSpawn(EntitySpawnEvent event) {
if(event.getEntity() instanceof Zombie) {
((CraftZombie)event.getEntity()).getHandle().goalSelector.addGoal(0, new MyGoal(((CraftZombie)event.getEntity()).getHandle()));
}
}
I swear, it's like they're targetting me specifically lol, the NMS stuff that I use, although obscure, is changed like every other update
it's crazy
I always need to change the methods that i'm reflecting
that's why you should use remapped-mojang instead
everything in data will be json
in 99% of cases, just adjust the version in the mappings, and done
It's all datapack stuff
tick() is what actually does anything
canUse() is there to actually start your custom goal
canUse is necessary
without canUse, it wouldnt even compile
tick() isn't neccessary, but it's the method that gets called every tick while your custom goal is active
you should normally use start() and stop() instead for pathfinding
But isn't NMS included in the server?
ofc it is
Yes
yes, because canUse is abstract in Goal
Then wouldn't the server need the mappings too?
That is how an abstract class works
no, the server uses spigot mappings. the whole remapping thing is to turn your mojang-mapped code into spigot-mapped code, so the server can understand it
it adds the goal to the entity if it's a zombie?
kinda, yes
i dont know if it works if it's too far away from 0,64,0
just go to 10,64,10, spawn a zombie there and it should work
I see
Well then, how can I get the mojmaps?
you mean, how you can use it in your plugin?
um
if ur depending on project A thas has a dependency on project B, but doesnt shade it, can u use project B in ur project?
this yeah
ty
Not using maven
on compile time yes. on runtime, only if something else provides it
Sadge
i see
then
why dont we have nms in spigot api
No
Or just x-1.19?
1.17+
Ah I see
In that case i'll finish everything up with the normal mappings, push it, and make a new commit with mojmaps
thanks
Spigot API doesn't depend on NMS?
Because NMS is ARR?
IIRC the mappings are available since 1.15 or so, but there's no remapped version for spigot until 1.17+
Spigot API is (L-)GPL, and everyone knows what happens if you mix LGPL and ARR code
I still don't know how to use SpecialSource with gradle tbf
using maven is by far the easiest for this since spigot itself uses maven, so md made a remapping plugin for maven
well you could just make gradle run the specialsource .jar manually
or use paperweight
Although really converting it to gradle should be a piece of cake
Oh, the method I was using, that caused the mojmaps conversation, seems to have been doing the exact same thing as a ctor that existed, and I happened to have a reflection for that ctor. I was under the impression they they did different things, but no.
pain.
Gradle is groovy
(Or kotlin)
It's more like a deranged child between kotlin and groovy imo
I tried to use the kotlin version for a bit
Although I never used kotlin myself, so it could actually be kotlin
It is so hard to find any documentation on it
It's hard to find any documentation on anything concerning gradle
Kotlin is still 100x harder than Groovy in that regard
The best way to learn is to just dig through it
Once you have Mojang Maps and if you know Java pretty well you can figure out the NMS stuff pretty easily
In a perfect world the spigot api would expose all you need
Even without there being docs
But we do not live in said world
Okay well then it might take more time for you to figure out what Mojang is doing in some cases, but you can do it 
I love unboxing pdc
yeah the ternary operator
i just call it question mark thing
Donโt worry I donโt know the names for half the things I use :p
although it's not really very useful for true and false lol
IE wtf is (X instanceof Object instance) referred to as
I thought it was just pattern variable
oh the variable part is presumably called that ye
Either way, best new feature imo :p
Agreed ^
agree apart from structured concurrency
Structured who what
it's quite easy. You can just define a name for it to aumatically cast
public boolean isEglibleEntity(Entity entity) {
if (!(entity instanceof Slime slime)) {
return false;
}
return slime.getSize() <= config.getMaxSize();
}
no need to do Slime slime = (Slime) entity
basically it only allows you to write one line less
basically a paradigm that tries to address the developer's control over concurrent running code, like error handling
People are always talking about fancy new/upcoming features like foreign memory api
And my smooth brain is just here like โRecords coolโ
mfw I only use records when IntelliJ tells me to
Listeners arenโt really a part of java itself
They are a spigot api thing, but other apis also use them
listeners?
I mean sort of
Java makes use of the concept of listeners, yes. Though there's no "listener api"
They're generally referred to as callbacks
Ah right
Basically the server just invokes your listener method when certain things happen
Via evil reflection
well, java does use observer/subscriber based callback patterns internally and somewhat externally also in the jdk
Almost wonder if it's worth migrating to use method handles
nah
Curious what the performance benefits would be of that
reflection is going to get reimplemented with method handles
Heh Runtime code generation
Let Paper figure that out 
if that didnt happen already
and not all method handles are faster than reflective invocations
only if you do it correctly with the right method handle and strategy like iirc lambda meta factory
I'm actually not a fan of this API by the way. Maybe I'll find good use for it but I find its cases are going to be niche and very specific
What I do like however is that those docs make use of the snippet tag
Which is neat :) First time I'm seeing them in action
yeah
Nothing wrong with a niche api
well, apparently people have been complaining about unstructured concurrency
Not at all. I just can't see myself using it
Actually, no, I can think of a case or two
I think one nice usecase is when u want a thread per user (websocket or sth), subsequently not having to rely on sth like netty to make an application scalable
Netty will hopefully make good use of these
yeah 
I can't seem to manage to add a poison effect to an entity
the wither effect works perfectly fine
What entity
yeah for undead things, you'd need healing instead
zombie will be healed by poison
yeah it's the other way around for them
healing potion makes damage on undead and poison makes them "healthy"
Pretty sure thatโs only for instant damage and instant health
Whereas they are just immune to poison
nah regen works as poison on em
Can we do worldgen with spigot?
Undead
Zombies are undead mobs, harmed by the status effect Healing, healed by the status effect Instant Damage and are unaffected by Regeneration and Poison. The wither does not attack zombies. Zombies are affected by the Smite enchantment.
According to the wiki
Side note I miss pre fandom wiki
and are unaffected by Regeneration and Poison
WHAT
Yes
The api for worldgen is somewhat basic, but you can also use NMS
Look at some amazing projects like Iris or Terra
I have been playing this game for 11 years
i did know know that they were unaffected by poison
or regen
I remember reading that from one of those minecraft hadnbooks
Hi all. In general, I have a small problem. I'm writing a plugin that has a few commands exclusively for admins. But players can see them in the tab completion menu. See only, don't use. Tell me, please, maybe I need to insert something into the code or the plugin.yml file?
Have you registered the commands?
Set permission: xyz in plugin.yml
Oh, I misread. Apologies.
If a command has a permission set it wonโt appear for players without said permission
I understood you
I will try
I noticed that this is a problem with many plugins that I have installed.
Yeah sadly a lot of plugins neglect to do that
For example, the AdvancedBans plugin. Players do not have access to the /ban command, but they still see it in tab completion
Alternatively, you can try to open each plugin through the archiver and manually configure the plugin yml
Maybe
dont commands still appear if you type /<plugin>: then hit tab
Hey guys, I'm trying to make a plugin that messes up a ton of things on a client, using Player#remove
But I cannot because of the safety issues, so I need an alternative. I've tried using NMS & A player's netty connection. But no further progress. Any ideas?
gonna need more context than that
can confirm
commission, not my idea
you haven't declared the target variable before you've tried to set it
you can do something like this
ignore the dependency
?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!
I declare it here
Ohhh
Wait it's the 3h learned java guy
ahhh, the commissioner wants me to make a plugin that kinda messes tons of stuff. orrr kicks the player without them knowing at all as if they were still on the server
you imported the bukkit Mob
You have imported the Bukkit mob
you want to use the NMS Mob
Itโs like spigot and Damagable :p
yea that probs needs nms. however, disconnecting someone removes them from the server, and you need to keep them there to make them think theyre still online.
the only idea i have is to do some network bullshit to 'remove' them from the view of other players and simulate the server around them
so that anything they do gets done to a simulated copy
my goal was to load the world into the client
not possible
dont know how
client is separate from client-server
a client that joined a dedicated server isnt using that internal server
Is there a way to force load chunks?
well, when using forge and using the original method did that thats the thing
it might be possible, but I'm guessing the world would freeze
which would give it away
Well what about slowly
Alright
could I use NMS to unload all entities for just the client?
oo ty
you don't need to put the specialsource thing into the same folder. just run it from the maven repo path, just like in the announcement
so?
you have it in your maven repo anyway
then i would have to cancel all outward packets from the client that update movement and stuff and then simulate a leave message and unload them from all new members and current
probably
any idea how i could?
Packets
if you ran buildtools --remapped, you should have the specialsource plugin in your maven repo
Send a destroy packet and cancel all incoming updates packet of these entities for the client
yeah ima need help with that... i havent really used packets at all
look up what packet get sent to a client which sees a entity thats teleported away out of render distance
send that packet to the client
is there a way to reduce the mining speed of a pickaxe? and/or the protection of armor?
doesnt have to be specific, just need a pickaxe to work as if it was broken, so same mining speed as a hand
There is an attribute for armor strength
As for mining speed, mining fatigue effect I guess
p.sendMessage(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Usage:" + ChatColor.YELLOW + ChatColor.BOLD + """");
Yoyo is it possible to add quotes to a
Reply*
packet injection could do that
"
If you want quotes in a string escape them with \
Use \ before quotes
yeah anyway, if you have it in the same folder as your jar, and your jar is called YOUR_PLUGIN.jar, then just do these two commands
java -cp SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.19.2-R0.1-SNAPSHOT/spigot-1.19.2-R0.1-SNAPSHOT-remapped-mojang.jar net.md_5.specialsource.SpecialSource --live -i YOUR_PLUGIN.jar -o YOUR_PLUGIN-obf.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.19.2-R0.1-SNAPSHOT/minecraft-server-1.19.2-R0.1-SNAPSHOT-maps-mojang.txt --reverse
java -cp SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.19.2-R0.1-SNAPSHOT/spigot-1.19.2-R0.1-SNAPSHOT-remapped-obf.jar net.md_5.specialsource.SpecialSource --live -i YOUR_PLUGIN-obf.jar -o YOUR_PLUGIN.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.19.2-R0.1-SNAPSHOT/minecraft-server-1.19.2-R0.1-SNAPSHOT-maps-spigot.csrg
\โ
yeah that was my second idea, thanks
Oh discord removed my \
Thanks mate
๐ฆ
how can i make player not see chat messages?
Lol discord also supports escaping stuff
ima need more context then that
Listen to chat packets sent to the player, and don't send them
Or
@torpid sapphire there should be a mining speed attribute
protocol lib?
AsyncPlayerChatEvent, remove them from getRecipients
much easier
Recipients?
Iirc there is no mining speed attribute
I think he means "all messages"
Sadly
does Recipients mean players who is receiving it?
the attributes are on itemMeta i assume?
mhmm
Do you want to avoid the player receiving players' chats ? Or even plugin messages ?
avoid to receive everything from chat
Ah yeah
Then you'll need ProtocolLib
Youโll need a packet listener then
yeah there isnt, but that works for armor
Or any other packet listener
how would i go about doing that? i have some networking experience but im totally new to minecraft plugins
is there a doc page you can show me as a starting point?
p.sendMessage(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Usage:" + ChatColor.YELLOW + ChatColor.BOLD + "\"" + ChatColor.WHITE + ChatColor.BOLD + "/message <player> [text]" + ChatColor.YELLOW + ChatColor.BOLD + "\"" + ChatColor.RED + ChatColor.BOLD + ".");
Any way to make this more compact?
ยง + hex number also doubles as color iirc
Yes but itโs kinda janky to have that character in your source
Donโt the [] imply optional arguments
I mean
I guess you can /msg someone nothing
well the [] is usually meant for 'argument' and () for optional i think
remove the dot
[] is optional and <> is required
Yes, That's what's indended.
Ah I thought <> was required and [] opt- yeah
If you do /message <player> you stay on there message so you can continue the chat with /r
any way to make a horse have a saddle
Or you can do both.
๐
check the data of a horse with and without saddle, then set that part of their data/inventory/meta, whatever its part of
Dont you need to nbt it?
I don't think so, I can get the horse's inv tho
oo ye
horse.getInventory().setSaddle()
oh you
nvm
ty tho
I was close
p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "You are now chatting with" + ChatColor.AQUA + ChatColor.BOLD + target.getName() + ChatColor.YELLOW + ChatColor.BOLD + ".");
Any way to make this more compact?
Like mergers
If you are happy with it being less readable you could use the legacy ยง codes
You can .toString the first ChatColor and remove + โโ
oo
Also Iโd use & and translateAlternateColorCodes over the legacy symbol
public static String c(String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}``` :p
fun String.colored() = ChatColor.translateAlternateColorCodes('&', this)
and its more readable ๐
I don't see #help-development-kotlin here
Error Fixed
If I mention it every so often maybe someone will give it a try
but if you've only just learned java then it's probably not the right way to go
does that code actually get run? maybe it's stopping execution before it gets to that line
It does get run, because 10 lines later there's horse.setColor(Horse.Color.BLACK); which does work
Is there any way to save the current player you are messaging to a variable?
is the horse tamed?
I set an owner but I don't know if it does the trick, lemme see
haven't checked but maybe a horse can't have a saddle unless it's tamed
I imagine that's the problem
maps
this is why people say learn the language before you jump into spigot. A map is a relatively simple data structure you should be aware of
Oh like a string?
not a string
Similar
map is not similar to string
Yep it was, thanks
it is a data structure 
they allow you to create a relationship between 2 objects
but not a similar data structure
I cant find it in the spigot javadocs
in this case you could 'map' the player that ran the command to the player they want to message
it's because its a part of java not spigot
does anyone know how to read when the recipe book is open, and to set a recipe unavailable
smth to do with packets, I'd think
I can't see any need for the server to be aware that the player has their recipe book open, so I doubt a packet is sent
Nevermind, I am incorrect
https://wiki.vg/Protocol#Update_Recipe_Book sounds like the right packet
its a bit like an array in the sense it will hold many of those relationships
so 1 to red isn't the only thing it can hold
I just need it to hold 1 thing though
to get the String you would do hm.get(int);
what about when more than 1 player messages someone?
yes, but you won't be the only player on the server. If more than one person runs the message command your plugin needs to keep track of who each person is messaging
if that isn't the case then there's no need for a map, just a simple Player variable for the person that the player is speaking to
oh
So what should I put in it?
public LastMsg(String user) {
this.user = user;
this.lastReceived = null;
this.lastSent = null;
}```
Cant I do that?
Like I said, before jumping into plugin development, I'd get a good grasp of not only the syntax of java, but also how to 'think in code' to know what to write to get the computer to do what you need it to do, which will involve learning data structures like maps, lists etc.
that is an option
Than I'll use that.
although I wouldn't keep track of players by their name
is it fair to use a onPacketReceiving event for this?
i don't rlly know how to differentiate between different packets
yes, I would imagine so, I haven't worked with protocol lib in a while so I can't remember exactly how it deals with things
actually, you may not be able to use that packet
it's clientbound meaning the server sends it to the player
this is the one you want, and yes you'd use a receiving packet listener
sorry for sending wikivg links, it's how I've always checked it, but I know people don't like them because they make their own names for things
cool, thx
is there a reason you aren't using maven or gradle?
yes, but why are you using it over maven, it would make this a lot easier as the tools already exist
never used it so I can't help sorry. I imagine you are just giving it the commands to run manually, and I haven't used special source manually
I think most people saying to use ant these days are satirical. irrc you can use ant inside of maven if there is something specific you need
but gradle or maven will make your life much easier
Maven won't compile with correct Java version
Are you on Windows?
||first mistake :p||
On the 2nd line, after SpecialSource-1.10.0-shaded.jar, see the colon?
Right before your C:/
No, change it to a semicolon.
md_5 uses Linux, and that guide is designed for Linux. I had the same exact issue. If you do java -help in your Windows CMD and scroll up to the -cp argument, it'll say separated by ;.
Yes
I updated to the mojmapped spigot build
https://paste.md-5.net/tudatutacu.java https://paste.md-5.net/koyicenaze.java https://paste.md-5.net/uwufewumoj.java https://paste.md-5.net/vovenequfe.java https://paste.md-5.net/ajohajesuk.makefile
This might be very complicated but the plugin is not working,
and I don't seem to be able to access any nms classes
The names change when you switch to Mojang Maps, what are you trying to access?
"yes i use linux"
NBTTagCompound... ItemStacks, and something else that I can't see cause my IDE just froze
you'll be getting an error in the logs somewhere, that will narrow it down
ItemStack has the same name, net.minecraft.world.item.ItemStack. Check if it's there.
I didnt get any erro
can i make string a charactersequence?
Arenโt all strings a CharacterSequence
Yes you're right use the obf one I think @quaint mantle
Yep it's there
I think you'll find you will somewhere. The reason you're getting those messages in chat is because either your commands haven't registered or you're returning false in the method (which you aren't explicitly)
Is net.minecraft.world.entity.monster.Zombie there?
yep
I'm stupid and idk how to set a plugin variable as the current plugin
Welcome to Mojang Maps
alright
was this actually made by him
i'm sorry I don't remember his name
bill wurtz
or something
Yes
Yes but you can do that inline, you dont have to make a variable for it unless you need it for some reason
Sure, try it
Could someone help me fix this?
Send you plugin.yml
Is there a spigot > mojmaps index?
I don't want to come here and ask what X is for everything I need
That's bothersome
no
Huh, is there no mojmap for NBTCompressedStreamTools?
Found it: NbtIo.
Bump
can you send your latest.log, I still think theres an error in there
your main class is set to BetterCommands.Main but you're registering your commands in a class called MsgPlugin
I made 2 mains/
make sure you are pointing to the right main file
you can only have one plugin class per plugin which should make sense
Hi, does any one know how to "register" a new/custom ItemStack in the server? I mean to able the player to the vanilla command to get the item... Example "/give @p PluginName:CustomItem".... Thanks
The one in MyGoal wont get called unless you register it
You should separate the classes instead of having MyGoal be a static class inside PlayerEvents
can't think of a way using the vanilla implentation of the command although I may be mistaken.
You can technically register a new ItemStack but it won't actually do anything
He did
You can add it into the server registry but you can't add it to the client registry
Class 'MsgPlugin' is public, should be declared in a file named 'MsgPlugin.java'
so i have ores as entities, should I check the player proximity every x ticks and spawn the entity if the player is near enough, or have the entity spawned all the time?
which one would be more efficient in a larger scale
thanks :/
yes, exactly as that error says, the file needs to match the class name. Going back to what I said about understanding java first
So unless you're also requiring a mod that adds the same thing to the client registry, adding new items via registration isn't possible via spigot alone
thanks
So change it to main?
yes
Spawn if they're near enough
Otherwise you're going to have a ton of loaded chunks for no reason
And loaded entities
although if you are okay with not using the vanilla command, you can definitely create custom items using resource packs and custom model data
alright thanks!
aren't the chunks going to unload if the player isn't in range anyway?
Probably, but I was just assuming he was going to forcefully load the chunk and spawn his entities.
Which, is terrible
intellij will do all the refactoring for you
shift f6 on the class name
but please don't ignore my advice and learn java first
perhaps that is the source of the issue?
People not needing to know how to code properly because the IDE already does everything for them?
[17:32:12] [Server thread/INFO]: EthanGarey: Please note that this command is not supported and may cause issues when using some plugins.
[17:32:12] [Server thread/INFO]: EthanGarey: If you encounter any issues please use the /stop command to restart your server.
[17:32:12] [Server thread/INFO]: Server Ping Player Sample Count: 12
[17:32:12] [Server thread/INFO]: Using 4 threads for Netty based IO
[17:32:12] [Server thread/INFO]: [BetterCommands] Disabling BetterCommands v1.0 Release
[17:32:12] [Server thread/INFO]: [WorldEdit] Disabling WorldEdit v7.2.12+6240-87f4ae1
[17:32:12] [Server thread/INFO]: Unregistering com.sk89q.worldedit.bukkit.BukkitServerInterface from WorldEdit
[17:32:12] [Server thread/INFO]: Loaded 7 recipes
[17:32:13] [Server thread/INFO]: [WorldEdit] Loading WorldEdit v7.2.12+6240-87f4ae1
[17:32:13] [Server thread/INFO]: Got request to register class com.sk89q.worldedit.bukkit.BukkitServerInterface with WorldEdit [com.sk89q.worldedit.extension.platform.PlatformManager@575644fe]
[17:32:13] [Server thread/INFO]: [BetterCommands] Loading BetterCommands v1.0 Release
[17:32:13] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[17:32:13] [Server thread/INFO]: [WorldEdit] Enabling WorldEdit v7.2.12+6240-87f4ae1
[17:32:13] [Server thread/INFO]: Registering commands with com.sk89q.worldedit.bukkit.BukkitServerInterface
[17:32:13] [Server thread/INFO]: WEPIF: Using the Bukkit Permissions API.
[17:32:13] [Server thread/WARN]: [WorldEdit] Server reload detected. This may cause various issues with WorldEdit and dependent plugins.
[17:32:14] [Server thread/INFO]: Using com.sk89q.worldedit.bukkit.adapter.impl.v1_19_R1.PaperweightAdapter as the Bukkit adapter
[17:32:14] [Server thread/INFO]: [BetterCommands] Enabling BetterCommands v1.0 Release
[17:32:14] [Server thread/INFO]: EthanGarey: Reload complete.```
[17:32:14] [Server thread/INFO]: Timings Reset
[17:32:21] [Server thread/INFO]: EthanGarey issued server command: /message
[17:32:36] [Server thread/INFO]: EthanGarey issued server command: /msg
[17:32:38] [Server thread/INFO]: EthanGarey issued server command: /msg EthanGarey
Use setOwningPlayer instead of setOwner
Why do you have two classes that extend JavaPlugin
It happened when I did shift + f6
wat
okay, maybe my advice wasn't perfect and actually requires you to understand what that keybind does
Your initial one that you sent in your first message is correct with the exception of MsgPlugin should be called Main
the contents of your MsgPlugin needs to all be inside a single Main plugin class (although arguably MsgPlugin is a better name)
True
this turned out to be, in fact, the source of the issue ๐
So what do you want me to do?
your IDE should be warning you that setOwner is deprecated, that's your first sign that you probably have the wrong method
It wants an OfflinePlayer not a String
what's the error
are you definitely depending on 1.12 spigot api?
https://paste.md-5.net/velalutipe.java Is this good @dim bronze
that looks better yes
although there's no need to wrap getCommand calls in Objects.requireNonNull
[17:42:37 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'msg' in plugin BetterCommands v1.0 Release
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:911) ~[paper-1.19.2.jar:git-Paper-132]
at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.2.jar:git-Paper-132]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.2.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:305) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:289) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2298) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2252) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-132]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1361) ~[paper-1.19.2.jar:git-Paper-132]```
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-132]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1338) ~[paper-1.19.2.jar:git-Paper-132]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1331) ~[paper-1.19.2.jar:git-Paper-132]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1309) ~[paper-1.19.2.jar:git-Paper-132]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1197) ~[paper-1.19.2.jar:git-Paper-132]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-132]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at BetterCommands.msgplugin.commands.MsgCommand.onCommand(MsgCommand.java:25) ~[BetterCommands.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 23 more```
Yeah because you didn't send a message when you typed the command
?paste
Do /msg <name> Hello
this method doesn't take strings at all
^
you shouldn't be using strings because players can change their name, and although it's probably what you want in this circumstance spigot isn't going to like it
Although I am suprised the setOwner method didn't work
how can I properly load/unload a world?
Same actually, I'm surprised it didn't just retrieve the OfflinePlayer from the provided String
ah
this is 1.12
pre flattening
is the skull a skeleton skull when you receive it?
you need to give it data 3 when you create it
Good catch
should have realised when the material was skull item and not PLAYER_HEAD
Yep
new ItemStack(material, amount, (short) data)
be aware that you cannot unload the main world
afaik
yes ik
but ive been trying for long and its not working
unloading once works
then i load using Server#createWorld
and unload again
then it throws exception
ClosedChannelException
and if i dont delete session.lock it throws a different exception
I don't think creating a world inherently loads it?
and if i pass true on unload the server crashes on the 2nd load
I might be wrong
then how do i load it
no I'm incorrect I think createWorld should load.
?paste send your code
then I think you need to use GameProfile
its a separate library from minecraft
this seems to be an alternate way
then you'll have to use GameProfile, but you'll still need to use reflection
according to coll its in NMS, so you'd need to use that, my bad
im developing on spigot-api 1.18.2 and my server software is paper 1.18.2 if thats useful
no nothing changes, it just allows you to access the actual implementation of Player class, world class etc.
what's the exact error?
apparently minecraft:brand runs after PlayerJoinEvent, is there any way i could make sure the value is not null?
I don't remember the location of GameProfile in the older versions, but I think it will
but if you are developing with the 1.12 api, then you want the 1.12 nms jar
@civic apex
ah, I don't think you should be deleting the session lock, that should get deleted when the world is unloaded as there is no need for it to be locked
java.nio.channels.ClosedChannelException: null
what code is on the line the exception is thrown on
unloadworld
hmm figured so
Did you run both commands?
Reflection doesn't seem to support mojmappings does it?
It doesn't
Use mojmaps to figure out what to do and then go back and change the names to Spigot's maps
With the site
Everything is reobfuscated
I was skeptic that it would, but I still tried, thus why I did this
I'll just revert everything back now, then. Thank you guys for the confirmation
just so we are clear, are we talking about your unloadWorld method, or boolean success = Bukkit.getServer().unloadWorld(world, save);
If we are talking about your method, which line specifically
2nd
that line
when do you get the location? is it tied to the old world?
is the world correctly loaded after the first unload?
its correctly loaded as in i can join it yes
whats the exception when session.lock isn't deleted
this has me stumped honestly
lemme look at logs
I don't think deleting session.lock should be a solution to anything
that's your error exactly, this does not exist in a static method. You need to pass that skull texture to your method
OverlappingFileLockException
IllegalArgumentException and NullPointerException were also thrown dont remember exactly when
Is there any videos I can watch to get to know NMS
dont just blindly copy and paste. try to understand whats happening. In this case, all that needs to change is base64Str to be the string of the texture you want to put on the head
this is all happening on the main thread yes?
I presume so otherwise the teleports wouldn't work
i think so
you dont call Scheduler#runTaskAsyncronously
i remember calling stuff async, but i dont think its related
not rn
that looks more like hex than base64, where is it from
yes, it is
looks good to me, now you just need to set the heads owner to the gameprofile
yes,
no, theres a separate method for setting gameprofile owners
or at least there is now, back in 1.12 you need to use reflection
stumped at the moment. Trying to understand that error if nothing is running asynchronously as the lock should be held by the main thread and released when you want to unload it. This is definitely a more meaningful error than the last one, and by just deleting the lock seems to open you up to more problems.
?tas :) i love this macro
if i delete the lock only one exception gets thrown, but if i dont both that and the OverlappingLockException get thrown
I imagine the ClosedChannelException is a result of the lock
so just deleting the file is getting rid of the meaningful error
yes but ClosedChannelException always gets thrown
except (iirc) if i save when unloading in which case i think it just crashes
(main thread freezes and dies)
it probably isn't remapping as you think it is
there's no need for the setOwner call at the top now because the gameprofile is doing it for you. When you initialise profile, try give it the name of an empty string rather than null, maybe it doesn't like the fact the player has a null name (second arg)
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
oh no
does it have the custom name?
This is 1.12
pretty sure its gameprofile
I have multiple versions for my plugin, across many versions, but when publishing, it only allows me to add one file. How would I add all the versions?
And categorize it across the versions (1.7.10 - 1.19)
that texture isn't valid
it doesn't point to a skin
no its not too long
if you convert from base64 -> ascii you get this json
{"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/57ccd36dc8f72adcb1f8c8e61ee82cd96ead140cf2a16a1366be9b5a8e3cc3fc"}}}
that url is 404
no
that's hex
the base64 value of the texture property contains the whole result from the skin server
which is that json
but for whatever reason that skin was deleted from the servers
@quaint mantle are you still using ant?
send your code for remapping
script
same thing ๐
You using reflection?
Reflection is a java feature
but alright you're prob not using it then
dunno then
I have multiple (MC) Versions for my plugin, but spigot only lets me upload one file; How do I upload all the versions and categorize them?
you'd have to upload them separately afaik. is there a reason they cannot be 1 file?
ZIP File
is there a reason they cannot be 1 file?
Let's see...
NMS, Different APIs, Different functionalities in many GUIs, different events...
you can shade them all into 1 jar no?
you just need 1 core api and it doesn't matter how different the implementation is in each of the modules, just make sure the right module is used as the implementation and shade them all into your plugin jar
Perhaps using ant wasnt the wisest of all choices?
perhaps
trying to put https://minecraft-heads.com/custom-heads/blocks/51088-ore on a skull, any idea how?
doesnt have a player name
what version
skullmeta doesnt have the textures thing i believe
did you remap
i reckon you just bite the bullet and spend 5mins setting up maven instead
pretty sure you have to do PlayerEvents.MyGoal