#help-development
1 messages Β· Page 126 of 1
Hi, im having trouble with my teams/scoreboard
can anyone help
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.
The method getname() is undefined for the type Player
Code: https://paste.md-5.net/bajizetibo.java
I literally cannot find the place where I typed it wrong
(I have saved it)
Hi. Im trying to send HTTPS POST request to SSL domain api (https://api.example.com/v1/status) but I always getting this exception:
IOException. Message: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I found that this exception thrown because its unable to find SSL certificate. (https://stackoverflow.com/a/36427118/13728122). I have no idea how to integrate SSL POST request to https endpoints without exporting my own certificate and moving this file to directory (I event dont have access to this directory)
Is there is a way to Send HTTPS POST request in spigot?
Also im pretty new to java, java libs and mc modding so dont hurt me
My implementation: https://pastebin.com/G5aXZu57
is there a way to create inventories with custom sizes? id love a 5x9 inventory
i think you can make a custom inventory upto 6 rows
im not sure tho
any idea how?
For post requests, you will just do it the normal way in Java. Nothing special has to be done
@dusk flicker Ok, but i think my implementation is wrong (it doesnt work)
google the error
I found a solution by just searching "SunCertPathBuilderException"
stackoverflow and other resources says to put .cer file somewhere in system directory, but i dont have access to it. I can only uplaod plugins and nothing more
what website are you trying to go to?
why this code is not getting the customModelData of the block: https://paste.md-5.net/icejaziwom.cs
I thiunk i found an issue...
https://localhost/api/server/linkaccount.php
smart thoughts haunt me, but I'm faster
localhost cant be https
?paste
https://paste.md-5.net/odonagayej.cs
This is what first method returns
[EJailPlus] [STDOUT] 51 {5c08880c-ed9f-34fd-9dbf-528b104c33cb=51}
This is what the end one returns
[18:22:44 INFO]: {}
Any ideas why? first one is ran on join and second on leave
and the error
^^ someone?
it can be, but generally it is not
It should be getName, not getname
I know
https://srcshare.io/631e0f8ed1a334def625de8a
I'm having trouble with making custom death messages for end crystal deaths
Easily share your source code with other developers.
Best show us the full context (which means showing us the full error message and giving us information on how you built it)
This is the log containing full error
what is the issue there?
It does not work
help.exe does not work
In the minecraft chat, it always says i killed myself
good ol' eclipse compiler
there is no getname in the file as confirmed
u can also see the code for yourself in https://paste.md-5.net/bajizetibo.java
I've saved it, compiled it multiple times
When compiling it there should be an error message, what is it?
no errors
1.8 π
Impossible, eclipse compiler and eclipse both use the same underlying logic
Why did you put that emoji there when i was typing
Did you accidentally "delete" the error?
(Yes that is legal in eclipse world)
If not you might be running an outdated jar
nah its fresh i just downloaded it
@quaint mantle EntityDamageByEntityEvent#getDamager represents the damager and not the damaged entity
Sure?
So here the damager should be a Player, and the damaged entity (getEntity) an EnderCrystal
k
Rename the method and see if it does anything
rename the method, as in?
Wait what are you exactly trying to do ?
If nothing happens something is not getting updated
renaming onPlayerDeath to onPlayerDeathAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWhyThisNoWork
Trying to make a custom death message for end crystal deaths
Aren't those explosions?
yes
If you server still breaks on onPlayerDeath, you know that either
- a) Eclipse compiler is using outdated cache (whyever that would happen)
- b) You are not actually running the compiler (or in layman's terms: Not exporting it)
- c) You are uploading the wrong jar
- d) You are not uploading a jar
- e) You didn't restart the server
- f) Your panel is fucked
- g) You are reading the outdated logs
that is to be expected. I was more talking about the server
Why does player.getUniqueId() is not matching namemc uuid? And which is true? (I have Bungee -> Spigot connection.)
if you get a value from that map, you can modify the internal state of that object yes
Map<Integer, Kingdom> map = /**/;
Kingdom k = map.get(6);
k.setName("boooo");
this will modify the name yes
Do you have UUID passthrough?
doesn't change anything (replaced the name to onPlayerDeathTest)
java works on references, so calling Map::get returns a reference to the object you're expecting
well except for primitives and some other stuff then
No
Still bricking on
at me.mallusrgreat.deathmessages.listeners.PlayerDeathListener.onPlayerDeath(PlayerDeathListener.java:31) ~[?:?]?
yea the save thing is fucked up
You may need to setup the bungee connection properly
bump
Yeah, you probably did something wrong somewhere
Delete all your jars, then repeat the process everywhere
havent begun learning those but they look pain
Should nothing happen some cache blew up
I think everything is right. IP forwarding on proxy enabled and Spigot has bungeecord: true
anyone gonna help me :(
I'm getting errors from other projects, does that do anything?
One is player action thingy, one is player thingy
It shouldn't care about other projects
Someone please help me
As I said, you improperly exported and/or uploaded the jar
if you failed a build Eclipse can show all kinds of errors. goto Project menu and select clean
Valhalla when
It does not show any errors, that is the issue
Hence I assume that it is 100% a user error rather whan an application error
You cannot store primitives in maps
my settings might have something to do with it
You retrieve two different things
mye ik i was talking about references and values, not about generic stuff
Someone PLEASE help
that is all fine, what is the next screen?
Map<int, double> when
stop begging
When valhalla comes :)
me thinking what valhalla is
could you show me what you mean by telling me lines?
game ig
i click finish and the window closes and nothing else happens
I generally recommend using the EntityDamageEntityevent over the death events, they always have been too fickle for me
playerActionBarTasks vs playerTitleTasks
EntityDamageByEntityEvent?
20, 21 vs 25 + 26
xcvsj,.y3et4fi
vbhgwjlmp me,Γ0 cnΓΌS B
+Β΄5
tndbnhe
bruh
i need to slap myself in face
what is the diff between hashmap and map in human language
uh what? Map<K, V> is an interface where HashMap is the implementation
Is there a way to get the item that is currently picked up by a player?
Is there any way to get the player who triggered the 'InventoryClickEvent'
As in, grabbed with the mouse
event.getWhoClicked()
thats not a method
inv click event or drag
ah ty
like on their cursor?
Yep. Just got the solution: player#getItemOnCursor
ok
aloha everyone
I wonder, is there a way to check that the plugin name I picked isn't already in use by someone else?
yes I did too
But I am sure there are plugins that are called different than their name on the spigot or bukkit websites
Oh I guess I could try spiget
sure. but generally plugins are named something like they will do
and generally people dont use 2 of the same kind of plugins
like. who's gonna use 2 crate plugins
hehe yes, ok I couldn't find one thing, neither Google nor Spiget, so I guess I am safe
thanks for the help
Spiget? whats that? did I miss something?
its just an api where you can request data about resources
Can anyone help me?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
https://srcshare.io/631e0f8ed1a334def625de8a
I'm having trouble with making custom death messages for end crystal deaths
In the minecraft chat, whenever i kill my alt, it says my alt killed itself
Easily share your source code with other developers.
can i run a plugin that i coded with deobfuscated nms (original-spigot is the file name) on a server?
if yes how
19:34:20 ERROR]: Could not load 'plugins\LazurRace.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `lazurrace.lazurrace.LazurRace'
in the plugin.yml there's the perfect path to the main class
i can't post images
post to imgur and send link
Hello, how do you make a EntitySnowball invisible with the obfuscated methods?
Why would you use the obfuscated methods π
how do i do that
Do you want maximum pain while coding
is there any tutorial or sth
i just came back from 1.15 spigot
how to deobf and reobf
Use the special source plugin for maven
then what config?>
https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/ @stray halo @swift dew
so i have to use the remapped-mojang jar right?
Their packets aren't weird
basically idk how to use em
You should start learning it then. It's very useful to have the same names in Forge, Fabric and Spigot
oh wait fr?
@chrome beacon so what is the code now?
I used to do EntitySnowball e = ((CraftSnowball)ball).getHandle();
i mean in a hacked client i was making it was the same with things like c04 behind so yg
yh
aight ig ty
It's probably SnowballEntity or smth
could it be this? net.minecraft.world.entity.projectile.Snowball
Yeah
Caused by: java.lang.NoSuchMethodError: 'net.minecraft.world.entity.projectile.Snowball org.bukkit.craftbukkit.v1_18_R2.entity.CraftSnowball.getHandle()'
with the code net.minecraft.world.entity.projectile.Snowball e = ((CraftSnowball)ball).getHandle();
Looks like you didn't use maven like the link I sent
uhh no, i was trying to use jars first cause i had it set up like this
but if i have to i can change
and your plugin.yml?
Send your plugin.yml
?paste
it's not possible to set an inventory's title's font in spigot right? since it doesn't use components
Hey everyone! I'm a beginner in spigot development and I have run into a problem. Can anyone help me?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
You can you resource packs to do that probably
well ofc the resource pack would be needed, but without components I don't see how you could specify which font to use
@EventHandler
public void onRightClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
Action action = e.getAction();
ItemStack item = p.getItemInHand();
if ((action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) && item.getType()==Material.STICK) {
if (item == null) {return;}
if (p.isSneaking()){
if (item.getItemMeta().hasCustomModelData() && item.getItemMeta().getCustomModelData()==000001){
getLogger().info("You shift right clicked with a wand");
}
else {
getLogger().info("You shift right with a stick");
}
}
else {
if (item.getItemMeta().hasCustomModelData() && item.getItemMeta().getCustomModelData()==000001){
getLogger().info("You right clicked with a wand");
}
else {
getLogger().info("You right with a stick");
}
}
}
}
My problem is that if I (shift) right click with a stick with custom model data of 000001 it will say that I (shift) right clicked with a stick. Can anyone help me?
how can i get craftbukkit shaded jar from buildtools
craftbukkit ?
(a) You probably just shouldn't. CraftBukkit shouldn't be used under any circumstance. (b) The server .jar isn't shaded anymore. It's a bootstrap jar
(c) look up the countless examples on how to developer against the server source code for spigot online (e.g. the recent update posts on the forums)
too
000000001 = 1
you're also checking item not null after using it
And how do you give yourself a custom model stick ?
/give @s minecraft:stick{CustomModelData:000001}
i need to use nms
So you can depend on the Spigot server instead
You just have to run BuildTools, then you can depend on it via Maven or Gradle
just java -jar BuildTools.jar --rev 1.18.2 ?
Yes
tactical bump
ok ty ill try
Is there a way to modify an item's display name that allows me to use the translated name based on the clients language
like for example if I want to make a item name that is its normal name but crossed out or in a different color etc
but still have it work with the client translation of an item
please ping me when replying
anoyne using maven knows how to do that thing when writting version: @version@ in plugin.yml uses maven's project version automatically?
${version}
ty β₯
Unresolved dependency: 'org.spigotmc:spigot-api:jar:1.18.2-R0.1-SNAPSHOT'
can you share your pom.xml/build.gradle.kts
the api is not the remapped one
if you want to depend on the server
you'd depend only on spigot not spigot-api
so i change the dependency?
Well concerning you have the reobf stuff
I'd imagine you wanna code against server internals
So yea
i just copied what is in here
No you didn't
That link has the correct dependency
You had the API
Alex blog post has the server
uhh ok im getting more confused. i just need the nms methods lol
y is it so hard to get
this pops up now Unresolved dependency: 'org.spigotmc:spigot:jar:1.18.2-R0.1-SNAPSHOT'
uhhh is it the same if i run it on the desktop?
nono
from the console
but like a random folder?
i run it first with the remapped and then without, does it overwrite?
No
Yus
how can I make like an area where mobs spawn but if there are already mobs there it doesn't just overflow the area?
how can i make a snowball invisible with nms
i used to do it in like 1.15/1.16 but the same method doesn't work anymore
@EventHandler
public void onBunnyKill(EntityDeathEvent e) {
Entity entity = e.getEntity();
Player killer = e.getEntity().getKiller();
}```
I have this. But the `Entity entity = e.getEntity();` is giving an error saying I provided a LivingEntity, and it is required an Entity. I am confused how I am providing a living entity?
If I am getting the entity that died, how is that living?
LivingEntity entity = e.getEntity();
I know thats how you fix it im just confusedhow its living
So how can I get the shit thats dead
its the EntityDeathEvent
how can I get the entity that the player killed
I guess I need to know
LivingEntity is like that specific entity I'm pretty sure
entity is just like the type of mob
even tho its dead, you can still use the LivingEntity I guess
an Entity is a boat, a LivingEntity is a bunny
ah
ye so you can have a LivingEntity even if it's dead, cuz like it can be living
Ohhhhhh. So even though its "LivingEntity" it still can be dead?
yes
ok
I think
π
correct
.
@pseudo hazel how can I check if player killed a bunny
dont know how to do that
if (entity == ???) {..}
are you in the EntityDeathEvent?
yes
@EventHandler
public void onBunnyKill(EntityDeathEvent e) {
LivingEntity entity = e.getEntity();
Player killer = e.getEntity().getKiller();
if (entity == ) {
killer.sendMessage("You killed a bunny!");
}
}
}```
try to check the cause of death first
https://paste.md-5.net/atuwexorag.cs
This is some code for a mob I'm working on but line 70 and 77 are just not doing anything. The variable sh is fine when I print it but it doesn't change the nametag.
Try:
if (entity.getKiller() instanceOf Player) {```
if (entity.isDead() && entity.getKiller() != null && killer instanceof Player) {
killer.sendMessage("You killed a bunny!");
}```
without doing the Player killer = ... line because that will throw an error when the cause is not a player
is that too much? π
why are you checking if the mob is dead on the death event
dont know bro. why I asked if it was too much
That should not be necessary but the two others seem fine to me
ok
so I have:
public void onBunnyKill(EntityDeathEvent e) {
if (entity.getKiller() != null && killer instanceof Player) {
LivingEntity entity = e.getEntity();
Player killer = e.getEntity().getKiller();
}
}```
yea and then you can do killer.sendMessage("blabla");
killer is used before it's defined
if (e.getEntity().getKiller() != null && e.getEntity().getKiller() instanceof Player) {
LivingEntity entity = e.getEntity();
Player killer = e.getEntity().getKiller();
}```
think that's right
you can change the last e.getEntity by entity since you defined it
ok
and how can I check if entity that is killed is a bunny?
Is it just name equals "Bunny"
?
or howver they are named in game
awesomeee thank you guys
after LivingEntity ...
@delicate lynx know anything abt this?
public void onBunnyKill(EntityDeathEvent e) {
if (e.getEntity().getKiller() != null && e.getEntity().getKiller() instanceof Player) {
LivingEntity entity = e.getEntity();
Player killer = e.getEntity().getKiller();
if (entity instanceof Rabbit) {
killer.sendMessage("You killed a bunny!");
}
}```
so thats what I got
I mean, you can add that second if in the first if statement if you want it even shorter
how do I check for a chest's custom name?
@EventHandler
public void onInventoryOpenEvent(InventoryOpenEvent event){
if (event.getInventory().getHolder() instanceof Chest chest){
getServer().sendMessage(Component.text("Chest Opened"));
event.getPlayer().sendMessage(chest.customName());
if (chest.customName() == null){
getServer().sendMessage(Component.text("Chest Opened NO NAME"));
}
if (CHEST NAME = RED TEAM???){
getServer().sendMessage(Component.text("Chest Opened RED"));
}
}
}```
For example, I just want to execute that little statement at the bottom if that chest's name is "Red Team"
Any way I can do that?
InventoryView has a getTitle() method
Don't use inventory names for detecting your inventory
im trying to make a chest gui background with a custom font, but i have no clue how to set the font thats used for the inventory name
any ideas?
Not sure if that even is possible
i thought thats how people did it
did what?
thats the only good resource i found on this topic
and thats how they do it aparrently
Deserialize List
And where did they set the font?
thats what im asking
but they also say you can use custom fonts
That is actually existing characters are replaced
declaration: package: org.bukkit, class: Bukkit
You need to use paper for that
Or NMS
it's not possible to set an inventory's title's font in spigot right? since it doesn't use components
is there some sort of other method for it? is it possible using bungee chat components?
No
But paper has support for that built-in
well im using paper on the server anyway so thats fine
ill check that out, thanks
You'd need to use the aftermentioned Compontent with font (however you set it) thoug
aight so no supporting this and going paper only, got you
lmfao
ig you can use adventure, which can be used on spigot
you cancel the event right?
Not that way
like when player breaks block
why?
The adventure-plattform-api is only meant to retrieve audiences, but not meant to set inventory titles and that stuff
r u using spigot?
How do I check if a value exists in a persistent data container?
.has
PlayerBlockBreak event most likely
If that does not work, PlayerCanBreakBlock (or similar) should do the trick
so pdc.has(key)?
You don't seem to cancel it
or something else?
Key and data type
ok
I know that in modern bukkit that cancelling it suffices
However in older versions it might be a different story, but that is something I have little knowledge of
can anyone help me with this?
I dont think that there's any plugin for this. You'd have to pay someone to code this for you. I guess someone would even would do it for as little as 30β¬ or so
I'd to it for 50β¬ π but
no
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
then please ask a proper question
how can I improve my question?
Possible, but you would not want to
erm welll
why not
you could have asked "How can I make ItemStacks have names that get translated by the client"
It involves downloading all assets and then picking the right one based on the player's reported locale
As far as I know it's possible with Paper's adventure
No idea how to do it with a Spigot server π€·π»ββοΈ
?jd-s the translation key should be supplied by spigot
You you could use translateable components, that is right
I cant put those on item names though
You can
You should
how?
Instead of using ItemMeta#setDisplayName use ItemMeta#displayName
But, remember this is Spigot help, not papers π
okay
well yeah I dont have that method haha
im trying to make it work using spigot
Then you are not using Paper
I know
Then that's another topic I'm interested too
I never said I used paper
And making it work with spigot is not possible unless you want to use NMS
If it's possible with Spigot without needing to use adventure, I would be really interested to know how to achieve this π€¨
Spigot's API does not expose any meaningful way to use components
Can you use #setDisplayName with GSON components?
If so, that'd be it
But I never tried it myself, and honestly I doubt so
you mean like {"translate":"item.minecraft.diamond_sword"}?
Well, there's this item. This banner that pillagers use
Yeah, kinda like that
In reality it's using a translatable component as a displayname
well yes
like I can give myself an item with a translated string just using vanilla /give commands
but I cant really put that into the item by code afaik
The question is whether spigot allows that
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#setLocalizedName(java.lang.String) exists, but I have 0 idea what exactly it does and what it should do
idk either, but its not set unless you do it yourself
just like the displayname and lore
The only time I used it was to store info before perstistentdatacontainer was implemented
persistentdatacontainer is nbt but it says I can only change keys from my plugin
and not the default minecraft ones
I was that guy who serialized objects in a String then rebuilt it in the class constructor π’
It's not really memory efficient. Don't ever try it.
lmao
I mean everything is working great except for item name translations, its the last part I need before its done haha
but if its not a thing then ill just not do that
it just seemed like something easily doable
For some reason that method doesn't even exist at the source level... WHAT
lmao
has anyone ever used https://www.spigotmc.org/wiki/spigot-plugin-yml-annotations/ ?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I have
It isn't even a patched-in at spigot-api level
I already added it with maven but can't figure out how to actually use it xd
oh yeah its confusing lmao
I just found it and want to give it a try tbh xd
what do I do? :C
if I recall
the @plugin and other ones are mostly put on top of your main class
if I recall
Idiot me searched in the ItemStack class
I did see it but didn't look at this π€‘
thanks xd
when does it generate the stuff tho? it just makes up the plugin.yml by itself or what?
on plugin start iirc
so basically I won't see the outcome? xd
guys
i need help
someone is here? i'll dm u cuz i cant send images here
@pseudo hazel Try to invoke ItemMeta#setDisplayName with json components (which can be created through adventure for example), it probably works
The only issue is getting the translation key, but that should be possible
On what grounds do you believe that that is permitted or at the very least acceptable?
Then you are unworthy.
oh
Unless the error stops when you add the -noverify flag, in that case you are worthy
But chances are you are not transforming random classes at will
getting the translation keys is my next problem but if I have atleast a way to present any key to the user i should be fine
I will look into adventures to see what kinda json gets generated and see if I can use that
You probably need to use some manualy schenanigans
ok
donE
so
idk why is that happening cuz
this is my code
how do i send the java thing
every command we have is ? with exception of !spacex
?syntax
?java
ok
public static void openMenu(Player player) {
Inventory i = Bukkit.createInventory(null, 9, Style.translate("&2KillEffects Menu"));
for (int x=0; x < i.getSize() ; x++) {
for (KillEffects effects : KillEffects.values()) {
if (effects.getDisplayName() != null) {
ItemStack effectIcon = new ItemStack(effects.getIcon());
ItemMeta effectMeta = effectIcon.getItemMeta();
effectMeta.setDisplayName(Style.translate(effects.getDisplayName()));
effectMeta.setLore(Arrays.asList(
player.hasPermission("practice.killeffect.".concat(effects.getName()))
? Style.translate("&aClick to select ".concat(effects.getDisplayName()).concat(" &aeffect.")) : Style.translate("&cYou don't own this effect.")
));
effectIcon.setItemMeta(effectMeta);
i.setItem(x, effectIcon);
}
}
}
player.openInventory(i);
}
}
do u know why is that happening?
.
it should show every killeffect not the last one
some bracket should be misplaced but idk
what
that's weird x
d
bro
and !verify.
.
that's the code
.
What's the problem with this? What are you expecting to happen?
Get all nearby entities and if there are more than your threshold, don't spawn in more.
how do i get nearby entities
You've got two options.
Entity#getNearbyEntities()
World#getNearbyEntities()
Both work off a radius, so you would ideally want to put your search in the middle of your arena.
Also, what's with the double for loop? You could just use your second loop and use Inventory#addItem() if ordering isn't important.
how can I create a runnable to constantly check the block under a player?
what's that texture pack?
how do I check for a chest's custom name via the InventoryView getTitle() method?
@EventHandler
public void onInventoryOpenEvent(InventoryOpenEvent event){
if (event.getInventory().getHolder() instanceof Chest chest){
getServer().sendMessage(Component.text("Chest Opened"));
event.getPlayer().sendMessage(chest.customName());
if (chest.customName() == null){
getServer().sendMessage(Component.text("Chest Opened NO NAME"));
}
if (CHEST NAME = RED TEAM???){
getServer().sendMessage(Component.text("Chest Opened RED"));
}
}
}```
?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.
your mom's
by scheduling a runnable thatn constantly checks the block under each player?
I mean what's the problem?
you can ofc just do "new Runnable() { ... }" ?
What is the default code for knockback? I'm trying to recode it and wish to know how the default system works. Ex. knockback based on sprinting, item in hand, etc. Would I just use something similar to this?
https://bukkit.org/threads/get-knockback.118745/
it's probably spread up in 50 classes or so
e.g. zombies etc probably have normal knockback
while the ender dragon has none
Ah that's unfortunate. What about just for player vs player?
I'm essentially canceling the event in EntityDamageByEntityEvent then recoding the knockback.
i am not sure, but I guess that each entity class has something about it :/
ah okay. thanks anyways
I might be totally wrong though
yea nw ill look into it
oki
Are plugin channel names still max 16 characters or has that changed since 2014?
Oh that would be wonderful thanks
I guess I will have to evaluate that once I am back at my computer
(also wished there were proper resources on these kind of things)
protocol wiki doesn't tell that much either
I am really not sure though
I guess you'll just have to try it :/
Ye I guess
I feel like I have to explore all of this and make a document about all of the inner workings
If nobody has it done yet someone has to do it
I am deserializing a list list using config.getList() and for some reason all the values are null?
but it is still the same size/has the same amount of indexes. Just the values are being turned into null
How do I reduce fall damage with the Player variable?
entity take damage event set event damage
Does someone have a class that when the lore or the type of item changes, also the name, or the attribute of the ItemStack, it can be updated in the player's inventory without having to keep it every so often, what I want is that when Do they change any lore or anything that is also updated to the player?
Hey!
β€οΈ
it automatically updates it to the player
you dont have to listen to anything for this
GN8 every1, going 2 bad early 2night, 3am lmao
have a good night β€οΈ
md_5 was drunk again, it seems
I mean
WTF is the purpose of this method
and why does setItemMeta call this
it's 100% useless
it just returns the input ahaha
@slate mortar looks like some code you wrote π
perhaps legacy code?
yea but in what world does updateMaterial not look so much cooler
like it served a purpose before and it's now purely kept for api purposes
I'm brand new to Maven, and I'm having issues building a shaded .jar file. Here is my error: [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.052 s [INFO] Finished at: 2022-09-10T21:11:05-05:00 [INFO] ------------------------------------------------------------------------ [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
Here's my POM.xml file:
https://sourceb.in/2549ZKDBzG
How do I fix my error? I'm trying to build and shade to include the org.apache.commons.io.jar
true, true
are you on jΓ€germeister again?
only beer
lmfao
why does this dude ask me for my reddit account name now
why do insecure people always ask me for my reddit account's name
can I have your reddit account name
you don't want it
I don't have reddit but im insecure in myself so I might as well
What class is that
Forever unanswered
CraftItemFactory IIRC
theres nothing you can follow that would freak me out
if you really wanna know, DM me lmao
any1 know how to make this code more efficient? It's just that Im repeating myself and I think this can be shorter
Can someone help me solve a Maven build issue?
make an itembuilder class ig?
I would recommend writing an item builder
Whats the build issue about?
Alright, thanks!
@lost matrix here
Let me know what else I can show/provide
How do you compile?
I see... use the maven tab on the right side. With install you cover pretty much everything.
Hmmm, I don't have that tab... Let me see if I can find it
He's using eclipse.
Ah missed that part
Then create a new run configuration mvn clean install
Dont remember. Dropped eclipse 4 months after i started out.
5 looks good
I've got a pretty big self-made plugin for my sever, and want to start keeping logs of player actions catered to my plugin. Is there a better way to go about this than to keep a .json created for each session and appended to - if anyone has any experience w this. thought about using MongoDB too because of its object based database system
Right click pom, Run As -> run configurations
These exist? Should I just run clean first?
I do goals: clean package
Store it in a database. Create a new entry for each player session. You can query those docs later if you need them.
So should I make my own configuration? Or just run 5 Maven install
Redis sounds easiest for this type of thing but i'm not very sure how to go about persisting that data, what db do you recommend?
mongo or some flavor of sql I'm more apt to use mongo though
I dont see why you would need redis for this. You dont query this data often so its just wasted memory.
Here's my build log and error
hence i asked
If you want to group by sessions -> MongoDB
If you want to build it relational -> SQL
more of a java question:
I have a long list of objects stored in cache, and each of them have two ids stored in them. (A minecraft UUID and a twitch id)
Usually I would just store all the objects in a concurrenthashmap and with the key being the id. But theres two keys that will be used often here, what do you guys think is the best design choice?
Two maps 
The ids are stored in the value which means you can get both in O(1) if you have either of them
huh rlly?
and both maps will have references to the same object?
Sure
as in, one value in map 1 will point to the same object as another value in map 2?
Ah...
Thats a JRE not a JDK
Yeah
Gotcha... I normally was exporting jars with just eclipse, but needed to shadow something which is why I'm now using Maven
Yes. Thats how everything in java works.
A List<Object> is just a list of references to actual objects in memory.
Same goes for maps.
Why an adopt JDK vs a regular?
everyone uses it due to licensing
Because oracle sucks
ye alright
just making sure that thats what you meant by two maps
This fine?
yes
Just want to make sure I'm downloading from the correct source
Should I always work with the latest? Or version 11 because it has LTS
just out of curiosity, would an arraylist of the object and using a manual search be just as efficient?
I'm building for minecraft version 1.16.5
my IDE is set to 16 and I can configure the pom to build for any lower version I want
No. The time to find something in a list rises with the number of objects in it.
A HashSet or HashMap doesnt care. The search will be as fast for 10 elements as it would be for 10000
how does that even work
Hash tables
Not easy to understand. I really only properly understood them after implementing them by hand in C++
I've touched C++ before 
Just think about them as a lookup table.
You have an array [...] and the index of your stored object is the hash code.
Every Object in java has a hashCode method which produces an int which can be used
as an "index" in this array.
So the lookup is instant.
alright
thanks
also another question
Im making a spigot library if you couldnt tell by now
I plan on publishing this on maven and Im gonna start worrying about javadocs later
Is it possible to "hide" certain methods and classes from other developers? I don't want their IDE to be autocompleting certain classes or methods
JitPack is the simplest way for publishing dependencies
No
Not possible. Use the right design and access modifiers.
I'm wondering how other libraries create a static class thats used to interact with their class though
For example LibsDisguises has a neat static class thats used to interact with their plugin. But none of the actual classes used to implement the plugin itself are visible
Well that would really be an example of an API not a library
he setup one module with all his interfaces and what not
Then they have an api or facade pattern over their implementation
and then he implemented that and probably exposed it as a service
in his plugin... so if you depend on the API and ask bukkit to give you the service instance
click add
it gives you the plugin (which is the implementation)
So in actuality, is the maven dependency a completely different project?
I did, and selected my JDK folder. It told me it wasn't a JRE
Also is lib still alive? It would be fun to talk to him again
Thats the wrong way around. The api asks for service implementations.
@lost matrix well I mean the way he is doing it he may have given you a static helper
something like
static Implementation getImplementation() { return Bukkit...... };
missing bin
Also, this dropdown is for installed JREs
But I mean that part doesn't really matter, bad design begets bad design.
Does this static API helper look normal?
https://mystb.in/ExtSuspectedMotion
you are selecting Standard VM when you click add?
yeah
I clicked search. but I'm doing add now
Everything is JRE
I don't think this is the right tab to add
Ok, I will trust
and browse to your JDK
It looks ok. But i would use JavaPlugin.<T>getPlugin(Class<T> clazz) instead
This is fine: C:\Program Files\Java\jdk-18.0.2.1?
Or does it need to be like in the bin folder
You need the binaries folder
it will find the bin folder
Ok yeah, it errored when I selected the bin folder. Its asking for the root
Pretty sure that it doesnt scavenge deeper for the binaries
for Eclipse yoou target the top folder
Any Default VM arguments?
no, click finish
I don't understand how my project would be "bad design" though.. I just don't want all the classes to be visible to the public. I'm pretty sure every plugin has some files that they dont want other plugins messing with, such as their command listener classes.
Ok, now its only letting me select either the JDK or the JRE
Or their utility function, database, etc.
yes, select the JDK
Oh
this blew up
I could be wrong, but I'm pretty sure I need that JRE selected
And my JDK needs to be elsewhere....
?paste your pom
Like I mentioned, I built all this fine with just eclipse. But I needed to use Maven to shade a dependency
you have no dependencies
This is my current file structure. A lot of these classes should only be used my my own plugin, like TwitchHandler, Database, or everything in the command package.
There's select few that I want to be public, like LinkedAccounts which is a class thats used to store info about linked Minecraft and Twitch accounts. Or MineTwitchApi, which is supposed to be a static API helper.
What's the correct way to do what I'm trying to do?
ignore teh comment, it was a copy paste
This also means you have a manually imported spigot jar in yoru project. Remove it
all your dependencies need to be in the pom
yes, they all need to be mavenised
I didn;t give you a full pom. only teh parts you needed to add
not quite
If I have this code:
Dispenser disp = (Dispenser)b.getState();
disp.getFacing()
How can I get the block directly infront of the dispenser? Is there a way I can turn a blockface into an X, Y, or Z easily?
And wouldn't really call myself a plugin dev
without making a switch statement
in that case https://paste.md-5.net/igizejuyap.xml
added the spigot repo so maven can find the api
Sweet
its not hard, just takes a little time
you can, but its not recomended
always use the correct repositories
ie Vault xml <dependency> <groupId>com.github.MilkBowl</groupId> <artifactId>VaultAPI</artifactId> <version>1.7</version> <scope>provided</scope> </dependency>
Because one is a .jar that a friend purchased whom I am making this for
but to use github you have to add a repositoryxml <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository>
and the other is a really old .jar that I updated to 1.16.5 verison of minecraft
you can add local dependencies
what
Vault has their own repo
did they switch to jitpack?
no clue, I just pulled that from an old pom I had
github works so I'll stick with that π
sure, if it works, no need to change it π
you are right
they actually suggest to use jitpack
so yeah, I was wrong
Missing artifact com.github.MilkBowl:VaultAPI:jar:1.7 error for this
add the repository
did maven say this?
if so, please send your COMPLETE pom.xml
?paste
as @eternal oxide said, you didnt add the repository part
you only added the spigot repository (lines 7+)
you also have to add the jitpack repo
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</dependency>
ooh no that's not how you do it
yep, this looks good. Use this file ^
Oh I see
doing it step by step so you learn how each bit works π
also, are you using IntelliJ?
eclipse
I appreciate it π
now see if you can find and add a dependency for LuckPerms
in intelliJ it looks like this
but eclipse probably has a similar button
it's important that you click this after changing your pom
yes
yeah that should do it
but no need yet
π
add all yoru dependencies first, and remove teh jars you added manually
oh wait
so spigot and vault can go now
is this person switching from "manual builds" to maven rn?
yep
oh okay, you also have to remove the whole .project folder
or whatever eclipse calls their files
otherwise you got a fucked up mix between "maven/eclipse project"
eclipse always prefers its own files, even when it knows that it's actually a maven project
and that can fuck up things VERY BADLY
yeah it's a night mare π’
I still remember when someone introduced me to maven
and nothing worked because of this
bump
b.getRelative(disp.getFacing)
ah ty
it might be b.getLocation().getRelative I forget
either way, ty
I was trying for org.apache.commons.io
to build with Maven it has to know all your dependencies
Quick concurrency question
I'm working on a system that will probably need to be run across multiple servers, with GUIs and all
Players are grouped n such
Should I make the API purely interact with redis, or should I make a caching layer that's synchronized across all instances with pubsub
or should I do something weird
I'm talking about multiple people managing multiple users on multiple groups across multiple servers
My apache does not like it ```xml
<repository>
<id>commons-io</id>
<url>https://github.com/apache/commons-io</url>
</repository>
<dependency>
<groupId>org.apache.commons.io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
remove the repository bit. its in maven central so needs no repository
the correct depend is ```xml
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
wdym "my apache doesnt like it"?
what's the error you get?
btw you cannot just add github URLs to your repos
as Elgar said, commons is on maven central anyway, so theres no need for any repository for this
Yes I fixed! Sorry I'm on a long phone call so I'm working slowly...
Does anyone know why (b.getState() instanceof Dispenser) is returning false when I place down a dispenser?
b.getState() = (shown below in the image), but
b.getState() instanceof Dispenser = false
b.getState():
what import is your Dispenser?
import org.bukkit.block.data.type.Dispenser;
theres 3 and you are probably checking against the wrong one
what's the right one then? I thought I wanted the block state so it would be this one
import org.bukkit.block.data.type.Dispenser;
thought the block state was the block data but il try that thanks
yea wait no I need the block data one, the one I was using
how can I compare it to that
because I need to use .getFacing
then you need to get BlockData not state
if (b.getState() instanceof Dispenser dispenser) {
dispenser.getBlockData()...```
I used if(b.getBlockData() instanceof Dispenser) that should work right
bump
Split your project into 2 parts. api and implementation.
Or simply dont expose the implementation to the user and ship everything.
You can probably get aways with just a static helper class.
How do I not expose the implementation to the user? There's a bunch of classes that are there because the plugin just needs them to function
Just... dont worry. Write a helper class and let everything how it is. Write a short documentation.
If the user uses your internals then thats their problem.
Is that how most other APIs do it?
And if so how come I don't see their implementation classes in autocomplete?
bomp
Redis only. No local caching. Make everything async.
*If all servers run on the same machine
what about guis that should update in real time
What if I have multiple machines on the same datacenter π€
Also fine.
pubsub
Redis also supports locks if you want to ensure consistency
Uhh I don't think I need locks
I can see like 20 people managing roles in a single tick, not 2000
this is gonna be hell to sync up but ok
i use PersistentDataContainer String type to contain encoded Stats of my items
is there another way to use a Object instead of a String ?
If you edit data then the data cycle looks like this
S << Pull from redis
S || Edit (+= 200 for example)
S >> Push to redis
What if
SA << A pulls from redis
SA || A Edit (+= 100 for example)
SB << B pulls from redis
SB || B Edit (+= 200 for example)
SA >> A push to redis
SB >> B push to redis
Then the result wont be +300 but only +200
I've faced this problem way too often
I know how to handle it
It's mostly tiny things that don't really matter
I'm thinking on making a GUI where "admins" can configure pre-made permissions for their own roles
a bit similar to discord's role permissions setup
There is only one solution to this. Locks.
How else could you solve this?
Yes. Implement your custom PersistentDataType and use it
You can store whatever in pdcs
It won't really matter if you need to allow the permission twice, the GUI will always represent the status in redis
I might have to make a local cache for currently open guis tho
*the last known status
Makes redis useless. Why not pull it from db and have it locally stored while editing?
I'd need a hella complicated database if multiple people are editing multiple roles at the same time
Well sure but exposing them is generally not an issue. But it's fine to have an API that's perfectly respectable. I just mean the desire to abuse static is something that comes around because bukkit abuses statics.
By local cache I mean not waiting the insert however long it takes for a redis operation to run ms for the gui to update
Well my main issue is that I just dont want my own implementation classes to be autocomplete by an IDE or visible on javadocs or whatever
I really wanted to abstract this a ton but I feel like I'll have to do a lot more raw database operations than I expected
Ah. So its just a write-through
You should not have to use any db ops for this.
so it'd update in real time, yet still send a redis packet
ehhhhhhhhhhhhh
this is hella complex
My idea is like
persistence layer should be completely unknown to redis
Persistence is mongo/sql
I hope one of them
It goes
Persistence -> Redis cache layer
And not both
Ok thats the default cache setup. But what db ops do you need besides simple read and write?
not much
I mean I have invite codes
similar to discord
so I could make a simple relational table for that
I kinda abstracted everything into UUID <-> Object operations
so for invite codes, I generate a UUID from the string (hashcode + length, go figure)
and fetch the target id from that but whatever
I feel like the cache layer will get extremely complex tho
Not only do I have to handle persistence, I also need to handle guis in real time n all
I have abstracted a system like this away. And i can say that its one of the more complicated things ive worked on.
I guess this is extremely similar to discurd in a way
I guess I made my own bootleg hibernate clone
flattens a Map<String, Object> into sql tables, if I'm using sql
or stores as a pojo for mongo
also serializes it for redis so that other servers don't have the fetching delay
It led to methods that are really fun to read...
that's the most complex db
wtf
am I tripping or is map.keySet() the same as keys because you end up tossing keys regardless
or do you call keyset again due to concurrency π€
Its pretty much the same. Shouldnt matter tho.
tiny tiny little performance niche I'd obsess about lol
it's like 5:30am I'm already obsessing
why does World#getNearbyEntities() take a location and then take the coords again?
Initial location, radius around that location.
The best thing which originated from all this was my TypedMongoStorage<K, V> which let me
use MongoDB as a key-value map with any object i want.
so the second set of coords are the farthest it can still count as in bounds?
Yes, it should at least. I'm not sure if it's inclusive or exclusive, but if you aren't getting the results you are expecting, just add 1 to the coords.
I guess I hate this a bit
how come it isn't just a number saying the radius, but a whole set of coords?
like shouldn't I just keep the same coords but change x to change the radius?
I have something similar but it just uses their Document object.
I assume more granular control. Not sure why you wouldn't just set them to all the same, but it could maybe give you a slight performance advantage being able to limit the height.
it gets converted to byte[] don't worry