#help-development
1 messages · Page 441 of 1
2nd most important thing in development after a computer.
Is there an @EventHandler for potion effect application?
Mhm
wack ok, lol why is it the entire link lol
nvm
fixed it
I've learned to just not question it
originally the sound for the creeper was supposed to be just a placeholder
but the early alpha testers loved it so it stayed permanently
Love the OG sounds of explosions
List.contains(<the message>)
but the message can be /ah arg1 ... arg5
hmm, maybe getting just the first argument
Split on space and take the first entry
Ok i got the uuid of a offline player how do i get his ingame name?
I think you can do getOfflinePlayer(uuid).getName
Which should get it from the local cache or Mojangs servers
script editor is a bit more polished now
all the items are configurable because that's how my engine works
thanks i forgot UUID.fromSting
how i can store a Block into .yml file and restore it into a Block with that String in the .yml file?
block.toString() looks like CraftBlock{chunk=CraftChunk{x=-22z=2},x=-339,y=63,z=41,type=LOG,data=4}
nice, and how
Block.getBlockData
unfortunately yes
Store the material and the meta data
No idea how to get the metadata anymore, it’s been too long
I think it was Block.getData.getData or something
then how to get it back into a Block?
this is basic serialization
get the data you want to serialize, write it somewhere, and then read it back and set it?
maybe Block.getState
i know nothing about serialization
then learn java
anywhere to learn about serialization?
not quite the best as it just uses basic writeObject
but basically you convert data to a common, simple to understand format
and read that format again back into your original data
First you must know what data to save
in case of a block, it's its location, block type, block data
and any other thing you care about
Som1 know why i have this error :
https://paste.md-5.net/ilejaxovuj.md
With this plugin :
https://paste.md-5.net/zugifujagi.java
What should i use instead of ShapedRecipe ?
public ItemBuilder setDisplayName(String displayName) {
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(displayName);
item.setItemMeta(meta);
return this;
}
lol is this a good idea?
sure
wanna do something like:
private ItemStack defaultIS = new ItemBuilder(Material.BLUE_STAINED_GLASS_PANE)
.setDisplayName("§1default")
.build();
if you wanna optimise, perhaps keep the meta as a field which is set only on .build
hmm okay
Im still getting Cannot invoke build() on the primitive type void tho
indeed
Good luck finding women?
lol
its ok i had to look up the keyboard shit
bc fuckkkk mojank code
i forget if u register a handler or if u mixin to one of their methods
i think i registered a handler
That’s just because it’s not mapped
obfuscation mappings not existing ezpz
idk what MCP Reborn uses but if they use Mojang mappings theyre SOL i think, u only get field, method, and class names
so then yeah mojmap
mojmap
mojangs mappings
they dont include parameter names
lol
now import org.lwjgl.lwjgl.utils.Display
or whatever the old class was
dont, it doesnt exist anymore
not since 1.13
Wait
different Display class
Lightweight java graphics library?
lwjgl-utils is a different thing 
there were always 2 classes in lwjgl family named Display iirc
one for utils and one for real Display stuff i think
Damagable moment
unless im trippin big balls
either way im referencing LWJGL2 stuff so it doesnt matter
LWJGL3 💪
lwjgl3
yes
dont listen to what i say tho, its all archaic knowledge in the grand scheme of the game (and probably flat out wrong)
the last bits of technical knowledge i have are from 1.8
does this call the super-class?
just use super.cp() then
Hey wait what does cp stand for
copy
🤨
🚔
If this is your code, you should name that method copy then
Although ideally you use the Cloneable interface and override clone() like a sane developer 😛
this should work for passing the enchantments from 1 item to another?
Map<Enchantment, Integer> enchantments = slot15.getEnchantments();
ItemMeta meta = slot11.getItemMeta();
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
Enchantment enchantment = entry.getKey();
int level = entry.getValue();
meta.addEnchant(enchantment, level, true);
}
slot11.setItemMeta(meta);
I barely feel ready to force a custom resource pack :p
I feel like if a server forced me to use a specific launcher I would simply just not play that server lol
A mod maybe, if you supported it properly.
And it actually added value
Well on the plus side you get to use mixins
On the negative side you get to use mixins

Damn. That's the truest shit I've read about mixins
Had to deal with them for VeinMiner's client mod. Shit sucks
Very powerful tho
Very powerful, obnoxious syntax that requires a strong understanding of method signatures and bytecode
what.
I wonder if I can create a public mixin plugin that other plugins can depend on 
and maybe market it for 5$
Good luck
Mixins have to run at class loading level, which is way before plugins get enabled
Yeah if you used an agent it would probably be easy
But then it’s less of a plugin more of a bootstrapper
Whats wrong here?
EnchantmentStorageMeta itemMeta = (EnchantmentStorageMeta) slot11.getItemMeta();
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) slot15.getItemMeta();
shouldnt i do this?
Are you certain both of them are enchanted books?
You just want regular ItemMeta for that then
yes
Ohh
so EnchantmentStorageMeta for book and regular ItemMeta for item?
Yes
Enchanted books can both be enchanted and store enchantments
A little confusing lol
yes
Incase you want a sharpness 1 book that also has sharpness 1
Exactly! :D
yo dawg
Ye so i have a question
I think Mojang did it to a fix a bug where silk touch books functioned as a silk touch tool
Unlimited grass blocks
I want to make the users can click the blank slots but not the whole inv, so i did this code java else if (inventoryView.getTitle().equals("Encantar") && event.getRawSlot() <= 44){ if (event.getSlot() != 11 || event.getSlot() != 15){ event.setCancelled(true); if (event.getCurrentItem().getType() == Material.LIME_WOOL) // normal code then
But it doesnt work.
damn
setCancelled(true)
should be false
no what
nono
its okay that way
It should be && instead of ||
Currently you are cancelling the event if they are not clicking slot 11 and they are not clicking slot 15
yes
They will always not be clicking at least one of those
You want to cancel if they are not clicking slot 11 and they are not clicking slot 15
Right
So you want to check they are not clicking slot 11 and they are not clicking slot 15
Hence &&
it would be || if you used ==
yes
Good evening, all!
Worked, thanks
But i have a question @young knoll
and i dont know what to do
I have this inventory that u just saw
So i want if the player puts an item in 11 or 15 and closes the inventory without completing the process
get the items back
and idk how to do it
no idea in my mind
Use the InventoryCloseEvent
on inventory close event check if theres items there
Get the items in those two slots, if they aren’t null give them to the player
Or air, you’d have to check which it is based on if it’s @coral knotable
bukkit doesnt
I haven't updated a plugin of mine since 1.17.1. I'm comparing the 1.17.1 and 1.19.4 jar files in Eclipse, and I noticed all of the sources that 1.17.1 used are missing from 1.19.4.
Did my 1.19.4.jar file build wrong? The import command doesn't seem to be working anymore.
Look
Bukkit's use of null and air when working with inventories is pretty sporadic
You'll want to check the Javadocs or the nullability annotations to verify which check you need to make
At least the annotations tell you which it is
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
I do actually think Inventory#getItem() is nullable though so that's probably fine
Thank you
better safe than sorry ¯_(ツ)_/¯
You do have item.getType().isAir() at your disposal for convenience though
Well it works
And just use the ! before and it should be the same
thanks
This feeling of your code working properly u know, i think is the best a dev can feel in his life
@young knoll You glorious, glorious human being. You've made this noob's night so much better, thanks.
x2 lol
There is only one set of Mojang mappings
It should map all classes, methods, and fields
Just not parameters afaik
I found this
Might help
hello, can someone tell me what is the correct? i found various images like these
Easiest way is to just make a click listener and print out the slot
pretty sure the second is correct
ok, thank you
Second is correct, first is protocol
First is InventoryClickEvent getRawSlot, second is getSlot
someone please?
guys, how to save to config list of my objects? ```blocks:
- x:
y:
z:
world:
items:- name:
type:
count: - name:
type:
count:
- name:
- x:
y:
z:
world:
items:- name:
type:
count: - name:
type:
count:
- name:
do your objects implement ConfigurationSerializable?
then what do I need to do?
I have now created a class for the object, added "implements ConfigSerializable"
added the serializable method, what should I write in it?
if your objects should look like this:
name: asd
type: 123
count: 45
then you gotta return a Map<String,Object> that has "name" -> "asd", "type" -> 123, and "count" -> 45
also you need the deserialize method as explained in the javadocs https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/configuration/serialization/ConfigurationSerializable.html
I kind of understood, but what about the list of items?
Can anyone help?
So i create a message command, that will send the target title ans subtitle.
The 1 arg its player and 2 or more its message
The issue is that when i type /wiadomosc <PlayerNick>
Its shows this
- when i do
/wiadomosc
Its dont send the message that player dont provide arguments
i forgot to put this image
Ok i will test it
well a List<> of your items
do like that? @tender shard
the server does not recognize keystrokes from the player's client
Yea its working but when i use only /wiadomosc with no args
it sends this
I will test
wait
really?
yea
I just saw my mistake, it shouldn't work)
No its work fine
nice
I hate having to wrap my debug statements into an if everytime D:
main
are you now complaining about how I call my private final fields
totally
Hello its me again.
I have a question and issue
-
How i can Tab the
onlinePlayersinTabExecutor? -
I made a
/wiadomosc reload, and reload is tabbed
But when i use it that send
"target" is null
but when i do this
you gotta check whether the player is null before sending a title
if(target != null) {
target.sendTitle(...);
}
if(args[0].equals("reload")){
//reload?
}
}```
or better - return after you detected that args[0] is "reload"
^
e.g. in line 39, return and stop further execution
you should still check whether target is null before sending the title
otherwise you'll get an error when someone does /mycommand nonexistingplayer
i do this
yeah that looks better
any way to store data in block ?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
dont want to use any external lib
then you can't
make a util class with a method to concatenate arguments for the future
why not :l
is there a reason why you don't wanna use any lib? I mean, spigot-api is also a lib
because blocks do not implement PersistentDataHolder
Yea now its not show's the error
move the check into main.debug?
then it would concat the string everytime even when debug is false
and that's expensive because it has to serialize the whole itemmeta everytime
is it only me who cant select jdk?
click "Download JDK"
fair I didn't put much thought into my suggestion
didn't even notice the concat
i downloaded amazon one. then it appeared in the list but when i clicked on it. it just dissapeared
weird, try to create a normal java project, without the minecraft dev plugins. does it work there?
looks like it does
then it's just the MC dev plugin being shitty again
it's known to cause troubles all the time
what do i do?
idk for maven you could just use archetypes. for gradle, just write the build.gradle yourself
I mean, that's all the plugin does, anyway
not experienced
how do i
(gradle)
do you want to use gradle or do you not care about gradle vs maven?
gradle
then you go somewhere and enter gradle init and let it generate an empty build file
then you just add the bungee repo and dependency
maven just updated something and messed all my dependencies
i doubt that that's what happened
maven doesn't update anything on its own
neither does gradle
idk i just wasnt coding for a week
updated intelij & plugins
and one of my plugins broke
File -> Invalidate Caches -> check everything -> Invalidate and Restart
it's probably IJ messing up, not maven
anyway, this is how you can create a bungee plugin with gradle from scratch
in projects folder?
you can also make a blank gradle project with ij
on the new project screen, look at the Empty Project section
whereever you want the project to get created
so usually, inside ~/IdeaProjects
why not using "New project?"
because its under new project
i just deleted my old project and saved src
xd?
is it so hard to setup?
imho it's a fucking pain
no
which one to believe
why?
the person who uses gradle
ofc you ca nget it working by just copy/pasting stuff from other people's build files
and which one uses
maven is so much easier though
me
I have to use gradle sometimes and I always hate it
maven vs gradle?
here's an explanation of what sucks so hard about gradle https://www.bruceeckel.com/2021/01/02/the-problem-with-gradle/
example:
sourceSets {
main {
java {
srcDirs('java11')
}
}
}
sourceSets.main.java.srcDirs = ['java11']
sourceSets.main.java.srcDirs('java11')
someone can explain the difference pls?
or this:
sourceSets {
main {
java {
srcDirs 'java11'
}
}
}
you don't. you just copy/paste existing stuff without understanding it
if you have never used it before, i wouldnt recomend starting now
not cool
that's the only way, as explained in the blog post I sent
so what do i start with
in gradle you either have to know everything, or you can't do the most simple things
what about maven
maven is easy
is there anything hard to understand?
https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
basically you just gotta replace "spigot-api" with "bungeecord-api" (or waterfall or whatever) and change the repo to the bungeecord repo (or waterfall)
gradle build file sounds prettier
is there any toturial like that for gradle
look at already made projects
that's for spigot, not waterfall
why not changing some things
in dependency
this is for bungeecord, so at least almost waterfall https://www.spigotmc.org/wiki/create-your-first-bungeecord-plugin-with-gradle/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
wait you can save location as string and then make it alive?
thx
serialize location
- you can't just cast your config section to location
- why don't you just use the normal set("blabla", myLocation), then later retrive it using getLocation("blabla") ?
i think you need to get x y z pitch, yaw and world then create new location and set that properties
try it
or just use the already builtin ConfigurationSeriazable interface, that Locations happens to implement, and don't worry about any serialization yourself
oh no
I save space like this, do I need to remove serialize?
it would be easier to get rid of the .serialize() and then later retrive it using getLocation("location")
the command is tas
Hello its me again.
I have an error, when i do /wiadomosc wyslij <player> <message>
Code there: https://pastebin.com/wgPQ5ch0
i try everything that i thing of and anything dont work
you accessed args[1] (the second element) although your array only has one element
i dont understand (I dont understand english very well)
what that means
OOo
in line 32, you say "do the following if ONE argument was entered"
in line 50 you then say "give me the SECOND argument"
but there is only 1
args[0] = first argument
args[1] = second argument
Yea i understand now
I dont see that
this bracket should be closed before line 48, and instead of "else if" you should just do "if" there
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!
i am working on another person code and its daunting to even look at.
this is not even all the files in the project right now and i have fix something apparently.
looks quite tidy
Yeah, that's quite a neat layout
in my first plugins, I had all the classes in one package so that I could keep stuff package-private lmao
yeah but i have almost never really worked with other people's source code before.
how does one even try to read someone else's code though for a complete beginner?
do i have to read every single line of code now?
um?
this is mostly what scares me about modding minecraft.
figure out what you hav to fix then check the classes you need or look similar to what you need to fix
i am not modding minecraft.
yeah but the hundreds of lines of code and trying to make sense of them is so annoying though.
hopefully method names are descriptive
How else are you going to fix it if you don't understand what it does? 🤔
there a lot of errors in the code.
there are probably like 10 or 20 different errors from this one class.
i am looking at the class and it appears to be missing a lot of code.
am i importing this wrong?
i literally got this from their github repository and it seems to trying to access instance class member functions as though its a static member function.
i am so confused right now.
Inconsistent as f
am i doing something wrong or is the code just wrong?
there are probably like hundreds of these sorts of errors everywhere.
Lol everytime i write code I'm trying my best to make it as readable as possible so when I come back in a month I don't forget everything
Hover on them
can somebody please try importing that project and check if its actually just me or just the code itself being weird.
i dont know i just download the code from github.
Does it even compile?
lets try.
it is compiling or maybe not??
Does it show up in external libraries ?
no
add it to your pom.xml file.
Did you reload project
then reload the project from maven.
He uses gradle
how do i
its gradle
or gradle.
ah right
??
ik
anyways why is there word maven in the build file if its gradle?
weird question right?
Because those are maven repos
Gradle is compatible with maven repos
I don't think gradle repos exist
Correct me if I'm wrong
nice it works now
You don't use that in groovy
It won't change anything just style
You will probably wanna shade jda later too
Use shadowjar plugin for that
When I save objects to config, only 1 is saved (I put 2 blocks, but only one is saved)
Can you show your data variable
And have you checked how many times is that loop ran
what is command i use for make npc with citizens?
#help-server btw its /npc create npcname
ok thanks
lmao the switch statement spam.
yeah i am convinced that is code is written by someone below mediocre at this point.
i would probably have this set up with a hashmap with the string being the key and a lambda of some sort for value or something like that.
To me, it looks like you are putting only one loc in data
I checked, there are two locations. If you put two blocks, then they are both functional.
That hurts to look at. I'd rewrite that at that point.
@hazy parrot
Omg, why?
what is going on here?
He's calling the garbage collector every 5 minutes in a runnable.
lol.
You're doing Integer.toString(1)
You might wanna do Integer.toString(num)
i thought it was bad because he was not using Bukkit.getScheduler().runTaskAsynchronously(); but what you described there sounds so much worse though.
It gets even worse when you realize that he's also creating a new thread to do it and never kills it.
oh my.
what is the problem here? when i using command /npc create (name of the npc)
There was an internal error when you attempted to perform the command
what i doing for fix that?
update the plugin
okk
he must be, otherwise he surely wouldn't post it in this channel
im got no devs, im developing my server my self
the code probably has thrown exception and your server software might log them in the console. Maybe try reading the stacktrace?
you could probably find the line of code that caused any errors to occur by checking out the stacktrace.
id just have a Map<String, CommandExecutor> for all the commands
Please help i'm going crazy, how can I change the default worldgen to just add a singular jigsaw based (like villages) custom structure
Add new generator, put StructureManager populator
won't that override the default overworld generator?
you specify before world load https://hub.spigotmc.org/javadocs/spigot/org/bukkit/WorldCreator.html#generator(org.bukkit.generator.ChunkGenerator)
specify what
the generator
yea but i want to keep the default world generation and add the structure "on top"
so?
public class YourGenerator extends ChunkGenerator {
and don't override the generateSurface
Hey guys, is there a simple way to listen for a forge event?
I'm trying to listen for interactions with the DayCare block in pixelmon.
oh yeah right right and where do i put the BlockPopulator?
that's more of a question for sponge or whatever thing you use no?
You can add the populator in teh worldInit, not sure if you can do it before
world init event?
The server runs Arclight (spigot/bukkit and forge mod/plugins access), I have the mod written in Forge but find it ass backwards and awkward to work with.
So was hoping to just use spigot
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
There are no forge events in Spigot
Sorry, thanks for your time
there are also no forge materials in spigot, and iterating over Material causes an NPE or sth in arclight
how that?
like, iterating over an Enum class #values ?
yeah IIRC that caused it to crash. or maybe it was another hybrid fork, not sure rn
I'll try whether I can find the issue on github
ah my bad, it was CatServer not arclight. and it threw NoSuchElementExceptions when looping over Bukkit.recipeIterator() https://github.com/Luohuayu/CatServer/issues/540
and this is their awesome fix ahaha
is catserver better against arclight and such?
i have this idea about doing red dead online in minecraft but still figuring out if modding the client with forge or if only make the players use a resourcepack
the main issue are mobs… they are hard to implement with custom models unless going with model engine and such (which the more latency each player has, the worse it will look), so I liked the idea of adding new entities to the game
how do you use the StructureManager to load a structure since it's an interface?
Hey,
anyone here who know how to give a player a splash_potion in spigot 1.8? Because the IDs do not work.
Its working but instead of typing You dont provide an argument when user dont type for example <player> in /wiadomosc wyslij <player> <message>, its shows this
read the caused by line
a length of 1 means only [0] exists
where? i cant find
O maybe i find the issue
I have now 1 issue
So when i do /wiadomosc its say You dont provide the args and This error thing
if (sender instanceof Player p) {
if (args.length == 1) {
if (args[0].equals("reload")) {
if (p.hasPermission("wiadomosc.reload")) {
p.sendMessage(prefix + reloadMessage);
} else {
p.sendMessage(prefix + noPermissionMessage);
}
} else if (args[0].equals("help")) {
if (p.hasPermission("wiadomosc.help")) {
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Przydatne komendy");
p.sendMessage(ChatColor.GREEN + "/wiadomosc wyslij <user>" + ChatColor.WHITE + "Wysyła wiadomość użytkownikowi.");
p.sendMessage(ChatColor.GREEN + "/wiadomosc reload" + ChatColor.WHITE + "Przeładowuje config.yml");
} else {
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Przydatne komendy");
p.sendMessage(ChatColor.GREEN + "/wiadomosc wyslij <user>" + ChatColor.WHITE + "Wysyła wiadomość użytkownikowi.");
}
}
} else if (args.length == 0) {
p.sendMessage(prefix + ChatColor.RED + "Zła liczba argumentów!");
}
i cant find the issue
read the caused by line in the stacktrace
where is stacktrace?
?npe
The NullPointerException, (commonly referred to as NPE), is thrown in the following cases, but not sealed to: 1. null is passed into a method or constructor which does not allow it; 2. When trying to access a field on an object pointing to null; 3. Casting null to a primitive. See https://stackoverflow.com/a/3988794/17047120 for information on how to debug NPEs.
i dont understand because its to complicated english for me
i understand few words of this but not much
read further down the error at the line which starts caused by
Firther
it means args is empty
O
but you are trying to use args[0]
What have you got on 51 line?
your issue is the fact you check if args.length is 0 in the if of checking if its 1
What? i dont understand
you sent this
you check for args.length == 1
then in that same if you check if its 0
when it should be seperate ifs
xd
?help
if (sender instanceof Player p) {
if (args.legnth == 0) p.sendMessage(message);
if (args.length == 1) {
//your code
}
}
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
Also please don't stack ifs like that
Use inverted ifs with return
It's much easier to read and maintain
if(!somecode) right?
but idk when use it when not
Yeah
I know that when ! so the player for example dont have permission
but i want to send the message to permission and non permission player
thats fine then
if (!sender instanceof player) {
sender.sendMessage(Bla bla);
return
}
// Other code
they are called early returns
what that means?
That's just the name of that
it means returning earlier in the function to prevent nesting if statements
if its java 16 or higher you can do if (!(sender instanceof Player player)) { message} player.sendmessage(othermessage)
In 2023 you can also stop using Spigotmc and move to Paper
no
💀
i will always dev against spigot
https://pastebin.com/ZKw7ykr8 << code
As a general rule, if you have have a simple condition test that will return if it fails, use early returns.
oh ok
i understand know
if I dev for spigot I can let my plugins be used on all 1000 forks of it
if I dev on paper I can use my plugin on just the paper fork
with probably some exceptions
I'm trying to determine if a brown mooshroom has been fed a flower and is ready to make suspicious stew. The game tracks it, because you get a different particle effect and it won't consume the item after you feed it the first flower. But I don't think Spigot exposes a way to see that.
and besides I know it was a joke argument but switching to paper wont solve your problems magically 😛
a way to see what? how did you get the particles showing up in the first place?
the way I believe pure vanilla works is you get infinite stew if you use a bowl
unless they changed it this year 😛
If you feed a brown mooshroom a flower, it will make suspicious stew the next time you use a bowl on it
oh
I don't think Spigot gives you a way to see if the mooshroom has eaten that flower and is ready to make stew.
okay well you are correct, there is no api for that functionality
Yeah, I even thought it might be a potion effect but it's not
Ah well, not a huge deal but I was hoping to track that
the only thing you can do with the MushroomCow entity isset its variant (red or brown)
Yup, and I already check that to see if the cow is brown before checking the other things
This code is in the interact event 😄
okay then I cant help you further xD
what does it mean?
No biggie, and thanks for the input
in one of your configs you have an invalid worldname saved on a location
Looks like it doesn't recognize the world in that Location. Are you using a custom world type?
Or is it null?
oh maybe something you can do is keep a list of cows players interacted with and then checking that list when they feed a flower
You're right, I could do that, but it isn't super important. Was just curious if anyone else had encountered it.
I see
idk why
A location can have a null world
wheres the location coming from
then how to fix it?
wheres the location coming from
Find out what's passing the errant location and check the world that's being passed
whats data in the first screenshot
Does your plugin load before worlds initialize or after?
okay and then when you actually save it I assume you pull those out and use some number to identify that combination?
how to check?
You would have had to specify that in plugin.yml
so probably not then 😛
load: STARTUP
If your plugin is loading before generation, no worlds are loaded and that's probably why the deserialzer can't recognize them?
Before world generation, plugin.getServer().getWorld("world") will return null
Take out load: STARTUP from your plugin.yml
or change it to load: POSTWORLD
But postworld is the default
Now your plugin might need to load before world gen if you do anything to modify the world files
But if not you should be good
I changed to StartUp, nothing changed
Where i can add the permission, so the user can change it, and give to players?
You can put it in your config if you want people to change it
Oh ok thanks
How i can create the placeholder inside the plugin, because i want to change player nick in config.yml
nvm i figured out
How can I "link" worlds
like world akex06, when you use a nether portal it goes to akex06_nether for example
is spigotmc down?
you handle the teleports yourself
I tried to search it up but
oof
bro what
its up
damn
hmm
it didnt let me access anything then it came back
yeah now it works, I was literally trying to access that same url
is there a way to create worlds in another directory?
no
f
How should i use ScoreBoardTeamPackets in nms, i tried using PacketPlayOutScoreboardTeam packetPlayOutScoreboardTeam = new PacketPlayOutScoreboardTeam(); but i don't know how to use it and online i couldn't find anything
Can I have your maven
?
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.neznamy</groupId>
<artifactId>tab-api</artifactId>
<version>3.2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.3.1</version>
</dependency>```
have you ran buildtools
did you reload maven
Maven says packages not found
Yes but I will try it again
Once happend to me to, i just execute the jar directily instead of using the .bat
And restared the IDE
https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/#post-4184317 @elder quail 1.17 NMS changed
read more hear. You also need to run buildtools with the --remapped argument once and do mvn install 😄
makes nms btw way easier ^ as it includes all method names and such
mvn install is done auto
if I have the permission foo.hello.n
mvn installcannot possibly work in the buildtools directory - there isn't even a pom.xml there
which would be the best way of getting n?
split foo.hello.n by "." then get the last array element
my python head would split the list at . and get last element
not talking about running it there anyways, i mean running it in your project folder
ok ty
well yeah of course you would compile there using mvn package (which is just mvn install without copying to local repo), how else would one compile? 🤔
how could I check if player has a permission with variable end?
Hello i need help with 2 things
- I want to make a npc (in a lobby) when clicked (right-clicked) it will to teleport you to a cords (of my choice)
- i want to have a title on top of them and under the title a description, but again dosenth know the plugin name
loop through all perms and check if it is the one I want?
is there any way to filter autocomplete commands by player that has permission
parse sender as player
and check if it has a permission
If you assign a command a permission in your plugin.yml
it is not a command permission
It will automatically be filtered from tab complete if the player doesn’t have the perm
commandsender has the haspermission method hmm
oh right
yes
you are talking about permissions sth like this right?
myplugin.maxhealth.20
yeah
Ok, I'd loop over the effective permissions, then map them to string, filter them by your permissions prefix, map them to only the value (after the last dot), then parse them to string. Instead of using mapToInt(Integer::valueOf), you should rather try/catch it to Integer so you don't get exceptions when someone assigns a non-number perm.
Then just filter out the non-number things, map it to int (IntStream)
Example:
public static IntStream getPermissionValues(Permissible permissible, String prefix) {
int prefixLength = prefix.length() + 1;
return permissible.getEffectivePermissions().stream()
.map(PermissionAttachmentInfo::getPermission)
.filter(permission -> permission.startsWith(prefix)).map(permission -> permission.substring(prefixLength))
.map(valueAsString -> {
try {
return Integer.parseInt(valueAsString);
} catch (NumberFormatException e) {
return null;
}
}).filter(Objects::nonNull)
.mapToInt(Integer::intValue);
}
and then ofc just reduce the stream to the min or max amount found
public static int getLowestPermissionValue(Permissible permissible, String prefix) {
return getPermissionValues(permissible, prefix).min().orElse(0);
}
public static int getHighestPermissionValue(Permissible permissible, String prefix) {
return getPermissionValues(permissible, prefix).max().orElse(0);
}
when i want to look into the impl
let me check that
Integer worldBorderSize = null;
for (PermissionAttachmentInfo effectivePermission : player.getEffectivePermissions()) {
if (!effectivePermission.getValue()) {
continue;
}
String permission = effectivePermission.getPermission();
if (!permission.startsWith("realms.world_border_size.")) {
continue;
}
String[] split = permission.split(".");
worldBorderSize = Integer.valueOf(split[split.length - 1]);
break;
}```
I did this (haven't tried it yet)
that's bad OOP, why don't you turn this into a reusable method
and why are you using the boxed type
ikik, I was just trying some stuff
also that would only work for for one permission, what if they have several
I was going to make it a method
I mean, it wouldnt be sorted, you wouldnt know whether you get the highest or lowest value or some random one inbetween
let me try to tell how your code works
why prefixLength = prefix.length() + 1?
Hello guys i have question.
How i can make that the one of file for example SimpleCode can be use it 2 file SimpleCode2?
because i do staff for my config like this
because you'd enter "myplugin.max-health" as prefix, then filter out "myplugin.max-health."
why not just pass foo.max-health. ?
yeah well then change it lol
just wondering
wha
I think it'd be dirty to always ask that method for the value of something. instead of asking it for the value of something
I mean, you want the value of myplugin.max-health and not the value of myplugin.max-health. Hence I see the dot as separator and so I +1 the length of the prefix
idk how to write it wait i will translate
I'm working on config.yml and is it possible to make classes and everything from 1 file to be used in 2 file. Because it looks a bit messy
(example)
rewrite your stuff to be reusable, then you don't have to copy/paste 100 lines
but it not possible to do this config and stuff in 2nd file?
time you learn about OOP and data structures
for messages you can just make a class that's responsible for sending messages
I have mine as "MessagesFile"
so stuff like sendMessage(player, "no-permission")
The messages file can then look at the config itself, and see if it's either a
- string (then just format and send it individually)
- String list (loop through each line and do the process above)
For placeholders you can just use a lambda or make your own placeholder class
For example, I have this
this is in MessagesFile?
and my config looks like
why is this not working when i right click air?
The client doesn't send any packets if you right click air with an empty hand
now, your item check is probably failing
cuz aair doesnt have meta
yeah RIGHT_CLICK_AIR only works for certain items that have functionality (compass e.g. I guess, or fishing rods)
also why the heck are you comparing the display name
works for any item except air
it's stupid
you can give a player an invisible item with a resource pack and it'll work
I dont understand now
how this works and where that come from
maybe i will code simple simplest code and understand
it
I saw a video commenting on them no wonder which version got added
they are for map making
atm they're not craftable I think
I didn't do it and fixed
you wouldn't be able to get any of them random
oh nice there's some new pictures
this paintings were already added to the game iirc
In this video I will show you how to get the four new secret unused paintings in minecraft java edition using commands!
If you liked this video, please be sure to hit the like button and let me know in the comments why you liked it! If you really love my content, please consider subscribing!
******************************************************...
havent seen those before
11 months ago
So is there a good rule of thumb for stuff like area claim plugins when it comes to the checks of its protected by a claim or not?
E.g:
block break event
Get region and chunk location
Check if region has a land claim
Check the chunks of that land claim
If the chunk location is in the claim, Check if player is in claim
If in claim, Check flags and, if right flags allow event
If not, çancel event
Seems hella bulky
Your clock is probably wrong and its some april fools
it's a bit ironic
Is that latin
ita est
video
wdym
oh you mean "i see"
if only I could come up with a good ACI construction as reply but I can't
ACI?
it's a latin grammar construct
accusativum cum infinitivum
and I studied this last year lol
hat's how we learnt the name in german
which is funny because it's wrong
🤓well actually cum goes with the ablative
yeah ik and hence it makes little sense, but it was called like that in our book lol
I think the book was called Actio
I've recently been switching my chat plugins deprecated ProxiedPlayer#.sendMessage(String s) methods to ProxiedPlayer#.sendMessage(BaseComponent c), but I've run into issues with URL links. Links that get put into chat are no longer clickable. Is there a solution for this other than writing code to check every message for URL links and setClickEvent each time?
How to do that?
which version are you using? I have never seen strings being used in bungeecord
how are you creating the component btw?
very latest bungee, i was just doing sendMessage(new TextComponent(String message)), but im about to try sendMessage(TextComponent.fromLegacyText(String message)) to see if that works
oh right, sendMessage(String) is declared in CommandSender
I only looked at ProxiedPlayer
ah yea, it's been deprecated forever, but im just now getting around to actually changing it lol
I made this config. how do i create a file for it? this is the output. and when I change the value, it still remains what it was
does IJ have an option to have more detailed tab complete menu ?
with stuff like javadoc info
CTRL+Q?
Hi all. I am creating a Redis-Spigot handler.
Now, I am trying to implement a PlaceholderAPI placeholder with a Redis value.
If the placeholder will be called more than once a minute, can I still do this sync without imploding the server?
If not, how can I do it async?
I am unable to know whether Redis will be hosted locally or not
Why not create a mem cache and poll from redis
Yo why is a Giant still collidable when I set him not to be collidable?
https://paste.md-5.net/roqoyahado.coffeescript
oh just noticed, one can also move it into a tool window
I'm actually using a cached JedisPool
I can count the pixels in this image
It's my first time with Redis, sorry for any misunderstanding
If you fetch placeholder data directly by querying redis it may hang
since redis at the end of the day is gonna be an external io device u depend on
So u should instead poll redis and cache some values, then use those values when parsing the placeholder
Isn't JedisPool some sort of Redis connection caching?
That’s just a pool design
Object pool
To avoid creating a new connection every time yk
But jedis is a bit meh imho
I've been asked to make it so that, to speed things up and not use a YAML file, you use Redis and then, when you shut down the Server you save everything in MongoDB.
At this point, would you suggest changing RedisDB value just when updating it and then adding a copy of the entry in a Map<UUID, Document> to speed things up?
Wdym? what do you suggest?
It's my first time, I'm open to every kind of advice
This sort of
You have a local cache
The redis cache
And then the persistent cache yk
But I wouldn’t use a map
At this point I fear that no one will ever be able to destroy my data anymore lmao
wdym
what?
To avoid experience data loss
ohh okay okay
But it supports eviction, expiration and concurrent operations
thank you so much! Couldn't ask for a better help 🙂
Yea
Well generally, you use the put if absent in cache design
Goes for both redis and local cache
Anyone know hot to add the "/shop" and the "/sell" command in ShopGUI+ and SellGUI+?
And for removing an entry, you remove it from the local cache, redis and persistent, then you tell the other servers to also remove the entry from their local caches
Through redis message queue for instance
I'm doing that inside PlayerJoinEvent, I'm trying to avoid loading every entry present inside Mongo
Thank you for these advice
File | Settings | Editor | General | Code Completion
show documentation popup in
Do it in AsyncPlayerPreLoginEvent