#help-development
1 messages ยท Page 1740 of 1
There is a plugin that makes that every 1h that the player is online it will summon a command like give player diamond 1? Like a playing reward
is it possible to make silent lava?
You probably imported the wrong Vector
java.util.Vector
Make sure you've imported bukkit Vector and not that one
^
yes thank you i fixed it ๐
so currently I am saving HashMaps through serializer
how can I determine how many saved hashmaps have the same key?
// this is inside of a class i just copied the code i wanted to show
public HashMap read = null;
try {
FileInputStream fileInput = new FileInputStream(Settings.file);
ObjectInputStream objectInput = new ObjectInputStream(fileInput);
read = (HashMap) objectInput.readObject();
objectInput.close();
fileInput.close();
}
catch (IOException | ClassNotFoundException obj1) {
obj1.printStackTrace();
}
could it work like a loop?
uhh what is wrong
You're not parameterizing the HashMap
It should be HashMap<K, V> where K and V are two types
Also why are you serializing it that way
is there another way to serialize?
There are many ways to serialize
Depending on what you're storing, it may make sense to use config, json, or sql
config and json are two HUMAN-READABLE SHIT
i am making waypoints plugin
and i dont want anyone that is an admin sees every single player's waypoint locations and stuff
that is why im using serializer
and json is human-readable too
serializing will not hide it
if you want to hide it from prying eyes just use sqlite
theres tutorials on using sqlite with spigot
hmm
how do i check if this exists?
notepad
null
and btw remove that new String[]
return null
let the server handle it
smh how do i save something to config like [uuid1, uuid2, etc]
class org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMetaItem cannot be cast to class org.bukkit.inventory.meta.SkullMeta
Hey! i have some questions about custom events...
public class HealthStat extends Event {
double getMana;
private static final HandlerList HANDLERS = new HandlerList();
//private double getMana;
public void currentMana(double getMana) {
this.getMana = getMana;
}
@Override
public HandlerList getHandlers(){
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
public double getMana(){
return this.getMana;
}```
I have this code, how can i do to do that the custom events do what ever i want?
btw, how do ppl do to get this colors?
@override
oh
true
ty
you can add scale to an armorstand?
You can save string lists directly to config
If you have a List<UUID>
You can convert it to a List<String> like this
List<UUID> uuids; //assume this is populated
List<String> strings = uuids.stream().map(UUID::toString).collect(Collectors.toList());```
Then you can just save that list directly to config
oh thanks
?
why do commands not work? i have this in my main class
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// /color
if (command.getName().equalsIgnoreCase("color")) {
if (sender instanceof Player) {
Player p = (Player) sender;
p.sendMessage(ChatColor.RED + "====================================");
p.sendMessage(ChatColor.WHITE + "&0 = " + ChatColor.BLACK + "Black"+ ChatColor.WHITE + "&1 = " + ChatColor.BLACK + "Dark Blue");
p.sendMessage(ChatColor.WHITE + "&2 = " + ChatColor.DARK_GREEN + "Dark Green"+ ChatColor.WHITE + "&3 = " + ChatColor.DARK_AQUA + "Dark Aqua");
p.sendMessage(ChatColor.WHITE + "&4 = " + ChatColor.DARK_RED + "Dark Red"+ ChatColor.WHITE + "&5 = " + ChatColor.DARK_PURPLE + "Dark Purple");
p.sendMessage(ChatColor.WHITE + "&6 = " + ChatColor.GOLD + "Gold"+ ChatColor.WHITE + "&7 = " + ChatColor.GRAY + "Gray");
p.sendMessage(ChatColor.WHITE + "&8 = " + ChatColor.DARK_GRAY + "Dark Gray"+ ChatColor.WHITE + "&9 = " + ChatColor.BLUE + "Blue");
p.sendMessage(ChatColor.WHITE + "&a = " + ChatColor.GREEN + "Green"+ ChatColor.WHITE + "&b = " + ChatColor.AQUA + "Aqua");
p.sendMessage(ChatColor.WHITE + "&c = " + ChatColor.RED + "Red"+ ChatColor.WHITE + "&d = " + ChatColor.LIGHT_PURPLE + "Light Purple");
p.sendMessage(ChatColor.WHITE + "&e = " + ChatColor.YELLOW + "Yellow"+ ChatColor.WHITE + "&f = " + ChatColor.WHITE + "White");
p.sendMessage(ChatColor.RED + "====================================");
}
}
return true;
}
discord has tabbed is strangely but this isn't python so it should be fine
did you register it
yep
Why do you compare the name with color
oh wait i did'nt ๐คฆโโ๏ธ i used the command from the video not mine
but should'nt it still work if it's unregistered?
no
btw, i should user player instead of p
If you unregister it (idk why you even would do that) then it obv doesnโt work anymore
i'm noob so don't trust at all
you're talking about plugin.yml right?
plugin.yml cannot unregister commands
Help with Annotations
Only register them in a way
Well this probably good so yeah not nooby at all
๐
The name of a variable should be explanatory to the scope it lives in
so you're talking about putting a line in the main class? in the onEnable
Uh well
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Here take a look
ty
I advice self teaching so yeah ๐
yep i self taught myself python
yep
this.getCommand("color").setExecutor(new CommandKit());
would i do this? as intellaJ is complaning about CommandKit())
What does it complain about
why this?
Because it marks the variable as an instance variable/field
Itโs more readable if you for instance read the source on GitHub or what not
but he is not registering a command?
He setup his command instance
And for that assuming you use the api, youโd need to grab the plugin command by the super method getCommand(name)
In which using this keyword before is arguably better, it wonโt hurt performance anyways
oh now i see how i did it before. i used a different class for the commands
How can I check if two entites collided
Is there any way to apply scale to a armorstand?
seems like you are trying to cast something to a skull that isn't
I'm new to java, how can I print /join2 to all players on the server with the /join command?
I only know how to write to the person who wrote it
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.performCommand("join2");
}
Loop bukkit.getOnlinePlayers
use
for(Player p : Bukkit.getOnlinePlayres){
p.sendMessage("message")
}
@swift sparrow thank you, it works
but for sending a join something, won't be better doing an event?
(i don't know what are you doing so maybe i'm bad)
hello i have a question please
?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. Create a thread in case the help channel you are using is already in use!
well
maybe seach in the spigot page should be better
"custom vanilla structures"
A plugin that works well pls
and something will appear ig
Hi, does someone know how to remove the hikariCp connection messages in the console ?
How can I get the entities a slime split into?
what's that?
Ok I'll change my question if it's ok. How can I customize the vanilla structures?
with plugins xD
Lol only plugins?
It's probably the easiest thing to do but me and my friend really took a long moment trying to
Mmh looks like this plugin adds things
You can modify some of them with datapacks
oh true
I also searched datapacks but nothing
hmm
so there aren't more expansions for minecraft
and by default i think there is no way
so just mods?
I mean datapacks and plugins are ok for me but idk how to make them for custom structures
hey fellas, I could use help from someone more knowledgeable with looking for a somewhat specific kind of plugin if that's alright
I'm trying to get my hands on something to stop shulker boxes being put into chests but I'm coming up dry on anything recent
that or making it with like skript but I'm not that familiar lol
well, you can do a plugin that if u try to click a shulker box in a chest menu it cancells
i think
adri do you think you could help me making a plugin for that
๐
That wouldn't be hard to do at all. It's just working with the inventory events
Can anyone help with this
how can I get the ItemStack from a Projectile?
how do you save information after a server reset? (besides mySQL)
ah, so just create a yml file for the plugin and read/write to it?
Does someone has a proper hikari cp tutorial to follow ?
i mean thats kinda the standard for most things
such as minigames details are saved in config files
like arenas/games/signs
Json is pretty popular for storage as well, as serializing stuff is really easy with it
its merely tad bit faster but annoying to work with
I disagree
For settings. Sure, but for storing data i think its more pleasant to work with
if you know how to work with parents,childs yeah not hard but for someone new like him its just a pain for no benefit
U really dont need to know alot about that, just use gson to serialize/deserialize objects, pretty much everything is done for you
bump
look at luckperms implementation
do you have to initialize something like this public class ToggleBlockInfo implements Listener, CommandExecutor { private Main plugin; private SQLLogger sqlLogger; public ToggleBlockInfo(Main plugin , SQLLogger sqlLogger){ this.plugin = plugin; this.sqlLogger = sqlLogger; plugin.getCommand("winfo").setExecutor(this); }
differently in main class?
Cast it to whatever it is like AbstractArrow
its quite solid
@untold rover
then use getItemStack()
there is no getItemStack
getting an error that is telling me the getCommand is returning null
which is what I said, cast it to whatever it is first
depends on what you want to do
this is the Spigot discord, so I am looking for Spigot related info
that too
it's the same in spigot
there is no such method in spigot
anyways he might not even be working with AbstractArrow or any of its derivatives
its a normal Arrow
just with a displayname
so to rephrase it, I need to be able to get the displayname of the Arrow projectile
You can in principle store the itemstack through pdc when the projectile is spawned
do you have an example how to do it properly? never really used pdc
?pdc
Is a switch of instance possible? (An example would help)
Like instead of
if(Object instanceof Object1)
if(Object instanceof Object2)
```You would do
```java
switch(objectinstance)
case Object1
case Object2
```?
yeah I'm not doing this just asking if something like it is possible.
and getClass() isn't exactly the same as instanceof
Yeah but you can't really check its instance only the name
and how do I put an ItemStack inside the PDC?
well you can check if it's exactly the same class, but not if it's a superclass
hmm most exaple checks
class name
also this hmm
Java currently has a draft to support this. See here. The syntax looks like this
switch (obj) {
case Integer i: handleI(i); break;
case Byte b: handleB(b); break;
case Long l: handleL(l); break;
case Double d: handleD(d); break;
case String s: handleS(s); break
default: handle(obj);
}
that's not the only way
Thats almost exactly what I needed XD
Class#isAssignableFrom and Class#isInstance both exist
though Class::isInstance just checks instanceof in principle
cant fully say what happens to non-primitives tho
conclure you have an idea
uh yeah but I believe smile actually got an impl for that luckily he seems to be here just in the right moment
There are 2 approaches.
- Create your custom PersistentDataType<String, ItemStack> which uses json serialisation
- Just store it as String
private void addTag(net.minecraft.world.item.ItemStack item, Map<String, Object> tags) {
NBTTagCompound compound = getNBTTag(item);
tags.entrySet().forEach(entry -> {
String key = entry.getKey();
Object value = entry.getValue();
switch(value) {
case <InstanceofString>: compound.setString(String.valueOf(value)); break;
}
});
}
```So basically I want to do this.
hello, how do i get the size of the result string when calling Graphics#drawString("My string", x, z) from awt
context: i want it to be in the center
The most performant approach here would be a
Map<Class<?>, BiConsumer<NBTTagCompound, ?>>
With concrete implementations where unsafe casts are not a problem.
Wait a BiConsumer might not be enough here...
Compound has different set methods. Thats why I was taking the switch route.
Let me write a mock up...
and the main set method is NBTBase
So I was making a command that would add a player to an arrayList if the player was on an array list they wouldn't be able to throw entitys
but it didn't work can anyone figure out why? https://paste.md-5.net/veruxuzaxu.java
Oh god this does not look healthy...
private interface TernaryConsumer<T, K, V> {
void accept(T t, K k, V v);
}
private final Map<Class<?>, TernaryConsumer<NBTTagCompound, String, Object>> applianceMap = new HashMap<>() {{
this.put(String.class, YourClass::applyString);
this.put(Integer.class, YourClass::applyInt);
}};
private static void applyString(final NBTTagCompound compound, final String key, final Object value) {
compound.setString(key, (String) value);
}
private static void applyInt(final NBTTagCompound compound, final String key, final Object value) {
compound.setInt(key, (Integer) value);
}
private void addTag(final net.minecraft.world.item.ItemStack item, final Map<String, Object> tags) {
final NBTTagCompound compound = getNBTTag(item);
tags.forEach((key, value) -> {
final Class<?> valueClass = value.getClass();
final TernaryConsumer<NBTTagCompound, String, Object> applier = this.applianceMap.get(valueClass);
if (applier == null) {
throw new UnsupportedOperationException("The value type " + valueClass + " is not supported.");
} else {
applier.accept(compound, key, value);
}
});
}
Yeah I'll just stick with if(value instanceof Object) at that point xD
But at least its really fast ๐
private void addTag(net.minecraft.world.item.ItemStack item, Map<String, Object> tags) {
NBTTagCompound compound = getNBTTag(item);
tags.entrySet().forEach(entry -> {
String key = entry.getKey();
Object value = entry.getValue();
if(value instanceof String)
compound.setString(key, (String) value);
if(value instanceof Integer)
compound.setInt(key, (Integer) value);
if(value instanceof Double)
compound.setDouble(key, (Double) value);
if(value instanceof Float)
compound.setDouble(key, (Float) value);
if(value instanceof Short)
compound.setShort(key, (Short) value);
if(value instanceof Long)
compound.setLong(key, (Long) value);
if(value instanceof Boolean)
compound.setBoolean(key, (Boolean) value);
if(value instanceof Byte)
compound.setByte(key, (Byte) value);
});
item.setTag(compound);
}
I don't wanna be pushy but uh can someone help with this I am taking a walk soon
Listener isn't registered
But its a command not a Listener
You're listening to an event. And its not registered to listen to it
I got this error in console: https://paste.md-5.net/axuqihufol.css
Did you forget to add the command to the plugin.yml
.. I am so stupid
anyone familiar with using the hex chat colors? i want to make it so its (color 1) T (color 2) e (color 3) s (color 4) t where color=hex code
@quaint mantle mini message is a cool API for that stuff
Wait nevermind I did that but it does nothing
Does someone know how to remove the loggings messages from HikariCP ?
Can someone explain to me the proper way of initializing this in Main.java, the way i'm using is giving me an error saying getCommand is null
private Main plugin;
private SQLLogger sqlLogger;
public ToggleBlockInfo(Main plugin , SQLLogger sqlLogger){
this.plugin = plugin;
this.sqlLogger = sqlLogger;
plugin.getCommand("winfo").setExecutor(this);
}```
im not sure thats what im looking for after looking up on it
You want that?
Yeah mini can do that
ah
yeah i guess im looking to make my own way of doing it so it can adapt easily to our code
Im getting this same error in console too
In configs it'll look like this
Gradient:color:color2:color3Message</Gradient>
Can i see the error?
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.n0grief.WatchBlock.Main.getCommand(String)" is null
at com.n0grief.WatchBlock.ToggleMethods.ToggleBlockInfo.<init>(ToggleBlockInfo.java:26) ~[watchblock.jar:?]
at com.n0grief.WatchBlock.Main.onEnable(Main.java:72) ~[watchblock.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-266]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-266]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-266]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:535) ~[patched_1.17.1.jar:git-Paper-266]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:449) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:725) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1212) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-266]
at java.lang.Thread.run(Thread.java:833) [?:?]
[10:00:04 INFO]: [WatchBlock] Disabling WatchBlock v1.0.9```
Ok
its not in the plugin.yml
Also, while you're at it, update your server, it's ~80 builds out of date
there's an issue with the way that i am initializing the class i believe, not able to do it the same way i have in the past
?paste your plugin.yml
๐ hey ollie
^ pretend this is an external emoji, they are booster only for some reason here
Yeah lol , i know 7smile7 was having an issue with that - idk why
yep
winfo
its indent is screwed
its technically a value of wblockdebugger
so it never gets spotted
?main and a main moment too
shit sec
?paste
what would be the easiest way to get a ItemStack when reading the pdc
Can't you just serialize the itemstack to bytes and then deserialize it when reading?
an ItemStack is probably too much data to be storing in a PDC
unless its a permanent storage
I mean, that is basically how shulker boxes work
yes
and the bytes to a string ๐ฏ
then vice versa
Can someone help me with this? The plugin isn't registering anything: https://pastebin.com/egjhYRXe
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.
I think the better way of doing this is separating the event listener in a different class
or at least that is the way i do it
also
commands:
egg:
usage: /<command>
description: insert shit here lmao use ur imagination
use this in your yml ^^
Are you on paper?
sorry for necroposring tho
Ok there are many things wrong with this
- That's not how you register commands you need to set the commands executor it's not an event
You need to add the command (winfo) to ur plugin.yml, like so:
commands:
winfo:
usage: /winfo whatever
description: whatever it does
Can you tell me how to fix this
Also the empty constructor for TestCommand is unnecessary. And you imported the wrong chatcolor it should be a bukkit import
You need to do this.getServer().getCommand("name").setExecutor(command class instance)
You need to get the command as a PluginCommand using JavaPlugin.getCommand(String) and then set an executor using PluginCommand.setExecutor(CommandExecutor)
I'm on phone so check syntax
and dont forget to add the command to your plugin.yml
getCommand("cmd").setExecutor(new CmdExecutor());
Also make sure you use org.bukkit import for chatcolor because I noticed you where import the bungee one.
And remove the empty constructor it's not necessary
why doesnt bukkit chatcolor have the of method
or the one that allows for custom colors
valueOf?
whatever its called
guys so i have a question
Or translateAlternateColorCodes?
?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. Create a thread in case the help channel you are using is already in use!
Oh idk I don't use bungee
convert java color class to bukkit equivalent?
getCommand("setHomesOptions").setExecutor(new AdminCommand());
getCommand("setHome").setExecutor(new PlayersCommands());
commands:
setHomesOptions:
usage: /<command>
description: Edit settings for SetHomes Plugin
setHome:
usage: /<command>
description: Make a home
this is how i register my commands
but for some weird ass reason
doesn't get suggested when i try to do / in game chat
Ye its loaded
i can type the command manually and use it
but it just does not get suggested
even after reloading
or restarting the server
ooh
The args aren't suggested or the command itself?
this happened with all my plugins
both are not suggested
maybe its if ur not using api-version: 1.16 in plugin.yml
Do the commands work if typed?
main: com.rephrasing.sethomes.HomePlugin
api-version: 1.17
oh
Nothing that doesn't matter
is it a release version
u mean experimental jar?
yeh
ye its a release
so not experimental
You mean getPluginCommand? this.getServer().getCommand("name") Gives an error
unstable
sometimes works and some other times just not suggesting anything
what the hell
probably a bug ngl
maybe suggest it as an issue or something
to paper
and the thing is
when i try to google that shit
it never gives results
not even random results, just complete none
ye well i asked here to see if anyone has experienced it before
so i can get some knowledge before making an issue
This is in your onEnable right?
@Override
public void onEnable() {
instance = this;
getCommand("setHomesOptions").setExecutor(new AdminCommand());
getCommand("setHome").setExecutor(new PlayersCommands());
}
this is my onEnable
if you were curious
seems fine
i recommend you use plugin.getCommand
yes
helping keylesstravis
Anyone know the distance in minecraft coords of the nametag above entity/players ?
I can't find it on google
should be able to find a lot of good series on youtube
looked everywhere
Intellij (Make sure you download the community edition!)
https://www.jetbrains.com/idea/
Java 8 JDK (You have to make a free Oracle account to download the JDK)
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
Feel free to ask in the comments or drop a message in my discord server and I will be glad to help!
Please L...
?paste
ye
how do i make it
I can edit so water doesnt push tnt
and tnt
doesnt move when lighted
i dont know
minecraft_tnt_merge
Check this guy out he is pretty good
https://youtube.com/playlist?list=PL65-DKRLvp3Yn7iglPfxKoc7bl0N80XgG
But you still need to learn Java along with that
?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.
You should really learn the basics of Java before you even think about plugins
kk
i had, it was spaced out wrong tho, fixed, thank you ๐
hey yall what we doing today
Are you in the right channel? I think this is a conversation for #general
was asking that as in like what are yall working on today/who needs help kind of way should of worded it better
Ah ok no problem just don't want to fill this channel with random discussion
Also sorry if i sound like a mod lol I just find it really annoying when I'm trying to help people or ask a question and it gets drowned out by people talking about random stuff
is it possible to set the color of a beacon to RGB colors? or just the default mc colors?
You're not wrong :p
wdym by combine? do you mean putting glass ontop of another?
Is anyone familiar with batch statements in sql ?
I would like to execute multiple statements in one query
with PrepareStatement#addBatch() and PrepareStatement#executeBatch()
But not sure on how to use the actual addBatch
the top one overrides it
Really? Huh I thought that was a thing maybe on bedrock idk
It's probably not possible then
rip
anyone available to hop into a voice channel for a few to help me out
sure
alright im in general-1
at org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity.teleport(CraftEntity.java:226) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at me.babario.HelloWorld.commands.Spawn.onCommand(Spawn.java:45) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
... 15 more
how do i see the rest of the errors?
1.8 ๐คฎ
because it says 15 more
yeah for pvp
those 15 more are irrelevant
oh
?paste
If you really want to support a 7+ year old version of the game, that's up to you
1.18 is about to come out and you're still on 1.8
the amount of versions plugins have to support honestly just make it not worth anymore
i love playing on servers with the newer versions but sometimes servers like hypixel are fun and thats in 1.8
i kinda already forgot how 1.8 api works got used to the 1.16+ api
i wanna make a server like that
just make a plugin where pvp is like 1.8 pvp then
Bit irrelevant to your case but you aren't moving forward by using a version older than your playerbase
that seems really had but i will do that in the future when i can
hard*
nope its actually super easy its just a few lines of code
You just modify each players Attribute when they join
and remove the attack cooldown, cancel sweeping attacks and anything else you dont like
You just wont be able to do block-hitting which is fine tbf
You can make it where if someone right clicks they just bring up a shield, but make sure you store theyre offhand item beforehand and make sure they cant dupe shield
Google it theres a forum on spigotmc forums that explains it pretty well
I cant exactly remember how i did it
ok i will tysm
oldcombatmechanics handles all that
is that a spigot class?
nah it's a plugin
ahh ok awesome
Ah yeah forgot about that plugin
btw here's a thread on 1.8 if you'd like to understand why it is generally frowned upon to use 1.8
https://www.spigotmc.org/threads/hackers-on-my-server-need-help.345790/page-2#post-3214230
except replace 5 versions with 10
ok ill read it rn thanks
dang it can even get hacked
yeah im switching to the newest version
idk if im late or not but try
for(string idk : playerheadlore) metaplayer.setlore(idk)
oh wait
in the wiki it can use the list<string>
wait
but it is deprecated
this isn't deprecate
Thatโs paper
wait SpigotAPI still uses strings instead of Components?
Not saying its a bad thing
Ohh so Component will still work accross the 2 alright then i was kinda saying oh shit over and over in my head cause my whole plugin uses them on PaperLib lmao
Oh no, spigot uses bungee chat api, whilst paper uses adventure
Donโt think spigot has component methods for a lot of stuff yet
Oh so if i slap my plugin on a spigot server it likely wouldnt work?
Imma test it rn but curious still
daaaaang
thats sad now i gotta make the plugin use 2 different libs
Would there be an easy way to support both versions inside one plugin by chance? Or would i have to make 2 seperate forks?
I mean changing the Component import would be easy just a simple ctrl + f search and replace tbf
Yeah but only way i can see doing that is one of two ways
Either creating a "spigot" branch on my github and replacing the Component import
Or revert to using strings which i dont really wanna do necesarily
burchard you could shade in adventure
and adventure bukkit platform
if you want to use it
Then you'd in principle use BukkitAudiences::create
and pass that around to send messages and whatnot
What is the difference between adventure and minimessage
adventure is a text library, minimessage is just a formatting library isnt it
Never used BukketAudiences before tbh but i could shade in adventure into the plugin
Iโm thinking of using minimessage
if you want to save size that is
Having people type rgb color codes in the config sounds terrible
I would assume the adventure lib wouldnt be too large, my plugin already has to shade in google gson so its already 331kb currently on top of the codebase
If adventure is on maven central you can use the spigot dependency system
Isnโt gson already in spigot
I wouldnt be concerned if the plugin was 5ish mb in size as it is a large plugin
tbf i actually think it is now that you mention it lemme check
anyways gson is kinda ded
I mean latest commit was 7 days ago so i dont necesarily thing its dead
Pluss the class serialization for parsing json makes things so much easier
Spigot might have it bundled in but doesnt seem paper has it bundled in
well
moshi is much better
https://www.reddit.com/r/androiddev/comments/684flw/why_use_moshi_over_gson/ here's what one of the contributors of gson said
intresting ill have to look into it i have never heard of Moshi before
It would be hard to convert as of right now as my whole entire plugin is based around Gson support currently (Adding mysql support is gonna be hell)
also like how the entire lib for moshi is much smaller
My current project is like 337kb in size which really isnt much but im always wanting to make my plugins smaller in download/storage size even if its a few kb
hmm
yeah
I really don't care about size as long as it isn't unreasonable, from my point of view the design and architecture should take precedence.
Yeah i wouldnt really care if a plugin is a few MB in size, especially after i add in mysql/mongo support its gonna reach a few MB in size
I would say the entire structure/design of my current project is pretty well done but idk i selt taught myself everything i know about java and this is one of the largest projects im doing right now
yeah, tho as said you could ofc try out runtime dependencies
where you download them at runtime and load the classes
Wouldnt downloading at runtime though increase startup time significantly? Or would it be negligable
in most cases its not that significant
plus if implemented properly it should cache, so obviously not every startup would require you to dl the dependencies
What would be the proper way to implement it? Just setting mavens scope to runtime would be enough or is it a bit more complicated than that?
If thats not the proper way ill google it up
I've seen a few libraries for it, can't remember names off the top of my head. I don't use it much
ty ill definatly take a look into that soon enough once i add in other libraries
I do want to split my code apart and make a seperate library jar for things like storage/config read & writing, playerdata classes, particles/animation and whatnot and keep the plugin strictly to events and commands but that's a lot to split apart currently, and having a slimjar would seem really usefull for that
try not to spread it too thin
Yeah i definatly wouldnt do that, having a thing like
ExternalAPI#savePlayerData(Type.MySQL, data)
Or
ExternalAPI#createAura(data) would deem pretty useful
As currently this entire plugin has its own API but its kinda just crammed into one plugin and just feels messy working with 50+ different classes all in one project
ill definatly need to do some refactoring as well because right now a lot of this junk is reptative or just not readable very easily to outside sources
My biggest mistake when working with large projects was spreading my projects too thin, Then its a huge pain to make sure you have correct dependencies, versioning etc etc
yeah refactoring is always good, spend a day or two just refactoring your project, it usually doesn't take ah uge amount of time
i refactored one of my 14k LOC projcets in < 3days
Oh yeah definatly, i would think maybe shoving all dependencies into the API jar and importing it that way would be a nice way of doing things
pog
uhh i thought heart day
Currently this projects reaching 3k lines of code and it doesnt have anywhere near 1/4th of the things i want added in yet
if you don't mind me asking what is the project?
Have you ever watched Dragon Ball Z?
yeah i just finished the whole series a few months ago
Its basically that but as a minecraft plugin
So far i have a race selection, RPG system, and im working on Quests right now
Im so not looking forward to creating ki blasts though, cause i utter dogshit with using math
The projects in a link in my bio if you ever wanna look through it
lmao sometimes its just a matter of throwing math at the compiler and see what works
Thats my plan
Took my a good like 20 mins to figure out a good defens formula LMAO
oh yeah formulas like defense, exp etc take a while to fine tune
its simple but as of now it works with the custom mobs currently added
But i feel like later on ill need to making it better cause it just looks bleh
oh and there custom mobs added ^
They basically go my radius in each world, so the farther out you go the stronger they get
ever heard of it?
this right? ^^
yep
Never heard of it hm
me too.
let me show an example real quick
๐ฆ
private int n;
public void setN(int val){
this.n = val;
}
public void getN(){
return this.n;
}```
becomes
```java
@Getter
@Setter
private int n;```
it becomes super handy when you have say 20 manager classes with getter/setters
instead of having say 100-200 lines for getter setters
it becomes 20 lines
also has other functionality like a builder annotation for classes and some other features
This class that currently has almost 400 lines LMAO
Thing i could set the getters and setters in other classes tbf, thats what i meant by some uh.... major refactoring
I see ill definatly have to look at that
I love lombok
@AllArgsConstructor
@Builder
@Data
@Jacksonized
public class HDLConfig {
@Singular
private Set<Repository> repositories;
@Singular
private Set<ResolvedDependency> dependencies;
}
Only thing is if i use lombok i need to be able to trigger cache updates when a method is called but tbf i can probably call that after the methods used
oh my
I really need to refine this class maybe i can make each getter/setter return a Savable/Cachable class and do something like setHealth().cache() so it does that for me
still shorter than my class lmfao
Would i be able to add in certain if clauses with lombok? EG:
sounds a bit convoluted tbh
not that im aware of
imo that looks like clashing of functionality, that check could be put elsewhere
Kinda is, its just that i would need to update the PlayerData thats in cache cause when things like this happen:
It would update theyre data in the HashMap that stores player data
TBF your right thats probably not needed because by default the player level is 0 without choosing a Race
Lombok is strictly for boilerplate code
Yeah i 100% can add in lombok to things like this class here And remove all my getters and setters inside my PlayerData class here: that would shorten things down by a bunch
I think lombok is something you should use from project start
if you already have it written out, it's just more work to undo it
i have no idea why you guys put the word this. in
but worth in the longterm
that is just boost the line 5 more words.
Everything in here is pretty modular i would just need to refactor the current code or just make my PlayerData extend PlayerCurrentData and it would be done pretty easily
I prefer using this whenever applicable
And final as well
its negligible in most cases
same with people using final, i saw some dude who used final on every argument of every function
Yeah it's mostly for readability not conciseness
final is only really useful when making APIs
Yeah definatly but i feel it just makes things easier to read, so that way people who read the code know that that variable is in this class
if you're writing your own code you should know what is immutable lol
There was a point in my programming like where i did @NonNull before everything im so ashamed LMAO
That was on previous projects though
yeah but its already established that the variable is referring to the class' variable
this is only really useful in constructors or with clashing argument names
(or passing the class as an argument itself)
Yeah thats pretty much where its used is in constructors
EG when i pass plugin into a constructor it will be this.plugin = plugin
But i still referance it in later cases by this.plugin so i guess my first line in this statement is false
EG:
this adds quite much readability
I even have my ide to complain if this can be added but isnโt
Yeah it does make it a lot easier for me to read personally but it can also confuse people who contribute later on maybe
I think it aids in readability in some scenarios but in say for example this.number = 1; it would be pretty useless
Sure ides do a good job coloring local stuff vs instance stuff but on gh for instance
Not at all
We now for sure know itโs an instance variable
But i doubt anyone will contribute to something large like this
My only people contribute to my Nodeactyl project
this.saveTime in that referance is a variable pulled from configs so it might not always be = static number
Yeah GH coloring is kinda bad i wish they made it better :>
brb
Indeed
i sort of like it, but idk if its some sort of stockholm syndrome or something lmao
how many players can play minecraft 1.17.1 server at the same time?
SOrry
wrong channel
at least 7 no more than 12 (if you get this joke nice)
Im still waiting for a github dark theme so im not flashbanged by it at 3am
Also speaking of github, what would cause a project that hasnt been heavily advertised to get views and clones like this? Bots i assume?
where is that at wtf
Not necessarily
Settings > Appearance
Someone might have just found it and then decided to share it with others
Ayyy thank you for that
Maybe, because a lot of the views are spread out throughout different classes and i dont think that git clone bots would really look through different files
Ye
Well thats nice to know people are using my dogwater code somewhere LMAO

Spigot sendMessage() Skipping Lines
i'm also pretty surprised how many visitors I have been getting recently lol
Spider spider = skeleton.getLocation().getWorld().spawn(skeleton.getLocation().add(0.5, 0, 0.5), Spider.class).setPassenger(EntityType.SKELETON);
error: incompatible types: org.bukkit.entity.EntityType cannot be converted to org.bukkit.entity.Entity
Need to use skeleton variable
Spider spider = skeleton.getLocation().getWorld().spawn(skeleton.getLocation().add(0.5, 0, 0.5), Spider.class).setPassenger(skeleton);
error:
incompatible types: boolean cannot be converted to org.bukkit.entity.Spider
set passenger returns a boolean
just spawn it then set passenger dont have to do it in one line
So how would I fire 3 arrows in the direction the player is facing with a space between them...?
so they look like multishot type stuff
I have it partially working but only in one direction..
Frolic are u new to java?, if yes then I suggest u to learn the basics before coding a plugin, u will have a easier time, and using spigot doc
im adding 0.25 to the location's X for each arrow but i need a way to know if the X or Z should be changed
depending on facing direction.
Making 2 arrows that have different rotation and velocity, pretty sure that's how multishot crossbow work
errrr..wot
Does anyone have any idea why my issue is even occuring
gotta say the issue first
check the threads lol
welp... I cannot comeback from that one
spider.addPassenger(skeleton);```
this should work?
link
This
Should. But also you don't need skeleton.getLocation().getWorld() you can just use skeleton.getWorld()
are you too lazy to click a button lol
You underestimate how lazy people are xD
I support that xD
what a toxic community this is
๐คท
if that is the case, why should I have to retype my issue
๐คท lol
Chill dude we joking
Only slightly
I have been trying to solve this for hours
Can somebody give me an exmaple how to listen to minecraft packets?
Dude I wasn't able to solve a problem for months, don't be so impatient
a problem that shouldn't occur
... still the syntax is correct
what are yall talking bout
Before I start being toxic I will take my leave ๐๏ธ
getBlockFace().getModX() best method that exists in the api prove me otherwise
what is src/test folder and how can i use that in plugin dev?
hello
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent event, Inventory inv) {
currentWorld = event.getPlayer().getWorld();
if(currentWorld.getName() == "bwlobby")
{
inv.clear();
}
}
is this ok?
i mean
uh
will the function get called with 2 argument?
or will only call the function with only 1 argument
nvm
i realize i can use event.getPlayer().getInventory().clear();
Event listeners don't work like that
They only pass the event
And yeah you can get the inventory from the player
?paste
@hearty solar
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent e) {
Player p = e.getPlayer();
checkPWorld(p);
}
public void checkPWorld(Player p) {
if (p.getWorld() == *your world* ) {
p.getInventory().clear();
}
}```
you should learn java
anyone got a clue what makes else if(action == Action.RIGHT_CLICK_BLOCK){ player.sendMessage("1");
execute twice but
if(action == Action.LEFT_CLICK_BLOCK) {
only executes once?
Pretty sure it's called for each hand
hmmm
if im wanting this method to run regardless of what's in the person's hand or if its empty is there another way of getting around that weird behavior
Does the event not fire if your hand is empty?
currently, it fires w/ empty and & block in hand
it fires 1 time w/ a block in hand and 2 times if naked hand
anyone got any ideas?
i want whenever my skeleton moves, Vex spawns with it, but idk why its not working.
import io.papermc.paper.event.entity.EntityMoveEvent;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton;
import org.bukkit.event.Listener;
public class SkeletonEvent implements Listener {
public void skelEvent(EntityMoveEvent event) {
if (!(event.getEntity() instanceof Skeleton))
return;
Skeleton skeleton = (Skeleton) event.getEntity();
if (!(event.getEntity().hasMetadata("SkeletonKing")))
return;
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}```
No such thing as EntityMoveEvent (In spigot)
Need a task checking its location
LOL
LOL
you didnt see the import right?
io
?
@EventHandler
public void onEntityMove(EntityMoveEvent e) {
if (e.getEntity() instanceof Skeleton skeleton) {
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}```
this is more easy to read man @last ledge
ur code is not cool.
but this doesnt work
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.
you just didnt check
check it
then tell me the result
after that if it works then just put another if to check its metadata like what you did
after u feel like u are pr0 enough for spigot
just go spigot javadocs
how to fire method for ONE hand using PlayerInteractEvent.getAction.RIGHT_CLICK_BLOCK?
pattern matching in instanceof is not supported in -source 8
yeah
instead of firing once for each hand when no block in hand
so what to do
then remove the skeleton then use Skeleton skeleton = (Skeleton) e.getEntity();
as i used java 16
and it is way better to use java 16
public void onEntityMove (EntityMoveEvent event){
Skeleton skeleton = (Skeleton) event.getEntity();
if (event.getEntity() instanceof Skeleton skeleton) {
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}
}```
???
remove the skeleton after event.getEntity() instanceof Skeleton
and put the Skeleton skeleton = (Skeleton) event.getEntity(); in the if statement
public void onEntityMove (EntityMoveEvent event){
Skeleton skeleton = (Skeleton) event.getEntity();
if (event.getEntity() instanceof Skeleton) {
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}
}```
^^ @last ledge
Do you even understand the code?
?learnjava @last ledge
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.
anyone familiar w/ right clicks using PlayerInteractEvent
show us code?
uh
Right click fires twice with naked hand, fires once when block held in hand on click
anyway to make it behave same way no matter naked hand/block hand
array2 = arraylist or wat?
its part of a toggle
Wait.
you just cant see the toggle portion
you dont even know java i think
OK... lol
First of all
I will post the code here and tell you why
shiet.
it passed 2000 words.
hmmm
your code is really messy lol
instead of passing xyz world
why dont u just pass the location of it?
sorry but me too.
Just pass the location
then after that
you can get the x y z world whenever u want
man
u dont know that?
LOL?
do you have any idea how to fix the problem i was actually presenting
or are you just here to flame people
cause if youre just here to flame people you should just fuck off
so what are u trying to do i forgot ๐ญ
Right click fires twice with naked hand, fires once when block held in hand on click
anyway to make it behave same way no matter naked hand/block hand
im aware it is firing once per hand
i was asking if there was a way to have it only fire once and ignore second hand
Check the hand
uh can u tell me what to do
.
.
in the if statement
just, put, that, line, in, the, if, block, code. maybe use the block code is easier for u to understand?
no, if he can't understand the word put in statement then he cant understand anything else.
@EventHandler
public void onEntityMove (EntityMoveEvent event){
Skeleton skeleton = (Skeleton) event.getEntity();
if (event.getEntity() instanceof Skeleton) {
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}
}```
to ```java
@EventHandler
public void onEntityMove (EntityMoveEvent event){
if (event.getEntity() instanceof Skeleton) {
Skeleton skeleton = (Skeleton) event.getEntity();
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}
}```
that isn't difficult...
put the in if statement
i hope i will never spoonfeed anyone...
doesnt work....
did u register the event?
this is fresh only
ok
Does anyone understand why I cannot pass an Array<ItemStack> to a function that accepts Array<ItemStack?> in Kotlin? I can't get to make the non-nullable array I have at the beginning nullable again without looping...
it is ur fault not mine.
oh and that picture is somehow reveals my identity so i will remove it
I dont see anything sus
import io.papermc.paper.event.entity.EntityMoveEvent;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntitySpawnEvent;
public class SkeletonEvent implements Listener {
@EventHandler
public void onEntityMove (EntityMoveEvent event){
if (event.getEntity() instanceof Skeleton) {
Skeleton skeleton = (Skeleton) event.getEntity();
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}
}```
here is full code
if anything is wrong
Is your plugin enabled ๐
bruh ofc yes
the only thing is:
the ondisable isnt necessary to keep there
and i used constructor instead of the static instance :v
but 2 of them is just my personal idea, u can take it or not
and i dont see anything really sus with those 2
just posted the picture
cause someone above said EntityMoveEvent doesnt work
that is for paper
yes of course will not work with spigot.
but if u used paper
then of course work.
yes it paper
help me solve my issue, i dont need picture
i dont see anything sus
so maybe can u give log?
or no log for the error
no error
then i have no idea why it dont work
i StArTeD cOdInG fOr OnLy 1 MoNtH
me 2 weeks
Hmm, I'l take a look one second.
yus
Try casting it?
array as Array<ItemStack?>
That is really weird though, nullable types should accept non-null values...
api-version: 1.13
i am using api version 1.13
will this work ?
Also don't ask people for help with Kotlin lol, most either hate or don't know the language, feel free to ping me instead.
Is there an entitymoveevent in 1.13?
Server dosnt load but the plugin is there```package me.luminaexe.hardcorepurge;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class HardcorePurge extends JavaPlugin implements Listener{
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("------------------------------------------------------------------------Hardcore purge was started Initialisation was success No problems were found--------------------------------------------------------------------------------");
int x = 1;
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onDeath(PlayerDeathEvent event) {
//Even for Joining
System.out.println("say A player has died L gg");
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
ye its there ig
?paste
Also the server itself doesn't load?
Why would we need your plugin code then? You'd want help with the server files.
no the plugin dosnt just show up when i do pl
Did you put the plugin in the plugins folder?
yes like in Vindicator how vex spawns
i want exactly like that in skeleton
Is there a plugin.yml in your resources?
lemme check rq
Oh btw
So the way you are doing it right now is that one vex spawns every time the skeleton moves a block (anywhere) which will cause ALOT of lag to your server.
where is it(im still new to plugins)
that is what i wanna say ^
like alot
so what do i do
maybe he needs a code for delay it
src/main/resources
k
bruh
yeah it actually died.
@EventHandler
public void onEntityMove (EntityTargetLivingEntityEvent event){
if (event.getEntity() instanceof Skeleton) {
Skeleton skeleton = (Skeleton) event.getEntity();
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}
}```
Here it only spawns when the skeleton targets an enemy
Also don't forget to register events in your main file.
that is the one we need
but
leme test it out
there is
but that can still kill the server
Copy and paste that plugin.yml here
if someone decides to run around to trick the skeleton then the server will die anyway
Eh, not really as its only spawning one
You could add a check to see if its targeting a player
wait?
oh hm
i thought it would spam the event until the player out of range
lel
oh no, i think the target event is only called when it agros on a player
@lavish hemlock
@EventHandler
public void onEntityMove (EntityTarget event){
if (event.getEntity() instanceof Skeleton) {
Skeleton skeleton = (Skeleton) event.getEntity();
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
skeleton.getWorld().spawnEntity(skeleton.getLocation(), EntityType.VEX);
}
}
}```
Just do this.
ok
for (int i = 0; i < 6; i++) spawn here
SPAM LOL
sus
Yeah I saw it, the file looks good. Have you checked to see if your jar file contains it?
sussy baka
wym?
amog us
a smoke us
A jar file is just a zip file (no joke), so have you checked if the plugin.yml is in it? Spigot needs it to recognize your plugin soo if it can't that's really the only thing I can think of.
I'm serious no joking ๐ค
jar file is a zip. no joking here dont sus me
maow is typing...
Well it is tho, it's literally the zip format but with an extra flag.
And also it's specified that jars must have manifests (META-INF/MANIFEST.MF)
oh that is my question from the when i tried to create a brand new resource pack by getting the assets folder in minecraft version...
what is the meta-inf?
basic java moment
