#development
1 messages · Page 21 of 1
just checked the repo
that's the significance of major versions
i mean tbf this is a rule of thumb in general for all kind of development (especially cuz "public" stuff can change between individual snapshots)
but bukkit did ya bad
maven
then put it there
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit:worldedit-bukkit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.2.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
you gotta add repo too obv
there is nothing such as worldedit-bukkit:worldedit-core
if you want core then you need to do
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.2.12</version>
<scope>provided</scope>
</dependency>
you can explore the repo yourself
here exactly
but if you are developing for bukkit
then use the bukkit implementation, not core
It works now, thanks
What may be the reason I don't get the item in the shulker after this code?https://paste.helpch.at/egasigodus.java
I should've used getShapshotInventory
Haven't looked in the code as I'm on phone rn but snapshot can't be modified
getState return a copy, that wont update the original shulker
Anyway I changed getInventory to getSnapshotInventory in the code and it worked
I have a class with the generic <T extends Number> and want to test a predicate Predicate<T> with the absolute of T val. How do I do this the best way? Is it even possible or do I have to change Predicate<T> to Predicate<Double> or something?
you probably need to write your own math method to suit Number
i am not sure if abs works with Number
public class Foo<T extends Number> {
public boolean test(Predicate<T> pred, T val) {
return pred.test(Math.abs(val));
}
}
It does not :/
Guess I'll have to do my own wrapper or smth then
then you need your own method for taking abs of number
with all the subclasses
so.. int double float etc
I mean given that Number is a freely extendible abstract class, you can't possibly consider all implementations
in his implementation, he probably can though
how come?
as in, unless the method is open he knows what types are going in there
I suppose, though a "proper" solution would be to do the abs inside the pred itself given that it is type aware
kinda the same issue though i feel like
how come?
its type aware but its still freely extendable
guess you could just throw an exception
not sure what you mean
new Foo(BigDecimal.TEN, bd -> bd.abs().compareTo(BD.ZERO) > 0)
new Foo(-7L, l -> Math.abs(l) > 100L)
etc
ah, thats what you meant
yeah thats cleaner
actually might yoink for my vector classes 
lmao
could also take a UnaryOperator<T> abs so new Foo(num, Math::abs/BigDecimal::abs/etc, predicate)
that's probably the best approach
yeah
still gotta check how the :: thing works
👀
im guessing its similar to C++ one?
okay, apparently its quite different just a shorthand for lambda one liners?
it's a method reference yeah
point-free code 😌
. pleasing face
or at least a::b.then(c::d)
pleasing
pleasing
yaaaa
((Function<I, O>) a::b).andThen(c::d) nerd
pensive
has it too nice
looks shit

how can i replace a specific word or line in a lore? i've tried iteratiing through it but to no avail
Get the lore, put it in a variable, replace the string, set the lore and meta back to the item
If I use getPlayer with UUID parameter, will it get me the player if he's offline?
getPlayer's return type is a Player. Which can only represent an online player.
if you use getOfflinePlayer then yes.
Yeah
the docs do say that if the player is offlune then getPlayer returns null
Hello
for PlayerInteractEntityEvent bukkit/spigot event, how can i detect if player's hand is empty / no items in his hand?
i know how to check if he is holding with hand he's interacting with a specific item, but not no item
if (player.getInventory().getItemInMainHand().equals(Material.DIAMOND_SWORD))
so how to check if his hand is empty
d; spigot Player#getInventory
@NotNull
PlayerInventory getInventory()```
Get the player's inventory.
The inventory of the player, this also contains the armor slots.
If I had to guess it would probably be Material.AIR since it shouldn't return null
Alternatively, just log what the empty item is
tested, doesn't work
how do you mean this
ok i logged as
Bukkit.getConsoleSender().sendMessage(" " + player.getInventory().getItemInMainHand())
it outputs (when i interact with hand)
ItemStack{AIR x 0}
your checking if ItemStack is equal to Material.
so try player.getInventory().getItemInMainHand().getType().equals(Material.AIR)
getType() returns the material that the itemstack is.
if its air, then its empty
this worked
thank you very much
when comparing something in the future, make sure that the 2 things you are comparing are of the same type otherwise it will always return false.
i bet someone will now tell me thats not always the case for whatever reason and ill become the stupid one lol
i bloody knew it
@Override
public String onRequest(Player player, String params) {
if(params.equalsIgnoreCase("towny_kasaba")){
if(PlaceholderAPI.setPlaceholders(player, "%advancement_has_town%")) == "true") {
return "sa";
}
}
how i can do this?
how can you do what exactly?
i trying get %townyadvanced_has_town% output
but idk how can i get it
.equals kullan onun yerine
denedim olmadı
wouldnt it make more sense to hook into towny and use the towny api rather then using papi?
dm for turkish lets not spam here with another language
yeah proper solution
any ideas if it's still possible to send a message above the actionbar?
Aka you have the actionbar, then that message and only then title and subtitle.
I think it's where item names are displayed.
no
I dont think it was ever possible?
it was.
You can probs send a switch item packet.
let me see if I can get a screenshot
it was probably done by replacing the item in hand for a tick
yes but wouldn't then when switching back to the other item, override the name?

aka it would also only display the name for only a tick
Maybe you can find the held item packet and set the name If the switch item packet isn't what you're looking for.
tbh never worked much with packets but will check it whenever it's a priority xD
thanks
Yeah with the spigot api it's missing things like that and then they complain when you don't use the api lol
how can I destroy pasted scheme with worldedit? I want to remove all the pasted blocks but leave other blocks within scheme area which were placed manually. It's like pasting a scheme without replacing existing blocks with air, but replacing blocks that belong to the scheme with air
the action bar is above the item name popup
Hello, I am looping through the contents of the top inventory and printing out the items; however, the item in the right slot doesn't seem to show up. Does anyone know why? Thanks.
https://cdn.discordapp.com/attachments/741875863271899136/1030994853762453514/unknown.png
https://wiki.vg/Inventory#Grindstone get the items by slot
there's also SlotType#RESULT
d;inventorytype$slottype%result
public static final InventoryType.SlotType RESULT```
A result slot in a furnace or crafting inventory.
Thanks
been looking for a place to read up on how to upgrade my plugin to minimessage, anyone know of such a doc?
thanks
i would say no?
lemme be lazy 
after adding these lines I get an error``` private BukkitAudiences adventure;
public @NonNull BukkitAudiences adventure() {
if(this.adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
return this.adventure;
}
public void onEnable() {
this.adventure = BukkitAudiences.create(this);``` https://paste.helpch.at/uxeqovobek.css
What error
did you look at the link?
ngl, assumed it was the code in pastebin form
I will label next time to be less confusing
How are you providing Adventure at runtime?
? I don't always understand the language, the above code is in my main class
The issue you're having is that the code doesn't know how to find adventure at runtime
I thought I followed the video's instructions
It seems like you've shown the IDE how to see what library you are using, but the library isn't available at runtime
Which video?
In this episode, I introduce you to the Adventure Library. This allows you to do many things more easily, such as sending messages, sounds, boss bars, titles, etc. #Spigot #MinecraftPlugins
Code: https://github.com/Spigot-Plugin-Development-Tutorial/adventure-library
Join the Community! - https://discord.gg/cortexdev
Want to Support the Channe...
Are you using maven?
Also, are you using spigot or paper?
I'm going to assume you're just using spigot
server is paper, or did you mean in code
the server
paper-1.19.2-142
let me see your pom.xml
You dont need buķkit platform if you will always use paper
Paper has native support for adventure, e.g. you can just do Player#sendMessage(Component)
OK, what if the plugin is run on Spigot servers?
if I make it work on Spigot then it will work on Paper also?
yes
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.1.2</version>
</dependency>```
make this `compile` and shaded it to a package
and you also need adventure-api I think
it's transitive
great
if I use #sendRichMessage() I don't need to deserialize it anymore right?
ok so yes, thx
If a player with a custom health amount (using setMaxHealth or modifying attribute) dies
it resets back to normal? (after death)
ahhh so to remove custom health i need to set max to 20 then
is there a better way to replace specific blocks in the area with air? Mine makes the server lag https://paste.helpch.at/rekohexuqi.java
Don’t do all that Bukkit.getWorld stuff all the time
can also use nms replacing
bukkit setblock should beable to do like 60k blocks a second and that doesnt look like more but tbh it depends how often the blocks are changed
nms is definitly the way to go if your gunna be doing somelike like prison mines for example
tbf i didnt check the code posted, on phone atm
isnt there a normal bukkit method to setting blocks without light updates?
you mean what I used?
or physics
what is nms?
then defo dont do it through nms
you access internal mc server
and set block directly
instead of doing through the api
depending on the method it can update up to like 14million blocks a second
it avoids all light - physics updates
but you need to care to not set blocks on unloaded chunks etc
so not for the inexperienced
does getWorld just take from a hashmap?
after my question I thought that maybe I can just send a few commands from WorldEdit in the console for each type of block like set 2 edges of the area and then /replace
It’s work that can be avoided while also making the code more readable
yeah, i am just asking if they are hashed
I think so
my guess would be that its hashed against world uuid
it's funny because world uuid is just a bukkit construct, not a vanilla thing
I just don't know how to convert //pos 1, //pos 2 and //replace into code and how to find this information on the site
^ try reading
i am willing to bet that getWorld(name) is used way more than the uuid version
uuid use case is quite rare i feel like
and its hashed against the name
apparently
oh 100% yeah
but like there is no world uuid in vanilla, idk why it's a thing in bukkit
Well you can't have 2 worlds with the same name. (Pretty sure) so there is no point in a uuid
uuid in general is a bit better imho as an actual id
size is known etc
but on use cases, where user needs to put something in as name it becomes kinda impractical
at least they are still hashing against the name

it's just a dumb introduction
Bukkit moment
How does this make any sense? I get Type mismatch: cannot convert from element type Object to Player from the method. The class Driver has the generic <E extends Event>. I've suppressed the rawtypes warning on Driver d
Smells like Type Erasure, but more importantly you probably shouldn't suppress errors if they're fixable, which I imagine in your situation is very doable.
I can´t set d to the type Driver<?> as then I can't call getUsers(<E extends Event>) at all. I don't know what type/class the event is.
So idk how to fix it other than not using generics for d
Why doesn't getUsers just take an Event as a parameter?
Cuz depending on the event I want to use PlayerEvent#getPlayer (or other event-specific methods) and didn't want to cast in the classes where I know the event type. Ig I can change E to Event for that method though
My big fat brain just remembered I can just cast the Set lol (Set<Player>) d.getUsers(event)
Thx any ways :>
that looks really really bad
Ik :V
But I want to avoid using Event as a parameter as then I'll have to cast the event a billion times in subclasses...
the issue basically is the getKey call, whatever that is doing
It's way too much for me to explain, but essentially I have a Map<Driver<?>, "CustomDataClass"> which I iterate over using Map#entySet
build a proper heterogeneous container and you're fine
Ig
I guess this is an eclipse bug? The top one works, the bottom one does not lol```java
Set<Player> users = l.getUsers(event);
for (Player p : users)
for (Player p : l.getUsers(event))
depends
a) does it compile? b) what does it say?
if getUsers is generic on T and returns Set<T> then it is not a bug
yeah there are rules about when inferences behaves how
I know, I was unclear. It was a follow-up from before
Why when I put a block in a hashmap and later get this block and modify it, it doesn't get modified?
How can I modify it properly?
I've tried hashmap.get(..).getLocation and it didn't work
Inner i gives me the warning Outer.Inner is a raw type. References to generic type Outer<T>.Inner should be parameterized. How do I get rid of it?
public final class Outer<T> {
class Inner {
}
}
public class Foo {
static Outer<String> o = new Outer<>();
public static void bar() {
Inner i = o.new Inner();
}
}
Generics are difficult :<
hi, im making a laser gun and im not sure what sound to use, im currently using ENTITY_WARDEN_SONIC_BOOM with a volume of 0.5 and a pitch of 2: https://srnyx.likes.cash/java_V65GopqNLh.mp4
but it sounds way too low pitched and kinda choppy, anyone got any better ideas?
Hey guys I need help with my discord account I can’t login because I lost my 2fa codes and I have lost my backup code
That looks like a problem you need to sort out with discord. Not us.
I have and it sent me this discord invite
We can't help you get your discord account back. Your account - Your Responsibility - Take it up with discord.
?not-discord
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
@open citrus
I think he meant store the location instead of block and then get the block on that location and do what you want with the block
^ That would be the more recommended way of doing it
Is there a way to do something like this? Where you create an interface with more than one method in a constructor?
class Foo {
Foo f = new Foo(
class X implements Bar {
void a() { /*Whatever*/ }
void b() { /*Whatever*/ }
});
Foo(Bar b) {}
}
interface Bar {
void a();
void b();
}
Or is it just easier to create two SAM interfaces?
if they are always paired, i dont see why you would need a single method one
Because I don't know how to create a double method interface in a constructor. Or what do you mean?
I could make a bunch of inner classes for Foo that implements Bar but I have a lot of Foo constants so I'd rather not
you can just pass this into its constructor:
new Bar() {
a() {}
b() {}
}
sorry for shit format, typin from phone
just make an anonymous class implementing your interface
and pass it to constructor
Ahh, that is how you do it. I didn't know how to create a multi-method interface in a constructor. But that solves it, thank you!
I will, thanks :>
well it's not specific to a constructor but yeah
Ik, but that was the case here so :>
why is getClickedInventory() method in InventoryClickEvent not working for me
It was working before
what api version do you have in your pom/build.gradle
1.19.2-R0.1-SNAPSHOT
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
Ah, Vault brings in an old version of Bukkit, add this to the Vault dependency
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
oh
It worked, Thanks for the info
I have a simple code changing the format of my chat messages, however I get this ugly "This message has been modified by the server" thing
Images:
Code: https://i.imgur.com/ZCM78rK.png
Notification: https://i.imgur.com/N0uCC6q.png
Anyone know how to bypass, change this?
you install freedomchat or something like that on your server
or you can send the message as a server message instead of a player message
Which setting may that be?
Setting enforce-secure-profile to false will disable chat reporting feature and the client will show a warning on joining the server
It's so painful i have to learn blockchain technologies just to send messages using packets... absurd chat reporting feature
that is so wrong
it doesnt disable it what so ever
btw freedomchat isnt a chat plugin, it disables chat reporting, the popup shown on join and that awful question mark thingy your seeing
anyone got any ideas better than what i already have?
No idea what sound, but a bird would probably sound better
imo laser sounds should be short
like .2 seconds or smth
like a pew pew sound
yk
I Kinda like Silverfish hurt, but it's still not quite right
Parrot hurt feels pretty close
i should just record myself saying "pew" and force them to use the resourcepack >:)
oh my that would be epic
have u ever played roblox arsenal?
u know the gun called "literal gun" or maybe its just "gun"?
o, well they made it shoot "pews" lmao
i assume
but its modified im pretty sure (so that it sounds good)
i should just go on cameo and pay a celebrity to say "pew" for me and no one would ever know
oh you can just get celebrities to say stuff?
👀
ye if they have a cameo account lmao
and ye agreed, i tried using the beacon sounds cause they're higher pitched, but they're way too long :(
I guess you could try Zodd's... cruel suggestions
hearing a parrot get hurt every time you shoot 😭
ye i did, but silverfish was "raspy", like the gun was dying, and the parrot was too recognizable so it made me sad :(
lol
what about this? https://srnyx.sucks-at.life/java_b8HMS5AL95.mp4
wb a higher pitch
cant :(
is this at least better than the original?
hmm
Pls help. I have a config that contains a world.getName() value (a String) that a plugin needs to read and add that world to a Location variable
But a Location can only contain World and not a world.getName()
Do I have to loop through every world on the server and check if the getName() is equals to the one in the config? Or is there a better solution?
d;Bukkit#getWorld
@Nullable
public static World getWorld(@NotNull String name)```
Gets the world with the given name.
a world with the given name, or null if none exists
name - the name of the world to retrieve
public Location(@Nullable World world, double x, double y, double z)```
Constructs a new Location with the given coordinates
world - The world in which this location resides
x - The x-coordinate of this new location
y - The y-coordinate of this new location
z - The z-coordinate of this new location
Oh yeah you can do that lool sorry it's been a while, thanks again
Yeah, a lot of people write down the whole everything, pitch, yaw, xyz world etc.. in the newer versions they did this so its saves everything in the correct way and if u do it with this method then there will be no errors at all
Oh god I just saw there are two spaces between public and Location
xd
how can I make my plugin work for every minecraft version?
no you didn't
🙂
Thanks
any ideas on what could be causing this? (not my server)
I assume it's related to getting an item but couldn't get much more from it
besides it's also related to a player
for reference, this was that player's inventory
Odd
What's the nugget item
so I think I might know the issue
aka the issue is excellentcrates
my client has an "afk region" which gives an excellentcrates key every x minutes
I assume the issue is with excellentcrates in this case then?
(cause the location where the player was, was inside the afk region)
Possibly
have an idea on a way to test if it's rlly it, thanks for the help either way, will update ya afterwards if ya want
Go to the location he was, and stay there for a bit, if you can turn on debug for the crates if it has any
Uhm would a method checking if a player has a permission or is console be able to be static without issues?
yeah
I have a class roughly like this. What is the best way to avoid the massive else if chunk?
public class Foo<T> {
public static final Foo<Boolean> BOOLEAN = new Foo<>();
public static final Foo<Integer> INTEGER = new Foo<>();
public static final Foo<Double> DOUBLE = new Foo<>();
/* etc.. */
public void something(T t) {}
public static void whatever(Object o) {
if (o instanceof Boolean)
BOOLEAN.something((Boolean) o);
else if (o instanceof Integer)
INTEGER.something((Integer) o);
else if (o instanceof Double)
DOUBLE.something((Double) o);
}
}
what is even your goal here
unless you have like 20 of those that's the best way I can think of
what
Hmm?
Map<Class<?>, Foo<Object>> map
map.get(o.getClass()).something(o)
ye that was what i was thinking at first
but
you could do something else that doesn't have the unchecked cast warning
Yeah
wait idk if you can actually
😦
Pattern switch?
Ig, but isn’t that pretty much the same?
Looks nicer imo
Ig
oh if java has it then use it 👍
I have a ’type’ string linked to the Object so I could switch that otherwise
Visitor pattern 🤓
Switch
Asked
Your website looks a little broke
A "little" allot
Personally I don't advertise broken websites, I guess I just assumed you wouldn't either
Hello guys
How can i make a item glowing?
without adding enchantments
Location loc = new Location(world, clickLoc.getX() + x, clickLoc.getY() + y, clickLoc.getZ() + z);
Block block = world.getBlockAt(loc);
world.spawnFallingBlock(loc, block.getBlockData());
block.setType(Material.AIR);```
Trying to make any block I click on be affected by gravity, though I notice that the fallen block entity that spawns spawns in a slightly wrong location
I'll show you a short video in a sec
Like this
The block seems to spawn with an offset, causing it to not place properly when hitting the ground
Offset is consistant so you could probably just add x and y to the location so its correct again
It works when clicking
Now the issue is that I want that to happen when a player moves
That's the code I have, in a PlayerMoveEvent
I'm just doing this to test falling blocks, i know it's very slow on the server
The offset seems to be completely random
you cant
i pwrsonally give an item protection 0, dows the same job and doesnt boost an item.
tho can cause a fewissues potentially
Custom enchant moment
Or just add the hide enchantments flag.
that's just editing lore
you hide the enchants and display them in the lore with your formatting
?
or whatever ya want
It would become to much complicate
handle everything regarding enchatments & stuff
you would need to pay attention the the grindstone too
not complicated lol
iirc there's no event for the grindstone
i mean
isn't there a easier way with a resource pack?
no clue about resource packs but you could also check a player's item every tick
that seems harder than without resource pack lmao
eh that can be tricky for performance
but yes
it should all be "cached" although idk what would happen if you had like 200 players
yeah we'll probably have around 150 players online
and also if you do this make sure that you check if the lore is not equal to whatever you want to set it to
yeah
you could just do it on inventoryclickevent
what's that? maybe we want to move to another chat i suppose
you just have to add the symbol before enchantment name
that's exactly what i wanted
easy peasy
idk if it supports colors, but worth a try
love you mate
OR
inventory click event and inv open event
ah
https://www.planetminecraft.com/texture-pack/enchantment-symbols/ looks like you can use section symbol or its unicoded code \u00a7
you only need to override the enchantment keys @coarse gulch, the pmc link is a texture that does the same thing, you can follow that
np
nice
\u00a7 and then the code (a-f 0-9) - \u00a78<star> \u00a77Efficienza
yeah that's perfect
does R works as in minecraft
so it reset the color?
i mean, can i do something like \u00a7r
confused is this texture pack or not?
that is minecraft's coloring system, so yes, it does
you can do it by editing default minecraft files
perfect
Love ya, thanks again
for real
Is it normal that opening it back from the pack it just fucked up all the lines?
o.o
uh not really
but don't keep all keys
override only the enchantment names, anything else will have the default value
Like this?
yes
let's see if it breaks again
of the server or client?
server resource pack
client files
both
you can do it both way
yo wtf is swift sneak
?
tffffff
that's probably something they wanted to add and the thrown in the bin
no
wait
that's a thing
what is a thing?
yes, it was added in 1.19
i didn't know it existed
Added Swift Sneak. It is currently applied to boots, and is not compatible with Frost Walker, Depth Strider, or Soul Speed.
F
ah nvm, it was later moved to leggings
are you supposed to go faster when sneaking with it?
yea
i have it at level 3 and i'm moving at the same speed
Skill issue
https://cdn.discordapp.com/attachments/1019656044470861877/1033147693150769193/3problem.jpg 14 slots not working 16 working
can someone help with maven shading
trying to shade kyiro adventure-platform-bukkit
do you have this in your pom? https://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
and make sure you build the project using package
I have that in my pom, build using package?
yeah, use the package task, not build
if you use intellij, from the maven tab, go to lifecycle and select package
they've got ClassNotFoundException which means that it's not being shaded at all for whatever reason
I haven't looked line by line to see if there's some small mistake or typo but in general their pom looked fine
@trail burrow just to make sure - does the jar have the dependencies in the jar? And make sure you're using the shaded jar, not the normal one
it only creates one jar, Not sure where lifecycle is
gaby why you using maven >:(
oh
can you resend pom.xml?
so that someone here can look through it
someone who uses maven instead of me just scanning through it
old project
or maybe ill look deeper into it later
<pattern>net.kyiro</pattern> this should be net.kyori
💀
I'd recommend just opening up the jar and relocating everything you see
that's what i do
and don't relocated to shaded.net.kyori, that will cause problems if you/someone else use the same package in other plugins
I hate typos
use something like <group>.<project name>.libs.kyori
@trail burrow pinging since you haven't responded with any other details and it's been a while
Can you upload the project, or a separate project meant to just reproduce this issue to github?
somehow I broke my project and trying to fix it
💀 i guess show the bug or when you get it back to the "original" state try uploading a test project for us to reproduce
also seems like mbaxter in kyori discord is also willing to help - so if they do end up getting the solution plz update here too (so that people don't waste their time looking into an already-solved issue)
it will not build correctly, jar is 1/3 the size now
mvn clean package?
maybe but the code for minimessages is all gone
not sure how world got added to the end on my project name
how do i make mobs hostile at each other (ex: skeletons)? but only if the other mob tests positive for a predicate
i have 2 skeletons, one is on blue team, one is on red. there's also 2 players, one on blue, one on red. currently, the blue skeletons will only shoot red players, and vise-versa (so the skeletons r friendly to their "teammates"). however, i want the skeletons to be able to shoot each other so that they are besties: https://media.srnyx.xyz/java_6wMSp6dvzX.png
also, while writing this, i noticed some of the skeletons despawned, even though they were in my render distance (not in view tho, i just saw their glow) and set to persistent
D;spigot LivingEntity#setTarget
void setGravity(boolean gravity)```
Sets whether gravity applies to this entity.
gravity - whether gravity should apply
D;spigot Creature#setTarget
void setTarget(@Nullable LivingEntity target)```
Instructs this Mob to set the specified LivingEntity as its target.
Hostile creatures may attack their target, and friendly creatures may follow their target.
target - New LivingEntity to target, or null to clear the target
^
PlayerMoveEvent.getFrom() returns a Location without pitch and yaw any idea why?
cause it's not relevant information?
For that event it's not really
oh so how would i get it then?
its for a back command i need to set the prev location with pitch and yaw
what has player move event to do with a back command?
i use getFrom method for getting last position
That's probably not what you should be using
i saw this being used on advanced tp thats why im using it
Is it not? Then why is it getting fired when you look around?
You don't 
I’m assuming you mean a /back for teleporting? If so, use the teleport event.
so i would have to create my own targetting ai basically?
No, you can listen to the entity target event and set a new target
wouldnt that only trigger if it sees another target tho, like a player?
cause i want them to shoot at each other even when there arent any players around
How are they being spawned?
at the player's location. either when picking up a power-up (item) or when a cmd is ran
You can set their target when you spawn them in then
the player could be invisible tho
or move out of the way before the skeletons target them
You said they’re targeting skeletons though
ok how?
^
what would i set it target to tho? would i have to calculate the closeset enemy that's in range and in view?

How tf does this "Diamond Pickaxe".replaceAll("^[\\w]", "") return iamondPickaxe?
and "Diamond Pickaxe".replaceAll("[\\W]", "") return DiamondPickaxe
Isn't D a part of \\w or wat
what about after they kill that target?
and there arent any other target in-range until an enemy skeleton walks in front of them
because \w = word (letter, number, underscore) and \W is the opposite
D is a "word" and is not a "word"
so the first one removes the D, and the second one removes the non-word
LivingEntity#hasLineOfSight(Entity) says
This uses the same algorithm that hostile mobs use to find the closest player.
does that mean it also takes into account invisibility, gamemode, etc...?
ok i fixed everything by just using a bukkitrunnable to check the target every second for all the spawned mobs (which i hate)
@dark garnet
Could you explain everything you are trying to do?
It might help me understand how to help more
since ive got it working (using runnable, i dont wanna use one if possible) ill show a video
https://srnyx.has.rocks/java_yVGYCNnPKM.mp4 the skeletons are shooting lasers btw
sry took so long, got distracted
there we go
that last blue almost clutched
Noiceee
how do i override a minecraft command? specifically when registering my own command
cause when i use Bukkit.getPluginCommand("enchant"), it returns null
all the forums say to PlayerCommandPreprocessEvent, but im not sure what to do with it besides cancelling the mc version of the cmd
try to unregister the command by deleting it from the command map
command map? 👀
Yeah it is a class and has a Map<String, Command> field named knownCommands iirc
It is replaceAll though?
Shouldn't that remove all letters in the first one?
Why only the D
No, because you told it to only start from the beginning
so it sees one D (as specified in the regex), and since it can only start at the beginning, it stops
if you remove the ^ (which means to start at the beginning), it works how you want it to
https://regexr.com/ <- helpful website, also has a nice cheat sheet
and the same goes for your second regex
the [] isn't needed either
Oh
that's for like [abcdefg] so that you don't have to put it in a group like (a|b|c|d|e|f|g)
oh
yeah I think it's basically (?:a|b|c|d|e) but shorter and easier (into [abde])
OH and it has ^
so all characters besides abcde
I forgot about that
so like [^abc] will match every letter except for a, b, and c
regex can be pretty fun 😌
Very...
Yeah lol
@queen plank i think you'll find this useful: https://regex101.com/, i use it all the time
WordlEx
it could give u start and end words then ask u how to get the end word via regex (from start word) (it replaces matches with "" [empty])
example: start: boat, end: oa, answer: b|t (ok maybe it'd have to be different so its actually hard)
bro what
fr
I finally fixed my github so I can push and pull, do I select all in commit tab or just the class files?
all
later you can learn what to put in the gitignore
intellij also has a gitignore generator
or maybe its a plugin
i have gittoolbox 🤷
anyways just post it on github and we'll see
I use intellij and I updated all that has changed, I have many that is Unversioned files
do you have a .gitignore file
I would assume
there is a .git folder
yes, that is the git repository
post it on github and I'll show you how to setup the gitignore
I think the unVersioned files are because on how I uploaded the first files
open intellij terminal and type git add .
git rm -rf --cached .
git add .
git commit -a -m "Cool Commit"
git push --force
just copy and paste these lines
later it's either ```
git commit -a -m "Cool Commit"
git push
but for now just copy and paste those four lines into the terminal
a forced push is the finial thing that fixed it
if it worked then send github link plz
so seems like you don't have .gitignore so if you want you can create a file .gitignore in your root project directory and add: ```
.idea/
target/
*.iml
Then in terminal type: (in order) ```
git rm -rf --cached .
git add .
```and then from here it'll be like any other commit and push - press Control K (or go to Commit tab if you changed keybinds), select all of the modifications/files, type in a commit message and `Commit And Push`
just letting you know how to do this now for future projects
IntelliJ or a plugin of intellij can also generate .gitignores but I won't go into that right now
thanks, I might be able to fix my other repos, will work on them tomorrow
https://github.com/dkim19375/DkimCore/blob/master/.gitignore
Here's just the first repo I saw of mine - it's not maven but you can see where the gitignore is and how it's setup (and how I also have .idea/ in there)
atm cloned your repo and building it rn
I had .gitignore file before I started this repair they got remove in some of the commands I ran to fix it
Ok I think I know why
you had an extra .
at the end of the relocation
actually that should still work though
try without the dot
also you should be getting two jars: ```
Autorank-5.1.6.jar
original-Autorank-5.1.6.jar
I uploaded the unversioned files and everything looks normal
if you follow this then it should work well
and you can delete world.iml I think
not sure what that's for
do I need .gitignore
you should
it makes sure that some files and folders are excluded from git
caches and ones that are specific to IDEs should usually be excluded
.idea = IDE stuff
target = cache
*.iml = IDE stuff
Already got linked one by Kotlin =, thanks though! 🙂
I'm trying to spawn an item frame on the block face that the player click. I currently have this code but the item frame seems to spawn a bit like it feels like randomly all over the place. Why lol?```java
public void onClick(PlayerInteractEvent event) {
if(event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
Location l = event.getClickedBlock().getLocation();
ItemFrame f = (ItemFrame) l.getWorld().spawnEntity(l, EntityType.ITEM_FRAME);
f.setFacingDirection(event.getBlockFace());
}
Wdym all over the place?
spawnEntity spawns the entity with a random offset I believe
That explains a bit. Because sometimes the item frame just decides to move one block over.
Hiya. Been trying to make a small plugin for Halloween. Want to create a few animal corpses and have them lie around sideways. Pretty much like this: https://imgur.com/a/HeQ6X6L
Thought maybe setPose(EntityPose.DYING) would be what I'd need but that has no effect.
I'm starting to wonder if it's even possible and if so.. how? 🤔
does it?, i am pretty sure i did an implementation that depended on it being the exact location i enter before
It might have been spawnItem then
dropItemNaturally does have a random offset
but also remember that .0 x and z are in the corners of the blocks, not the center (messed me up before, I was so confused)
Yeah ik
Anyone know how to convert a bukkit player to a worldedit player using the 6.0 WE API?
public void onPlayerLeave(PlayerQuitEvent event) {
org.bukkit.entity.Player player = event.getPlayer();
com.sk89q.worldedit.entity.Player wePlayer = BukkitAdapter.adapt(player);
}
this works in the v7.2.x but for some reason BukkitAdapter is not a public class in 6.0
Hello, i am having issues with spawning an entity using nms, when i spawn the entity it is invisible, i cant see it (i can hear it and i can kill it with fire etc)
Custom entity class: https://paste.helpch.at/ixisunulap.kotlin
Command class: https://paste.helpch.at/ewijuzeluh.java

what event should I use to detect when a door is opened with redstone?
like lever or button
d;spigot BlockRedstoneEvent
public class BlockRedstoneEvent
extends BlockEvent```
BlockRedstoneEvent has 1 extensions, and 6 methods.
Called when a redstone current changes
@sonic quartz I believe this is what you're looking for 
let's say I need a List#forEachIndexed method that gives you access to each item as well its index trough a BiConsumer<T, Integer> or something like that. Would there be another way to skip to the next element, like you would use continue; in a normal loop, in another way that by using return;?
public <T> void forEachIndexed(List<T> list, BiConsumer<T, Integer> consumer) {
for (int i = 0; i < list.size(); i++) {
consumer.accept(list.get(i), i);
}
}```
```java
forEachIndexed(list, (element, index) -> {
if (element does not meet condition) {
return; // skip to the next element
}
// rest of the code
})```
This would work like this, I was wondering if it is possible to skip an element without using `return`
What I want to do with this method, is to avoid a lot of for loops with an index i
that's dumb
you still need a variable for the index regardless
you just called it index in this case
yeah but it is not defined explicit for each individual loop
for (int i = 0; i < list1.size(); i++) {
var element = list1.get(i);
}
for (int i = 0; i < list2.size(); i++) {
var element = list2.get(i);
}
for (int i = 0; i < list3.size(); i++) {
var element = list3.get(i);
}```
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/for-each-indexed.html 'source of inspiration'
i don't see how that is different than
forEachIndexed(list1, (element, i) -> {
});
forEachIndexed(list2, (element, i) -> {
});
forEachIndexed(list3, (element, i) -> {
});
I prefer it over a normal for i loop in this case
well as I said, that's dumb, but you "continue" by returning, because that return exits the consumer function, not the loop, thus skipping to the next element; the downside is you can't break out of the loop without external state (or.. throwing an exception)
I was hoping I miss something and return is not the only option to skip an element
thanks emily
it is in fact the only way
yeah I know
with that abstraction there is no "loop", it's just a function that takes a T and a number, that's all it sees
is there an easy way to get the player who activated RedstoneBlockEvent?
I thought about using PlayerInteractEvent to save the player to a hashmap and then use him in RedstoneEvent but It will probably cause problems when handling several players doing the same thing simultaneously
I realized that I can't event use Hashmap
I don't think it's an easy thing to do reliably
I think Sponge does it or something similar like who pushed a piston, and it's incredibly complex, but it can do things that a bukkit plugin can't given it's basically just a mod
You could check Griefdefender to see if Blood tried to reimplement it in his plugin.
I say this because he wrote the notifier system you're referencing in Sponge
Hi when i do /papi reload my placeholders being llike this
https://imgur.com/yTic99R
before papi reload work fine
https://paste.helpch.at/ekefutufiz.typescript this is the code
Override the persist() method with true
Any efficient way to get list of player who is currently open Custom GUI?
im having trouble getting this api to work: https://github.com/WesJD/AnvilGUI
i downloaded the code of it as a zip then added it to my projects library,
i got the dependency and repository to work in pom.xml but cant use any of the functions or import a package from it
yeah i followed that but couldnt do any of the example methods
that doesn't say to download the zip
show pom.xml and make sure you did what I linked
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
Intellij
oh wait also you have maven shade plugin twice
lines 21 - 42 and 52 - 67
and you reloaded the maven config thing?
I'm not sure what it's exactly called
but intellij should show like a reload button
👍 np, just make sure you always refresh (it should pop up whenever you modify the pom.xml)
I have this config file for my Bungeecoord plugin, when reading the file, how can I make the plugin store server1, server2, and server3 as seperate values, rather than storing [server1, server2, server3] as one value?
Sorry if that makes no sense I'm not really sure how to word it
how are you saving the config?
private File file;
public static Configuration configuration;
@Override
public void onEnable() {
getLogger().info(ChatColor.translateAlternateColorCodes('&', "&a&lMATCHMAKER &8&l» &7Plugin enabled!"));
registerCommands();
file = new File(ProxyServer.getInstance().getPluginsFolder() + "/Matchmaker/config.yml");
// Tries to create & load the file.
try {
if(!file.exists()) {
getDataFolder().mkdir();
file.createNewFile();
}
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
configuration.set("group1", "[server1, server2, server3]");
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, file);
} catch (IOException e) {
throw new RuntimeException(e);
}
}```
like that
I take it this is a bad way of saving a configuration?
funnily enough if you save a string, it will save that string
use a list object instead
np
as in an array or?
any list-like object
but given that i said "list", i was really talking about list
not arrays
I have a list of numbers
and I wanna get x amount of unique numbers from the list
how can I do that
Make the list into a set
Make a for loop and put the elements in a new set or list
Also randomize
I forgot
Randomize the set before you loop it
Google like randomize collection java
Hmm
why make it into a set if you're already creating another set
true
there's multiple answers to this question. But yeah most of them will include sets. You can do what dkim mentioned but instead of converting the list to a set, just loop thru the list directly and add the elements to the set until the set size is whatever you want.
I wasn't really thinking
but i said set bc it doesn't have duplicate
but i forgot about the ordering thing
just Shuffled the list using Collections.shuffle() method and just got the x amount of beginning numbers of the list

Collections.shuffle(old);
List<Integer> newlist = new ArrayList<>();
for (int i = 0; i < x; i++) {
newlist.add(old.get(i));
}```
umm. that will not guarantee you the numbers in there are different tho. you could have duplicates
oh... well then java has a sublist method. if all you needed is n elements from another list.
you did?
🥲
I can not find that
how so? never used a sublist
I mean in the code
oh. right
How do I change level or duration of the potion effect in potion meta of a tipped arrow itemstack?
I want to get arrows just as they are in creative inventory. Can I get them with proper names, duration and lore?
without using addCustomEffect
you can probably do that by using ProjectileHitEvent
setBasePotionData?
hmm, I will probably be the 549687815 person asking this, but how can I generate a server jar (with shaded net.minecraft in it) of version 1.19+? And no, I don't want to use mavenLocal for this, I'm not building a project, I'm experimenting with classes and decompilers
Add --remapped flag to when you run build tools.
Or just download it from the maven repo
paperweight ftw :(
or
sponge thing if you don't want spigot
so paper is no more?
wdym
no paperweight is a thing
sponge also has a gradle plugin
but it doesn't include paper and spigot
I'm experimenting with classes and decompilers
wait what
ok I think I misunderstood
yeah
well, I want the compiled code of net.minecraft classes bundled together with Spigot (or preferably Paper) in a jar file
Paperweight - I'm not exactly sure where the jar is stored but I assume somewhere in the build folder
hm I can't find it
oh found it
.gradle/caches/paperweight/ivyRepository/io/papermc/paper/paper-server
I'm not sure exactly what you want
since that's basically a maven repository
is that paper + vanilla in a single jar?
how can I build the server jar using paperweight then?
https://github.com/PaperMC/paperweight-test-plugin
when you reload gradle it'll run all the stuff
and read the readme
I don't understand how paperweight-test-plugin related to paperweight, nor why I would need paperweight-test-plugin to have the paper server jar, am I missing something? Is this some kind of "hack" to get that jar?
it's an example
of how to use paperweight
I'm not building a project
Nor am I using Gradle, Maven, or any build tool for that matter
I have literally 0 code to be compiled in my hands
I guess you could try looking at buildtools source code
and see how that works
well actually
without a build tool you can't deobfuscate it I don't think
assuming you want it deobfuscated
but I need exactly the obfuscated code
then download from minecraft.net
or papermc downloads and run the server to get the jar
Minecraft for whatever reason has a 1 page load ratelimit 👍
for me
you could also download the paper jar, run the server, and go to versions/1.19.2/paper-1.19.2.jar
actually this isn't obfuscated at all
just checked
I'm assuming it uses spigot mappings
anyone here good with jackson object mappers :p
?help
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait
what's the issue?
kotlin
my b didn't mean to press enter after just that
so this is the error
[21:25:49 WARN]: at [Source: (String)"Hat(id=test1, material=FEATHER, displayName=Unnamed, lore=[1, 2, 3, 4, 5], modelID=10000, enchants=[MENDING:1, PROTECTION_ENVIRONMENTAL:4, DURABILITY:3])"; line: 1, column: 4]
[21:25:49 WARN]: at FruityHats-1.0-SNAPSHOT.jar//com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)```
it could be worse, it could be java
I don't think you can read the value as Hat in the deserializer since that's the deserializer
wait
nvm
ignore me
lol
that's where im kinda lost lol
after that point im not sure where to advance to
yeah that's for when the deserializer is registered
Could we see the whole stacktrace? Because with what you have posted, seems like your problem is elsewhere in the code...
so basically I think this is what's happening:
- it tries to deserialize a Hat
- the
deserializemethod callsreadValuefor Hat - repeat
yeah sure no problem uno sec
note that I've never used jackson before
and all I know about it is that it's a JSON library
so I may be very wrong
and I think I am very wrong
so I think you should be ignoring me
yeah ignore me
🤓
Emily
oh I think I get it, Jackson is complaining that you gave it this, but this is not a JSON:
Hat(id=test1, material=FEATHER, displayName=Unnamed, lore=[1, 2, 3, 4, 5], modelID=10000, enchants=[MENDING:1, PROTECTION_ENVIRONMENTAL:4, DURABILITY:3])
I agree
i kinda just went along with this guide 😛
https://www.baeldung.com/kotlin/jackson-kotlin
yup I was right, see, I made a small, reproducible snippet
fun main(args: Array<String>) {
val jackson = ObjectMapper().findAndRegisterModules()
jackson.readValue<Map<String, String>>("TestTILO(dsadasadasdadsa=\"dsadasdas\")")
}
prints
Exception in thread "main" com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'TestTILO': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (String)"TestTILO(dsadasadasdadsa="dsadasdas")"; line: 1, column: 9]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)```
So your fix is: give JSON parsers valid JSONs 😉
big brain i like it
OR OR
hear me out
use the actual serializable option for configs amirite
https://i.imgur.com/f07UXRQ.png
yeah i used jackson (atleast the object mapper) for writing and reading to a file
ty
[ERROR] Couldn't load server icon
My icon is named "server-icon.png" and is 64*64, so whats the issue?
hey, i wan't to learn minecraft plugin development, where do i start?
seems like some youtube videos are outdated, or is it?
Depends on the video I guess.
For all I know you're looking at cat videos. (Pro tip: cat videos are not up to date)
im using a bungeecord plugin to store data for every player in a map. is it possible to add placeholderapi into the plugin on bungee, and create a separate expansion for the spigot servers to get data from said bungee? would this have any major performance impacts?
or should i just add mysql support and slap the plugin onto every spigot server? i would still like to know how to do the above though.
codedred or kody simpson i guess
i hope you know a bit of java, though.
You can not run papi in bungee
i am aware.
the bungee placeholderapi expansion is a thing, though.
any tutorial on how that works?
it uses plugin messaging. spigot offers you a way to transfer players by just sending a message to bungee
also note that plugin messaging is only useful in certain scenarios
since it requires a player on both the receiver and sender server
yeah and it also gives you some specific stuff like PlayerCount which is nice
I have a item, and I want it to show the pickup motion towards the player, but not go into the inventory. Anything I can use to do this? I tried to remove it from the inventory after picking it up but that made it flash if there was a open slot in the hotbar which I don't want
packets are game internals, spigot just offers an api for some of them
https://www.spigotmc.org/resources/protocollib.1997/ this is a library that you can use to use packets easier
you don't have to copy the class - in fact I didn't - but you can see an example of the usage
thanks!
Yeah I have heard of it
it uses protocollib btw
packetwrapper is useful
very useful
usually wiki.vg isn't needed with packetwrapper for basic things like this
@forest jay if you do use packet stuff in the future, https://wiki.vg/Protocol is very helpful for documentation (and then you can refer to PacketWrapper to see how it's implemented in ProtocolLib since ProtocolLib has some utilities that PacketWrapper uses)
yeah, I have tried to use packets before, went right over my head lol
🥲



