#help-development
1 messages Β· Page 714 of 1
What's the best method to import and remove a disposable 50x50 map into a void world?
Hey! I have been trying to find a good way to "push" someone away when they are in a region they shouldn't be while in combat. The easiest one was:
player.setVelocity(player.getLocation().getDirection().multiply(-1).add(new Vector(0.0, 0.5, 0.0))) but obviously this means that if you face backwards, you actually just get thrown further into the region you shouldn't be in.
I also tried player.setVelocity(player.getVelocity().multiply(-1).add(new Vector(0.0, 1.0, 0.0))) because I figured if I just multiply their velocity by -1 it would also invert them but handle the pushing backward problem. However, it ended up just throwing them straight up even if they are walking forward. Could anyone help me out?
Do I just paste it, discard it after usage, or do I load multiple maps at once and then discard it on stop. Or should I use something like asyncslime?
change it without physics and light
light is optional tho, i assume you want it to have shadows inside
substract the other player from the current player location and then do to vector and normalize
there
π
or the other way around
i always forget the order
I'm sorry I don't understand the "other player". I'm just checking if they are inside of a cuboid region and if they are, I run that. I don't understand how to apply your response to that.
I'm making a quick duels system, but I am trying to figure out the most efficient way to import a map from a schematic.
So what im asking is what the sequence would look like
To minimize lag
probably you need nms for this
what
if you want to optimize it further
or
separate it in chunks
i mean
slices
and paste each one on some interval
Optionally just have a preset amount of duel arenas so you aren't pasting on demand π
so like on startup, I paste per say 50 maps slowly and mark down the locations
yes
alright thanks, appreciate it
or use slimeworld
i don't think it removes the lagg completely
but it should help a lot
https://github.com/InfernalSuite/AdvancedSlimePaper/
I'm taking a look at this, but it seems like this is only used to store worlds more optimized than the normal
isnt that for 1.8?
let me check
1.8-1.14
https://github.com/Paul19988/Advanced-Slime-World-Manager
Alright this should do, thank you,
I'm trying to create potions, but the code i find online only gives me a type, boolean, boolean method. how do i make a potion with custom strength, duration, and block it from being able to be chucked into a brewing stand?
type has in the constructor what you're looking for
actually this is how you're making a potion
and how do i put that into a itemstack
Dont set the base potion data. Add custom effects and change the potions color.
PotionMeta#addCustomEffect(PotionEffect, boolean)
is that boolean alwasy true?
I'll just assume it is
up to you
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta meta = (PotionMeta) potion.getItemMeta();
PotionEffectType type = PotionEffectType.REGENERATION;
int duration = 100 * 20;
int amp = 1;
PotionEffect effect = new PotionEffect(type, duration, amp);
meta.addCustomEffect(effect, true);
meta.setColor(Color.FUCHSIA);
potion.setItemMeta(meta);
No idea
wait tf
whats the material of a filled water bottle
'Bottle' only gives glass, honey and xp
Isnt that just a potion?
i... maybe?
if thats the case how do i check if it doesnt have any effects tho
setIngredient only takes material
oh it has a materialData option
goddammit
setIngredient?
For a shaped recipe?
Yeah use RecipeChoice.ExactChoice for nbt sensitive ingredients
Custom Predicate<ItemStack> support when?
that doesnt have a set method tho
oh
its in the constructor options
havent seen a varargs constructor yet
how to change time of action bar using spigot().send type.actionbar
You mean the time it gets displayed?
@kindred sentinel
how do i get the recipechoice for an ominious banner? And does the data in a recipechoice have to be exact?
its just a white banner but if i just say 'white banner with nbt hidden' that might not count if it's exact
Material -> nbt doesnt matter
ExactChoice -> nbt must be exactly identical
The timings of an action bar aren't changeable
They're fixed
Nope, thats why i would like custom predicates for years.
But its not possible because it can lead to memory leaks if not done carefully and the average spigot
dev eats crayons while coding.
ah tru
java.lang.IllegalArgumentException: Must have at least one choice
fucks that kinda error
its not giving me a caused by
You didnt add a choice to your recipe (put the crayon aside
)
now its Caused by: java.lang.ClassNotFoundException:
π
Caused by: java.lang.ClassNotFoundException: io.github.moterius.GreekGodsPlugin.Player.Eldritch.PatronHandler
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]```
dafuq
wdym spigot crashed
I sure hope you dont use the /reload command
it didnt cause issues before
like the class is still there and it stops all functionality on onDisable
so why would it have issues with this
Did you completely ignore the warning?
Just never use reloads. It is bound to cause issues.
Recipies are known for having issues on reload. Along with a myriad of other things if not handled properly.
It's why /reload isn't advised
but why exists, if it isnt advised?
no this happens even with the recipes disabled
Legacy code. It was in the Bukkit project.
and as i said i get rid of em in ondisable
But doesnt spigot work over / wrap Bukkit? So you could just edit the bukkit code and take out
I mean yea, that could be done, but I doubt it would ever be approved.
wait wtf
this is pointing to my onDisable
the plugin classes are unloaded BEFORE onDisable?!
WHY
does anyone happen to know if Material#isEdible() returns true for potions as well? lol
i would think yes, but then why is it isEdible and not isConsumable
alright i really want to know this now cuz this is nonsensical
isnt the onDisable meant SPECIFICALLY to handle things that need to be serialized stored etc
so why would the classes already be removed from the class loader
did you do /reload
why do i get that error that tells me 'class doesnt exist' when the plugin it belongs to is being diabeld
The classes are not unloaded before every single plugin is disabled
certainly seems like that
Does this occur on normal shutdowns?
i bet my ass the only reason it isnt erring out on stop is because that kicks the players and then disables plugins
Or did you reload?
I would bet this originates from
- A broken compile
- You forgot to shade something
- You used /reload
I am having a very strange issue, and I have a feeling I understand why it's happening but have absolutely no idea how I can fix it.
Pretty much, I'm making a plugin which randomises block drops, so I need to replace drops in both the BlockBreakEvent and the BlockDestroyEvent. So I have this code```java
List<Item> dropItems(Block block) {
final List<ItemStack> newDroppedItems = game.getNewDropsFor(block.getType());
if (block instanceof InventoryHolder inventoryHolder) addFromInventory(newDroppedItems, inventoryHolder);
return newDroppedItems.stream().map(
itemStack -> block.getWorld().dropItemNaturally(block.getLocation(), itemStack)
).toList();
}
public void onBlockBreak(BlockBreakEvent event) {
// Bunch of checks if an item should actually be dropped/replaced
event.setDropItems(false);
new BlockDropItemEvent(
event.getBlock(), event.getBlock().getState(), event.getPlayer(), dropItems(event.getBlock())
).callEvent();
}
public void onBlockDestroy(BlockDestroyEvent event) {
// Bunch of checks if an item should actually be dropped/replaced
event.setWillDrop(false);
dropItems(event.getBlock());
}```And it works if I break or destroy a single block, but if both happen at the same time when cancelling the BlockBreakEvent prevents me from being able to drop items in the BlockDestroyEvent. For example, if I break a dirt block with a torch attached to it, the dirt block's drops are successfully randomised and the torch block causes dropItems to be called (including dropItemNaturally) but the torch doesn't actually drop anything. I'm guessing this is because the BlockBreakEvent has already created the item drops, so after cancelling them it destroys all the items which were queued to be dropped, even if not specifically from BlockBreakEvent.getBlock() (BlockBreakEvent.getItems() includes the items dropped by attached blocks, such as the torch, so this kinda makes sense).
The only thing I can think of doing is just waiting a tick before actually dropping the items, but I feel like there must be a better solution
Why are you manually calling the drop event
I'm monitoring the BlockBreakEvent, because I don't want to "replace" the drops if another plugin has cancelled the event or something, but I want other plugins to be able to handle the BlockDropItemEvent with the replaced items. That isn't the source of the issue, though, because I've tried removing that line and the torch still doesn't drop anything (of course, neither does the dirt, but that's to be expected). It's the event.setDropItems(false); that causes the issue
hey @lost matrix i didnt change any (relevant) code. It's not erring out now wtf
you annoyingly cant actually add drops to a BlockDropItemEvent in spigot for some reason
on paper and its forks you can
so you gotta manually call it basically
to still make it play nice with other plugins
I don't think it does as it's not one of the materials listed.
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Material.java#5584
The PlayerItemConsumeEvent will let you check if the item is a potion though.
That's cause there's another event you have to check against.
damn that's kinda silly, i guess ill need to keep track of such drinkable items manually then because i need that information in attack events instead of consumption events
which is?
Do you want a paper or a spigot solution?
Because you are using quite a bit of paper code here.
Oh, sorry, I didn't realise any of that was Paper, I tried to remove the Paper stuff lol. Well, I'm using the Paper API, so if the Paper API has a better solution I'd be happy to know it π I just thought it was a Spigot issue
Oh wait, you were already talking about the event. :p
I thought you were talking about the BlockBreakEvent
oh for gods sake
I thought i was smart and could just use ConfigurationSerializable and deserialize it back into ItemMeta.
NOPE! Why in the world would a serialization interface have a deserialization method
I'm so done bruh
i would just have liked to edit the drops from BlockDropItemEvents directly
β
There is BlockDropItemEvent#getItems().
I'm not sure why it says that adding items to the list is illegal as it is a mutable list.
the weird thing is, its not illegal on paper and its forks
its just spigot that disallows this
or maybe it's on bukkit's end idk
Have you confirmed that behavior? I would assume that it would work since the list is mutable. Even if there is a warning not to.
Idea:
player.getInventory().getItemInMainHand().getItemMeta().serialize().toString()
Reality:
package org.bukkit.configuration.serialization;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
public interface ConfigurationSerializable {
@NotNull
Map<String, Object> serialize();
}
That's the whole interface according to Fern
i have yes
Same here, I had the same issue
i even have a spigot post on it and md5 commented on it saying it should be possible, and it wasn't
so it seems even he isn't aware of why its like this lol
(in fact, for me it doesn't work on Paper either so)
really? i tried before on paper which worked fine
You should never have to call the serialize method yourself.
Do you just want to write this to a yml file?
no, i just want to be able to use ominous banners in crafting
at this point im considering just serializing an inventory to get to that item
oh actually doesnt the ItemStack serializer have a deserialize method?
yea it has
This is what I'm having to do at the moment, but I'm having to rewrite it using BlockBreakEvent and BlockDestroy event because I need to be able to differentiate between which blocks caused which items to drop in order to fix quite a few issues. Also because the BlockDropItemEvent only gets called for block drops caused directly by a player, so not for example explosions https://github.com/HopperElec/RandomEventsPlugin/blob/master/src/main/java/uk/co/hopperelec/mc/randomevents/RandomEventsPlugin.java#L217-L249
ItemStack someItem = ...;
FileConfiguration config = ...;
config.set("some_cool_item", someItem);
// Later on
FileConfiguration config = ...;
ItemStack deserializedItem = config.getItemStack("some_cool_item");
You can do that with a List of ItemStacks as well.
No need to call serialize or deserialize yourself
well yea, but it doesnt change right? shouldnt i hardcode it?
Sure, you can just create banners through code.
I dont understand why you would serialize it if you want to hardcode it tho.
im having that issue too π the way im dealing with that right now is to simply make BlockDestroyEvents not drop their items and to use Block#getDrops() instead and just manually drop those
could call a custom event in such a case too
my idea is to deserialize the string serialization spits out, but i've not yet figured out how to get a map<string, object> from that
Yep, but the random drops are based on which block dropped them, and if I did that then both drops would just be replaced with event.getBlock() which would be the dirt

ah
i found how i originally stored itemstacks
ByteArrayOutputStream bos = new ByteArrayOutputStream();
BukkitObjectOutputStream oos = new BukkitObjectOutputStream(bos);
oos.writeInt(stack.length);
oos.writeObject(itemStack);
oos.close();
return bos.toByteArray();```
this is argruably even worse

that is literally just the exact same
the Bukkit OOS literally just does the same
yea but i can reverse this one
how so? using the method you have knowledge on which block was broken and have control over which items drop. the only thing you don't know of is the player responsible for it, if any
If I break a dirt block with a torch on it, the BlockBreakEvent and BlockDropItemEvent is only called once and event.getBlock() is just the dirt but event.getItems() has both the dirt and the torch
BlockDropItemEvent#getPlayer()?
Is that a Paper thing?
ah nope you're right
paper only
spigot has individual events per block destruction reason
goddammit
java.lang.RuntimeException: java.io.StreamCorruptedException: invalid stream header: 5B2D3834
what does that even mean
its not the [] at the start / end
Are you trying to read a text file via an object stream?
kinda
i must've screwed up the conversion from byte[] to string
cuz it worked on another project
does the byte thing not like spaces?
Post all your code please
Don't know why I hadn't actually tried this yet, but I've confirmed that java getServer().getScheduler().scheduleSyncDelayedTask(this, () -> dropItems(event.getBlock()));fixes the issue, so it is definitely just that the dropped items are removed after the event call. However, this still seems like a janky solution (and if I understand correctly, not specifying a delay still results in a tick delay, which is kinda annoying) so if there's a better way do let me know
I am having the most unhinged chat right now
Serialization is basically the toStack in reverse
//function works when passed the byte array from serialization
itemStack[] byteToStack(byte[] data) throws IOException, ClassNotFoundException {
ByteArrayInputStream bis = new ByteArrayInputStream(data);
BukkitObjectInputStream ois = new BukkitObjectInputStream(bis);
int length = ois.readInt();
ItemStack[] stack = new ItemStack[length];
for (int i = 0; i < length; i++) {stack[i] = (ItemStack) ois.readObject();}
ois.close();
return stack;
}
//Numbers string somehow faulty, error here
ItemStack omenBanner = byteToStack("-84,-19,0...".getBytes(StandardCharsets.UTF_8))[0];```
some dude downloaded a map I made and have been distributing for free for years, changed the name and reuploaded it in like 7 different websites for sale, I told him to take it down and that I would keep sending dmca takedowns until he did and now he's mad because I might get him banned
Just serialise to a yamlconfiguration
Also "-84" to bytes is not -84
It's the ASCII of - 8 4
Ive specifically not done that because in a previous project i had to store thousands of items and opted for a sqlite db
ah so the string conversion cant be done with that method then?
so i can copy it from console and paste it here
all i want is the ominous banner item in code lol
yea the base 64 thing did it
i really want to know why that 'class missing exception' only shows up on some reloads tho
?paste
is it against mojang eula for us community to make our account authentication system instead
Likely
I don't think it's specified
at least I don't remember it the last 4 or 5 times I read it
but these things change
could fall into some other less specific subsection though
https://paste.md-5.net/iduhiqenic.bash
I'm not changing anything to do with that class, and I'm removing all instances when onDisable is called. Dumb part is, this error comes from onDisable
WAHHH WHY WONT YOU JUST LET ME STEAL YOUR WORK π π π
some people just got very special minds
just earlier i got someone asking why one of my commands wasnt working and he was knowingly using the wrong syntax because he thought it made more sense
guys
did you know filing dmca strikes when people are illegally selling content content they took from your free download page and renamed is bullying
today I am learning a lot of things
i did know that actually and you're being, dare i say, a doo doo head
oddly enough I don't know if it qualifies as theft, just piracy
I mean, the download was free to start with
you wouldnt steal a car
i mean its not theft its just plagiarism
which might be a type of theft? idk lmao
it's not just plagiarism
All of those things boil down to theft.
personally i believe piracy and theft are different things. both bad, yes, but not the same
if I go to the app store and pick free games and reupload them with a price tag I'm not "plagiarizing"
i dont think things need to have a price tag for it to be considered theft, in this case its theft of intellectual property because they're distributing it as their own
semantics aside tho you're being a doo doo head and definitely a bully (cringe)
wow
I've been thoroughly dunked on for having the gall of getting my content pirated
I've learned my lesson
thank you god bless
actually now that im thinking about it
bullying is kinda fun
so keep doing it
aaanyway, different topic, how do i put a name into ItemMeta without making it go cursive?
add a color code with it
Now now children
add formatting
rly?
yea
or &f
you'd need to do that whole translateAlternateColorCode stuff but yeah
now convert it to the correct character
the color code
Do ChatColor.WHITE + your name
just for the sake of simplicity but there are much better alternatives
chatcolor applies to just about every single last bit of minecraft UI
chatcolor isnt just for chat
for ease of use you can make a utility method that translates all traditional color codes to chat color, it'll be easier to work with
i just do the &f thing with the translate method at the end
just one last hot take, the dude left anyway but turns out my content actually belongs to mojang, which means that actually it's not piracy because now he's reselling something he didn't make and belongs to mojang... somehow
hey , im getting this error "Couldn't parse element predicates:fast_leaf_decay:should_start_raycasting", any idea how to fix it?
Love it when IJ takes too much time to load the language syntax highlighting correctly so it marks everything as incorrect, then once it finally loads, it updates line by line removing all of the errors. .-.
Sounds like their recent language server change
hard drive or ssd
I'm trying to update a chest's inventory during a PlayerInteractEvent and it doesn't seem to update. Already tried forcibly closing player's current inventory (old chest inventory before items were added) and open the new one with the contents, doesn't seem to work. Any thoughts?
Hard drive
SSD unless the data is important
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
mb π
?paste
It helps if you can provide the class this resides in and not just the code excerpt for the chest
it's just a listener
Otherwise we lose some context ie your code could be fine but not the order its done for example lol
this is the InteractListener, nothing else is happening
Ah ok
let me put the whole method
I've verified that the container's inventory contains items after the addItem() method call
I think is due to the old inv overlapping the new, updated one
idk
What is customchest?
Also if you are going to use physical blocks you need to set the holder of the inventory to that block
Uh, just a class with some other data not related to the block in itself
Otherwise you first create a generic inventory and then set its type of inventory you want
Anyways hopefully someone else can help further i am at work now lol
I'm editing directly from the chest's inventory so isn't the holder already the chest?
π€
Depends on your custom chest implementation assuming it works and actually gives you an object that refers to a physical block and not just one in memory
uh, it gives a copy of a chest item that's on memory yes
Well cant set an inventory of a block that doesnt exist
No, but the block is placed. I'm trying to update the inventory when the chest is opened
while already placed on the world
I understand that, but you have this custom chest object you are relying on and you create the object in the event. Since we cant see the code for it as well as what chestregistry is we cant say for certain that object is indeed pointing to the same thing
And it could just be one in memory only which if true is why you are not seeing any changes
CustomChest doesn't not relate in any form to the block. It's just a data class, the influence it could have is the fact that I get the chest's itemstack from there before placement.
I'll drop the class src
relevant classes in there
Hmm i will have to look at it more when i am on my break. Interesting you made it abstract
Implementation sake
ends in that
Using git bash?
This is how I trigger commands in him
They're actually unavoidable
But it also displays these warnings during compilation
does it still continue to run and and give you the spigot-1.17.1.jar
Yes, but I am unable to turn on the server
okay, its not an issue with buildtools then
do you use a .bat to start your server
Yes
right click it and edit it with notepad, then on a new line at the bottm add PAUSE then save it and run it again
Is there any way to set/place a BlockState that was took from a Structure?
Using Bukkit/Spigot API
This is exactly how I do it
My current code just sets the BlockState's Material and BlockData
The issue I am having is related to TileEntities
They get set/placed in world but don't get set/placed with their data. I've figured out that BlockData doesn't hold the information for TileEntities
Good evening guys, I was wondering how to read the space in the config.yml when I want to put more strings for example
message:
- "hello"
- " "
- "welcome"
This is because it simply doesn't read it and doesn't give spaces
getStringList and iterate
Ok thank you π
Do you know of a solution or a link to like a bug issue?
no 
BlockState.update() not actually sure if there's a way to copy to another location, might be
o_o
do you know of an issue that makes it so you can't drag out a anvil's result after modifying it from the event?
how can i fish different fish on my nbt tagged(optifine) special fishing rod or ittemsadder fishing rod in minecraft
PlayerFishEvent or whatever
No idea
thx
how can I get the diamond sword in the add-on I don't know how the lore tag works
items:
sword:
chance: 100 #
item-name: "&a&lMy Custom Sword" #
lore: #
- "&7Made from CustomFishing!"
amount: 1 #
material: DIAMOND_SWORD #
The issue is that these BlockStates use their Location as an offset to know where to paste in the structure
Thereβs no setter, just getter method for BlockStateβs Location
Can someone help me with a vectoring issue? I'm just being stupid and it's alot to explain.
And from what Iβve read you cannot instantiate a BlockState from a constructor alike (like, I canβt dependency inject the locationβ¦)
I don't see any error there
There is setrelative
In yml this is a list. List<String> would be the serialized type and FileConfiguration has a method for that.
Where? I am doing this from
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/Structure.html
declaration: package: org.bukkit.structure, interface: Structure
I already have the Structure (I loaded it from InputStream).
I just simply cannot set it's Palette's blocks...
declaration: package: org.bukkit.block, interface: Structure
That's a Structure block
I'm talking about Structure's, like what the Structure block saves and loads
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/Structure.html
declaration: package: org.bukkit.structure, interface: Structure
What I am attempting to do is pasting the Structure on World myself, splitting the operation through multiple ticks
With my current code it pastes entities without issues. I am only having issues with TileState instances since there's no way to copy/pass the existing TileState
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Just call blockstate.update(true)
when the player presses the jump key, is any packet sent to the server even if they happen to be in mid-air? basically is there a way for the server to know when a player attempts but fails at a jump
i want double jump mechanics but im tired of the requirement to use the toggle flight control to do it
no, there is a reason the flight is used for that
and it is the fact that the server does not know about the player "wanting to jump"
darn
strange question
but how can i check if a block is actually a block
a cube
not stuff like walls and flower pots or brewing stands
public boolean isCube(Block block) {
VoxelShape voxelShape = block.getCollisionShape();
BoundingBox boundingBox = block.getBoundingBox();
return (voxelShape.getBoundingBoxes().size() == 1
&& boundingBox.getWidthX() == 1.0
&& boundingBox.getHeight() == 1.0
&& boundingBox.getWidthZ() == 1.0
);
}
this is my old thread
asking this exact question
loool
im rewriting the same plugin
did that not work?
πΏ
oh no
not a dev question per se but can someone explain why theres multiple common things that don't have one unifying event? Item transmutation through crafting stations, item movement between inventories or between world and an inventory...
what do you mean item transmutation
like a milk bucket turning into a bucket when making a cake?
lmao
Besides commenting is there another way to show a block of code is related? A way to wrap all the methods together?... not talking about adding it to it's own file, I'm trying to make my code look better by getting together like the beginning, middle ending within the class itself
not sure what you mean
in terms of javadocs there is @see and @link
Inside the code itself I'd upload a picture of what I currently have but imgur tells me the link is broken for some reason... I have everything very organized utility classes in a utility package, even the main class in it's own package (I don't know if this is optimize friendly but it looks nice to my eyes)
yea anything involving crafting
theres like 10 events
crafting
?img Or verify
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
i mean usually the answer for not having such a unifying event available is because such conversions are different enough to not really make such an event very useful
brewing is pretty terrible though, i've had to redo that entire system to get custom recipes to work
yeah
yea u know my pain
i think 1.20 added a brewing stand burn event so you can stop it from brewing but aside from that yea nah
yea what if someone inserts a potion later
urgh theres so much nonsense in brewing
and of course the input and output data structures arent the same
think those recipes are hardcoded in minecraft to begin with
theres no recipes even related to it
so the only way to properly make brewing recipes is through modding
otherwise you gotta do hacky shit
why is one an inventory and the other a List
wdym
i havent figured out how they correlate yet
BrewEvent
has the inventory as input and a List<ItemStack> as output
yea
To expand on this to make my code look neater I just had the idea of loading and saving so my persistent data in two different methods and calling those methods when needed. I'm currently loading and saving everything by copy and pasting the same thing over and over again in different classes. This'll help stop the repetitiveness
I solved it thank you very much
I'm a beginner. :D
Hey doing spigot coding for the first time
having some issues with setting up the world variable because it keeps returning a null value. anyone mind telling me if I wrote this right?
private World world;
private BukkitTask task;
@Override
public void onEnable() {
world = Bukkit.getWorld("world");
spawnMobs(9,10,5*20);
}
Do not keep reference to the World like this.
Use UUID instead and get the world from it every time.
(Probably don't forget to check if the world exists or is loaded or whatever)
Make sure you set the plugin to load after (post) world
By default it will load before the world causing it to be null
that might be the issue, how do I change that?
Has two possible values: STARTUP and POSTWORLD
Also I'll look into this, for now im following a a video and coding along to get used to how some things operate.
thank
no default is postworld
df default was startup for me
By default I think they mean if you do not specify "load" at all
Startup might have been default in the mcdev plugin
Yeah thats more likely the case
also the thing you write to spawn in entities is
world.spawnEntity(loc, EntityType.ZOMBIE);
right?
Yes
okay yeah mb it was working was just using the wrong coords
?paste
I'm trying to add hibernate orm into my plugin but I cannot for the life of me get the plugin to turn on due to JAXB or wtv. Does anyone know how I can fix this error? https://paste.md-5.net/icolenobus.cs
I already have the maven depdencies in my pom listed
https://paste.md-5.net/xonanasise.xml - pom.xml
Could be a problem with spigots custom classloader.
Did you look into your compiled jar to make sure those classes where properly shaded?
Yep they're there
ur not meant to use a file config anymore iirc
for hibernate?
guys is networkmanager a private field in 1.19.4?
which class
entityplayer
what verison of hibernate are you using
i cant access it
6.2.7.Final
and i dont know how to get the type of click of a PacketPlayInUseEntity
ServerGamePacketListenerImpl?
Btw why did you include both javax.xml.bind:jaxb-api and jakarta.xml.bind:jakarta.xml.bind-api.
Arent they essentially the same libraries under different groupIds due to Java EE moving to the Jakarta namespace?
thats the only network thing
i dont have time to implement mojomaps
osfucated is b for that
at least 30 minutes
b for what
connection
this is the only network thing i see
yeah its b
yeah yeah that
player connection is b
and in that
onlyt takes 10 minutes to implement mojmaps, including building spigot
Dont use nms if you dont use mojmappings. Thats a horrible idea and you will loose
a lot more time than simply setting up mappings.
in player connection
216 packages
and i need times for rest stuff pls dont ask me to do it
i have 35 minutes max
i need to fix other stuff
It definitely is worth it
?nms
I mean its just running BuildTools and adding a few lines to your pom
um, might sound silly but why are you using nms for this?
Probably for fake entities
fake entities
npc
I guess. I'd just addToWorld and use Spigot events
please dont try to change my entire logic
thats the worst answer
if you want help with fake entities
using teh API is ALWAYS the correct answer
I'm not sure why you're expecting to get an answer considering 3 people have told you better ways to do what you're trying to do
ServerboundInteractPacket has an action field of type ServerboundInteractPacket.Action
i cant do muych with that
they want me to change my entire logic in the small time i have (25 minutes)
Sounds like poor planning, but what you're looking for is exactly what smile just gave you, he just gave it to you in mojmaps because that's what you should be using for NMS.
u guys are bunch of npcs fr
It's not our fault you didn't do your research and time management well π
i used to be an adventurer like you, then i took an arrow to the knee
@small current i don't know what you mean by this
.
Create an implementation of ServerboundInteractPacket.Handler and then call ServerboundInteractPacket.dispatch(Handler) on the packet.
This way you can get hold of the Action and ActionType of this packet.
*Without mappings: Use ProtocolLib or play around with reflections for an hour.
private ClickType getType(PacketPlayInUseEntity.EnumEntityUseAction action) {
switch (action) {
case INTERACT_AT:
return ClickType.RIGHT_CLICK;
case ATTACK:
return ClickType.LEFT_CLICK;
default:
return null;
}
}
it was as simple as this
can we do it without implementing stuff?
I would never read out a bytebuf if i can gain access another way
im not using plib
You dont need reflections to get the ID or Action
is this plib
reflections
without
can you send the code to this?
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.buffer()); packet.write(friendlyByteBuf); int id = friendlyByteBuf.readVarInt(); int action = friendlyByteBuf.readVarInt(); if (action == 2) { friendlyByteBuf.readFloat(); friendlyByteBuf.readFloat(); friendlyByteBuf.readFloat(); } if (action == 1 || action == 2 && friendlyByteBuf.readVarInt() == 0) { Bukkit.getPluginManager().callEvent(new AsyncPacketEntityInteractEvent(player, id, action == 1)); }
it's in my packet sniffer
nvm i thought the id could be read through the handler.
public Entity getTarget(ServerLevel var0) looks like a garbage method which should not exist.
Since when is a packets responsibility to fetch an entity from a serverlevel.
it's for 1.20 but it's the same on 1.19
cant i do it with reflections?
you can
because the only var int i see
is
private final int a;
which is the ID
there is no other int in the packekt
the enum is stored as an int anyway
Use the bytebuf then. Reflections on packets will kill your servers performance if not done correctly
public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {
private final int a;
private final EnumEntityUseAction b;
private final boolean c;
im doing it correctly dont worry
private final EnumEntityUseAction b;
doesnt look like an int to me
it's stored as ordinal()
EnumEntityUseAction is not even an enum
The field is of type Action. Only the buffer has it as an int.
it is named as one
interface EnumEntityUseAction {
b a();
void a(c var1);
void a(PacketDataSerializer var1);
}
it is
π
that doesn't seem right
Well. Then get the Action via reflections and the ActionType by calling a() on it
the type is b
b is the enum
that's the action
there is
b
private static enum b {
a(d::new),
b((var0) -> {
return PacketPlayInUseEntity.d;
}),
c(e::new);
final Function<PacketDataSerializer, EnumEntityUseAction> d;
private b(Function var2) {
this.d = var2;
}
}
well
a is attack
b is interact
looking at the ordinal you used
correct?
a is Interact
b is attack
You just fking wasted 10 more mins by digging through mappings
static final EnumEntityUseAction d = new EnumEntityUseAction() {
public b a() {
return PacketPlayInUseEntity.b.b;
}
public void a(c var0) {
var0.a();
}
public void a(PacketDataSerializer var0) {
}
};
so here, i should get the d ith reflections, then get a() ?
its static
wha
No
it's package private
well thats the only b
means you can't read it like that
Get the b field
that i can get
From this object you call a()
Which gives you the b enum
thx m8
is there any way i can trigger a void that is not static from a command
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
thx
Do you know a site that creates text for you with gradient colors but can be used in the console.
Spigot console doesnt support normal colors iirc so youd need a specific one
ok
But you can do new color using "new Color(255, 255, 255)" for example
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Block clickedBlock = event.getClickedBlock();
if (clickedBlock != null && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Material clickedBlockType = clickedBlock.getType();
if (clickedBlockType == Material.SOIL) {
// Verifique o nΓvel do jogador para determinar a distΓ’ncia mΓ‘xima para plantar trigos
int playerLevel = getPlayerLevel(player);
int maxPlantDistance;
if (playerLevel == 2) {
maxPlantDistance = 4; // Se o jogador estiver no NΓvel 2, aumente a distΓ’ncia mΓ‘xima para 4 blocos
} else {
maxPlantDistance = 2; // Use 2 blocos como distΓ’ncia padrΓ£o (NΓvel 0 ou NΓvel 1)
}
Block targetBlock = findNextFarmlandBlock(player.getTargetBlock((HashSet<Byte>) null, maxPlantDistance));
// Verifique se o bloco de destino estΓ‘ vazio e Γ© um bloco arado (Material.SOIL)
if (targetBlock != null) {
// Defina o bloco de destino como CROPS (trigo)
targetBlock.setType(Material.CROPS);
}
}
}
}
Hello, I once had a problem similar to what I'm having now, when I tried to plant the seed on the nearby plow block, it was breaking where it was planted, how can I do it to plant it and not break it, the last time I had this problem Someone told me to use something like "nextblock" but I don't remember anymore ((spigot 1.8.8)
findNextFarmlandBlock is to search for the block next to the side the player planted and plant a seed
Why do you use getTargetBlock when you already have the block they clicked on from the event
ey
Then no
Which class is this in?
PlayerConnection or mojang ServerGamePacketListenerImpl
If I create a public repository on github for my standalone library without any license meaning that I retain all rights to my source code and no one may reproduce, distribute, or create derivative works from my work. But if I upload the same standalone library with another plugin which uses that library on SpigotMC, will the rights stay the same or will it go under GNU license?
Technically plugins should be GPL since spigot is GPL
At least that's how I intemperate it, idk I'm not a lawyer
But it's not enforced at all and tons of plugins are ARR
If you want to keep your code your own, don;t publish it on GH
and what if someone decompiles my code from Spigot and creates a new plugin out of the code?
do I have the right to report a take down?
you could issue a DMCA IF you can 100% prove it's yoru code
If you can't you open yourself to being sued
what do you mean by 100%?
You'd have to be able to prove its your code without a doubt
interesting
how would they confirm that its copied from my code?
A server was reported to me once, where it looked like they had broken my license. The display of all text was identical.
I contacted them and asked, where they offered to show me theior code, so I asked for specific sections. It wasn;t mine, although teh final output looked identical
and it wasn't my code so that was the end of it. You can;t copyright an idea.
You can patent it though
if its functional, yes
Me omw to patent my skripts
and how is that done?
Money
And legal stuffs
its nto really worth it, in most cases
You dont have anything worth patenting
How dare you, I invented oxygen
Why are people so greedy, just let peeps use your code
Oxygen is useless to us. We are spigot devs, surviving on basement fumes.
Why did you change your namerino?
choco isnt here untill the 17th

chollco is our replacement
lol
I didn't even change it myself
Can anyone tell me that ascii text is the writing LP?
| _ )
I would generally advise against those kind of messages
They just take up log space for no real reason
It's either BigFig or Straight
ok
bigfig
How do I set a list of ingredients to a specific character on a recipe?
Atleast, what's the best way to approach that
Just create a RecipeChoice and use the vararg or List constructor.
Both MaterialChoice and ExactChoice work.
I'll have a look at it, thanks π
Hey guys, let's say I have a method that has to take a object like ThisIsAclass.class and the class has to extend some other class I specify, like for example ExtendMeClass. How would that look? public void myMethod(Class<idkwhattoputhere> clazz){...}?
Viable
public <T extends ExtendMeClass> void myMethod(Class<T> type) {
}
Also ok
public void myMethod(Class<? extends ExtendMeClass> type) {
}
Hmm, ig the T one is better as I wanna have a variable with T type and return the T type variable
Thanks!
It's not
T is not true
U can put whatever u want
you can have any type you want
T is just the prefered char
T just stands for Type
Nah you can also just use VELOCIRAPTOR if you wanted to
alright u do you
wait it can be full words?
Yes
im returning apacheHELICOPTER
public <BUSDRIVER extends ExtendMeClass> void myMethod(Class<BUSDRIVER> type) {
}
This does the same
T is just a convention
T - Type
E - Element (used extensively in the Java Collections Framework)
K - Key (common for maps)
V - Value (also common for maps)
N - Number
Same as K for key and v for value
i saw someone use L and R for a tuple once
and then there's the DFU
left, right
Sounds good to me. But Pair or Tuple are evil and dont belong in java.
Use records instead?
Any type of class will do
isnt there that K, T, Z thing too
YOU DON'T BELONG IN JAVA


3
Quintuple
Bi and Tri Value
So a triplet
I swear you did 4 too
couldve used @builder
i was goinging to
then thought i dont want to make my code that bad
my lombok is perfectly fine
lombok is fine if you know what its doing, using it without knowing what it does is whats bad
u finna right tho
imo needing to use something like that indicates a design issue
yeah
It's more of a skill issue
lets just remove the actual usage for insert key and give it to ides
reminds me of cmarcos toml thing
I always love seeing the @SuppressWarnings("unchecked") on top of a method.
Prepares me to read some nasty stuff.
i just ignore warnings smh why supress them
@SupressWarnings("all") on every class
You guys don't do that?
What in the absolute generic fuckery is that
seems like something you would do
Probably
wow hm that class seems rather generic
its sometimes needed
even jdk code uses that
Lord without suppress unchecked I'd be dead. It's so useful when working with generics
Still wish you could do instanceof but alas type erasure
this vs:
which is cleaner?
is it worth making this a method?
actually without the last line
Isn't there computeIfAbsent?
yes
wait there is
mhm
and with a function
Yes
even shorter if you just use k instead of uuid :p
Jesus christ on a bike.
Someone get to the vatican and ask for a pardon for the whole of the MC plugin dev community.
It does not work as intended. I checked carefully and it seems that said reference of BlockState whenever you do BlockState#getLocation it returns an offset from an origin. That location is not even linked to a world...
Yeah
That is documented
There is currently no way to place a blockstate from a structure aside from placing the entire structure
Guys, when I restart the server via /rl confirm and right click on the items I drop this error, but if I exit and return everything works normally and opens the server selector gui etc.
I'm confused, because everything works fine, but the moment I restart from this, until I log out and log back in from the server
/restart
that changes, excuse my ignorance
reload not good?
So before i go into a rabbit hole, ive been thinking about the Bukkit Scheduler and, as of the moment, it doesnt have a way to be checked during event listeners unless you bodge job.
(E.g: Say you had a scheduled task that teleports a player, there is no out of the box way to tell if a TP's cause was via an execution within a task, or even if the player is involved with the a currently scheduled task) .
Would there be utility (other than my own cases that ive seen, but am concious of tunnel vision) to adding a system to allow for this sort of check
Could make use of a CompletableFuture
How so?
here's an idea: Minecraft's coordinates support a lot of (unnecessary) precision. Encode a custom teleport reason in the less significant digits (10^-10 to 10^-5) of the location the player targets to
would use y cuz u just fall down
how can i create a only console command?
check if the CommandSender is a ConsoleCommandSender
and show an error message if thats not the case
hellooooo! can anyone help me on this? i am trying to dynamically load a world from a directory, but when doing so i apparently create a normal world
File outputFile = new File(Bukkit.getWorldContainer(), "game_world_" + externalWorldDirectory.getName() + "_" + System.currentTimeMillis());
try {
Files.copy(externalWorldDirectory.toPath(), outputFile.toPath());
} catch (IOException e) {
getLogger().severe("Failed to copy map " + mapDirectoryString + "!");
getLogger().severe(e.getMessage());
}
WorldCreator worldCreator = new WorldCreator(outputFile.getName());
World loadedWorld = Bukkit.createWorld(worldCreator);
lol
What is the best way for creating multiple player nametags lines, independent fron each other. Something like:
<other line> <line here>
player head
I had find so far that the only way is by multiple armor stands
I sometimes am sure I can cast, but the compiler isn't, that's why i use it
maybe displayentities
What do you meant by that? Using armor stands?
I have asked to some devs and they told me to use them
im not sure about this one, since i haent looked into it yet, but afaik new minecraft versions have them
basically the same thing but simpler
yeah tha tthe whole issues, shity versioning
Display Entities are the successor to Armor Stands. There is no reason not to use them if they are available to you.
If it's an earlier version - use ClientSide armorstands, setMarker(true) to disable collisions/hitbox.
Just a suggestion
packets right?
so it doesn't affect server performance
yea
Or at-least not as much as a real entity
because each line == 1 armor stand, 2 lines == 2
Mhm
I mean so far armor stands cant have more than 1 text, or im wrongly?
I mean i never really worked in deep with them
Well, entities overall, can only have one displayname, so I'm not sure about having more than "1 text"
Doubt they have support for \n though
so you can simulate many lines with it?
Not with a single armorstand, from my knowledge.
Each line is an additional armorstand
Just make it packet based and you should be fine
yeah what i mean before?
allright thanks sir
Have a nice day
If i need or havbe any doughts i will tell you
I need help related to programming and politics. Can the prepayment for the program be demanded back? I'm just sick and would like to be cured
oh i just understand, you are having legal problems
is there a way to run a command like gm 1 for player that are not in the server like CMI?
I'm an even worse performer
can you elaborate it more?
as a performer
ohh you mena performance and applications
I understand u were having legal problems because i read politics
Iβm making a plugin with an advance payment for a considerable amount, but Iβm sick and maybe I wonβt make it on time or the customer will change his mind and I need to get cured
i mean they cant force you specifically to give it back, but they can request a chargeback through their bank or paypal
yeah, that why is always to make then signed a file
Atleast in my case im none 18, i made the reponsable my fathers. So if i have any legal problems they respond for me
s
Yeah i think is really necessary to have a form when selling
I know i dont have best enlgihsi but i will translate what i mean
do I need a contract? Does it protect completely?
Yes contract protect a lot
Because you clarify everything for both part, you as a dev and client
So then if they broke it, you can take legal actions
but I heard about consumer rights, some conditions cannot be included in the contract
Yeah, well it depends on the counry laws
this isnt legal advice, im not responsible if anything bad happens if you follow it but im pretty sure a legally binding contract will help, if it includes "you get paid xyz for software with xyz features and if its not completed in xyz time all money returned etc etc"
then if they would charge back you could take legal action and sue for the cost and court fee's
what you think ilussion?
Can the time spent be considered an expense?
Write a full contract
for each commission you do
I'd be signing 200+ contracts
It's pain
Yeah, i just write a single contract which is meant for all comissions
If you are doing serious work for a team, and doing part/full-time hours every week for months
Get a contract
If you can
Why wouldnt you?
I've been writing for 2 weeks now
tax evasion
If you ask then a contract and they dont give it, its not the way
For example
I've signed 3-4 contracts in my life
Been working for this dude for the past year and a half and no contracts with him
but we have mutual trust
Contracts cover your ass
They cover both parties
yeah, but when you dont know the people you must sign
if not they will fully open and take approach of you
right, so in conclusion smile?
If you can trust them with your life, do whatever
NDAs and ICAs are two different things
I wouldnt trust life haha
Sometimes they're merged
Itβs too late, Iβve already spent 10% on treatment. Is it possible to give him a program for this amount as insurance?
If you dont have any contract he cant barelly do much
If you're only been working with them for 1-2 weeks
If you don't have a contract they don't have to pay jackshit
i was dont do contract π
So none contract signed?
And when you usually sign contracts
If you're an employee, they can cover depending on where the contract was signed
If you're a contractor, you're on your own
9/10 chance you're on your own
I donβt have many orders for large amounts, very rarely, so not yet
But why would you try to pass on medical fees to someone in this industry is beyond my understanding
okay, could really describe what happen specific
just make more money and pay for it
you have already spent 10% of the pre-payment but dont want to complete the comission now?
I think he means that, but not sure
If that's the case
Refund the 90% and explain how you had to spend some in medical fees
and offer to refund the other 10% later
Hold yourself to the highest standards possible and ask yourself "what would a perfect person do in this scenario?" and follow through
That's how I got as big as I am
u sure its not bc ur a nerd
Can U make me a ploogin
what kind of plugin
πΆ they said I would be nothin' πΆ
πΆ now they only say πΆ
eY aliSon mAke Me Poogin Hypixl 5$
^ Hypixel ploogin would be grate
I was made the plugin over 2 weeks 50 %. Everything was fine until I got sick. I couldnβt write a plugin while I was sick, so I decided to recover and pay for treatment. I didnβt ask my family for money; everyone there got sick. The customer is not set up for a refund, I'm worried just in case
this is why I don't take upfront money anymore
lesson is simple
don't spend upfront money
Depends on what the contract says
give me 150k and a good 2 years
there isnt one
If there's no contract well then that's a lesson
He doesnt signed one if im not wrong
my budget is 32$ and maybe 2 weeks
I think there's enough attempted legal advice here already taps sign
entirety of hypixeel in 2 weekl?
ye
go get urself some new wrists
lol you are a fucking nerd, how the heck you can recreate entire hypixel in 2 weeks
AAAAAAAAAAAAAAAAAAAAAA i am your fan
πͺ
"for 200$ today i will give you legal advice"-md
what
We really miss you!
smh iphone

Doesn't show in discord for me either
I can replicate it in console?
Even though it's on the keyboard
πͺ
you can but it's cringe
Android

Iβm on iOS
you need slashes for that W
π
Sue me
That's USB 2
Thank you EU overlords
I've been trying for an hour but I can't, it doesn't detect Color
That's the outrageous part
getConsoleSender instead of getLogger 90% chance
ο£Ώ
You have to do it with RGB colors if im not wrong
I love how they're advertising usb3 hardware on apple silicon as a selling point
_ \ /
|_) \ /\ /
| ) \/ \/
- ```
it is in Color, in normal java
that fucked up
even a raspberry pi has usb3
There was a pleasant incident when, by the mistake of my youth, I took an order for a large amount (large in our country) and failed. But the money was not taken. βKeep it with you, Iβll goβ - something like that
okay but, is that made by apple
didn't think so
Oh ffs whats the plugin, I have some free time this week
Cant let a guy choose between illness and plugin work