#help-development
1 messages · Page 794 of 1
how can i fix this NullPointerExeption?
It says that the problem is in the main classe but i don't have almost nothing there;
public final class flycommand extends JavaPlugin {
@Override
public void onEnable() {
getCommand("fly").setExecutor(new FlyCMD());
}
}```
[flycommand] Enabling flycommand v1.0.0
[16:31:41 ERROR]: Error occurred while enabling flycommandv1.0.0 (Is it up to date?)
java.lang.NullPointerException: null
at im.yuvi.flycommand.flycommand.onEnable(flycommand.java:10) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) ~[patched_1.8.8.jar:git-PaperSpigot-445]
[16:31:41 INFO]: [flycommand] Disabling flycommandv1.0.0
Now read what it says
You probably forgot to define the fly command in your plugin.yml
commands:
FlyCMD:
description: "Enable/disable fly mode."
usage: "/fly"
FlyCMD is not the same as fly
Lol
wait what was the java command to make it a different version of java
i have java 8
Use the path to your java 8 exe
oh right
is there an in depth guide to protocollib?
thanks
What part?
Whats the diference with Oracle JDK?
Just to know
Eclipse Temurin is OpenJDK. Oracle comes with some proprietary stuff I believe
@chrome beacon help
one is more scalable than another and stuff
Did you forget --rev
what BT spigot are you building?
take the pointed hat to the corner ^
Does someone know how can I roatete a display item based on yaw pitch and roll?
ok so i need to synchronize files and large binary data between nodes in a network but the network uses rabbitmq for communication and it doesnt seem like a good idea to send like megabytes through rmq
but i dont think you can get an ip address from a rabbitmq event
so i cant send it raw through sockets
anyone got suggestions?
Relative to what?
rabbitmq can do dozens of MB/s
I dont see a problem
fr?
in one packet?
or like message
ig i could compress the data further
maybe
as well
and send it in blocks
Don’t think sending such large packets is wise
Are they on the same machine?
How about you create a protocol which only publishes a delta
u mean like the changes
yes
how would that work with binary
idk i need to send a full file at some point tho
One entry change for example
0x0A=0x01
detecting changes would prob be goofy
I remember there being some adapter your could run on top of RMQ which split huge messages into smaller pieces
yeah thats prob what im gonna do
like give an id to initiate the file transfer on a normal communication channel
and then do the transfer on a sep exchange
with the id
and the receiver get thsat
I purchased a plugin awhile back and now it's no longer in my library :/
how can i create sub forlders with like languages configration?
Which plugin?
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
GriefDefender
Did you charge back or smth
no i dont know how to do that lol
i have proof that i purchased it and everything
only thing it might be - i used a guest paypal account
oh shit. just realized i might have bough it without being logged in :/
put it in a hashmap (Thats basically caching)
Then write it to a database. Are you concerned about when to read/write to/from the map and DB?
You can't view the spigot page without being logged in
If you've made the payment you can contact the author with proof of purchase and see if they can help you
I'm not worried, I want to store simple data like kills, level and deaths
they said to go to spigot
Then email support
then if player leaves transfer the data to database
Sounds good. Is there a question behind this?
yup xd
i don't know the way to transfer hashmap data to database 😄
- Remove it from the HashMap
- Write the object into your Database
I dont... did you use a DB before?
I have a little knowledge about DB
Ah ok. So your core question is how to write an Object into a Database
yup
Im assuming you want to use SQL?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Ah yeah we have that as well
Before you start with that: Do you have a good reason to use a Database instead of saving your data into files?
Yes, because I want to create a server
i think database is better
than files
Thats not a good reason. You can run a server with writing your data to files.
But can you make an argument for it? Otherwise there is a very good chance that a DB will actually be worse for you.
I think everyone has a server that uses the database
Thats a bold assumption
But why would database be worse?
I feel like most smaller servers don't bother with a DB xD 
Plugins fall back to SQLite in most cases
If you cant make a good point about why to use a technology, then you should probably not use it.
Idk seems like something that'd be better off in SQLite rather than JSON if you plan to scale
unless you get a ton of players though you're prob better off just sacrificing the memory
I mean an int takes up what 32 bits*, if you have like 50-60 plays that's practically nothing even if you have like 10-20 stats that are 32 bits each
For persistence, the difference gets noticeable after a few thousand unique files. (Which 99.9% of servers never reach)
Only argument would be to have access to extended queries.
Because it adds complexity. SQL is a whole new programming language you need to learn.
not to mention you have to make sure you may unkowningly open yourself to vulnrabilities given you don't use it carefully
You can use a DB. Just be prepared to learn a lot of new stuff.
And if you have never written data to Files before, then i would recommend you to do so.
Just storing data in files is underappreciated.
wait I just thought of something are ints stored in
32 bytes or 32 bits
bits
I was read before
lol
Ooh you mean you where right before
yeah haha
well I want some systems of mine to be scalable when needed in the future
so I just use DBs for most of the stuff when I write a complex system anyways
or you just abstract and make it later you's problem 
ehhh idk about that
having it is having it
also, SQL is sexy to view, manage and so on
I use nitrite which is even sexier
nitrite is infact the sexiest database I've interacted with
I still prefer Bson for nosql
iirc this is BSON based
What? I must be missinformed then, last time ive read about it
Bson is great
yes it is
It has support for using java serialization to store their documents.
Where did you read that they use Bson?
Their documentation doesnt mention it
I haven't touched it in a few months, I support both mongo and nitrite in my Database tools project, I prob got the mongo module and nitrite module mixed up
how do i add an id for custom model data to an itemstack
ItemMeta#setCustomModelData
thanks
This is cool
This is also interesting
Other than that it sounds like a bootleg MongoDB 😄
oh interesting I haven't used htat one yet, I usually map to and their Documents
basically is :3 that's why we use it 
But i like that you can start instances from java
I thought that was a feature with most databases?
I only know SQLite and h2 which have that
ahh I mainly use the file datbases since I have no use to scale to the size of needing one like MySQL
A. most minecraft servers don't need that scale no point in my coding some overkill solution
B. I just haven't felt like setting up an environment to mess around with that stuff
Oh right. So this is basically what SQLite is to bigger SQL DBs, but as an alternative to MongoDB.
Ill keep that in mind
yep basically
I spent like 2 weeks searching for a solution like that because I wanted to try something other than SQLite
and I actually quite liked Nitrite for the little testing I did 
plus it NoSQL and plays nicely with json like storage
how can i set an attribute modifier to only work on head? and how do i hide the modifier from showing "when on head"
right now i have meta.addAttributeModifier(Attribute.GENERIC_ARMOR, new AttributeModifier("generic.armor", 3, AttributeModifier.Operation.ADD_NUMBER));, what exactly is the name and UUID supposed to be? am i using the name right?
the name can be whatever you want
what about UUID?
The uuid is used to identify your modifier. You cant have two modifiers with the same ID on you.
Also used when removing a modifier
so i can just set it to whatever?
Sure
Hello, I'm trying to store data for a plugin in the config.yml. I've got a method I call in onDisable() that serializes the data and writes it to config.yml. I also have it print the contents of the config to the terminal for debugging. In onEnable() I call a readData() method to read the file and get a Map<String, Object> for deserializing the data. I have a matching print command here to compare what was written and what was read, they don't match at all. The file contents seem to be what it should be, but the readData() method gets something else entirely which I'm not able to cast to the needed Map<String, Object>. I'll attach a screenshot and the code. I'd really appreciate any insights you might have.
public void saveData() {
getConfig().set("data", factionManager.serialize());
System.out.println(getConfig().get("data"));
//{invites=[], factions={787d1337-5692-448f-9ae6-c49b5881b6e1=net.sudologic.rivals.Faction@42c39711}}
saveConfig();
}
public FactionManager readData() {
if(getConfig().get("data") != null) {
System.out.println(getConfig().get("data"));
//MemorySection[path='data', root='YamlConfiguration']
return new FactionManager((Map<String, Object>) getConfig().get("data"));//error is here
//java.lang.ClassCastException: class org.bukkit.configuration.MemorySection cannot be cast to clas java.util.Map
} else {
return new FactionManager();
}
}```
Call getMap() instead of raw get()
That method doesn't seem to exist, do you mean getMapList()? I think that would return a List and not a Map, not sure I can cast that.
Honestly, you are passing a Map<String, Object> through your constructor.
At that point i would 100% simply let my FactionManager implement ConfigurationSerializable
It already does implement ConfigurationSerializable. I've been trying to follow this tutorial: https://www.spigotmc.org/wiki/introduction-to-serialization-section-2/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Then... use it.
public void saveData() {
getConfig().set("data", factionManager);
System.out.println(getConfig().get("data"));
//{invites=[], factions={787d1337-5692-448f-9ae6-c49b5881b6e1=net.sudologic.rivals.Faction@42c39711}}
saveConfig();
}
public FactionManager readData() {
if(getConfig().get("data") != null) {
System.out.println(getConfig().get("data"));
//MemorySection[path='data', root='YamlConfiguration']
return getConfig().get("data", FactionManager.class);//error is here
//java.lang.ClassCastException: class org.bukkit.configuration.MemorySection cannot be cast to clas java.util.Map
} else {
return new FactionManager();
}
}
Hello, im fighting with a bug in my code (image)
Code: https://paste.md-5.net/lufelaxoba.java
Actually, idk what could be happening
Maybe FileWriter isnt the proper way?
Also, this is the command code: https://paste.md-5.net/igiwohajiv.js
how do i give an item a custom nbt tag
?pdc
- 1.8 is a decade old. Support was dropped years ago
- Gson cant randomly serialize
ItemStackyou need to write a custom adapter for that
Oh
Is there way to disable vanilla biomes from loading, if I am using a custom generator such as terralith, or a config I can add to terralith?
And spigot serialization/deserialization?
Sure, you can write your adapter by using spigot as a backend for serializing it
any type of resource for this?
really thought gson would work by vanilla
no
k
no, like a tutorial
or forum post
like to understand better
well, finding the adapter itself will be awesome
Already writing it
woh you're writing a resource already smile xD
public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> {
@Override
public ItemStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
TypeToken<Map<String, Object>> token = new TypeToken<>() {};
Map<String, Object> map = context.deserialize(json, token.getType());
return ItemStack.deserialize(map);
}
@Override
public JsonElement serialize(ItemStack src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src.serialize());
}
}
Usage:
Gson gson = new GsonBuilder()
.setPrettyPrinting()
.registerTypeHierarchyAdapter(ItemStack.class, new ItemStackSerializer())
.create();
what is the back end difference between teh serializers and the adapter. I have always assumed the adapter is faster, but is that even necessarily true?
Will that work
probalby gson can probably handle a string object map
i rlly dont understand whats happening
Because one of the things you’ll get when deserializing is an ItemMeta instance
Can gson handle that
lets try
It was able to when i tried this last time (a few years back)
I think this was my first type adapter i wrote a few months after i started
Just make sure to register it as a TypeHierarchyAdapter and not a TypeAdapter bc the runtime class is CraftItemStack
yea
just did that
going to try
this been in intellij since i started it
i dont use kotlin and well
idk how to stop it
well
its empty
Alright so at least the serialization worked.
Your FileWriter is not being flushed.
Just serialize it to a String and write it to your file.
Okay let me see
got it, thanks
Where can i learn how to write this serializers?
They are pretty similar to bukkits configuration serializable
in fact it should be possible to make a general ConfigurationSerializable adapter
You really only need a few
Gson can handle the rest of your data pretty easily
Does anyone know how this class https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java actually affects plugins..
Thanks for your help so far. It seems there is a new error a bit earlier in the code, in the createCustomConfig() method. It seems to be failing to deserialize an object, I would assume the FactionManager. I believe this is a fairly standard way of doing it, most tutorials I've seen have nearly the same code here. Any ideas?
public void createCustomConfig() {
File customConfigFile = new File(getDataFolder(), "config.yml");
if(!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
saveResource("config.yml", false);
}
customConfig = new YamlConfiguration();
try{
customConfig.load(customConfigFile);//error here
//org.yaml.snakeyaml.error.YAMLException: Could not deserialize object
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
factionManager = readData();
}```
I have never seen this exception before.
Where do you call createCustomConfig?
When slot is empty, ItemStack#getType will return null or AIR?
It's the second line in onEnable, right after I log that the plugin is starting.
@Override
public void onEnable() {
Bukkit.getLogger().log(Level.INFO, "[Rivals] Starting!");
createCustomConfig();
createConfigs();
registerClasses();
registerListeners();
registerCommands();
}```
I just got an idea though, maybe I should move registerClasses() above it?
It will throw a NullpointerException because your ItemStack will be null before you can call anything on it
Okay
im doing this:
public static boolean isEmpty(Inventory inventory){
for (int i = 0; i < inventory.getContents().length; i++){
if (inventory.getContents()[i] != null){
return false;
}
}
return true;
}```
Wdym?
I wonder if an event gives a modern Material and a plugin tries to compare it with a legacy material, does it return true?
If so, how???
because its still a material? only difference really is in the naming
bytecode shenanigans iirc
Legacy materials are converted on plugin loading iirc
*Through bytecode shenanigans 😄
yeppers!!!
can't wait to add even more!!!
Bytecode fuckery for enums coming soon™️
Don’t worry about the legacy support classes in craftbukkit
They are clever and somewhat interesting to study
Lets do 1.13 two point 0.
Just bomb everything and call it legacy
But they may also be against the Geneva Conventions
It's not the same in the enum
== only works with exactly the same objects
again byte code fuckery
it does conversions
It can do it after Material is loaded?
Yes
Alright, thanks
iirc it works by editing your jar file directly right?
It does it to the plugin bytecode
Kinda yeah
It doesn’t actually edit the file, it edits the bytes as java loads classes
Do this: Material goodIdea = Materia.valueOf("LEGACY_WOOD");
yeah as its loading it is kinda what i meant
Instrumentation is cool
meta.setCustomModelData(Integer.getInteger(entry.getKey()));
meta.setDisplayName(entry.getValue().toString());
stack.setItemMeta(meta);
player.sendMessage(stack.getItemMeta().hasCustomModelData() + "k");```
why does the sendMessage return false? i just set it?
entry is entry from a map
Im trying to do a deserializer from json, first:
what should i use?
Cause i would like to use Reader json, Type but idk what Type really is
whichever one best applies?
Type is just a class
or a gson TypeToken given you're using a complex type
So Type is lets say, my object.class?
yeah prey much
Okay and that will return T
so for the case of an item stack it'd be
ItemStack[] stacks = gson.fromJson(new FileReader(file), ItemStack[].class)
whats T?
its a generic so
Oh yeah, i got that understood
if you put in ItemStack[] it'll return ItemStack[]
Okay, thanks
This is not the best implementation isnt it?
i feel like thats the worse way to do it
I wouldnt worry too much on implementation and first just get it working
Easier to optimize when something is working then when it isnt lol
im testing it
okay
at least deserialization works
my code for giving kit to player doesnt
Why do you create your kit and then copy all values into a new kit?
Cant you just use the intially created kit?
Hey guys do any of you have your own jar api? what for? Some sort of wrapper? or what

dude what?
Was kind of thinking of creating my own for updates, java plugin updater sort of stuff
I already have an api endpoint on my subdomain
So yeah wrapper would be kinda cool
❓
Tbh seems like you are just throwing words
What even is the question!?!
I think he wants to download updates for his plugin and patch his jar or something
Spicy
Interesting snapshot
finally
is block hardness client sided
Hm? You mean for the cracks, right?
Basically if you increase the server side hardness the client will have to break the block multiple times for the server to actually let them break it
It used to be kinda nice. But now its weird with client predicting stuff.
with blocks having a codec now there is a realistic chance that gets changed in the not-so-far future
Data driven blocks plz
how much ram do you guys give intellij, mine somehow consistently runs out of ram even though I give it 4gbs
well thats where mojang is going
I would stay with mojang. The moba is trash.
Riot is really good at taking existing concepts and slightly improving them and making them more accessible. I don't think Minecraft needs that
Took me a second
Hey riot is kinda behind hytale
That epic new sandbox game
That was announced 50 years ago
Ah right. They ditched java and went with C++
They better develop the most insane tools for it or there is 0 chance that it comes even close to MC
following the same formula. if they make it free-to-play they also have done the "more accessible" part with Hytale
And I would bet that their MMORPG also ends up like this
Gotta get that new legendary hytale skin
ngl i was kinda hyped when i heard that they work on one
That was half a decade ago i think
I was a bit hyped when they hired a bunch of former GW2 devs from ArenaNet
but most of them quit by now, and the lead dev (former WoW lead dev) also quit. and I wouldn't be surprised if its partly because Riot plays this very save and isn't gonna innovate anything
I mean, its a strategy that works very well. Its just so boring
Sounds like Microsoft with minecraft
Since 1.19 they have done a really good job imo. Mojang is just really really slow
Yeah I read that it’s because it’s hard to get things approved by the overlords
But what they are making is still really cool
I give it the minimum it lets me give it (if you have ≥16 GB the minimum is 2 iirc), most of the memory intellij actually uses is off the JVM heap anyway, so the less I can give it the better, actually, because it has more room for the off heap stuff (memory mapped files)
maybe I'll try less ram
ur just bad
I think I give eclipse 2
I give it 10gb
on my desktop I have it at 2, on my work craptop (8 GB) I can give it 1 lol
maybe one of my plugins has a severe memory leak? I lose a shit ton of ram quick
why are you in craftbukkit josh
Add Jishuna*
ah, possibly
I have like 5 plugins enabled lmao
which plugins do you use?
a few of the built-in ones (maven, gradle, terminal, kotlin) and nyan cat progress bar (very important)
Help it’s dark in here
which jar is the server craftbukkit-ver or craftbukkit-ver-bootstrap
intellij doesnt show me sizes
I think I might be due for a reinstall
disabled every plugin and I'm still leaking memory faster than you can say "leaking memory"
Sounds like me earlier when my plugin tried to index the entire server root
bro
new jetbrains ide dropped
y2k is femboy confirmed

bruh out me 🥹
do you have programming socks
no
do you
@EventHandler
public void onQuit(PlayerQuitEvent e) {
Player p = e.getPlayer();
PlayerStats playerstats = Main.getInstance().data.getPlayerStatsFromDatabase(p);
Collection<Integer> values = map.values();
for(Integer value: values) {
playerstats.setKills(playerstats.getKills() + value);
Main.getInstance().data.updatePlayerStats(playerstats);
}
}
is this right way to move hashmap data into database?
Yes
1
one of colls nms projects
do jishlib or somethng
why does bro nest nms like 3 times
Ooh that’s the cursed one
its okay im trying to even understand where tf nms is defined in this gradle file
paperweight dev bundle
well im not using paper though-
There’s no special source for gradle
Well there are some third party ones
But userdev is easier
share 🕵️
im trying to like
get the jist of what the fuck is so weird about adding nms
here i thought you quite simply include the nms jar as a gradle dependency
but i see people having all of these subprojects and stuff just for nms
Subprojects are just for versioning
bro actually only has compileOnly "org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT:remapped-mojang"
what da hell am i missing 😭
My guy are you writing in Arial font?
its the spigot dep for remapped mojang
it just implement subprojects
i love arial
I'm revoking your PR privileges
oh okay
At least if you used Eclipse I would understand. But Arial font?
i guess ill give dat a try thanku
make sure to run buildtools with --remapped and have the plugins setup
i loved it in school and its just a nice font
anyway
cause Kit is the class, u know
idk
it works
i know its not the best implementation but it works for now
well tbf my current issue is not compiling the plugin
but getting the NMS imports in the ide
I have deprecation warnings: https://paste.md-5.net/ajesanimac.css
Should i waste my time finding new solutions or nah?
@worldly ingot is this better for you
Those aren't even deprecation warnings. Those are "Dude, you're using com.sun code, what the fuck are you doing bro?" warnings
sure
mmm
i copied 7smile7 code
!
stinky
choco do you like my jetbrainsmono nerd font mono
They're internal packages not exposed by Java
If you're using them you're probably doing something wrong lol
Or ur having lots of fun
False prints the usage message defined in plugin.yml
?paste
where i find the newer packets names?
this is v1_17_R1 packets
Oh i faund this!
https://www.spigotmc.org/wiki/general-introduction-of-packets-nms/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
alright 15 billion years later i have this remapped jar
here is where the fun begins (i do not see how your gradle build file in any way mentions a jar file)
when you run buildtools it installs it to maven local
oh shit i see
about maven local since ive never used it
is it sorta like
just there
or do i need to run it manually
its just there
its files on ur pc
/userhome/.m2
@worldly ingot is this better for you
epic
yeee i see it there
im guessing i should be using the uh just spigot one though
ye
yea well
maven doesnt find it
💀
do i need to manually include the local maven repo
ur dependencies block should have mavenLocal() in it
oh thanks
WHOOO ITS INDEXING IT
WHOOOO THE TUTORIAL I WANTED USES A REMOVED NMS METHOD
what is life anymore
are you sure it has been removed just not relocated
reload is literally save and load again?
i mean im looking for uh
sendPacketNearby
im currently following https://www.spigotmc.org/threads/1-8-1-13-custom-block-breaking-change-block-hardness.362586/ but im using 1.20
unless there's better resources
i gotta yolo it and suffer
thanks
anyways its really dumb how they implemented chat signing as most servers style messages
obviously that's not mojangs job and they probably just use the signing thing as a legal cop out
but its how it ended up being implemented
they used to have the thing where you could view changes the server makes to the messages before you send them, but I'm assuming that had too many exploits or something
They have no legal obligations to even implementing signed messages. As far as i have been told people in the EU wanted it and so they implemented it.
Idk whose these people that voiced wanting it but they are quite dumb regardless for trying to force it on everyone
too be fair it doesn't matter since it doesn't work on most production servers anyways
it wasn't implemented in a way where it could
for some reason i am being told this loop is bad
https://pastebin.com/Z0LuvuLg
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 what does that even do
supposed to expand out 3 times in a x,y,z + 1 and log the blocks that are wood defined blocks
wasnt the code, it was the fact i put Location location in a public void that checks for block breaks and never used it
that code still doesn't do anything
useful atleast
though I'm sure you know that?
im trying to remember without googling docs or anything. i get its something people use but i have a real bad memory so i am going to to this entire class without looking anything up
i have a config.yml
'1':
- 'this is a hat name '
- rare
how do i only grab one of these strings
i used Entry.getValue() but it grabs the whole thing
what's wrong with doing
List<String> values = config.getStringList("1");
?jd-s
declaration: package: org.bukkit.configuration.file, class: FileConfiguration
you got a lot of methods to work with
how can i make it so you can equipt an item in the helmet slot like normal
If I am on an offline-mode server, is the player uuid still useful?
In offline mode uuids of players are derived from their name
if a competant auth plugin is used uuids can still be usefull
plugin development wise
do our hosters have the say when it comes to what java version we can compile with? when i try to upload it with the newest java i get console errors
been using shockbyte for years i can wait
The Shockbyte Knowledgebase contains hundreds of tutorials for managing your game servers for Minecraft, Hytale, ARK, Rust and more.

that works lol
Can I make IntelliJ ignore certain characters when spellchecking?
Like for example: I want IntelliJ to read &ccannot as cannot
You can add them to the dictionary
So that I have to add them every single time i write something with a color code?
¯_(ツ)_/¯
You can disable the inspection, add words to dictionary (as raydan said) & use @SuppressWarnings
idk if there are any other alternatives
I wonder if the Minecraft Dev plugin touches that
Is that an actual "I wonder" or a sneaky way to tell it does? xd
infact a "I wonder" xD otherwise there would be a
behind my statements

you mean that they follow the player?
Yeah
set the move target to the plauer position
idk the hypixel way, but im sure just setting the target should work
they may have to be actual living entities though
but im not sure
never done that
If you are using a shitty shared host. Recommended to get dedicated vps or dedicated server then you are in control of the environment. Not expensive either. Can rent a decent dedicated server for like $60-$70 / month
Mob#setTarget
Move them to always be following and facing the player whenever he's like 1.5 blocks away
In a repeating task perhaps
Does anyone
Know the Translator api that was used here?
So it's google
prob ye
oh pooling api users?
ugh idk
maybe they ip check it as well
or sth, idk
but prob against their ToS also lol
Doesn't matter
Why do you think you would need that many requests?
One request per newly installed instance.
ugh well, we're not really encouraging illegal activity here :>
Isn't it per translation?
Im assuming you want to auto translate your plugin messages?
he can just have them pre-translated
yea thats the usual way
he can use gtranslate to automatically do it
u'd use crowdin along with resourcebundles or sth
then he just pulls out from the file..etc
how would yall go on about making an artifical hitbox?
can think of various was not sure which ones most efficen
efficent
for what purpose, like for collisions and stuff?
Hello, are there any Up to date, in depth guides to protocollib?
i believe javadocs is a thing at least
else these standard guides ought to get u started decently well :)
not hit boxes checking for hits
player/entity hit entity
Im struggling to set a Fake armor stands metadata :(
What version?
1..20.1
Salvage what you need
private PacketContainer createDataPacket() {
PacketType type = PacketType.Play.Server.ENTITY_METADATA;
PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(type);
packet.getIntegers().write(0, this.entityId);
WrappedDataWatcher.Serializer byteSerializer = WrappedDataWatcher.Registry.get(Byte.class);
WrappedDataWatcher.Serializer chatSerializer = WrappedDataWatcher.Registry.getChatComponentSerializer(true);
WrappedDataWatcher.Serializer boolSerializer = WrappedDataWatcher.Registry.get(Boolean.class);
List<WrappedDataValue> dataValues = new ArrayList<>();
Byte flags = 0x20;
dataValues.add(new WrappedDataValue(0, byteSerializer, flags));
Optional<?> optChat = Optional.of(WrappedChatComponent.fromChatMessage(this.text.replace("&", "§"))[0].getHandle());
dataValues.add(new WrappedDataValue(2, chatSerializer, optChat));
Boolean nameVisible = true;
dataValues.add(new WrappedDataValue(3, boolSerializer, nameVisible));
Byte armorStandTypeFlags = 0x10;
dataValues.add(new WrappedDataValue(15, byteSerializer, armorStandTypeFlags));
packet.getDataValueCollectionModifier().write(0, dataValues);
return packet;
}
Thank you :) how did you learn this?
wiki vg, packet wrapper and just taking a look what's in an existing packet should be all you need
Hey,
[10:56:42 INFO]: org.bukkit.craftbukkit.v1_20_R2.scoreboard.CraftTeam@71662d53
[10:56:42 INFO]: org.bukkit.craftbukkit.v1_20_R2.scoreboard.CraftTeam@71662d53
[10:56:42 INFO]: false
[10:56:42 INFO]: false```
My plugin is causing an issue where players can hit eachother although, they are in the same team and friendlyfire is false.
I have added a number to check every event that is triggered within the plugin to see if there is any interference.
I proceded to remove Event 12 which is:
```onPlayerFight(EntityDamageByEntityEvent event)```
This brings me to:
```[10:56:42 INFO]: org.bukkit.craftbukkit.v1_20_R2.scoreboard.CraftTeam@71662d53
[10:56:42 INFO]: org.bukkit.craftbukkit.v1_20_R2.scoreboard.CraftTeam@71662d53
[10:56:42 INFO]: false
[10:56:42 INFO]: false```
Players can still hit eachother while being on the same team. What could be going wrong?
I just used it for a bit. For me, reading the NMS packets usually helps construct them.
And wiki.vg
Are you doing anything with packet teams
Can you explain what the wrapper does and why i need to zse it
No.
Is it interferring with my mapped jar?
Print out the members of each team
Packet wrapper is premade classes for packets to make things easier. Sadly they're quite outdated but still worth looking at
Packet wrapper classes for ProtocolLib. Contribute to dmulloy2/PacketWrapper development by creating an account on GitHub.
[11:03:56 INFO]: org.bukkit.craftbukkit.v1_20_R2.scoreboard.CraftTeam@7c013c38
[11:03:56 INFO]: org.bukkit.craftbukkit.v1_20_R2.scoreboard.CraftTeam@7c013c38
[11:03:56 INFO]: [Antwarpe, Zodra]
[11:03:56 INFO]: false
[11:03:56 INFO]: false
[11:03:56 INFO]: [Antwarpe, Zodra]```
They are equal
Is it supposed to use org.bukkit.craftbukkit.v1_20_R2.scoreboard.CraftTeam?
Where does the false come from and why is it printed twice?
System.out.println(s.getEntryTeam(event.getEntity().getName()).allowFriendlyFire());
System.out.println(s.getEntryTeam(player.getName()).allowFriendlyFire());```
checks if the team of both players have friendlyfire on false
Have you any other plugins installed?
Yes I do have many plugins installed, however if I remove mine and then start the server, then I can not attack a teammate anymore (which means it works)
It means your plugin somehow bypasses pvp restrictions for teams
Okidoki
These are the main components of teams in my plugin
https://paste.md-5.net/ulowadojah.cs
If you are mixing IO and bukkit methods like that, then you gonna produce game breaking lags in no time
oh I only used that for Debugging, Should I use Bukkit.getlogger.info?
runTaskAsync bro
Is everything inside your runTaskAsynchronously thread safe?
Also: Pls dont use single letter variables anywhere. It just obfuscates your code for everyone else
Basics #2
Do you have any EntityDamageByEntityEvent listeners?
And also #3
EntityDamageByEntityEvent
I do have two yes.
I have disabled both to check if they interfered, which did not fix the issue.
ya, no errors, runs.
Players are placed in their proper team else defaultteam
Threading problems occur sporadically and are non-deterministic.
I could run it sync, just to check
That... huh?
rip sql perf
ya sql performance will go rip, but we are trying to debug here for now
What do you mean sql performance? It runs the same sync as async
I mean tps
Anyways. If you enable your plugin, and dont do anything to teams, does that still prevent people from attacking each other
Running it sync applies the same scenario.
I will give that try, sec
That shows exactly nothing
Wouldn't it trigger errors that are not shown if async?
Again: Threading problems occur sporadically and are non-deterministic
Your code might run just fine a few hundred times and then suddenly crash the plugin
Usually async exceptions are hidden if using CompletableFutures
Doesn't mean that they don't occur with another method
Its not even that exceptions are being hidden. But conditions for a concurrent modification of
collections for example, are only met sometimes.
Exactly
CopyOnWriteArrayList go brrrrrrrrrrrrrrrrrr /s
ConcurrentHashMap.newKeySet go brrrrrrrrrrrrrr
synchronized go BRRRRRRRRRRRRRRR
Something like that
Well, I'm going to get breakfast
Just woke up all crusty after travelling for 3 days
enjoy
Ay!
There seems to be an issue there!
Nice
So simply enabling your plugin lets players attack teammates
ya
more specifically Setting up their team again onJoin (Or leaving it onQuit) is disabled now
so the issue has to be in there
Then show some code
ya, I'm just narrowing down where the error is now, sec.
I hope you dont do anything async there
You should not access spigot api from another thread.
How does getPlayerKingdom look like?
Rechecked this:
Can still attack teammates when disabling anything related to teams.
had connect protection first time I checked my bad :/
Why do you use teams in the first place?
it had most attributes I was in need of + using displayname in scoreboard was easier to do.
it also had "can not attack teammates", which worked, but now it does not anymore. Last time I checked was 2 months ago.
I could however just add that players on the same team can not attack eachother in:
EntityDamageByEntityEvent
it just feels weird to do so
Thats a workaround
ya
Idk, not enough code to look at, and the snippets you sent could cause this issue in hundreds of indirect ways.
Cant really help you with this.
That's fair, ty anyway :o
just a small check. Is it?
You are printing type@memory-address
Thats the default toString behavior of Object
It's className @ hashcode (hex)
How? The default equals method uses ==
Don't see any ref to that
Idk, was in the oracle docs
I mean the impl details
it can actually be sequential as well :^)
I have it on good authority that the default hashcode is actually 7
😄
The point is a runtime translation plugin
Translate them once and cache the result
But not a blocking one
Yeah that's what I'm doing
I just provide a file for that
I’ve been thinking of trying to do it on the packet level but I’d have to work with components
Dasss what Am doin
Yeah I think that's good enough for most users
You could even provide some pre-setup files for other languages
But I'm trying to make a plugin that translates the messages sent to the user
That would be kinda neat
You could apply it universally to everything sent to the user
Yeah I imagine you'd need a paid translation api for it
Or force users to provide one
How translation will help detect bad words?
Its somehow possible to set amount of ingredient needed fo recipe? This is not working. Item can be crafted only with one item.
recipe.addIngredient(new RecipeChoice.ExactChoice(new ItemStack(material, amount)));
Minecraft doesnt support that
thats stupid... so I will need to make listener for PrepareCraftEvent and CraftingEvent I guess
Its just how mojang developed minecraft.
Recipes all use up 1x of the ingredient slot
I just need 10 of item and another 10 of other item to craft custom item. Well there is support for ItemStack so I just think that will be possible if I set amount in ItemStack and looks like is not.
Thanks
I found it actually.
My plugin has a main scoreboard and a per player scoreboard.
A player has the player scoreboard set.
The main scoreboard is to check in which group they are,
The player scoreboard is to set their priority on tab.
Players can hit each other due to their player scoreboards (each rank within a group having an own team) overlapping the team from the main scoreboard.
I could either remove the entire player scoreboard system and use packets to fix tab priority (and the whole system behind it), while keeping the main scoreboard.
OR
Use the workaround to simply check it in entityHitByEntity.
Probably going for the latter
Funny think is, It will save recipe with custom amount. But is ignored in crafting.
Scoreboards are kinda bad. I always avoid using them, and i havent used them for ages.
Yep. This is how mojang intended minecraft to work.
There is probably an api somewhere for multi-ingredient recipes
I feel like this could be patched in nms
probably, yeah
stupid... But thats should not be hard to make it work... Just check if there are ingridients in craftin inv and than craft item.
Hehe. It took me a while to develop a stable custom crafting system. Its not as easy as you might think.
ig if i have only 1 or 2 inventories isnt necessary
I need that only for few recipes so shoudl eazy. I can be wrong 😄
If you have more than exactly one, then you should write a system for N
okay and i guess
InventoryOpenEvent - Add to map (Check from map if the player has an open inventory, if thats true, dont open a new inv)?
InventoryCloseEvent - remove from map
and InventoryClickEvent has smth to do with that?
Yeah you got the basic idea
Usually you would write this differently by introducing your own class and them map the vanilla inventories to them
Map<Inventory, Handler> where Handler is your custom class
More in-depth guide for this
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/#post-4553427
yea
It's a shame the RecipeChoice interface isn't usable by plugins
what do you mean?
Isnt it just a Predicate<ItemStack> really
You can make both an itemstack choice and a material choice
You cant have custom implementations
ah
just finished and understood everything but, what can i do to diference lets say, inventory with name "Kits" and inventory name "Kit: Starter"
iirc the crafting system is composed of a ton of predicates.
So adding the amount to a predicate would be easy. The main problem is deducting ingredients from the matrix
should i check it on handler or in the listener?
You just create two classes. KitSelectGui implements InventoryHandler and KitGui implements InventoryHandler
The only reason you can't make custom recipe choices
Is that we don't know how to handle them if the owning plugin gets disabled
imagine the client having to ask the server for every item placed on the crafting grid if it's a valid recipe
Weakreferences 😄
sounds awful for ux
But then the recipe would just break :p
Make recipe registration per plugin, when a plugin is disabled remove the recipe, easy enough
Hmm, but i guess if i have multiple kits i can do a KitGui with the data retreived from the .json of the kit?
it already is
or smth like that
And then lazily throw them out the next time the crafting list gets iterated
Then where is the issue
But what if plugin A provides a custom RecipeChoice and plugin B uses this choice
Then plugin A gets disabled
KitGui should be able to support any kit. You simply pass the Kit through the constructor.
k thanks
Plugin B is a depend of A, if a plugin depends on another plugin and that other plugin gets disabled every depending plugin should be disabled as well
True
But what do you mean by json files?
You should load all your kits into memory when the server starts and then save your kits back to json when the server stops.
Idk, I know MD had concerns in the past
Good luck finding them with discord search :p
@lost matrix periodically saving is better in case of abrupt shutdown
yeah no won't even bother lmao
You can do that in addition
Should that matter? Simply let the custom RecipeChoice impl hold a WeakReference to the providing JavaPlugin and invalidate it when
the reference is loose.
I just dont like the idea that crafting is now loaded with checking for references in addition to the Predicates.
What if instead of all of that
you just removed recipes which are of a plugin when that plugin is disabled
so like
X registers 14 recipes, when X is disabled unregister all of the 14 recipes
*Assuming that depends (Plugins directly depending, soft-depending or using X's classes) of X are also disabled when X is disabled
But Plugin X could use a RecipeChoice from Plugin Y.
Then Plugin Y gets unloaded and suddenly Plugin X breaks.
See note
in this case if Y unloaded X would unload too
it makes sense
How would you track references like that?
Probably a dependency tree?
like
A
| B
\ C
\ D
If D gets unloaded, C and A also do, but not B because B is not a depend of A or C or D
Who builds this? Do you want to do bytecode inspection and build dependency trees for each plugin?
No?
Then how do you find out which plugins use classes from other plugins?
Basing on my knowledge:
- Plugins have depend & soft depend
- There is something in console which can detect it, as it prints "Plugin A is using a class of Plugin B even though Plugin B is not a depend or soft-depend of Plugin A"
Hm, not sure if i would rely on devs having to not forget dependency entries in their plugin.yml
But its a possibility.
That's why if a plugin calls something from another class it would mark it as a dependency
it can be done at plugin runtime it doesn't really matter
The next problem: Adding plugin references to recipes wont stick because they get translated from spigot to nms and then get discarded
Skills issue
Just do the same thing as entities and store the CB reference on the NMS versions
^
So we are back at embedding them in the choices again 
Okey making recipes system suck 😄 I get what you ment...
@EventHandler
public static void prepareCraftEvent(PrepareItemCraftEvent event) {
System.out.println("event");
Recipe recipe = event.getRecipe();
System.out.println(DataManager.getCustomRecipes().containsValue(recipe));
}
Im getting false here but the result is corrent in crafting table
Use the recipe key to identify it
^
Rather than the entire object
But I cannot get key from Recipe
For some reason you need to check if its instanceof Keyed
Because... some recipes are not? Idk. Confused me as well.
Ah MerchantRecipe is not for example
Which is the only exception
🥲 merchant recipes technically don't exist in nms iirc so that would make sense
Hmmmm, Im saving my recipe as Recipe shoudlnt be issue I gues... I have only ShapelessRecipe but I guess I can cast Recipe to it
Should be like enchantments
MerchantOffer, EnchantmentOffer
What if we just add a dummy key to merchant recipe so all recipes can be keyed
Let MerchantRecipe extend Enchantment 🙂
😅
That's not a half bad idea tbh
I wonder what md would think of that
/shrug
how can you change the texture of a note block depending on its instrument property in json? Need to specify the tool type?
i mean if note blocks have so many states
a powered note block and an unpowered one has 25 notes, which means only 50 states, but how to indicate the remaining 750
how many unique blocks can you add like this?
the tool type in json is the same as in bukkit api or will have to be converted
without ruining the noteblock
no one i gess
but who use note block lol
Studying how textures are created, I get the feeling that a json file is like a markup language like html
Depends what you count as ruining
Them not being usable
Too their fullest potential
Note blocks never lag tho :p
True
But yes displays are cool
You can do no resource pack custom blocks with itemdisplay and custom heads
Wonder how many display entities it'd take to lag
Wonder if it's possible to further optimize display entities 
Things I want to look at
Go ask sodium :p
Did they optimize them or sum?
what happens if you use the player’s skin as a texture? Then the texture pack probably won't be needed
I always why the Scoreboard have numbers on the right?? Why can't directly use an array of elements, it already has indexes
Is there any website convenient for creating json “code” for minecraft models?
because each entry is an individual score
and scores are ordered from highest to lowest
Hnmn
It's a scoreboard after all :p
And what males that the diferente
🤔
Can just contain a list of objetives and order them vía index
It could, but that’s not how mojang has decided to implement it I suppose :>
yea, im doing that
just for now testing, loading everything from json everytime i need
Oh yo back to stuff.i didnt realize he
K, but the inventory creation is in the command right? lets say i have the command "guikit" and this will create a inventory and open it for the user, the Inventory instance is created in the command, in what i understand
Conclube :3 explain octree I am ready
today is the day for the octree
I so have some killing time rn
Hide conclube
Lol
you're killing time 😨
wtf bro what did time do to you
Everything
ahhh anyways I did a tad of research on this legendary Octree and I don't really get how it helps me ig. Most exmaples I saw provided a range for the octree
but minecraft worlds are boundless
Well, I thought about it yk, idk if you actually want to use octrees, cause I reckon a map per world or sth is enough for u
But anyway it used in worldguard iirc
you suppose a
Map<UUID, Map<long[], WorldBoundGenerator>> would work?
To just represent regions (maybe im wrong)
yeah
As frost said, might be possible to let the key just be a simple long
and then use an Long2ObjMap
wouldn't that kill negatives though?
for world uuids
ahhhh
ohkay yeah that makes sense
do you like shift the most significant and least significant bits into eachother?
Yeah, also not sure if a record X(long,long) is better than a long[2]
hmm, wait, can u check the uuid version of worlds?
it needs to be a long[3] because of y coordinate mattering
how would I check
But basically if you wanna use a record, or an array
No java has different versions supported

