#help-development
1 messages ยท Page 9 of 1
i want to display my logo like that but when i try the logo don't work and just do a square
so you don't have any development question? you should rather ask this on ItemsAdder's discord
this channel is for coding plugins
i don't got my answer on itemsadder discord
oh is it, crap
cant you open a ticket there?
because people here definitely cannot help you with that
is there any way to get the speed multiplier of a tool or do i have to manually map it
what the diff between a plugin and a mod
plugin goes in a server and modifies how it sends and recieves packets, mod is client side
and affect the player's game
k thx
NMS I guess
I manually mapped it for BestTools
yeah trying to avoid nms
since I got maven modules to work, I started to love NMS stuff
That's wrong btw
getKeys() is non null so it returns an empty set
and wrapping an empty set by a String.valueOf will return "[]"
true
so it's 100% because "list" doesnt equal args[0]
or because they didnt register it in the first place, lol
intense level of creativity
i cant believe it
whoever made that thing
is so creative
Defining Damage
what's wrong with that logo, lol
I think sometimes servers go so far with custom textures rather than look nice it just assaults you in the eyes
wtf is an ItemStack "Rarity"
or their chat is filled with way too many colours
Yea that too
I think simplicity can be part of the charm
Rather than full on color overload
uh
yk how an enchanted golden apple
display name is like
pink or purple
and a wooden axe is white
Wouldn't that make the enchanted golden apple the only rare item in the game
its rarity is epic
no
are we talking about clash royale?
there's 4 rarities
heeheeheehaw
fun fact some items upgrade when enchanted
e.g an elytra is uncommon
it gets upgraded to rare
when enchanted
but what does the rarity tell
color
just the namecolor?
yes
golden apples and beacons are rare
op stuff that u mostly get with creative mode are epic
like barriers
and command blocks
spawners and light blocks
as well as dragon eggs
and items for developers like debug stick
there are 15 epic items
yea
they should add legendary
and make it for supreme items like
an elytra with a chestplate
it's funny how all banners are non-epic. except of course for the mojang banner, which obviously is soooo epic lol
lets make a mmorpg with a rarity system
lol i bet if most of the people in help dev make a server
it would go huge
imagine like
20 devs working in one single server
and 17 of them would be unexperienced
hmmm
not really though
there are many here who know their shit
just 3 off the top of my head
alex
and then there's me
redempt
yeah and 7smile
cought elgar cought
and none of them would contribute
what beginer plugin projects would you sugest i try?
does anyone have a good idea on what to do with NMS
im new though
plus to get ideas just think about what u need
how do i change a farmland into one with seeds?
e.g i wanted to learn japanese so i made an app to help me
a tax plugin. All players have to declare their taxes every 30 ingame days. If they dont declare the exact amount they earned since 30 days ago, it fines and jails the player.
hey that's a pretty good idea
I always suggest this idea when someonne asks lol
TaxAuthority 1.0.0-SNAPSHOT
I have another funny plugin idea
btw @noble lantern i made your cowflipper, but its less hilarious than it sounds
yk idk what to learn anymore anyone has some ideas i can learn about?
a plugin that scans your other plugin .jar files, looks for static methods/fields/classes and then it prints "STATIC ABUSE DETECTED in file X in line Y"
lol
and make it sort them out
"nah, you're out"
lol
or even better
or it removes those methods from the other plugin and then everything breaks
throw fake exceptions
Nag author(s) ... of plugin ... for using static method ... in file ...
awe
fr
video?
F
whats the difference between spigot, bukkit and paper
bro
is this a custom font?
its the default mac terminal
i was kind of hoping some random guy was named jeff so i could tag him and blame him
@wet nova
we blame you
@opal juniper
NO
we blame you as well
YES HIM
Bukkit is the API. CraftBukkit is the implementation, aka it adds the Bukkit API to minecraft. Spigot is CraftBukkit + improvements. Paper is Spigot + improvements
NO
HE DESERVES ALL THE BLAME
not until my server crashes
yeah, fuck this jeff in particular!
then i blame him
i will prevent that
btw since 2 hours, I need to go to the toilet but I still havent done so
i do that alot when devving
everything you say against patheticapi will be reflected to me anyways
fuck toilets
PatheticAPI sounds good. does it exist yet?
"okay one more then im rly gonna go"
so is paper the best?
yup
HAVE YOU NOT SEEN
I havent
i HaVeN't WaTcHeD tHeM eItHeR
fr?
the best depends on what you need. As a general rule of thumbs, if you wanan stay as vanilla as possible, use spigot. If you don't care about a few fixed duplication exploits, then use paper
i tagged ollie when i made them
Credit for the actual A* algorithm goes to: https://github.com/olijeffers0n/PatheticAPI
smh
send link
thats a good performance test
all lag is just from Navigator.move call
lmfao if i see that coming i run
AHAH
oooh its about path finding
its creepy lmfao
I thought it was just a stupid general-stuff lirary that calls itself pathetic lol
LOL
citizens author like it too
even considered using your guys api
considered
keyword
well
he just said that to sound nice
who even is the citizens author
im still not satisfied with how the Pathfinder interface is built up
no his is actually rlly complicated
it has a pretty static design
well yeah ofc
impl needs work
ok guys I'll make this "static abuse" plugin now. who's going to contribute?
i was already looking into that giving it a collections-alike design
https://github.com/JEFF-Media-GbR/JarStringReplacer I already got this to scan jar files for strings, should be pretty easy to just copy/paste most things and make it look for static stuff instead
wym by collectors-alike?
Lombok and asm libs ๐
lmao wtf
menace
you can use that to replace strings in a jar
I've already written code to find static abuse lol
just replace public with public static
I made this so that I can apply the %%__USER__%% placeholders myself
lazy
because my plugins won't run if that isn't properly replaced
yeah it's for local testing stuff
hi, I'm a new entry in the Minecraft developer world, and I had some questions that I wanted to try to solve with your help ... I would like to understand how I can do to allow myself to do these two things:
โข How can I do to ensure that by clicking or interacting on a block (for example a diamond block) it can perform actions (events, commands etc)? The problem lies not in the question itself, but in the fact that this event or command must have arisen by clicking only that specific block of diamonds (with its own tag / data etc) and not any diamond block.
โข I would also like to know how to give me a material through plugin (I always use the example of the diamond) with that specific date or tag that can allow me to take advantage of the event or command I explained above, in the same way I would like how to attribute a colored name and a custom lore (always via code or config)
Thanks a lot in advance for the support!!
let's open a thread for this
^^
Actions when clicking certain blocks
hi, I'm a new entry in the Minecraft developer world, and I had some questions that I wanted to try to solve with your help ... I would like to understand how I can do to allow myself to do these two things:
โข How can I do to ensure that by clicking or interacting on a block (for example a diamond block) it can perform actions (events, commands etc)? The problem lies not in the question itself, but in the fact that this event or command must have arisen by clicking only that specific block of diamonds (with its own tag / data etc) and not any diamond block.
โข I would also like to know how to give me a material through plugin (I always use the example of the diamond) with that specific date or tag that can allow me to take advantage of the event or command I explained above, in the same way I would like how to attribute a colored name and a custom lore (always via code or config)
Thanks a lot in advance for the support!!
erm
I actually wanted to help you but now I just think that you keep spamming the same message every minute? lol
sorry, I thought asking about discord would have a quicker response
built up like the collections api
instead of the regular interface-impl design i plan to do interface-baseimpl-specificimpl with a less static design
even if its not static, the methods could all be static with the current design
Ohh I see so your just essentially gonna mimic java Collections impl api
I like that, basically each Pathfinder is a Collection (impl wise)
And it could be many different types of Pathfinder while being a Collection
basically yes, just that it will not be a collection
Pathfinder remains but will get more methods to f.e. validate the nodes
and we will provide a Base- or AbstractPathfinder which will be the root
and from there on users can create their own specific impls
for you f.e. the PlayerPathfinder
for others the regular Pathfinder
or a Dot- or ControlPointPathfinder
Lol were you mentioning me spamming /tps for this msg xD
Ahh yes
That's nice
It will be ready tmrw right
<4
Jkjk
Hello, can someone develop plugins? I just need a small plugin for 1.19 to be developed. Dm me
tomorrow? that late?
?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/
I would actually be amazed if you got that whole impl system redone in a day
thx
i could get it done today evening probably
Beastly
Ive been having a hard time focusing lately, likely do to the fact I cant stop fucking with the nps
but ironically the only motivation i find to work on that is at work
I did something foul earlier with them and got stuck doing it forna few hours
yeah im at the evening/at night way more productive
but first i gotta see what methods i give them to implement
When this is too easy to do now lol
since i wanna go as userfriendly as possible
I should of reloaded my server beforehand
It was getting me leaks out the ass it would of been better that way
Rn its rly good ngl but it is just basically static methods
Actuall Pathfinder is stupidly efficient
And its actually perfect its on block points bc that means the server needs less thinking process to actually make entity walk x distance
yeah i focused on as less effort as possible on use
whats that sound LMFAO

but its good that you test it
so bugs and performance issues or other wishes etc. comes up
Keep in mind this is running on an emd epic too
Not an i7 or i9
So it has like
Way more room
Amd epyc*
well i never actually tested it myself
Uhmmm
Wym
Oh rly
So when I set it up it could of not even worked ๐
Thankfully it did xD
oh the strategy
Not rn but later
Yeh
Rn they fall into lakes
And get stuck in some holes
They yet themselves off mountains too
man is sleeping
default is just the direct one
yeah but if its in the air it will just go straight up
It can only be so good
Yee
Like if your at top of mountain
And npc is not
He just stays at bottom
He won't try to Pathfinder up
Indeed
If you want to implement an interface in an anonymous class, no. That's not how that works 
You can instantiate an interface though
That method is called before a Path lock is added to return value
yeah I figured lmao
Eg "is this block valid for the current Pathfinder goal?"
Choco since you're there, do you know if I can use an ObjectInput/OutputStream somehow even for classes that do not implemennt Serializable?
like, I wanna turn ANY object into a byte[] and then later again, load it
Or where the block above is water rather, its one of the 2 ik
I fear it's not possible D:
yeah but without looking at the code or any advise from us this is not evident
Yeah unless it's Serializable you can't. You can kind of hack around it, though even then you're limited to just reading/writing fields that are exposed by getters/setters
Can u just
Shit, seems like I gotta use kryo then
no
๐ฆ
Wow java sucks
Imma have a look at kryo, it seems promising
I'm basically looking for sth like that lol
Choco prolly wondering wtf this for ๐
public final class WrapperOfNonSerializableClass implements Serializable {
private transient final NonSerializableType object;
public WrapperOfNonSerializableClass(NonSerializableType object) {
this.object = object;
}
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
// Write here
}
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
// Read here
}
}```
That's a kind of hack around it. Then just serialize new WrapperOfNonSerializableClass(nonSerializableType)
But you have to handle pretty much every type you want to be serializable
bruh quit your bitchin
LMAO
hm yeah I basically wannna be able to "serialize" runnables
Oh
so that wouldn't work I guess
Well if you're serializing a code block, yeah, not happening 
:(
unfortunately, lol
would be awesome for stuff like GUIs to save the "what happens on click" runnnable inside the items PDC
You could probably do some weird shit and class load it to bytecode and serialize that. Then when deserializing, write something with ASM
idk
But that's also insecure af
yeah I mean it's probably not worth it, but now I'm curious on whether I get it to work anyway lol
So you judge his method name ๐คฃ
Thats like attacking someone's face over an internet argument
XD
isBlockValidToAddToPathfindingVectorList
Oli ^
dont pass out the internals
that is such a god method name
also its not a vectorlist
Ikr
I forgot all the class names or ide go suoer in depth on a god method name
Its 6am tho imma sleep
4 pm here
wtf bro
~at work
itโs summer ahahah
iโm on holiday rn
literally, in greece rn
2 weeks till my vacation

where are you going to?
hell
oeh come visit me
you gotta Thread.sleep bro
I took garlic bread in a ziploc bag in my room earlier
Rรผgen
wtf
And I just layer in bed and saw the garlic bread
how can i make a maven repo for the api of my plugin? its a paid plugin so i cant just put the paid plugin in the resources file and get it like that since people could just decompile it and download the plugin for free, everything ive found online in conusing and makes no sense to me
Now im eating garlic bread in bed at 6am
hell is my home
lol
publish to jitpack
me eating candy at 1am
is this a reliable way to check if the player is on ground?
if (!player.isFlying() && player.getLocation().subtract(0, 0.1, 0).getBlock().getType().isSolid()) {
// on ground
}```
i thought there was an isOnGround or something
and people wouldnt be able to download the paid plugin jar or anything right?
there is but it is spoofable by clients
checking down blockface?
separate it into an API and impl module and publish the api module
do you have a webserver?
yeah
you also got docker?
no idea what that is
if you got docker, you could just run the free version of nexus (e.g. check this: https://nexus.jeff-media.com )
Nexus Repository Manager
if not, you gotta "manually" deploy it with the maven-wagen ftp plugin or similar
Bro u just got links for it all
Defo using that ty
Didnt know nexus had a docker image
nexus without docker is a pain
I really dont like docker, but for huge things like nexus, it's amazing
๐ฅฒ
get rekd, javadocs repo
if I use the api-version: 1.13 does my plugin support every version above 1.13?
well that depends ofc
what's the best I can do for multi version support?
tl;dr: yes. Unless you use any methods that aren't available in 1.13 yet
you should use the lowest version you wanna support as dependency. e.g. to support 1.13+, set api-version to "1.13" and use the "spigot-api" version 1.13 to compile
I want to use version 1.8 and support from there to the latest version of minecraft
then set "api-version" to 1.13 and use 1.8 as dependency when compiling
do I have to use spigot-api or spigot as the artifactid?
do you need NMS?
I read so many things about it that it is not (safe), but what do you mean with do i NEED nms
okay, then you don't need it ๐ you can use "spigot-api" as artifactId in the dependency
my plugin.yml:
api-version: 1.13
my pom.xml dependency:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
and I code the plugin on 1.8
that looks good
and this will support 1.8-latest version of minecraft?
in theory, yes. unless you use stuff that is available in 1.8, but not in later versions
for example, you must never use numerical IDs for blocks because they were removed in 1.13
but there are changes in the newer versions
yes, but almost everything is backwards compatible
if something compiles and runs fine on 1.8, there's like a 99.9% chance that it also runs fine on 1.19
what if someone says that he has problems on the version 1.17 what can I change in the code to fix it
that depends on the problem ofc
also NOONNE uses 1.17
everyone is using either 1.8.8, 1.12.2, 1.16.5, 1.18.2 or 1.19
i was using 1.17.1 a few weeks ago smh
WHY
idk
it's dead since a looong time
just for testing
yeah ok
and those later versions take more and more time to load
anyway @tender robin if you only use the API, then you don't have to worry about what version someone is using
well, I will just code and I will see what can i do to fix the problems if there are any
"plugins having problems in certain versions" is in 99% of cases because those plugins are using NMS
which you don't do, so don't worry
is there any alternate for nms?
np ๐
Should setLeashHolder work with a Player? The description sounds like this is a method to set the player who is at the end of the leash that is attached to the LivingEntity the Method is called on
Ohk
where is that method from?
it says that it has no effects on players, since they cannot be leashed anyway
why, when use a % my setFormat will reset ?
replace % with %%
yes
okay i well test this
otherwise, String.format thinks the % is a "identifier" or whats it called
would this run well https://paste.md-5.net/acadejihem.coffeescript
event.setMessage(event.getMessage().replace("%","%%"));
it's pseudo cause I'm not on pc rn
What is str_replace php equivalent in java ?
oh thanks!
String#replace(String, String)
the runnable stuff? Yes that works
why don't you use the BukkitScheduler?
I'm new to anything async so I'm slowly learning about how it works
didn't know that exists
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
// Do stuff
});
}
this is the "preferred" way
thanks that work!
aha
btw
"this" is your plugin instance
ik
kk
np!
I have to run the Runnable in the Executor service thread pool to have many threads right
Nah you can just dispatch them
But since theyโre expensive as they get mapped to os threads a thread pool is mostly always necessary
(reusability for instance)
how many double decimal can a location x, y, z and the yaw,pitch has ?
NMS doesn't really have documentation
You can go of the names and take a look at the code
yea just wing it ๐
How i can getDeathMessage() on EntityDamageByEntityEvent. iโm using 1.19.
anyone got any reccomendations for command manager api
cloud is pretty neat
is this simpapi any good? https://github.com/Cortex-MC/SimpAPI
I mean, that seems like another "here have all the utils you want" package
which is bad becauuuuse?
I mean, if I want bloatware I install windows
like this ColorTranslator.translateColorCodes("&#baebabThis is &c&lcool") can be done with one extra charecter with standard bukkit
Thanks:)
This one got no unit tests or anything what so ever
How do I know the framework classes work?
well how do yall make ur plugins then
u use different libs for parts u need?
Yea
Is their an api just for subCommands no extra bloatwear
indeed
hmm
https://github.com/Incendo/cloud is pretty good
that might be something il need to look into too
Cloud is nice, acf is nice or just raw brigadier 
thats just a command framework tho right?
what do you suggest for menu's then
anyone got any reccomendations for command manager api
Interfaces
^
From incendo
tho that is quite on the edge
got a link?
incendo generally hosts some really nice stuff
Or well you have IF
Or triumph gui
appreciate it
tho, does that actually work on spigot ? xD
Theres an awesome minecraft gh repo
pretty sure that is paper-native
https://github.com/Incendo/awesome-minecraft this one ? xD
Ye
so do yall use seperate stuff for handling chat too then?
parsing hex all that stuff
Adventure, mini message :>
Yea mini message does that all ๐
i like minimessage for that too
if you want legacy support I know phoenix has some stuff
has support for your &6Golden text
so even kacper can be happy
EpicGod Id say there exists libraries with good apis for the consumers, for mostly everything, but the issue is if they are reliable, did the writers write any tests to prove their shit works? And also about the design of any library? Can it support concurrency easily? Can you add it you your project and still keep testability, reusability as well maintainability?
beyond that, just vendor lock would murder me with these large all-in-one libs
imagine if that project goes unmaintained
how do i set the goal selector in remapped?

now your entire codebase is basically dead
How would I hide 1 player's nametage from everyone else on the server? I'm on 1.8.8. Setting a passenger is not working.
I mean, teams have the nametag visibility option
if that wasn't in 1.8.8 yet then ehm
upgrade ๐
:P
tho it seems like you are in luck
If I'm putting players on a team, they wont be able to see each other's name. I need one player to be able to see the other's nametag, but have that player not see their's.
Well no wouldn't you just put the one player in a team ?
like, add them to a team for just themselves
and set the name tag visibility to never
now no one else will be able to see their name
Isn't it only never for people on that same team?
no
ScoreboardTeam team = new ScoreboardTeam(((CraftScoreboard) Bukkit.getScoreboardManager().getMainScoreboard()).getHandle(), p.getName());
team.setNameTagVisibility(ScoreboardTeamBase.EnumNameTagVisibility.NEVER);
ArrayList<String> players = new ArrayList<>();
players.add(p.getName());
((CraftPlayer) player.getPlayer()).getHandle().playerConnection.sendPacket(new PacketPlayOutScoreboardTeam(team, 1));
((CraftPlayer) player.getPlayer()).getHandle().playerConnection.sendPacket(new PacketPlayOutScoreboardTeam(team, 0));
((CraftPlayer) player.getPlayer()).getHandle().playerConnection.sendPacket(new PacketPlayOutScoreboardTeam(team, players, 3));
I found some stuff online and modified it. Would something like this work?
Scoreboard board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
Team team1 = board.registerNewTeam("invis");
team1.setNameTagVisibility(NameTagVisibility.NEVER);
team1.addEntry(p.getName());
that looks better
Well board wise, all players have to be in that board
else they won't ever get the new team
how can i make a maven repo for the api of my plugin? its a paid plugin so i cant just put the paid plugin in the resources file and get it like that since people could just decompile it and download the plugin for free, everything ive found online in conusing and makes no sense to me
you will have to host it somewhere
Take a look at Sonatype Nexus
I can make it get an existing scoreboard that every player has,
Scoreboard board = p.getScoreboard();
i dont have a webserver
Well, there it stuff like jitpack
How can update this by exemple: [RANK] PlayerName ?
never liked it much
thats paid though isnt it?
jitpack is free for open source projects
ah well that wont work :/
huh
anyone know how to verify if a account is premium? i tried use mojang api, but wont worked
please
use teams
How?
Scoreboard sb = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = sb.registerNewTeam("teamName");
team.setPrefix("prefix");
i dont want a scoreboard ๐
or something like this
use scoreboard just to create a team
but the scoreboard no will appear
How can i make a string into a string[]
depends
I thought i could just surround it in []
u can use a stringbuffer
for now yes
im doing a create if not exist
and will add more data as it comes
to give a LivingEntity armour (just want to give a zombie a skelly skull to stop him from burning), i assume you would need to do setMetadata()?
they have inventories
Mob#getEquipment
might be a paper thing
but Zombie#getEquipment is guaranteed to work
oh and just editing that instance will grant it to the zombie?
Yeah
How do they work
use a foreach with the stings[]s elements, and #append in ur string builder
That sounds like a horrible way to create a one-element array
so i cant just make a normal string like "hello" into ["hello"] easily?
you can
that not possible to set a another tag name without scoreboard??
String[] array = {"Hello"};
maybe, but i known't
packets
oh ok, i thought you wanted get all elements from string[] and transform into string, srry
this seems so weird ngl zombie.getEquipment().setHelmet(plugin.getServer().getItemFactory().createItemStack("minecraft:skeleton_skull"));
i'm not sure if i'm doing it right
what is the packet do use ?
You can precache the item for future reference
is the only way to get an itemstack through the ItemFactory tho?
You can make different scoreboards with packets and send multiple scoreboards type of thing
look into the scoreboard packets, not sure about the name
new ItemStack(Material.SKELETON_SKULL);
lol
anyone know how to verify if a account is premium? i tried use mojang api, but wont worked
How can i see if a string array includes a specific thing
i just want it to have a helmet to stop burning without the helmet showing
like is their a .includes
You gotta loop
dam ok
If you want those fancy features you can just create a list
you can just cancel EntityCombustEvent
ArrayList love
wouldn't it be quite memory/calculation intensive to keep track of all zombies i spawned, check if it's combusting and cancel it?
Hey, anyone knows about worldgen and undertakes commissions??
You can just add some metadata
Or make a Set<UUID> and making sure to remove dead zombies and all
ah they won't die what i'm making was an idea of someone else. They wanted a plugin of clickable corpses (instead of items spilling everywhere) so it's special no AI invulnerable zombies with some persistent data of their owner's UUID
but i don't want update the TAB list, beacause already edited @echo basalt
only the player name above head
Yeah so just check for that
that
it still wont work!
hmm the MetadataValue interface has all these "asX" methods that I must implement
but some stuff I really don't need
dammit
is it normal to just leave those as placeholder values or something?
Hey, how do people actually do NMS block setting?
hello, how can I set the text data in new ItemStack()? Currently when I use Player.openBook(new ItemStack(Material.WRITTEN_BOOK)), the book just says * Invalid book tag *
Waterfall not finding Paper server
BookMeta?
FixedMetadataValue
I'd just use PDC honestly
PDC?
oh persistentdatacontainer
i tried that and it looks way too complex not going to lie
oh, thanks! I'm guessing something like this?java ItemStack book = new ItemStack(Material.WRITTEN_BOOK); book.setItemMeta(book.getItemMeta().addPage("Foo"));
yup, just found that out too, thanks
does the PlayerInventory.addItem cause the items to be automatically dropped if it wasn't able to added to the inventory, or will it purely return the hashmap forcing you to drop the items yourself?
public class Die implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("die")) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.setHealth(0.0);
}
}
return true;
}
}
why is this command not executing? I added it to the plugin yml with another command
This is the onEnable
public final class MyPluginDA extends JavaPlugin implements Listener, CommandExecutor{
@Override
public void onEnable() {
System.out.println("Plugin Works!");
getServer().getPluginManager().registerEvents(this,this);
getCommand("agility").setExecutor(new Agility());
getCommand("die").setExecutor(new Die());
}
This is the other command
all of it compiles
why are you implemnting command executor on ya main class
Previousley made a command there
I now removed it
When I had one command it worked
gotcha
public void onEnable() {
System.out.println("Plugin Works!");
getServer().getPluginManager().registerEvents(this,this);
getCommand("agility").setExecutor(new Agility());
getCommand("die").setExecutor(new Die());
} ```
public class Die implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("die")) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.setHealth(0.0);
}
}
return true;
}
}```
public class Agility extends JavaPlugin implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("agility")) {
if (sender instanceof Player) {
Player player = (Player) sender;
PersistentDataContainer p = player.getPersistentDataContainer();
int currentexp = p.get(new NamespacedKey(this, "agilityxp"), PersistentDataType.INTEGER);
int currentThreshhold = p.get(new NamespacedKey(this, "agilitytreshhold"), PersistentDataType.INTEGER);
int currentAgilityLevel = p.get(new NamespacedKey(this, "agilitylvl"), PersistentDataType.INTEGER);
String message = "Current Exp: " + currentexp + "\n" + "Exp needed to level up: " + currentThreshhold + "\n" +
"Current agility level: " + currentAgilityLevel;
player.sendMessage(message);
}
}
return true;
}```
you forgot the java
you can also use getLogger().info("plugin works") instead of sysout
cache namespacedkey as a field
p.get() without the pdc entry being present will result in a NullPointerException too iirc
package me.dor7123.mypluginda.commands;
import org.bukkit.NamespacedKey;
import org.bukkit.command.CommandExecutor;
import org.bukkit.entity.Player;
import org.bukkit.command.CommandSender;
import org.bukkit.command.Command;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
these are the imports
PDC is here no ?
p.get(new NamespacedKey(this, "agilitytreshhold"), PersistentDataType.INTEGER);
you can either check if pdc.has before getting it or assign currentExp to an Integer instead of int and check nullability
both commands are packaged under "commands"
im not talking about imports
ohhh you say it wasn't instanced
that's not the issue right now but I have a todo to make it so it will be created upon joining the server for the first time so nullpointers wouldn't happen
im saying if the player doesnt have a "agilityxp" tag in his persistent data container, that method might throw a nullpointerexception
Yup, currently not the issue it seems
bro
u cant have 2 javaplugins
lmao
Was that the issue ?
ur creating an instance of agility which extends javaplugin and ur other class which extends java plugin as well
yes that is the issue
ur plugin wont even load
2hex
or is ur main class called Agility?
?
now it breaks my namespaces key this argument
how do I fix it? super or something ?
How does the spigot now that 2 clases extends hava plugin when it only look for the one on plugin.yml
Wheel
well i assume it assume that
whenever there are 2 objects that extends it in the jvm
it throws
@grim ice How do i pass the plugin as the argument for the namespacedKey constructor now ?
by learning java
-_-
?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.
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
What have to JVM with class inheritance?
๐ค
JVM is the java virtual machine
mhm
its implemented in the plugin class loader afaik
@sterile tokenso the extension wasn't the issue ?
lmao
it's not a java error
bukkit raises it
when there are 2 instances extending javaplugin in the heap
as far as I know 2 classes can both inherit from the same parent
Dor723, we straightlly recommend learning the basics from the laguage before touching the spigot api
Yeah
I know the basics
He also said JVM
yea wtf
you dont know the basics
Thst have nothing to do with spigot
im pretty sure you dont
what
JVM = java virtual machine
I did my intro to compsci on java
its implemnted in the api impl, not in the jvm
I'm just rusty on the syntax
and u dont even know di?
And what have to do thst with 2 classes extending the another class
nothing
di as in ?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
bro ๐
what time is it
2:15 pm
I know lmao
how do i run spigot 1.16 with java 16?
But your Where saying that JVM doesnt allow many classes extending java plugin
๐
You have said it
....
๐
wtf
bro u need some sleep
ur english just died and now ur saying stuff no one said
he needs to see his gf /s
why can't I have 2 Javaplugins ?
cuz it doesnt make sense codewise
there's something called google actually
but anyways
Because of JVM as hex said....
lmao
only ur main clas
only one class is supposed to extends JavaPlugin and that class tells what to do when enabling and disabling
i guess he means this
Hi! I am looking to make a class that will identify other
Let me explain:
We would have a base class call it: Island.java
And some classes that I'm going to register that will be extensions of this one, NetherIsland, PlainIsland and DesertIsland
Then I assign them in my player, but how do I assign this or that quest to some type of island
How can I do all this, someone has a tutorial to guide me?
not talking about the context of the pluginclassloader
You are on crack hex
do you know english bro?
the agility command previousley worked by the way and it extended the JavaPlugin as well
no it didnt
bro im losing brain cells by the second
wtf someone help
Bruh it literally worked until I created another class under the package
ur telling that ur quest object has an island field?
๐
Yea, you've just been a dick the whole time
how am i a dick
what isnt working now then?
telling me learn to java isn't help
so I don't remember 100% of Java syntax and intricacy
then im not doing that
Dor723 are you Spanish?
Yea, telling me to google isn't help is what I'm saying
learn java and you wont need to ask those questions
get a phd in compsci and you won't need to ask those quesitons
they made a whole command to tell people to learn java
what the fuck kind of answer is that
because of how many people do what u do
Yes, ask a question about something people know and can save trouble
Why people is so rude
You know you can know a language and miss 1 aspect of that language that completely breaks your code
In fact I would like to create several islands, which is a subclass of a base class so Island
And with this one we can assign the parameters for each island then, example quests, challenges, objectives, finally everything we put in for example NetherIsland will be only in NetherIsland and if we put for example Break 5 blocks in desert Island, only the one of Desert will be able to do it, unless we put it to 2, 3 or everywhere actually
Except I don't see how to do this
It's not like I came in here "wtf is a class lol"
if you miss aspects that completely break ur code then u have to ask in a discord server about it for half an hour
trust me, you dont know the language
so each island has a set of quests and stuff?
No it's because there's zero help in the server
lmao
yeah, each island her own data @tardy delta
This is legit toxic
but ur generalizing things yk
u didnt talk with the whole server
u only talked with me
so you prob should say that im toxic
splitting hairs
not the entire server ig
have an abstract class or interface Island and have classes like NetherIsland implement that and have their constructors for populating the islands data
dunno if all of the data should be in memory at all time (speaking of quests rn) so maybe do a little bit of caching idk
wondering the same thing ๐ค
yes they do
aight bro, pretty sure inheritance is a basic java concept
Dor723 also didnt he said it?
I have sent a screnshoot tho
verano if you dont know english
pls dont argue in english
yea
๐
since what i said could be easily comprehended if you know 6th grade english
seems like 2 hex confused the fact that one class can't inherit from two parents
@grim ice thread the photo man
what
"it" literally goes to "spigot"
if you learnt english that is
๐คฆ๐ป
English is my second language and I speak it fluently
Also me
im not telling u to be fluent or whatever
if both of us thought you said what you said
just basic 6th grade english
youre bad at communicating
Me too, i'm french
Aight
i can get a few dozen mistakes
Got my max points on it on my SAT
bro you mistyped the second assume and extends should be extend
tf are you talking about with your 6th grade english
bro ๐
that what a misspell but yes
i noticed that
k
