#help-development
1 messages · Page 1864 of 1
If you want to have it intelligently use a specific item you’ll need to use the event
You cry
yeah ok i cry
I believe HashMap permits null keys and null values so in that sense checking for null won’t check if there really was a previous value
Listen to the prepare item craft event and check if it’s using the appropriate items
But yeah using PrepareItemCraftEvent you can do it
omkay thanks
no but i mean to check if the entry wasnt already there, ignoring other things
As conclure said, hashmap allows the value to be null, so that by itself does not mean the previous value was not in the hashmap
Hi, how can I get the Material/ItemStack of an entity that is an dropped item?
declaration: package: org.bukkit.entity, interface: Item
Yes, but how can I get the Item from an entity?
if you assume no values are null
which happens in my case
then it would work i guess
yes but why
Can you explain to me what I need to do to let this work?
Inventory#addItem(DroppedItem);```
i check if the channel isnt already present before adding it
returns false if it failed
Item droppedItem = ...
droppedItem.getItemStack
droppedItem.remove ?
what version do you use ?
1.16.5
yeah droppedItem.getItemStack()
This should work right?
Item droppedItem = (Item) entity;
Yup
if entity is a Item yes
Alright thanks
Make sure you check that it’s an item
I already have that
Alright then
why am i getting these errors
Could not find artifact org.bstats:bstats-bukkit:pom:1.7 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/)
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
``` <repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
</repository>```
What could be the reason that my spigot dependency is not found?
Ugh I really need help with JDA
@Override
public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) {
System.out.println("GuildMemberRemoveEvent");
System.out.println(event.getMember()); <-- returns null
System.out.println(event.getGuild().getMemberCache().getElementById(event.getUser().getId())); <-- returns null
saveRoles(event.getGuild(),event.getUser());
}
Here's my construction thingy:
jda = JDABuilder.createDefault(BOT_TOKEN)
.setChunkingFilter(ChunkingFilter.ALL)
.setMemberCachePolicy(MemberCachePolicy.ALL)
.enableIntents(GatewayIntent.GUILD_MEMBERS)
.build();
jda.addEventListener(new RoleSaveListener());
Any idea why the member always returns null in the GuildMemverRemoveEvent?
im now getting this error and i literally changed nothing lmfao Could not find artifact net.kyori:adventure-text-serializer-bungeecord:pom:4.0.0-20210914.041527-85 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/)
Pretty sure the discord API doesn't really give you much info on the user once they have left
but isn't that what the CachePolicy should be for?
You need to cache it yourself before they leave
You should be able to at least get the ID of the user
Yeah but I need their roles and not just their ID, and for the ROles I need a Member object, not just a user
MemberCachePolicy.ALL should actually cache ALL members from what I understood
but the docs say that getMember() in that event returns a member object if it was cached
otherwise that method would be a bit useless 😄
The javadocs always lie
this happens when you get use a protocol noone understands
uSe ThE dOcS
Hmm I’d say discord4j isn’t 😔
No one uses that lolz
Wut
Also it's a LOT more wierder
Elaborate
Even the example on their github page is wierd
But can you elaborate on what you mean by weird
like you wouldn't understand what a lot of methods do by just looking at the code
I bet you haven’t even tried it
For example .block()
bruh
what should that mean
That’s a common word which means it blocks the operation on the thread its called on
Stop bullshitting nonsense
It’s same with RestAction::complete in jda
Also blocking
Thats probably not less confusing for you tho
nope
If you don’t understand the name/intent of a method, then read the javadocs, don’t just call it weird
tbf I've read the javadocs then said it was weird even after reading the description before
the docs say I'm doing everything correct though lol
like how random items are damageable but have 0 durability
it is allowed to Complete Futures with nulls?
why am i getting this error when building with maven
org.bstats:bstats-bukkit:pom:1.7 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
```<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
</repository>```
Technically yeah
check the link for yourself, bstats ain't there
thats the spigot repo link so therres nothing i can do to fix it...?
you're looking for bstats not spigot
how
either way his maven repo is wrong
should only be this, not the org spigotmc spigot-api stuff after it
https://hub.spigotmc.org/nexus/content/repositories/snapshots
im still getting this error Cannot resolve org.bstats:bstats-bukkit:1.7
you have the wrong repo
<repository> <id>spigot-repo</id> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> </repository>
A description on how to include bStats to your plugin
send your full pom
the repository isnt mine
sure then whoever wrote that has the wrong repo
md did
nope
send your full pom in a paste
doubt that
:/
yeah loading the project 1 sec
md has at one point, but others have edited it more
but the wiki is right either way
md5 wrote the repo for spigot, why the hell would he write the repo for bstats
im getting the error from spigot
adding the spigot dependency
im not doing anything with bstats
no
you are getting bstats not found in the spigot repo
unless I am going blind
which is possible, I did have eye surgery a couple of weeks ago
mavens errors are hard to tell
could be spigots wrong, could be bstats is wrong
its a mess
no
all i did
it's very plain to tell
was add the spigot repo and dependency
if spigot messes with bstats thats not my issue
its spigots issue
i havent done anything with bstats all i did was copy the maven from the spigot wiki
no clue why you insist this is an issue with spigot when it clearly says bstats is the one MIA
but sure
you're refreshing maven right?
because bstats is included in spigot... whenever i add spigot as a dependency i get this error so how is it not spigots fault
yes
lol
no
but I guess it's fun to make stuff up
personally I blame the 5g networks for your issue
?? if i add the spigot dependency then i reload it and it gives me the error after adding the spigot dependency how is it my fault? its spigot giving me the error i havent added anything to do with bstats
could also be another dep you have installed, do some testing
did he post the full pom
here
its not the offical paper
oh that's much worse, thanks
gotta go to the gym gl
worldedit needs it or it wont work so :/
uh does it?
mhm
nope
if i dont add it, it gives errors saying it needs paperlib
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ok i'ma be late
Cannot resolve io.papermc:paperlib:1.0.2
Could not find artifact io.papermc:paperlib:pom:1.0.2 in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Teleporting Error
fastest crash in my history with a lot of dope shit right there
maximize your console so the lines are spaced properly. It'll make it easier to read
Is PlayerQuitEvent sent when players switch servers using bungee?
the problem is that the api doesnt want me to register new entities ... so it crashes the server in like 2ms when trying to generate villages
Yes
From my testing a few months back it did
thats correct since the spigot server dont rly know its a bungee - switch
How do I get the number of blocks passed through PlayerMoveEvent?
normally it shouldnt be more then 1
but getTo / getFrom and a little bit of calculations will help you
What calculations? Can I have an example? I didn't understand anything
LocationA - LocationB = dif
dif.length = blocks passed
dif.length will be less then 1 for sure each time
getConfig in other class than Main
I can't understand. I have the coordinates 'y' also writes something
what ?
x y z
PlayerMoveEvent:
there are 2 methods: getTo and getFrom
both return Locations
Does anyone present use caddy as web server?
If I fall from a height, it will be protected too
you dont want to have blocks fallen count as walked ?
Constantly writes a number like this: 0.324234142354335
yes
both location: setY(0)
can I have an example, please?
thats not complicated tbh
I have a TreeSet using Bukkit's Vector impl private final TreeSet<Vector> doors = new TreeSet<>(Comparator.comparingDouble(Vector::getX));
however i still get a ClassCastException when trying to add to this treeset
Location from = null; // e.getFrom
Location to = null; // e.getTo
from.setY(0);
to.setY(0);
double blockdistance = to.subtract(from).length();
Thanks a lot
How to create a animated tablist in the 1.18.1 api?
with header and footer or more ?
only header and footer
player.setPlayerListHeaderFooter
How to animate it?
setting the header and footer multiple times
have a bukkit runnable that changes it 🤷🏽♂️
?
0.4325342346456
what
writes to me in the chat
no
OK, I'll check)
I am constantly teleported to 0 height
yes
Location from = null; // e.getFrom
Location to = null; // e.getTo
from.setY(0);
to.setY(0);
double blockdistance = to.subtract(from).length();
annnnd why do you teleport the player then ?
It teleports me when I move
because ur setting the y of the location
clone it instead
e.getFrom().clone()
e.getTo().clone()
didnt expected that ....
and iam speed
I have writes
🤣
i have writes
1.3453053453456
the higher the speed, the greater the value
and thats making totally sense
anyone know how I can get my plugin to download JDA library at runtime? Because if I shade it, the .jar gets 7MB in size so I can't upload it to spigotmc anymore lol
how can I output for example 10 blocks?
.
the relative calculated 10 blocks ?
How many blocks have I overcome
in total ?
yes
Player player = null;
int cm = player.getStatistic(Statistic.WALK_ONE_CM);
no
player shouldnt be null
jumps are not taken into account
doesn't help, JDA is not in maven central 😦
it has its own repository
then you will have to add each calculation and store it somewhere
you can create an external download link ?
nope, it will be a paid plugin
Yes it is. Unless you want to use snapshot builds
if I just run, the number increases, but if I run and jump, the number will remain the same
oh really? thanks. on their github they don't mention that
oh wait
that sucks lol
they only have 5 alpha and 1.2 and older lol
They do 😄
then create an downloader in your plugin that downloads the jda-spigot-plugin too ^^
.
How can I do it via PlayerMoveEvent?
You dont need to track that at all. Minecraft already does.
jumps should not count since you set y to 0
-> only 2d distance calculated
since players jumping gives move-speed it will never be the same ... but i dont understand what your problem is
yes
declaration: package: org.bukkit, enum: Statistic
if I just run, the number increases, but if I run and jump, the number will remain the same
I need to get the number that the player has passed in blocks
Overcame
Ah i see. Then you need to use the PlayerMoveEvent.
Filter out teleportations then calculate the magnitude of the vector spanning between 'from' and 'to'
in order to add them uo.
i told him to get distance between from and to ... but somehow he cant describe his problem
Can I have an example, please?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
what does that have to do with it?
Location from = ...;
Location to = ...;
double distance = from.distance(to);
seems like you dont understand anything
How do I display a message to the player about how many blocks he has overcome?
declaration: package: org.bukkit.command, interface: CommandSender
Player#sendMessage(String)
e.getPlayer().sendMessage(String.valueOf(d));?
assuming d is the distance
double d = to.subtract(from).length();
How can I get player's yaw and pitch
Location#distance(Location) is a better approach when calculating the distance between 2 locations.
But this will only display the distance you have travelled in this exact one tick
tick?
get the eye location and get the yaw/pitch from that
yes as almost every other multiplayer game, minecraft is tick based.
I asked how to do that
that is, do I need to constantly add the resulting number?
btw you will need a hashmap somewhere to store player move distances
- Get a Player
- Get the eye location of that Player
- Get the pitch/yaw of that Location
yes
bro
that is, do I need to constantly add the resulting number?
By literally calling 'getYaw()' and 'getPitch()' on a Location
thx
😮💨 if ppl would just try to read provided methods before asking or at least javadocs
index iteration bounds: [0, 18[
Then call Inventory#getItem(int)
*If you are speaking of Chest type inventories.
For other inventories such as dropper you would
need to differentiate.
Ikr, it's not even hard considering if you even start typing what you want the IDE should complete it for you 
does not work
instead of saying that it does not work you could show the error or even describe the problem you have 🙂
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
Location from = e.getFrom().clone();
Location to = e.getTo().clone();
from.setY(0);
to.setY(0);
double d = to.subtract(from).length();
int ds;
ds = (int) d + ds;
e.getPlayer().sendMessage(String.valueOf(ds));
}```
- Create a Map<UUID, Double> to associate a players ID with a double value, representing the distance
- Listen to PlayerMoveEvent and filter out teleportations
- Get the distance in this event
- Add this distance to the maps value associated with the players id
- on disconnect: save the value from the map into the players PDC
- on connect: load the value from the players PDC into the map or add 0 to it if the value is not present in the PDC
dont cast 0,4 or all those values to an int ^^
different numbers are always shown
When I run, it shows something normal, then not
is baby zombie with player skin possible?
resourcepacks probably
hmm since player is a adult-object i dont think you can create an baby npc
The player model is not ageable and a zombie can’t be given a player skin without disguising it as a player
Which would then be full size
Best you can do is colored armor and a player head for helmet
could i do it with Lib's Disguises?
im getting this error
[19:18:26 WARN]: at Guilds-1-all.jar//me.wally.Guilds.Functional.createGuild(Functional.java:263)
[19:18:26 WARN]: at Guilds-1-all.jar//me.wally.Guilds.Command.createGuildCommand(Command.java:30)
[19:18:26 WARN]: ... 29 more```
you have to initialise it properly
Why do people use Logger.getLogger("Minecraft")
I should honestly PR a patch that nags when this is used
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
yeah thats what i have
PlayerTeams are not UUID - based right ?
Always get your eco lazily
And make sure there is even an eco
Your economy plugin might start after your plugin after all
And not every plugin uses #onLoad
paper error (helpppp)
ive never had to do any of the things you describe and it's worked before
please help me
inventoryclickevent? you can also cancel inventorydragevent and if a player has an item on cursor while closing inventory you could give him this item in the inventory ^^
Load order is more or less arbitrary if not defined explicitly via depend/loadbefore/softdepend, it may work one day, but it will fail the other
When selling plugins do yall use a regular paypal account or a paypal business account?
am i supposed to use the craft bukkit file as a reference library?
no
how the hell did you get the cb jar for 1.18
am i not supposed to have it
To some degree, yes because it is more or less deprecated for removal
It is a far better idea to use spigot instead even though the difference is not too large
Also you should be better using 1.18.1, 1.18 could have a severe exploit if it is too outdated
shouldnt be but im using it for testing my own plugnis only
*plugins
Anyways, to answer your question, it is recommended to use maven instead, linking directly to the cb/spigot jar is a bit complicated
do u think u could help me 😦
https://bukkit.fandom.com/wiki/Plugin_Tutorial_(Eclipse)#Reference_the_Bukkit_API helps, even if it is outdated and might be for the wrong IDE
https://www.spigotmc.org/wiki/creating-a-plugin-with-maven-using-intellij-idea/ would be the step for intelliJ
<!-- Spigot Javadocs -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${project.spigotVersion}</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>```
Hey, what is player.isAllowingServerListings() for anyway?
but i forgot where i faund the file
I have a quick question: If I use .getItemInMainHand(), which has @NotNull, does that mean that I don't have to check for .getItemInMainHand() != null before I start using ItemStack commands?
which sometimes happens
Unfortunately yeah
At which point you have to use Objects.isNull to not trip the static analyzer
Like can I just use
ItemStack m = p.getInventory().getItemInMainHand();
if (m.getType() == Material.COMPASS && m.hasItemMeta()) { ... }
What is the best way of going about this, just testing and see if it works?
Just get the meta and set it back
What do you mean with setting it back?
An ItemStack with material as compass will always have a meta to return when you invoke getItemMeta
ItemStack::setItemMeta
Ah okay! When will an ItemStack not have a meta?
if it is air I suppose
Material::isAir yeah
Ah okay! So that means my m.hasItemMeta() is redundant, right?
there is also cave air now
Hmm yeah I don’t know the exact implementation of it to be fair but just use getitemmeta
And I think void air?
Yeah and cave air
😠
@ivory sleet Do you know what would cause Gradle to say this
It seems just randomly it decides to say it
Do you use custom tasks?
or 3rd party plugins?
If so you are missing some anntoation
Or actually, I think you are providing the annot, but not the files which it needs to track. Regardless I know as little as you
So does Google unfortunately, it's extremely annoying LOL
It happens just randomly it seems like, it'll build a few times, say that, and then sometimes it'll work the next build else I have to clean/restart my IDE
I myself never bothered doing things incrementally because when I looked into it I thought that it would be quite the pain to get working
do you clean the directory or build before a new build is created?
I mean you don't really need incremental builds
I don't clean before every build no
I guess if it's going to prevent this I'll start LOL
well sometimes I know in maven, by deleting the extra files from previous building can cause it to lose track
not entirely sure with Gradle
Cleaning before each build sucks
Nope
The whole point of incremental building is to stop that
ok i attach source
spigot-api-1.18-R0.1-20211206.042128-24-sources.jar
that work fine
Another quick question: does anyone know the difference between hasLodestone() and isLodestoneTracked() on this page? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/CompassMeta.html
why don't you use the dedicated download sources button of eclipse?
isLodestoneTracked()
Gets if this compass is tracking a specific lodestone. If true the compass will only work if there is a lodestone at the tracked location.
how to make lightnig when right click air spigot coding?
hasLodestone()
Checks if this compass has been paired to a lodestone.
@glossy marsh
enlighten me wise master
expand the maven dependencies -> right click on an artifact -> maven -> download sources
works only half the time, but relatively easy
Technically you shouldn't need to manually do that in the first place, though I know that eclipse sometimes does that
Boy Gradle really is a pain in the ass....
that is quite the pom
OneDrive?
?
It probably has something to do with your spigot only being defined via the towny dependency
how to check if NBTBase is of specific type (e.g. NBTTagInt, NBTTagDouble)?
If you were to manually define the spigot dependency and exclude towny's dependencies then it should work better in theory
how could i do a system that knows the x and z values to be added for the vector goes into the given direction?
what this for
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
Defining version info for xml and pom
how would that look like?
https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/pom.xml#L70 for the exclusions of transitive dependencies and https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/pom.xml#L43 for the manual inclusion of spigot
meh brain i dont know enough to understand it all
Also you forgot to include the repository which is used by towny, I doubt that it is on maven central
Thanks! i will add that :))
how to make lightnig when right click air spigot coding?
PlayerInteractEvent -> get target Block -> spawnLightning
thanks
np
can i use github actions with the mavenLocal repo for the spigot server?
how?
please, can anyone say, how can i convert NBTBase to specific type, like NBTTagDouble, if i am sure that it is of that type?
Cast
will that really work?
Nbt base is a superclass off nbt tag double, right?
yep
It should work then
ok ill try
Hi guys from spigot help devolopment! I wonder if it is possible to enable the player-head image in front of the player name in tab list? My server is in offline-mode. Thank you guys!
I've been looking over and over at this, maybe im stupid?
Why is this returning 0.0 and not 0.33 ect. 😂
Bukkit.broadcastMessage("NewVL: " + String.valueOf(newVL));
Bukkit.broadcastMessage("VL limit: " + String.valueOf(VL_limit));
double progressDouble = newVL / VL_limit;
Bukkit.broadcastMessage(String.valueOf(progressDouble));
you're doing integer division
omfg kill me
intelliJ should really start to warn about that one
(eclipse, but yes)
I can probs just make a plugin for that lmfao
will save me a lot of time
is nbt tag type ids different in every version 1.13+?
Sorry for the late response, but I did indeed read this on the spigot api website. I don't get the difference but maybe I have to look more into how exactly lodestones work
so I have process.env.DISCORD_CLIENT_ID and then in the .env I have DISCORD_CLIENT_ID=2738131388wa8d829 but for some reason it can't get the value
did it send any errors?
I’m pretty sure they do
TypeError: OAuth2Strategy requires a clientID option
?buildtools
?buildtool
?bt For future reference 🙂
Another NPC plugin?
How I can create this? ( under pointer )
This happen when you join a 1.9+ server with 1.8 ( viaversion, backwards and rewind )
Sending a subtitle
its only for 1.8- ?
I believe so
Hm? If you plan to use as cooldown indicator then yes, it is pointless on 1.9+
thanks
Is there any way to serialize an itemstack?
Yes; use Bukkit Object Output stream
Although the serialisation is sucky, but it works l
manually serialize 😎
is there any way to disable pickaxe repair?
funny guy you are!
honestly even hooking to nms sounds better than this
I mean if you wanna know what I'd do
I'd basically just create a "handle" class that contains a small bit of information on an itemstack
that I'd deserialize/serialize manually
ok
🤯
KO
🤯
😵
if you don't get that joke you should take a biology class
Hi, I'm currently having a NPC class that spawns a NPC/EntityPlayer, but I want it so it can walk to a specific Location. I've heard of using PathFinderGoals, but I don't know how I need to use that in my code, can anyone help me with that?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
is there any way to disable tool repair?
I have this check, but while player click on a block my codes ran twice
It gets fired for 2 hands
cancel if off hand ?
return if off hand
ty
Set repair cost To Integer.MAX_VALUE
PrepareAnvilEvent
set result Air
What does it sags
Why would you want to return String
I want to create a action bar Util
thats not how a util works
sending action bar to player with Utils.sendActionBar(player, "text");
ye
"" + bad
String.valueOf()
Better
ok explain
oh
Using String.valueOf(int), or better, Integer.toString(int) is relatively more efficient for the machine
well, "" + just looks ugly at first. At second, it unecessarily creates a new string while combining it with empty one

is there a way to drop an itemstack so that only a single player can see it?
maybe packets?
Packets prob
yeah packets
lovely
where might a good resource be for learning to work with packets
You can't pick the items up unless you implement the logic yourself
And some spigot threads like https://www.spigotmc.org/threads/understanding-protocollib-packets.529392/#post-4280924
Yes, drop an item and hide it from other players using api, LoL
No need for packets
you can't hide entities purely via the API
odd, that's new
I'lll try the hideEntity method first
wasn't in 1.16
im so happy that i dont bother myself supporting older versions
yeahh
It's more about api methods that didn't exist like 5 years ago
and I didn't know they exist
ah
hm
hideEntity is deprecated but it doesnt say what to use instead
how do you force someone into a crawling/swimming position
technically you dont want to return void on an util function
but i may be a bit picky lol
(impure functions)
yea fixed, any way thanks
and also make them stay that way
how do you force it
also what is the method for it
I mean
The block should be fake
So protocols
We don't want others to see the block do we
wdym
so im using typescript rn and im wanting to use bigint with mysql but it says bigint is not support with mysql so what should I use instead of Number?
I can't use number due to it making it a int in mysql and the index cannot be 18
player.spigot().
yes it is
Pretty sure it is
yes it is
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar (download), or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
?cc create bootstrap Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
?jd
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
its a wiki
anyone can edit it, including you
' Click on the + button and select JARs and directories..., locate your Spigot-API-shaded jar and click Apply.'
there, edited
use maven or gradle and you dont have to worry about this
It's worth it
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
luckily there's a wiki 😉
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.

i got it to work with vs code 😏
Why isn't what included
it is, you're just using the api improperly
try and call ItemMeta#getAttributeModifiers and you will run into similar issues
because titles are not chat messages, but we have sendMessage(ChatMessageType
I am trying to make a plugin that will help me type a command much easier but i don't know why it is not working
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What isn't working
It will not dispatch the command that I want it to do and it wont show the information that I want it to show when i type /plugin. I tried doing /EpitaphPlugin:plugin in case it interferes but still no luck.
I have no console errors which is strange
in your main did you register "plugin" as a command?
yessir
And it doesn't print anything in your chat?
no
do you have the op permission
if it isnt in the yml it would throw an error at load
😼
oh okay
ty
prob the reason i didn't get any message is because i didn't have it send a message if you don't have permission
that would do it
Anyone know if TabCompleter forces alphabetical order? Mine is but I don't like that
I think in 1.13 it does force
Trying on a 1.18.1 server
(1.13+)
I got this error after loading up my plugin:
https://pastebin.com/j6w6dK2M
java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "knownCommands" is null
knownCommands isnt registered in the yml im guessing
bump
making a little plugin loader for myself
enabling a plugin works fine, but disabling the plugin seems to do nothing
all the commands and events related to the plugin are still handled by it even after i tell the PluginManager to disable the plugin
and each time i tell it to disable it just seems to add a new instance of the plugin to the enabled plugins instead
does disablePlugin not behave how i expected it to?
if (args[0].equals("disable")) {
Plugin plugin = Main.getPlugin().getServer().getPluginManager().getPlugin(args[1]);
if (plugin == null) {
sender.sendMessage(ChatColor.RED+"Plugin not recognized or not loaded.");
return false;
}
Main.getPlugin().getServer().getPluginManager().disablePlugin(plugin);
sender.sendMessage("Successfully disabled plugin.");
actually
enabling plugins seems to have an issue too
the events work fine but none of the commands are registered
im just grabbing another plugin and making their arguments easier to type lol
which one?
From when I tested it (1.13?), it automatically sorted the list. Which is annoying because:
- You can't put things in a certain order
- It did weird things if the items were mixed case
I wish it would just leave the items alone. I'll put them in the order I want them to be in.
anyone know what this means i dont normally get these in runnables
missing public
wdym
oh
public void run
thx
intellij autogenerated it without public
strange
does Spigot not load all classes in a plugin jar file?
it seems it only loads classes that are referenced
That is how java class loaders work usually
Yh ikr? Oh well. Thx
I have been trying to implement more and more changeable Settings into my plugin, but i think i went a bit too far. What do you think?
Use variables, and also capitalize your static constants
And also don’t use getTitle
To compare inventories
Also another thing about that topic, the plugin has different items with abilities and i decided to create a class for every single item that has more perks than just opening an inventory.
Is that too simply to much and should i just put it all in one?
Always use primitives instead of wrapper types if possible
Also don’t name your plugin class Main
Just name it directly your plugin
The Tutorial that i'm using uses .getTitle, what should i use instead?
Stop following the YT tutorial
right, because I'm trying to use ClassGraph to register some event listeners and commands
there are a few libraries out there that can explore it all for you iirc
I'm in episode 23/27 😕
reflections does it ?
You should have never wasted your time the first place
Have you learned any Java so far tho?
yeah, perhaps reflections is a better option to go with
Do you know what primitive types are?
This should not be a hard question
It’s one of the first things you learn — defining a primitive variable like int, long, etc
The Basics yes, and i know that constants should be capitalized but i planned on making them customizable in the Config
and i know that constants should be capitalized
this is really just a naming convention, varies with languages/habits/preferences
primitive types varies a little too, but generally very similar
Well, you should always use an int over Integer of course
Always primitive over wrapper cause it’s faster and unnecessary memory
generics says hello
vahalla when
think its like 4 or 5 years since it was touched 
huh ?
We do a little touching
Wait fr
yea
we got language specs
it looks sooooo good
The cpu cache is going to love this
Ah nice
Does anyone know what the hell this means? LOL
It says that when I try to build my project, and then when it goes to build the modules
Well that file seems to not be existent
I've decided to watch the series to the end and then see what i can improve.
But i cleaned up a bit.
But that's the jar task, shouldn't be be there 
All I'm doing is clean and then build on the main project and it says that
Is the file inside a zipfolder?
No
then nvm
Dessie mind sending your build.gradle
May I ask why go through the trouble to do all this
When paperclip exists
Or if it was paperweight
Idk what that is
Also java-library adds java
o
So no need to add java then
paper userdev is probably what you want
Uuhhh I guess but what was causing the issue then?
I have no idea what's causing it. 
If you run with -stacktrace
Yeah I can send the stacktrace if you think that'll help
Any info helps xD
What if you wrap the logic of jar inside a doLast
Well it builds, but it doesn't include the submodules into the main JAR
Hmm?
Probably need to use shadow jar

Since you’re not building an application, implementation and runtimeOnly won’t shade 🌚

Yeah I know, it’s a bit baboony
Still weird that this is all of a sudden a problem
Yeah
Could using api cause this you think?
that’s basically implementation + transitive
api should shade
try it yah, tho I don’t recall it shading with simply the jar task
yeah I did try it
It doesn't
But I recently added it for other purposes and this seemingly started when I did that
Yeah stuff is strange sometimes
But might wanna fallback on shadowJar
It’s not a big change
Curse you Gradle.............
Just change all your jar stuff to shadowJar
I've noticed that it is very finiky
You can touch 1 thing and it all goes down hill from there 
Yeah well gradle has great potential but you’re right
Oh yeah, Gradle is great when it does what I want it to do 
It’s minute and getting things to just work is just so hard, effort taking and cumbrous
build.configure {
dependsOn shadowJar
}```
I believe he uses a custom build task sequence but yeah that’d what you’d use
Sure maven actually wins here when you just want to get things to work
Maven is also an eyesore lol
Maven is way too verbose
But gradle has the potential and the configurability
Yeah using xml is something I detest wholeheartedly
Gradle often doesn't tell you what went wrong which is what bothers me the most
But yeah anything beats xml
I think they just made Gradle a little too... I dunno, rich? Doing simple things with it is just such a pain because of it.
🌝
Ant > Gradle
Precisely
I find very little difficulty with gradle at this point
I believe the tool is extremely powerful once you master it, however mastering it is quite the challenge already which may discourage the usage of the tool
Gradle is quite literally the definition of "OH MY GOD IT WORKS IM NEVER TOUCHING IT AGAIN"
then u are writing methods and stuff
super easy
tbh id want to say gradle is easier at this point, but id see why it has a steeper learning curve
and harder for beginners
Yeah well understanding the implementation of gradle is something inevitable you in principle have to go through before being able to master it I think
Which takes some time lol
i realized i had a lot of weird shit in the past in gradle i forgot to delete
🥲
and when i started using it more like a build script rather than a configuration
i realized how powerful it is
Yeah
private inline fun <reified T> findSubTypes(reflections: Reflections): MutableSet<Class<out T>> {
return reflections.getSubTypesOf(T::class.java)
}
private fun registerCommands(reflections: Reflections) = findSubTypes<PluginCommand>(reflections).forEach {
commandsHandler().registerCommand(this, it.getConstructor().newInstance())
}```
this shit works in one of my plugins, but not the other... in the other plugin, it's as if there are no other classes than the main class, even though within the jar file, I have multiple classes
anyone have any ideas why this could be?
In the light of configurability as opposed to maven its endlessly better
sure enough, manually registering the commands from my onEnable() would work just fine btw
Just wondering, can you import a module dependency but on the final shadowJar artifact
rather than the actual module
Hmm possibly
Yeah why not do that
I have a project with a similar project layout as in the build scripts here: https://gist.github.com/MineDev2014/4816b9ee78e0c5e1cf26 The project has multiple submodules, the core module includes s...
Extract an inline function and invoke that which just registers every command
It makes your application less coupled for free
think so, in Gradle you can pretty much write Kotlin code in the build file
inconvenient, I want my plugin to just automatically find and register my command classes
😐
It’s not inconvenient, just a part of every fundamental loosely coupled design (:
wot
it's inconvenient to write 100 lines of registerCommand(...)
abstractions
Well it’s explicit, in no time will you be able to tell which commands are registered and which aren’t
I-
I have a------
,,,,,,,
You don’t want your code to hide things from you, especially not when you bind dependencies imo
🧿
Lol
Anyways nozemi I assume you don’t run unit tests
So have you debugged with your logger?
Like which classes are even found
well, it'll be fine imo, because it'll automatically register anything deriving my abstract command class
Ok few things
yeah, only main class is found
no unit tests (yet at least)
Bukkit command api is kinda stale and cringe
elaborate?
It is but it's good for building abstractions on top of at least
Want to play a little game?
I'll describe a command and we'll see who can implement it more cleanly
Hint: PluginCommand/CommandExecutor never wins this game
PluginCommand is my class btw, not the one in Spigot
It’d be cool if we’d deprecate the command api and replace it with a brigadier supporting one
well, your library is way more mature than whatever I'm working on
so there is no way I can win
Sure but that's kinda the point lol
You don’t need a library to make a command clean
Ehhh
abstract class PluginCommand(
val subCommands: MutableMap<String, PluginCommand> = mutableMapOf()
) : CommandExecutor {
abstract val name: String
abstract val description: String
open val playerOnly: Boolean = true
open val aliases = listOf<String>()
open val permission: String? = null
open val permissionMessage = "You don't have permission to use this command."
open fun tabComplete(sender: CommandSender, alias: String, arguments: Array<String>) = emptyList<String>()
fun registerSubCommand(command: PluginCommand) {
subCommands[command.name] = command
}
}```
this is all it does
Just make sure to extract methods which expresses your intent in code and write explanatory variables etc
Surely a framework helps significantly with the productivity part
The point is to illustrate how cleanly I can implement commands with my command library and help you understand it to see if you're interested
and efficiency
Do you want to give it a go or no?
sure
Alright
Can we set a deadline?
Write a command /strike with alias /smite
20 min should be enough init?
It takes a player optionally and strikes them with lightning
If no player is provided it strikes the sender
30 min maybe
But only if they are a player
I got it working with Shadow Jar, appreciate the help 
Very pog
Should be pretty easy, 30 mins is too much
15 min
I could do it in <5 on mobile
Granted I will be using a very very high level of abstraction lol
Idk your opponents productivity but giving them a decent amount of time might make the duel more interesting
Anyone else can feel free to participate using their command library of choice
What is it?
Yeah write that command
A smite command? lmao
Yeah let's see it
It’s about the cleanliness (:
It's not difficult but it illustrates the difference a good library makes nonetheless
Alright lmao
We can do something a bit tricker after
If the participants are fine with it, I’ll judge, promise to be impartial
Ok lol

I guess I should start writing
not entirely sure how to strike someone with lightning, have never written code to do that before
?jd-s (:
World#strikeLightning(Location)
@paper viper do you want to judge also? I believe you’re quite experienced in regards to clean code
Does the version matter?
In principle not
command class?
Yes Redempt vs bk vs nozemi
Yeah indeed
I hate writing any low level stuff
I'll go dig up some old code, I'll be back in a bit lmao
👍
Ya
just the basic
Command file:
smite,strike player:target?(context self) {
permission smite.use
help Smites the given player, or you
hook smite
}
Method hook:
@CommandHook("smite")
public void smite(CommandSender sender, Player target) {
target.getWorld().strikeLightning(target.getLocation());
target.sendMessage("Thou hast been smitten");
}```
class StrikeCommand(
override val name: String = "strike",
override val description: String = "Strikes a player",
override val aliases: List<String> = listOf("smite"),
override val playerOnly: Boolean = true
) : PluginCommand() {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
val player = sender as Player
// If no player is provided or found, will strike sender.
val target = if (args.isEmpty()) player else Bukkit.getPlayer(args[0]) ?: player
target.world.strikeLightning(target.location)
return true
}
}```
so like this
i cant really judge kotlin lol
It’s same as java pulse
Yeah true
What if the sender is not a player and no argument is given
well, the command can only be executed by players
that's checked in my command handler
what is hook smite for?
correct, that's the way I've done my thing for now
needs to hook on the correct method name
like I said, my shit is not mature at all
Will hook into the method annotated with @CommandHook("smite")
Yeah
Would you ever use more than 1 command hook for a command?
redempt yours is looking good however there’s minimal code to judge
Nozemi yours isn’t bad but the comment is redundant, it could be just extracted to its own method where the name of the method is explanatory such that it can express your intent of the code
you can call multiple methods from within your hook, so kinda pointless to have more than one hook



