#help-development
1 messages · Page 42 of 1
Runtime or compile time?
Caused by: java.lang.LinkageError: loader constraint violation: loader 'NeoPerformance-1.10.10.jar' @69f55382 wants to load class com.neomechanical.neoutils.inventory.managers.data.InventoryGUI. A different class with the same name was previously loaded by 'NeoConfig-1.0.3.jar' @215587da. (com.neomechanical.neoutils.inventory.managers.data.InventoryGUI is in unnamed module of loader 'NeoConfig-1.0.3.jar' @215587da, parent loader java.net.URLClassLoader @5c29bfd)
Maybe the two 7s means he's 77
This sounds like you shaded in an api
accurate
only boomers have a picture of themselves as a profile picture
yeah I shaded in my api neoutils with my plugin that uses that api
7smile boomer confirmed
is there a way to animate a armor stand to make it have a hit animation? basically like when a player hits another player or smth
that animation is rendered client-side
https://hastebin.com/raw/oneyadihor
Idk man this seems kinda jank... @lost matrix @echo basalt @vocal cloud but it will work
with packets and all
what if you make your own beehive tile
oh
I just need to sort out some reflections but it's possible
but its for a armor stand?
I am absolutely clueless on reflections
you just gotta access a couple fields
reflect
what if you become a bee?
and change them to reflect a method's internals
that might help you empathise with the hive?
and then they will tell you how their code works
basically just gotta do reflections to emulate this method
by changing the maps fields
you gotta be careful tho
and inject your custom beehive
and just change the tile impl
I think that making a fake beehive and just playing pretend with it going in and out would bee better
i beelieve you are right
Server goes down and restarts you can just get all the stored bee info and generate a new set of bees while killing the old ones off
with this hacky tile approach all beehives act correctly in a deeper native level
Yeah if it works. Good luck
I really don't want to change like 7 different fields over reflection
but all the tile code is handled
just need to hack into the registry
or unfreeze it, delete a value and insert stuff
similarity > equality
I phrased it this way so It gets taken out of context and I get cancelled
wdym?
how do i stop a bukkit runnable
By beating it with a stick. Or storing it somewhere to cancel later
im gonna beat my head with a lead pipe
BukkitTask (and consequently, BukkitRunnable) has a #cancel() method, yeah.
location.add modifies the original location right?
Yes
Yeah it's all mutable
Though bear in mind, pretty much anything in Bukkit that returns a Location is a clone
(e.g. player.getLocation().add(0, 1, 0) won't teleport the player)
is metadata stored in memory ?
like a living entity
then, yes
no
You're talking Bukkit metadata, right?
yes
Kept in memory, not lost on plugin or server reload
specifically a armor stand
Lost on shutdown though
you're talking about this, right? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/metadata/Metadatable.html#setMetadata(java.lang.String,org.bukkit.metadata.MetadataValue)
declaration: package: org.bukkit.metadata, interface: Metadatable
oh so it only loses on reboot
Yeah
damn that sucks
well well well
i tried without using a database
you can just use the PDC to store "persistant" stuff
Entity#getPersistentDataContainer()
that data will be kept through shutdowns etc
Take a look at these two posts that explain PDC:
?pdc
oh i guess that works too
yeah awesome now i have to rewrite everything
F
in theory, you can even use it to store maps, lists, and other collections https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
im surprized ive gone so far and still not knowing 98% of java
lol, yeah well
if you claim yourself that you don't know java very well, I highly suggest you to look at one of these:
literally my 3rd day using java and didnt take any lessons or anything lol
?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.
yes
cuuute ❤️
i took it on my phone lol
ty
well
technically its my cousins
but noone knows
Well boys...
I got a working solution
If I set the UUID of my CustomBee, will it also set the UUID of the bukkit entity itself?
because I cant set the uuid of the bukkit entity
if your overriding nms it should because iirc all bukkit entity does is wrap nms
i'd have to look at impl but thats pretty much bukkit almost ever does is wrap
//Spawn custom bee
CustomBee newBee = beeManager.spawnBee(nearestHive, beeEnteredHive.getCustomName());
newBee.setUUID(storedBeeUUIDs.get(0));
i'm not sure but wouldn't it be easier to override the nms behive and mix in
rather than doing something more hacky
nope
yes
Entity#getUniqueId simply returns vanilla's / NMS' getUniqueId()
if your curious about such things in the future you can take a look at the stash usually the classes contain Craft infront of them CraftEntity, CraftPlayer etc
?stash
you have to go to the CraftBukkit repository
commands:
rtp:
description: Randomly teleports you so a random place
usage: /<command>
This is my plugin.yml for the command section, Do I need to add anything for adding args to commands?
For example /rtp {playername}
no all args stuff is managed by logic
if you want tab completions you need to register a TabCompleter
no
Ok thanks
I'll have a look
I'd reccomend using a command framework though I don't like bukkit's you could take a look at Brigadier I also think Lamp is really good though it adds a quite a bit of size to your jar versus brigadier which is packaged with servers and clients post 1.13
help with itemstacks in shapeless recipes
ItemStacks can't be used as recipe requirements
your limited to materials atm
any way to use preparecraftevent
for shapeless I guess you could check for every possability though just making it shaped is much easier
i just need recipe for 1 item
using prepare craft event
but when putting multiple itemstacks
doesnt register
?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!
recipes only take a single item per slot in teh Matrix
ItemStack#isSimilar is way better tahn ItemStack#equals isSimilar ignores stack size
hm
you can NOT make a crafting recipe use more than one item of each itemstack
you need to do that manually
oh ok
i was just wondering bc my friend is able to recreate something similar in skript
Skript < Java
ofc
if skript can do it java can do it better a whole 100% of the time
but i thought there must be a way to recreate it
if you need a specific amount of an item you need to manage how much is subtracted upon crafting the item because by default its only going to take one
isSimilar is just equals without comparing stack amount
ok
ideally what you'd want to use for crafting recipe stuff
alright
still need help
i believe theres something wrong with my code... whenever i craft with multiple of an itemstack, it no longer clears the items with the crafting matrix..
i can send you the code to take a look at if you think that will help
anyone else have an idea
alr
ik shadow master bouta drop a question I can't answer and I'ma have to dip outa shame
?paste
btw ^
Vanilla crafting works similarly. If you have multiple items in the proper slots and then you only craft one item. The crafting table will remove one from every relavant itemstack and you will still have something left over that results in a valid craft.
Lmao. I just ask the important questions I guess. ¯_(ツ)_/¯
with how long it took you type that I thought you were asking some hyper complex question
and I was gonna have to run but nah u just answered him
so explain what the problem is now
in a way that i can process
what is happening currently vs what do you want to happen
Why dont you just register a recipe?
whenever i craft my custom chestplate with 2 types of my custom block,
and take the chestplate out of the table, the blocks dont get removed from
the crafting table, making it a duper.
What i want it to do, is remove one of each block every craft
he wants to use a custom itemstack apparently
So? Recipes can use custom ItemStacks
is this new?
wtf I swear I was always told Materials only for recipes
same here
if you want to make a recipe which requires multiple of an item, instead have them craft X amount of the required item into a custom item. Then use that in your recipe
no need to listen to events then
i dont want it to require multiple of an item... i just want it to be crafted when there are more than just one item in crafting grid
what version was that added in
say you wanted to craft multiple armor types in one go,
what do you mean byt hat
A recipe should help with that though.
so do i just create a shapeless recipe except add itemstacks as ingredients?
I believe the docs say ExactChoice doesn’t work with shapeless recipes
No idea if that’s still the case
idk. 1.12 or 1.13
I think this is what they mean.
yea
uhm recipes will help with that lol
dw about it
it wll all be dealt with by the recipe's no need to worry
alr
Get with the future old man
all these cool things I still haven't figured out yet
No several amounts for ingredients wont be respected.
Minecraft doesnt work that way. one recipe = one of each ingredient
honestly if you want it to be harder to craft the item just add an annoying amount of sub recipe's
Octuple compressed cobblestone
Thats how the mods solve it
Or they make their own crafting system
still in ShapelessRecipe var type?
Ayo can something help
It can be either one.
?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!
Anyone know how I'd go about making something happen when I item is thrown onto a block for my example I have it so that when I throw an item onto a gold block it sends a message to the player only problem I'm having is that it's wonky a bit
ShapelessRecipe slr = new ShapelessRecipe(NamespacedKey.minecraft("keyexample"), item);
slr.addIngredient(1, (RecipeChoice) myitemstack);
does that seem right?
or is there any documentation
i could follow
Thats pretty hard to achieve. You actually need to keep track of the dropped item for N ticks and check its trajectory.
I've seen that some people were saying to keep checking if it's velocity was at 0 to replicate it hitting the ground
You can also work the other way around if its a special gold block. Just let it fetch all items in a radius of 0.75 or something every 10 or 15 ticks.
Doesn’t Item have an onGround
How would I go about doing this? Making the block fetch all the items in a radius
To do this properly you would need to build an entire system around Blocks that can trigger actions. Machines so to speak.
You need a block manager that keeps track of all currently loaded blocks. You need to load and unload them with their chunks.
You need one runnable that gets all the custom blocks from your manager and ticks them once every tick.
And this system can be used to quickly pump out machines. You can create item spawner, or blocks that heal nearby players, or blocks that shoot arrows at
zombies, or blocks that harvest crops and puts the crops in a chest. There is no real limit.
And then you have slimefun4
Interesting I'll have to figure this out my main goal was for some type of spawn mob method thing
Or advanced machines. Please dont look it up. I dont want to fix that plugin.
At least you probably don’t store everything in a bunch of yaml files
My idea was a throw a special item onto gold block then some effects n stuff happen and boom mob spawns I'll check out what you were saying though
No im using json stored in the pdc of tile blocks
hey smile
hey
This works but can it be improved? https://hastebin.com/ubonekatam.csharp
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Everything can be improved
First thing i would do:
if(event.getEntity() instanceof Bee beeEnteredHive) {
to
if(!(event.getEntity() instanceof Bee beeEnteredHive)) {
return;
}
fair
Do you know anywhere that goes into more depths for this or will it just have be trial n error mostly
Same here
if (blockAtLocation.getType().equals(Material.BEEHIVE)) {
This is a really advanced topic. You need to understand how to properly manage data and schedule tasks.
The main problem is probably managing the data.
safeguard statements
Works the same as having the ifs but just cleaner to read I guess?
Yes
== for enums
semantics
Btw. I would approach it this way:
When a chunk loads -> get all tile states from that chunk, check if its a beehive and then load the CustomBeeHive into memory.
From then on you dont touch the pdc anymore. You work with your CustomBeeHive object (which contains the List<UUID> and everything else)
Then when the chunk unloads you store the CustomBeeHive in the pdc again.
This is much cleaner and also faster
The only reason I have the pdc is so I can check if the closest hive (the one it must've spawned from) had custom bees at one point
still not able to get it work.. could you send documentation?
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: ExactChoice
Describe what you are trying to achieve
what is shown here
put with custom ingredients
and custom result
but it is able to be done in skript...
if you want to two items to one slot your better off creating a nested recipe anyways
it can be done in java too its just a pain
not that, just want leggings to be craftable if there is an extra diamond here or there
they would be
@lost matrix Currently im using gson to load everything into a list of my CustomHive objects
A recipe will cover that case.
onEnable
Whether it's Shapeless or not.
how would i go about creating that
I still dont understand what you want. Dont try to tinker with multiple amounts for a singe ingredient. Its really really hard to achieve.
And im almost certain that skript cant do that.
Skript is just a hacky script kiddy layer over the java api
ShapedRecipe recipe = new ShapedRecipe(...);
recipe.shape(
" A ",
" A ",
" A ");
recipe.setIngredient('A', new RecipeChoice.ExactChoice(new ItemStack(...)))
Bukkit.registerRecipe(recipe);
alright thank you
recipe.shape("A", "A", "A");
Is def better here. (Spaces removed)
Is that a valid shape though? I thought you needed the extra spaces.
throwing error on Bukkit.registerRecipe
Isn’t it addRecipe
A recipe will not cover multiple amounts per ingredient
That's not what I was referring to.
That's not what I was referring to.
I think he's just talking about having 2 diamonds on a slot instead of 1 and it still works
it is
This is even preferred because using spaces means you can only craft it when the ingredients are in the middle.
Removing the spaces means it can be at any vertical line.
Ah, I did not know that.
Smile, how would you recommend loading them on chunk load? I have them just stored in a json file as a list. I mean.. on chunk load, I could loop through the file again and look for ones with a location inside the loaded chunk but that seems even worse
Database
Ah ok. This information didnt come through properly. Thats why i asked him to specify.
hard for me too took me till shadow said anything to figure it out as well
You know what speedcrafting is right? You can put multiple items on top of one another to create the shape of a recipe that's on top of another existing recipe. Then you can just shift-click the output and get multiple recipe outputs.
Would you recommend sqlite or mysql
the way it explained just didn't make sense likely
I speed craft and still didn't get it
ChunkLoadEvent -> get tile states -> filter out and take only the hives -> get the pdc of the hive -> load the data into your custom hive manager
Ah this is PDC stuff
Yes i got that 👍
Yeah but im loading it all in my onEnable right now.
Yeah chunk has a getTileEntities
If I load from my json, it loads them all
not just the ones in the chunk
If I switched to a database I could do the chunk thing
No need to load hives which are not even loaded on the server
Did you miss the part where i suggested a pdc?
im not moving everything to pdc id rather kms
I already tried that once and it was a huge headache
so I switched it back to what i got now
You can do the chunk thing with files, a database or pdcs
I mean, how would I load this on chunk load realistically? https://hastebin.com/keradociho.json
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
It's a list.
I'd have to get the list and iterate over the list from the config every chunk load
For files you can just have a folder per world and name the files after their block position.
📁 CustomBees
- 📁 Worlds
- 📁 world
- 213#90#-1455.json
- 133#92#900.json
- 📁 nether
I mean realistically though... that would try to load a file every time a chunk loads and if you do like /speed 10 and fly, you could be accessing the file multiple times a second
I thought that was bad?
I mean
Then chunk load -> get the hives -> get their location -> check if file exists and load it
Where do you think chunks themself get loaded from
Do it async
am i able to check if an entity exists in the world with the specified uuid by using Bukkit.getEntity(UUID) != null
public void mineSpawner(BlockBreakEvent e){
if(e.getPlayer() instanceof Player){
if(!e.getBlock().getType().equals(Material.SPAWNER))
return;
if(e.getPlayer()
.getInventory()
.getItemInMainHand()
.getItemMeta()
.getLore()
.contains(ChatColor.GOLD + "Spawner Touch"))
e.setDropItems(true);
}
}
Intent: Make a spawners drop with specific pickaxe
Problem: It still doesnt drop
This checks if an entity with this id is currently loaded
think ik what you mean... chunk load, loop through tile entities in the chunk
check their type..
I mean, that just checks to see if the entity exists. If you wanted to compare UUID's you'd use if (Bukkit.getEntity(entity).getUniqueId.equals("UUID HERE"))
i am trying to see if that uuid is a valid entity uuid within the loaded entities
Dont use names, lores or metas for custom items. Tag the ItemStack by uing the pdc of the ItemMeta.
?pdc
if not, return
trollo
Sorry to cut in but When some one runs the command below it always returns /clearrtp in the minecraft chat
if (command.getName().equalsIgnoreCase("clearrtp")) {
boolean isPlayerCommand = false;
if (!(sender.hasPermission("wildTP.clearrtp"))) {
sender.sendMessage(ChatColor.RED + "Insufficient permissions");
return true;
}
if (args.length != 1) {
sender.sendMessage("Invalid args length, 1 needed, " + args.length + " we're given");
return true;
}
Player chosenPlayer = Bukkit.getServer().getPlayer(args[0]);
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (player == chosenPlayer) {
isPlayerCommand = true;
break;
}
}
if (!isPlayerCommand) {
sender.sendMessage(ChatColor.RED + "Args 1 is not a player!");
return true;
}
playerCooldown.put(chosenPlayer.getUniqueId().toString(), 0L);
sender.sendMessage(ChatColor.GREEN + chosenPlayer.toString() + " has had they're cooldown set to 0!");
}
Debug it. Add messages. And please send the whole code next time.
Oh ok
Something like this, smile?
@EventHandler
public void chunkLoad(ChunkLoadEvent event) {
Chunk chunk = event.getChunk();
BlockState[] tileEntityList = chunk.getTileEntities();
for(BlockState tileEntity : tileEntityList) {
if(!(tileEntity instanceof Beehive)) continue;
//Check file for hive at location
}
}
Yeah
Returning false will send the command usage
Wait, I am dumb. Didn't read what that method did or what it's parameters were.
Yes, your method of checking is valid.
regardless of using pdc or metas, it still wouldnt change the issue no?
I think you are just missing a return true after the last sendMessage
But cant tell with only half the code
Yes it would greatly change the issue. It makes all the difference.
PDC > Any other identifier you could use
So how would I save to the file as a list of custom objects, but only load one at a time?
I mean..
efficiently
List<CustomHive> hives = gson.fromJson(reader, new TypeToken<List<CustomHive>>() {}.getType());
for(CustomHive hive : hives) {
cadiaBees.hiveManager.addHive(hive);
cadiaBees.hiveHoloManager.setupHiveHolos(hive);
ParticleUtil.createHelix(hive.getHiveLocation().clone().add(0.5, 0, 0.5), 1, hive);
}
One object per file
I could just modify this to not actually add them to the list 🤷
oh right
you said that.
To be honest. It wouldnt bee too bad if you loaded all the data into memory when the server starts.
Whats 50mb more or less anyways? (Unless this is a public plugin and you want to please the aternos kids)
It's not public rn
aternos :{
2 years back i was on a server where we decided to simply reserve 8 gb for caches.
We had the whole 2k playerbase loaded at all times and didnt even use 200mb
Yeahhh data doesnt really take that much in memory.
No comment on that statement...
google chrome moment
I like to be running my server log on and then get an out of memory error
simply get more memory
please don’t load a google data center into memory
I assure you do not have enough to complete that operation
I have a mission now
im assuming that namespace keys should be the same instance between all use cases? Or does it simply need a namespace key of similar name and type?
10TB nvme swap space. Technically memory XD
how much data does google store and are there any motherboards that support that level of memory if not would it be possible to wire them together or something
smart move
They dont have to be. But its common practice to just create them once.
I guarantee 10tb of memory is not enough for a google data center
Google stores exabytes.
that’s like one hard drive on one server in a single rack xd
Go and request your data from google. They have 100gb for you alone probably.,
fucked that most of that data is probably really creepy shit too
so unfortunately true lmao
I'll do it
Its quite easy. Takes a while and you need to download a lot of zip files.
I can't download 100gb i get 1mbs
That's only like a day to download.
@EventHandler
public void mineSpawner(BlockBreakEvent e){
if(e.getPlayer() instanceof Player){
if(!e.getBlock().getType().equals(Material.SPAWNER))
return;
if(e.getPlayer()
.getInventory()
.getItemInMainHand()
.getItemMeta()
.getPersistentDataContainer()
.has(new NamespacedKey(plugin, "spawntouch"), PersistentDataType.INTEGER))
e.setDropItems(true);
}
}
well this also doesnt work
much longer because it fluxuates
1mbs if its good otherwise around 500kbs
This method has to be completely reformed. Let me write you an example
if(e.getPlayer() instanceof Player) Bro
confusion
looks like I can request up to 50gb
What
💀
idk if this even can be initiated by a non player ok
there’s a getPlayer that returns an entity
Sometime you gotta double check
HumanEntity
Unless that’s been fixed since 1.8 xd
sometimes its HumanEntity
im pretty sure human entity is also always a player
I think it depends on what event you are listening to.
Player extends HumanEntity, sooo.
no
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
ItemStack tool = event.getPlayer().getInventory().getItemInMainHand();
Block brokenBlock = event.getBlock();
if(brokenBlock.getType() != Material.SPAWNER) {
return;
}
ItemMeta meta = tool.getItemMeta();
if(meta == null) {
return;
}
PersistentDataContainer container = meta.getPersistentDataContainer();
if(container.has(new NamespacedKey(plugin, "spawntouch"), PersistentDataType.INTEGER)) {
event.setDropItems(true);
}
}
Keep in mind that this will not drop the spawner! setDropItems only enables the vanilla behavior.
HumanEntity can be an NPC if you go super advanced
I forgot to register the command :/
since Bukkit.getEntity() cant return null and instead throws an IAE error, i can just try catching for the exception and return if so right?
I'm pretty sure it can return null.
wait maybe my ide was wrong then
well whatever nope still no good
Elaborate
spawner doesnt drop
hmm whatever i did before i mustve mispelled somewhere in what i was doing as it is registering fine now thanks anyway
Go figure, he even said it wouldn't.
You'll have to drop the spawner manually.
Here.
PersistentDataContainer container = meta.getPersistentDataContainer();
if(container.has(new NamespacedKey(plugin, "spawntouch"), PersistentDataType.INTEGER)) {
brokenBlock.getWorld().dropItemNaturally(brokenBlock.getLocation().add(0.5, 0.5, 0.5), new ItemStack(Material.SPAWNER));
}
!! 𝐉𝐮𝐬𝐭 𝐛𝐞 𝐚𝐰𝐚𝐫𝐞 𝐭𝐡𝐚𝐭 𝐭𝐡𝐢𝐬 𝐰𝐢𝐥𝐥 𝐚𝐥𝐰𝐚𝐲𝐬 𝐝𝐫𝐨𝐩 𝐚 𝐩𝐢𝐠 𝐬𝐩𝐚𝐰𝐧𝐞𝐫 !!
Bottom text not noticeable enough.
already wrote that part, just wondering how to set it to a similar spawner
BlockStateMeta iirc
█████╗ ██╗ ██╗ ██╗ █████╗ ██╗ ██╗███████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██║ ██║ ██║██╔══██╗╚██╗ ██╔╝██╔════╝ ██╔══██╗██╔══██╗██╔═══██╗██╔══██╗██╔════╝
███████║██║ ██║ █╗ ██║███████║ ╚████╔╝ ███████╗ ██║ ██║██████╔╝██║ ██║██████╔╝███████╗
██╔══██║██║ ██║███╗██║██╔══██║ ╚██╔╝ ╚════██║ ██║ ██║██╔══██╗██║ ██║██╔═══╝ ╚════██║
██║ ██║███████╗╚███╔███╔╝██║ ██║ ██║ ███████║ ██████╔╝██║ ██║╚██████╔╝██║ ███████║
╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝
██████╗ ██╗ ██████╗ ███████╗██████╗ █████╗ ██╗ ██╗███╗ ██╗███████╗██████╗
██╔══██╗██║██╔════╝ ██╔════╝██╔══██╗██╔══██╗██║ ██║████╗ ██║██╔════╝██╔══██╗
██████╔╝██║██║ ███╗ ███████╗██████╔╝███████║██║ █╗ ██║██╔██╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║██║ ██║ ╚════██║██╔═══╝ ██╔══██║██║███╗██║██║╚██╗██║██╔══╝ ██╔══██╗
██║ ██║╚██████╔╝ ███████║██║ ██║ ██║╚███╔███╔╝██║ ╚████║███████╗██║ ██║
╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
Thank you!
Would it be possible to have a block get the breaking animation?
Coll solved this. BlockStateMeta of your ItemStack -> get the BlockState -> cast to CreatureSpawner
Dont forget to set all the data back on its place because you are dealing with copies.
Yes
There’s even an api method for it in new versions
Oh really? what's the method
Dont forget to set all the data back on its place because you are dealing with copies.
Don't worry ive only made this mistake 4 times and asked here why it wasn't working
does anzone know how to fix this
Player#sendBlockDamage
Update your server version. ¯_(ツ)_/¯
to 1.19.1? nty
show pom xml
- Listen to your IDE
- You are using a different version for your server and for programming
How old is your code?
Your api version almost certainly doesn’t match your server
How do you compile?
So you are building artifacts?
uhh im guessing
Let me guess. You manually added a spigot jar to your project.
But you would need a player wouldn't you?
used the minecraft "plugin" or whatever it's called
in intellij
Nah im going to sleep... bye guys
Is it possible without a player?
No, you need a player to show the damage to
soo how would I fix that? afaik 1.19-RO.1-SNAPSHOT is the latest org.spigotmc.spigot version
and my server's running on 1.19
ah alr
how can i create a new world with the api that is void, completely empty
Bukkit.createWorld afaik
ye but how to make it superflat and the only block is air
Hey in really really new to this and i just wanted to setup a simple private server with dynmap
When i try to join my own server this error code happens
is there some kind of gamerule where spawners placed by survival players are always pig spawners?
no, not gamerule
is there a way to prevent an item dropping into the end dimension? i know how to prevent it using PlayerTeleportEvent, but that doesnt work for entities/items
oh, is it just a general rule of minecraft that survival players placing spawners will always be pig spawners, and we have to override this manually?
not sure, that shouldnt be happening
i guess i'll just manually set the spawner entity type upon placing
i guess so
bumpp
EntityPortalEvent
alr thanks
I have a while loop that runs and it stops the server for 7 seconds, How can I use another thread in bukkit?
^
?scheduling
getDisplayName can return anything. It doesn't guarantee to be the same value
Therefor it's not constant
Strings can be changed
alright so im trying to prevent an action if a player's non-armor/offhand inventory slots are full while in viewing a shop inventory
Inventory#getFirstEmpty
oh im dumb, this returns -1 when full, thanks
Is it possible to do this synchronically
*Not async
new BukkitRunnable() {
@Override
public void run() {
boolean worldLoading = true;
while (worldLoading) {
if (finalLocation.getChunk().isLoaded()) {
((Player) sender).teleport(finalLocation);
sender.sendMessage(ChatColor.GREEN + postTpMessage);
((Player) sender).addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 10, 5, false, false, true));
worldLoading = false;
}
}
}
}.runTask(myPluginInstance);
This doesn't end well
How could I mirror an inventory? (so slot 0 to 8, slot 1 to 7, and vice versa)
Uhm.. basic math?
you loop 0 to 8 and subtract that number from 8 to get the mirror slot
for each row
yeah I know the mirroring of a row
There is no method Inventory.mirror() that’s ridiculous
my deadass brain wasn't able to figure out the multi row
Hi I am working on a /nick command for my 1.19 spigot server. I want that when you type /nick the players skin get changed with the PlayerTextures.setskin, but the method wants a textures.minecraft.net link where do i get those links? or is there an alternative changing a players skin?
lol I just finished writing a skin/naming plugin and now it gets added to the API 🙂
What exactly gets added?
the whole PlayerTextures
Like Paper already has?
No clue, I don;t use Paper
I was just finishing up a multi module plugin for skins
but how to i get the link needed?
mineskins usually
when i use a link like that it says it only supports texture.minceaft.net links
Just get it from there with player url
yes, mineskins will give you a minecraft texture
UUID *
how can I cancel the inventory close event from being fired when I open an inventory for a player who already has an inventory open?
Why?
If i call an event within an event will it execute all listeners before the subsequent listeners for the initial event are fired?
Chill Chad, was a simple question, didnt Tell anybody uSe PaPeR, hOw DaRe YoU tO UsE sPiGot
does EnchantItemEvent include anvil enchants? if not, what does?
Not sure this is possible
Why would you cancel it though?
just code it in a way where you arent opening an inventory for someone who has it open in the first place
much simpler than cancelling the close event
could you send me the url from the site
thx
each skin has a minecraft link
eg http://textures.minecraft.net/texture/3c19d78f366e2e83feec4b20e8c5f1287df8b3880c56523bc739a615760f6666
yeah ok then the problem is solved
say I wanted to prevent a player from enchanting/anvil-ing a specific item, i can see how to intercept the enchantitemevent, but not the anvil craft event
Does anyone know how I can update the position of a vehicle driven by a player using packets?
PrepareItemAnvilEvent
This is my code
currently I can move slowly in the boat
and after maybe 10s of moving, I will be warped back along with the boat to the correct position
That suggests to me that there is a way for the server to update the position of the boat to the client
Because if the player opens a new inventory it calls the inventory closed event if they have an inventory already open, the means that opens the previous inventory and they cant go anywhere
Any ideas? Also maybe setting the movement of the boat to counteract the movement thee player is creating?
I don't know for your answer but here you are only using client bound packets
So it's just visual on their client but not happening in server
(I think)
Isn't there a serverbound packet as well for that ?
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
Inventory inventory = event.getInventory();
InventoryManager inventoryManager = InventoryUtil.getInventoryManager();
if (!inventoryManager.isGUI(inventory)) {
return;
}
InventoryGUI gui = inventoryManager.getInventoryGUI(inventory);
if (gui == null) {
return;
}
Player player = (Player) event.getPlayer();
if (gui.getOpenOnClose()!=null) {
new BukkitRunnable() {
@Override
public void run() {
player.openInventory(gui.getOpenOnClose().getInventory());
}
}.runTaskLater(NeoUtils.getInstance(), 1L);
}
}```
Im trying to find the row, i cannot switch to BLOB from longtext Data too long for column 'item' at row 526, anyone?
The server already thinks that the boat is not moving
things are functioning correctly on the server side
that's why the boat eventually gets warped back to the correct position
or if I dismount it gets warped back
I'm just trying to sync the client back up
don't server bound packets update the server?
They should I think ?
so why would I want to update the server if the server is already correct?
But here you are sending client bound packets so only visual on player client but not sync with serv
Currently the client has wrong information, server has correct information
?paste
so I need to send packets to the client to tell it to move the boat back to the correct position
Oh
Or at least that's my understanding
So when the player opens an inventory and they already have one open it opens the inventory set to open on close https://paste.md-5.net/puqolujuza.java
By sending a ClientBoundBlablaPacket you aware that you are sending information to the player that is not present in the server
how so?
im trying to, but I dont particularly understand how this is achieved
Basically ClientBound packets are bound to the players Minecraft client. A packet is just a bunch of information. So you are basically telling the player, I would like your client to update the placement of the boat, but the server itself hasn't changed the state of the placement of the boat
The data that is stored on the server doesn't get affected by the ClientBound packets you send to players
For example, if you send a ClientBound paxket to player A but not player B, player A will see different stuff than player B on their client
Although player B is the one synced with actual state of the server
import net.minecraft.network.protocol.game.ServerboundMoveVehiclePacket; maybe? (idk) (so server thinks that its the correct placement as well as client)
@Override
public void action(InventoryClickEvent event) {
if (inventoryGUI != null) {
Player player = (Player) event.getWhoClicked();
player.getOpenInventory().getTopInventory().setContents(inventoryGUI.getInventory().getContents());
return;
}
throw new IllegalArgumentException("Inventory GUI does not exist.");
}```
Is doing this okay?
The current situation: Server has the correct location of the boat. 1 player has become out of sync, I need to sync the position of the boat on the client back up with the server
server has the correct position
client has become out of sync
so I need a client bound
ah sorry then, i misunderstood
ah, i'm unaware of the technical aspects of vehicles
so am I 😔
how come? (just wondering)
This is the code I'm running
well, not all the packets at once
that's just different stuff I've tried
ahh
for whatever reason, the boat can still be driven by the client
but every 10s it teleports back to the right pos
so the server clearly thinks that the boat hasn't moved
but the client has
if I dismount the boat it warps back to the original position
is it just me or is location.getBlock().setType real messed up?
As to why this desync occurs, I couldn't possibly tell you
but it looks as if there is way to fix it, since it eventually syncs back up again on a dismount, or after enough time
so I'm just looking for the right packets to send
This packet maybe though
the clientbound of what you had sent
what if u spam the packet (like send one new packet every 1 second or even less) cuz i feel like this happens BECAUSE the server does send these packets ur sending but not only, maybe it sends other packets automatically. (or the client does this idk)
Other idea: So have you tried listening to all the packets that arrive with protocollib or whatever, and cancel those that are not sent by you (or modify their information so they match for sure what's on the server) before they are sent to player
I have a feeling it’s just you
Ig I could try something like this
I get the feeling there's something simpler though
but I could try doing something like that if worse comes to worst
good luck i cant really help u more on that cuz i don't really know
ty
might be, but I call this function twice ```java
public void setCageBlocks(Location spawnLocation, Material material) {
// Floor
Location block = spawnLocation.clone();
block.add(0, -1, 0).getBlock().setType(material);
// Wall 1
block = spawnLocation.clone();
block.add(1, 0, 0).getBlock().setType(material);
block = spawnLocation.clone();
block.add(1, 1, 0).getBlock().setType(material);
// Wall 2
block = spawnLocation.clone();
block.add(-1, 0, 0).getBlock().setType(material);
block = spawnLocation.clone();
block.add(-1, 1, 0).getBlock().setType(material);
// Wall 3
block = spawnLocation.clone();
block.add(0, 0, 1).getBlock().setType(material);
block = spawnLocation.clone();
block.add(0, 1, 1).getBlock().setType(material);
// Wall 4
block = spawnLocation.clone();
block.add(0, 0, -1).getBlock().setType(Material.AIR);
block = spawnLocation.clone();
block.add(0, 1, -1).getBlock().setType(Material.AIR);
// Top
block = spawnLocation.clone();
block.add(0, 2, 0).getBlock().setType(Material.AIR);
}
got it working 😄
what is the best way to open an inventory when there is already an inventory open?
I need to avoid the inventory close event from being fired, and make it as seamless as possible.
why would you need to avoid that event
Because I have a open when closed option for inventories
and you can see that will be a problem
sounds like bad design to me
add an if statement in the event
Okay, if you don't know how to help me please don't confuse me
it would help if you show some code
.
my current action is this
@Override
public void action(InventoryClickEvent event) {
if (inventoryGUI != null) {
Player player = (Player) event.getWhoClicked();
player.getOpenInventory().getTopInventory().setContents(inventoryGUI.getInventory().getContents());
return;
}
throw new IllegalArgumentException("Inventory GUI does not exist.");
}```
great job!!!
I'm so happy it worked for you cuz i always wanted to make fucking unicorns in minecraft
so like flying white horses
lmao
Do NOT open nor close inventories in teh InventoryClickEvent
read teh javadoc on the event
?
Then what do you propose I do?
if you have an inventory open already and you want to open another, you open it in a runTask
you will get a close event
you can not avoid that
It's fine if you don't try to move
so how will I do what I am trying to do?
if you do move then it's a little jerky but not too bad
Have a open on close option but don't open if closed due to the player opening a new inventory?
actually it's really good
the camera doesn't move at all
the boat kinda vibrates
but not the player
so it's as good as you're gonna get realistically
niice
solved, the solution was to check if the inventory opened after 1 tick was an InventoryGUI, or apart of the util
if (gui.getOpenOnClose()!=null) {
new BukkitRunnable() {
@Override
public void run() {
//Make sure it wasn't just another inventory being opened.
if (!InventoryUtil.getInventoryManager().isGUI(player.getOpenInventory().getTopInventory())) {
player.openInventory(gui.getOpenOnClose().getInventory());
}
}
}.runTaskLater(NeoUtils.getInstance(), 1L);
}```
does anyone know how to remove only one item from a players inventory, because if I use p.getInventory().remove(RerollToken.token); it removes all of the same item
Hi, I have these lines of code to execute on player death, the problem is theyre not teleporting, I cancel the event then try to tp them to world spawn but they just survive and stay in the same spot where they got "killed"
the first if executes but they just don't tp
Why is broadcastMessage deprecated?
i have no idea
They might be on paper
I think paper deprecates if you’re not components for message-related stuff
Yes but its subject to removal once paper hard forks iirc
am I doing something wrong when it comes to the tp tho?
i feel like it should work
I tried Bukkit.getWorld("world").getSpawnLocation() as well but it did the same thing
nevermind it seemed to work after I did the teleporting before I cancelled the event
Any better ideas on how to check if an entity is within an area?
how would I run this particle command? particle flash ~ ~ ~ 0.1 0.1 0.1 0 1
i tried this:
but .spawnParticle is literally so confusing and I have no idea what to do
look at what your ide is saying
yeah, I am
hover over the linting
there's like 100 different syntaxes for it
Your parameters are in the wrong place
?jd-s
yeha maybe look at the syntax of the vanilla command and try and look what those args mean
i figured
sorry it took me so long to respond
my pc literally just crashed
no BSOD, just a restart
hello! Does anyone know how to edit a plugin with missing imports?
What I normally do is to add the plugin in the build path, recreate the classes that I need and add them back to the original plugin
However, this plugin I'm trying to edit is missing a couple of imports (I have no idea how does it function anyway)
quick quesiton, if i set a value in config.yml, do I have to save() it right after setting?
i believe so
yeah its pretty much just checking the latest player to purchase an item from the shop and saving that
also, for what reasons should i not be using /reload to reset my plugin?
Don’t use it on a production server
i mean config.yml does exist
or wrong config huh
yep i did
huh, so i cant generate defaults by code, it has to be defined in the resources/config.yml?
then what is the purpose of config#addDefault?
Iirc if a value isn’t present that will be used instead
ah, but it wont be written into the config.yml?
tbh that's what i wanted it to do so thats good
who can I get the player that moved the item in InventoryMoveItemEvent
?jd-s
BRO there is not getPlayer or smth else
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/Inventory.html#getHolder() There is by proxy
declaration: package: org.bukkit.inventory, interface: Inventory
.getSource() or .getDestination() and then .getHolder()
Make Sure that it is actually a Player Holding it though
It can be a Plugin-created Class or be null
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/Inventory.html#getViewers() May also work
declaration: package: org.bukkit.inventory, interface: Inventory
There is No catch-all Method however
I was confused why that Event exists (as in I know that there are millions of inventory interact Events)
But yea makes Sense now
any idea why this wouldnt work?
saveConfig
me again, how would I put loot (with random slots) into a chest? /loot insert ~ ~ ~ loot minecraft:chests/end_city_treasure
nvm found it
looks like no work :/
Trying to change the skin but i don't work ist something wrong on it?
if a command is entered with no args, is args null or empty?
just empty
Depends
Scanner for Sysin (or using jline) is usually a Bad idea, for other streams it is a mediocre solution
You are creating a brand new profile
yeah but with the players uuid... i didn't created a profile before
Use the players existing profile
How to get it?
how to add fake players to the server list menu
?jd-s
uh so
i wanna add fake players to the server list menu
so it doesnt say 0/100, but instead maybe 50/100
and in the taablist
it shows random, real minecraft accounts there
the actual players arent online
but it shows them there
how to do that?
cuz you cant divide -1 by 3?
it's modulus 🤔
but this isn't a regular divide...
is % not modulus?
so you're wrong anyways
ah
a
tf are people saying lol
Do I use Math.floorMod() then?
% is not a regular divide
I want -1 modulus 3
Looks like it
so um
i wanna add fake players to the server list menu
so it doesnt say 0/100, but instead maybe 50/100
and in the taablist
it shows random, real minecraft accounts there
the actual players arent online
but it shows them there
how to do that?
no
i wanna add players to tablist
that never ever joined
but the name has to be real
so like if my ign is 2Hex
and i never joined that server
itll still show that im there
Schedule a task in onEnable
Iirc the task executor doesn’t start until all plugins are loaded
o
well you're gonna need to use packets
actually
probably not packets
spawning a fake NPC perhaps?
I know how to add a player to the tablist on client
but I'm not sure about the server
Maybe fake a player log in?
a question how i can make a simple world generator like for a moon world (some git or idk)?
no need
its just vsual
i dont care if the server doesnt have it
i only want the client to see it
and i want so when ur browsing servers
and u see the server
the player count is the same as tablist
yo guys
anyone can gib hint on how to make this animation?
https://www.youtube.com/watch?v=37_R7ahD6A4
z o o o o o o o O O O O O O O O O O P
the part where all mobs get sucked
but arent killed
Hello, I am trying to make a custom anvil crafting with enchantments, like I want to go over the enchantment limit like 2 pickaxes of efficiency 5 make efficiency 6 etc, everything works fine the result is there and is good but I cannot actually anvil theese two items, I cannot get the result out of the anvil
lol i remember when that update wasnt released yet
well you should apply force (velocity) to them, perhaps
ye ik the velocity part
but the blocks part
is da problem
here look
I made a few points
if (entity instanceof LivingEntity && !(entity instanceof ArmorStand))
Because armorstands count as living entities
So if its a living entity and not an armor stand you pull it
Oh also make sure you cannot pull yourself
Btw you need to teleport mobs slowly towards middle, applying velocity is not a good idea
Because friction in minecraft is infinite if the applied vector is 100% horizontal and the mob is on a block i believe
Atleast when applying a vector on a player
So you need to teleport slowly towards the middle
In order to teleport slowly towards the middle you can use vectors from bukkit
Vectors are basically objects which contain 3 integers: x, y, z
What you can do is take the block gyro was used on
Take its location
Convert it to a vector
And then subtract from it transformed location of an entity to a vector
This way you get a vector representing a line from entity towards the middle of gyro formation
Then you can use a normalize function on a vector which makes it so the angle of the vector line stays the same but its length is reduced to 1
Then multiply it by the distance you want the vector to have
And then every 5 ticks or whatever amount you want just teleport the entity by the amount of blocks this vector has```
multiply the vector by Math.max(length, x) where length is the length of the original vector between middle and entity and x is the number you normally want to multiply by
otherwise the entity may skip the middle```
Anyone?
hmm
how to refresh inventory player?
i have using player.updateInventory() but not working
player.updateInventory()
is your item not showing?\
Hello guys, someone know why i have this when i remove an object from my list Task #38 for NefarionEvent v1.0 generated an exception java.util.ConcurrentModificationException: null at java.util.ArrayList.forEach(ArrayList.java:1513) ~[?:?] at fr.snapcoze.plugins.nefarionevent.tasks.TaskCooldown.run(TaskCooldown.java:20) ~[?:?] at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot.jar:git-Spigot-21fe707-741a1bd] at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-21fe707-741a1bd] at java.lang.Thread.run(Thread.java:833) [?:?] ?
saving user in json be like
use an iterator to iterate over your collection while removing elements from it
So i need use an for I ?
could you show your code
what is the latest version of the spigot api is it 1.19.2-R0.1-SNAPSHOT or 1.19.1-R0.1-SNAPSHOT?
maybe you could use an ArrayList::removeIf
public void run() {
if (!plugin.getItemCooldowns().isEmpty()) {
plugin.getLogger().info("isEmpty");
plugin.getItemCooldowns().forEach(itemCooldown -> {
plugin.getLogger().info("itemCooldown");
if (itemCooldown.getTimeCooldown() <= 0) {
plugin.getLogger().info("if");
plugin.getItemCooldowns().remove(itemCooldown);
} else {
plugin.getLogger().info("else");
int i = itemCooldown.getTimeCooldown() - 1;
itemCooldown.setTimeCooldown(i);
}
});
// for (Iterator<ItemCooldown> it = plugin.getItemCooldowns().iterator(); it.hasNext(); ) {
// Iterator<ItemCooldown> itemCooldownIterator = it.next();
// }
}
}```
in this way it seems better to use an iterator
removeIf crying
Working thx
The error disappeared
wondering why it isnt a set either 👀
what ?
Hey How Can I create sub commands?
plain api i guess
if you wanted to make something like /shop open then create a shop command and in the onCommand method of it, check if the args.length == 1 && args[0].equals("open")
oops there FB
?
shop is the command, its not in args
ah i meant "open"
fuck
im using acf for too long
really thought args.length would return the size lmfao
I have never use any framework. Just didn;t see the point
Yes I know this method but for me its so ugly in code and I dont know how to add a tab completer for sub commands
in teh TabCompleter you simply check args.length
it's not any other method
return a List of all acceptable options
oh thanks
my code just ended up being ugly and with so much boilerplate code for just handling a simple command with args
that's the biggest problem
then use some kind of command framework if thats the problem?
it's difficult to read a code with a lot of if or switch cases
Do u know some framework?
then store a Map of String subCommand, Consumer
i ended up doing that
anyways, anyone who uses acf and knows what @Flags is for? i thought it was to tell the framework how to obtain some kind of object, like
void command(Player sender, @Flags("data") UserData data)
commandManager.getCommandContexts().registerContext(UserData.class, context -> {
User user = userMap.get(context.getPlayer().getUniqueId());
return user.getData();
});```
i can't figure out why this error keeps happening https://paste.md-5.net/yuxozovocu.log (https://paste.md-5.net/kayocefopo.java code)
immutable list ig
the descrription
oh
so would i just do List.of() or smth like that
nvm im stupid
just new ArrayList<>(); and add it
i'd just use Arrays.asList for the description and the rarity
hoping bukkit doesnt expect an mutable list as lore
anyone know how im getting "Index 29696 out of bounds for length 172" in maven? (its after adding the shade plugin, the dependencies weren't being found) https://paste.md-5.net/semogurina.xml
hmm hate it when my old code starts to put a knife in my back
aah gson moment
oh lol
no i wont make it mutable
how did you check if command sender is console
anyways, how does an index out of bounds error happen in maven
i noticed that these poms are still missing for whatever reason
my pom is very broken
!(sender instanceof Player)
sender instanceof ConsoleCommandSender
heres full log https://paste.md-5.net/opizocujek.log
3.3.0 if im correct with maven-shade-pluginhttps://mvnrepository.com/artifact/org.apache.maven.plugins/maven-shade-plugin
:o
omfg i hate this why does it exist i have to restart my ide every time to get rid of the caches like it works without the jar so i genuinely do not care Failure to find net.dv8tion:JDA:jar:4.3.0_293 in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of spigot-repo has elapsed or updates are forced
lol
like why tf did they have to add that
now i have to wait like 10 seconds for my ide to restart
and also why tf is it looking for jda in spigot-repo
idk, they never provided any repo
it should be automatically added from essentialsx but it doesnt for whatever reason
bc it cant find the pom
JDA doesn't have a repo ?
I have doubts
Unless they are in maven central
they are
at least thats what the gradle import says
Hi i have open a thread if someone want to give his opinion #1005279404873756776
ig
how to make client side entity invincible
so what am i supposed to do
it also happens with bstats
another thing used by essentialsx
that didnt actually work
it has?
