#help-development
1 messages · Page 196 of 1
yes, you don't need all that code. Only the code to get the contents
isnt a shulkerbox an invholder?
how do I use these?
only when its placed, maybe?
Not easily
idk
I've been trying to make it and ppl are using GameProfile object on a variable but I cannot seem to find this
You have to create a fake profile using teh new name but copying the current players profile signature. The send an Info packet to all players.
bro why does this have to be so hard
I have no idea how to do this
because its not vanilla behavior, or API
I need some guidance
where i find some tutorials for java with sql
idk sql 😦
yeah
i do not understand sql
specially tables etc..
I have a question (probably is basic java idk ) but i made a string to be used in a command arg now idk how to check if the player has used the args or not and if it has i want to be able to check which one of the list i made... but i really don't know how to do this if somebody could help me out that would be great
for some reason that link starts at end of vid just go to start
are you competent using NMS?
the java part i do understand and connecting
no
literally dont even know what that is
Then its something you should not really attempt. It requires NMS, remapping and packets
Hey um i was wondering if you knew how to make a check for an arg in a command
sure
String#equals() if you want to compare exact words players are using for their arguments.
thanks
I did that wrong hold on
oh?
args is an array?
yes because its a string right?
uh yea
length
String customenchant = args[0]; and String[] Enchants = {"Telebow", "Explosivebow"}; im trying to make it so like its kind of like Player player = (Player) sender but for like an arg check so that if a arg is used then it puts it into a thing like player is in the var i sent above so then i can do like get players held item and set a lore according to the arg that was used so then i can use that as a check in my events thingy to make custom enchants
god i worded that so weirdly
but
idk how to explain
I think you have a fundamental misunderstanding. Or at the very least might be overthinking things.
If I understand correctly, you want to make a command that applies a "custom enchantment". Your way of doing so involves Strings. So in order to do that you have an array of strings that represent all of your enchantments. For a setup like that, you are just doing simple string comparisons. I'd recommend converting that array into a List<String> so that you'll have an easier time getting the information you need.
Also, the third code block you have is what's know as casting. You can't cast an array to a string as they are incompatible types.
Is there any good approach/library for Integration tests with spigot plugin?
You should see MockBukkit
right yeah i see what you mean but you know im trying to make it so that if arg0 is selected so the telebow then it will change the lore of the item so that my telebow event thing will be activated and the item is a telebow. Is there a way to do this without the lore?
MockBukkit is for unit testing as I remember
i think im definetly overthinking this
* * * * 0
0 * * R 0
0 ] * * HALT
0 _ * R 1
1 b * R 2
2 e * R 3
3 i * R 4
4 _ * * 5
5 * _ L 5
5 e r L 5
5 b i L HALT
``` what a masterpiece of code
cant understand what you are trying to do with the command, going to shower, ill be back soon if u havent solved it till then i can assist you
I'm not sure if I'm following. lol
The way I see it is like this.
List<String> enchantments = Arrays.asList("Enchant1", "Enchant2", "etc")
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if player does not have permission
return
if args length equals 1
if enchantments contains args0.toLowerCase()
do stuff
}```
idk how to do the if enchantments contains args0 bit
List#contains()
If you were to convert your current array to a list that is.
You would have a far easier time.
Otherwise, you'd have to loop through the entire array and compare indexes.
Is that cron?
wdym list
oh
List<String> enchantments = Arrays.asList("Enchant1", "Enchant2", "etc")
this
ok
OH
I FIGURED IT OUT
I THINK
MAYBE
turing's machine code
wait
this is basically instructions for the oldest imaginable computing machine that can compute things.
hey would this work?
if(args[0] == "Telebow") {
You'd want to use .equals() instead, but yes it would.
Yes
wait
so if i want to change the lore of the item
how would i do that
Get the ItemMeta and call setLore
public void OnPlayerChat(PlayerChatEvent event) {
//do ifs for chat sequence
Player player = event.getPlayer();
String message = evnt.getMessage();
evnt.setCancelled(true);
switch (event.getPlayer().getEffectivePermissions()) {
case "betterprefixes.owner" -> {
}
case "betterprefixes.admin" -> {
}
}```
How can I get the players permissions in a switch case
how do you get the itemmeta that a player is holding
because
ive done ItemStack itemInMainHand = player.getInventory().getItemInMainHand();
Yeah thats right
ping me if you find a answer to my question*
Just get the ItemMeta of that item.
^
You can't use a switch on a Set like that
Use .contains() would probably be the best way to do that.
Is this the correct use of getitemmeta
It won't actually set it because getItemMeta returns a copy, so you have to re-set it also.
what does that mean
ItemMeta meta = item.getItemMeta();
meta.setLore();
item.setItemMeta(meta);
so
if i pasted this into my code
it would change the lore of the item?
i mean like
I mean... you'd have to actually pass something into setLore() but yes
Although you should understand why it works not just copy paste it.
so i dont have to do anything with iteminmainhand
No, you will have something to do with it.
It's the item you want to compare against and then modify.
right im trying to figure it out and being spoon fed all the answers is nice after 2 days of trying (12 hours + i know its ridiculous but im having a hard time with args) but i'd also like to know how it works
2 days 
ik
but
where do i apply itemInMainHand
i would do
ItemMeta meta = iteminMainHand.getItemMeta();
Yes
k nice
Since ItemMeta returns a copy and not the original, you need to overwrite the original with your copy. You can think of it like how Strings are immutable so you need to return a new string each time you want to make a change to it.
so now meta is the ietm
and i can do whatever i want with meta
such as change name
add atributes
and change lore
correct ?
Yes
And then you have to re-set it like I did, reason is what Shadow just explained here.
tbh im not gonna lie to you and say i understand what any of it means i mean ik what a variable is ofc but wdym by copes and not the original?
oh
a copy
so then
why not just do
itemInMainHand.setlore
Well, try it and you'll see why.
Because that is the ItemStack itself, not the ItemMeta.
oh it doesnt exist
oh
wait so then what is itemstack
is it litterally the item
More or less.
and meta is just the "elements" of the item
The ItemMeta is all of the "extra" data.
right
ok
Let me test it out
also
when looking for the item lore
does it have to be exactly the lore
because my lore has multiple lines...
Depends on how you are looking for things.
if(itemInMainHand.getItemMeta().getLore().equals
That way would require the exact lore.
how do i make it search for part of the lore
If you want to look for individual lines, you have to iterate over the list.
iterate = loop over
There's two ways, but the easiest is with a foreach loop.
for (String s : meta.getLore()) {
// do your comparisons
}
wait
what if i did
nl in my lore.add thing
so that
i dont have to use a loop
Well, yea. If you are adding enchantments, using #add() will more than likely work for your case. However, you will have to loop over your lore when you need to check for individual enchantments.
I'm not adding enchantments
Well, unless you use the PDC, then you wouldn't need to, but that's a separate topic.
im not adding enchants
so
then if its just a lore
can i do nl then?
because the event looks at the code of the item
not the actual item lore right?
Again, it depends on how you implement it.
Walk through your process.
You start with the command.
You add the enchantment if the criteria is met.
Update the item lore as well
I mean the same thing. I'm treating the addition of the lore as the enchantment itself as that's one approach to custom enchantments.
oh ok
the thing doesnt work for some reason
uh
where did i go wrong
oh wait i forgot
itemInMainHand.setItemMeta(meta);
im having problem with the criteria
so
when i went to test it out
it doesnt do anythign
Share your code.
can u explain what you are trying to do with few simple steps
You are checking if the argument length is 0. Meaning that the player only typed in the command and nothing else.
okay thanks. wait 2 seconds ill make you some code
so i need to do 1 right
or greater then 1?
You need to check if the length is equal to 1.
/command args0 args1 args2
Where do I put the .contains()??
does nothing now.
also hover over the yellow thing
Oh, well you are also comparing item materials with #equals. You should be comparing the item material.
ItemStack#getType()
"/Command" "Fox" "1"
/Command would be cmd.getname, "Fox" would be args[0], Fox would also be args.length == 1. 1 would be args[1], 1 would also be args.length == 2
what
meta.getLore().forEach(lore -> {});
ItemStack item = new ItemStack(Material.BOW);
if (item.getType() == Material.BOW) {
// Do whatever you need.
}
☝️ ❤️
for 🤢
I guess three ways lol. I don't use lambda all that often so I forget it exists.
what is lambda ????
Don't worry about it.
Oh LMAo i cannot code without lambda
what is a neural network that learns with trial and error, instead of having an example to go with calledÉ
You don't need it for what you are doing, but it can be used as a syntax shortcut of sorts.
obsessed by functional interfaces?
so
regarding this i have a question
Yes! I use them for everything
::forEach just adds another level of indentation and its ugly when you cannot immediately pass in a method ref
I keep getting this error for my plugin in my console for an InventoryClickEvent and it says .getCurrentItem() is null. It works exactly like I want it to and does what I want when they click on the item, the only thing is that it spams console with this. Anyone know how I can remove this?
should item be itemInMainHand like in or should i litterally use what you are sending me?
show your code
k
Use whatever you called it
current item being null
If you called it that then use that.
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getView().getTitle().equals("§aGame Selector")) {
event.setCancelled(true);
if (event.getCurrentItem().getType().equals(Material.GRASS_BLOCK) && event.getCurrentItem().getItemMeta().getDisplayName().equals("§a§lSurvival")) {
event.getWhoClicked().sendMessage("§aMoving to SURVIVAL...");
sendPlayerToServer((Player) event.getWhoClicked(), "survival");
} else if (event.getCurrentItem().getType().equals(Material.COAL_ORE) && event.getCurrentItem().getItemMeta().getDisplayName().equals("§b§lSkyMining")
event.getWhoClicked().sendMessage("§aMoving to SKYMINING...");
sendPlayerToServer((Player) event.getWhoClicked(), "skymining");
}
}
if (!(BuildModeMap.containsKey(event.getWhoClicked().getUniqueId()))) {
event.setCancelled(true);
}
}
dont compare view names smh but ye your choice
so then this would work correct
this being null event.getCurrentItem()
Yes, that would work.
why not compare that?
2s tryna help 1 guy fast, but intellij crashed
is that why I get the error in console?
ok
dunno exact explenation, its generally bad in terms of scalability ig
add null check
Your error is an NPE, meaning you have no null check.
if event.getcurrent item is null, return;
but that should still give error right cus im tryina use .getCurrentItem()
ok nice
the lore thing works
finally
i mean its not done
but
its what ive been looking for, for over 15 hours
wtf is wrong with my intellijj keeps crashing omg
going to sleep soon:D dont want to
intellij kept giving me errors for a bugged database plugin
is there a way to get player permissions in a switch case?
ok
litterally spent 15 hours for 46 lines of code this includes the imports
😭
i mean it happens
and it doesn't even work -_-
but its not there faut
its the event thing i coded it wrong
and idek why
also
if(itemInMainHand.getItemMeta().getLore().equals(ChatColor.LIGHT_PURPLE + "RARE! " + ChatColor.BLUE + "Telebow III")) {is this done correctly
or is there another way
i should do the
.equals
Did you test it?
Oh, you shouldn't be using stings in #equals when checking lore. You should pass in a List<String> for comparisons.
.contains
what does that mean
kk ty
plz i've been researching and I need help :-C
FINALLY
I MADE IT WORK
HOLY
LETS GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
love that feeling
if (player.hasPermission("permission.a") || player.hasPermission("permission.b")) {} ?
switch (evnt.getPlayer().getEffectivePermissions()) {
case "betterprefixes.owner" -> {
}
case "betterprefixes.admin" -> {
}
}```
like that
omg again crash 😭
but that doesnt work
also
?doesntwork
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Why not just use #contains()?
Agree
I asked a simple question
2s rewriting this third time
can you yes or no?
I always confuse it
I think I got it
for (ItemStack itemStack : player.getInventory()) {
}
How would one know which slot the itemstack is in?
if (event.getCurrentItem().equals(null)) {return;}
Well i like thinking that i did all of thise
also
im going to have fun using my totally not spoon fed plugin
I mean ?google is your best friend too, we are here to help but those questions can be simple googled before asking them
Google your question before asking it:
https://www.google.com/
Bing your question before asking it:
https://www.bing.com/
bing which is?
ip is localhost btw if you want to join and play with me
Well, someone correct me if I'm wrong, but I don't think you can use a List as an input for a switch. Unless you are comparing actual lists themselves. Not the contents of said lists.
:xd:
Hey dont troll
wdym bro its the ip of the server im connecting too?
You must be trolling!
How can I turn this into a switch statement
if (player.hasPermission("betterprefixes.owner")) {
}
if (player.hasPermission("betterprefixes.admin")) {
}
Yes that why, how would you connect thru remote using localhost?
you cant
??
i think your a genius ngl
switches are for enums and Strings, etc. I believe
No, any type of obj
You can use char, string, int, etc
oh wait I can just use a .contains, brain fart lol
no.
I woudl straighntly recommend learning java before starting coding
i dont think u are correct
are you ?learnjava ing me?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
unless you were not including objects like a StringBuilder for example
Defintly no, why would i told u that? Doesnt sound rude?
🤣 🤣 🤣
I suppouse u are trolling because i dont understand what u talk about
also
second question
"any type of object" sounds like you include every custom object there is. primitive types I suppose, as well as enum values
Either that nor dont understanding my humor
can we just end this convo and go on with our day
Oh my bad, i was trying to refer to primitives, Integer, Boolean, String, Double, Char
then yes.
If wont ask for support please move to #general thanks
so was I with the enums, Strings, etc.
get it from the entity that died
event.getEntity
also the same with doing getLastDamageCause() on the same entity
Player killer = event.getEntity().getKiller();
ik
Well since i have a teleport bow thing right i need to use a public void onBowShoot(ProjectileHitEvent event) { but i want to make it so that the person has to shift to be teleport on shoot and not on land see i have it setup like this if(player.isSneaking()) { player.teleport(location); but i dont want to use it like that anymore i want to make it on projectileonlaunch event... so the question im asking can i get the .evententity in a projectileonlaunch...
What=
U want to do your own event?
?custom-events
you want the player to only tp when they were sneaking while shooting?
not quite sure
yes
but right now
it only tps if they are sneaking on land
and i dont want it like that
then only tag the arrow with whatever if they were sneaking while shooting
seems like a no-brainer
huh
you gave one line of code that I can see
unless you posted it earlier, could you link it?
public void onBowShoot(ProjectileHitEvent event) {
if(event.getEntity() instanceof Arrow) {
if(event.getEntity().getShooter() instanceof Player player) {
ItemStack itemInMainHand = player.getInventory().getItemInMainHand();
if(itemInMainHand.getItemMeta().getLore().contains(ChatColor.LIGHT_PURPLE + "RARE! " + ChatColor.BLUE + "Telebow III")) {
Location location = event.getEntity().getLocation();
if(player.isSneaking()) {
player.teleport(location);
player.sendMessage(ChatColor.BLUE + "You have been been teleport by the use of your telebow!");```
this is my current event code
we need the shoot event
and as you can see it uses hitevent
right
so then do i just replace ProjectileHitEvent with ProjectileLaunchEvent
and then boom it works?
you want to teleport where the arrow lands? use projejctilehitevent
right
when a player is shooting the arrow just attach something like "ShouldTeleport" to its scoreboard tags and then check whether the arrow that hit has that tag
You can still have that.
lemme spell it out
Also, I'm not sure if the #isSneaking method works if the player is in the air.
lemme test that
it should work in air, idk why wouldnt it
nope it works
Player shoots -> if sneaking -> arrow.getScoreboardTags.add("ShouldTeleport") -> when arrow hit -> arrow.getScoreboardTags().contains("ShouldTeleport") -> true -> teleport
Wait, are scoreboard tags that easy? I haven't ever used them
not sure how to explain it any clearer XD
yeah, a string list
its not the normal scoreboard tho
They are called Metadata*
I use that for persisting data that doesnt need to persist for long
i would just taken the arrow entity location
they arent nbt tags are they?

elaborate
can you make it just a little bit clearer
how do i get the playershoots thing
show me what you got and Ill show you what I'd do
Is posible to save List<UUID> thru ConfigurationSerializable objects?
if(event.getEntity() instanceof Arrow) {
``` because this is where im at right now
so
yes
then do i add
Answering to?
you
you can make it a list of strings
not sure if UUID is ConfigurationSerializable
Ok, so smth is broken because List<UUID> is not being saved
yea thats probably the best way
you do event.getEntity.getScoreboardTags().add(SomeTag)
ProjectileHitEvent
get hit Block location?
I would make a good fucking question why shity configuration doesnt thru SHITY EXCEPTIOns when you cant serialize an object 😡
I always think and think about continues using public apis they are so home made in reference that they are not
it uses the toString because java assumes it is correct
and toString() isnt always implemented in the best way
if my code looks like this shouldnt the code that is on bottom should be on top since im adding an effect?
So?
I dont udnerstand ur point
shity libraries 😡
The way you order your methods in java doesn't matter. This is a language feature.
If you were using another language like C, then it would matter how your methods are organized.
that does not matter
there isnt a getConfig().getFloat
since im adding an effect should the shoot event go first?
You can use getDouble()
the sequence is determined by the events being fired
youre listening to 2 events which are called at different times
so then the bottom code goes first right?
are you guys trying to assign things to the arrow?
yes?
Float and Double are the same, but one has more numbers support after the coma
not accurate. the bottom code goes when a Projectile is launched
the top one goes when a projectile hits a block or something
yes, the order does not matter
alrightly thanks
now you only need to replace the top isSneaking call with a arrow.getScoreboard().contains(SomeTag) check
only primitives, for enums it uses the ordinal making it an int and for strings i assume the compiler evaluates the hash code making it an int as well
already did that
so whats the check for the arrow has thing
it works for enums
because right now im at if(arrow.getScoreboardTags().contains("ShouldTeleport") )
it uses that
what do i write next
i think
thats all we needed, thanks
we werent arguing about why enums work, we were saying that they work
wdym seems correct
that it looks like it would work on the surface
I cant know without knowing the entirety of your code
but we dont know for sure
your telling me if(arrow.getScoreboardTags().contains("ShouldTeleport") ) { would work?
so you have to try it
but it seems correct enough XD
it makes sense
the Event triggers then hitting
i bet it would
I love how some parts of spigot api is designed i also think and think that the api was designed by a 9y child
you think and think
I think im overthinking this way to much
yes
By the technogly we have the spigot api should be even better than now
looking for a problem when there isnt one
try it out and get back to us
?tryandsee
this works
i think
the concept works
you could use PDC
too complicated for something this simple
send your code
?notork
if the arrow despawns or doesnt hit its important to bind the data to the entity
ik the command
simplest way would be PDC or scoreboard tags
So?
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.inventory.ItemStack;
public class telebowevents implements Listener {
@EventHandler
public void onBowShoot(ProjectileHitEvent event) {
if(event.getEntity() instanceof Arrow) {
if(event.getEntity().getShooter() instanceof Player player) {
ItemStack itemInMainHand = player.getInventory().getItemInMainHand();
if(itemInMainHand.getItemMeta().getLore().contains(ChatColor.LIGHT_PURPLE + "RARE! " + ChatColor.BLUE + "Telebow III")) {
Arrow arrow = (Arrow) event.getEntity();
if(arrow.getScoreboardTags().contains("ShouldTeleport") ) {
Location location = event.getEntity().getLocation();
player.teleport(location);
}
}
}
}
}
@EventHandler
public void onbowshoot(ProjectileLaunchEvent event) {
if(event.getEntity() instanceof Arrow) {
if(event.getEntity().getShooter() instanceof Player player) {
if(player.isSneaking()) {
Arrow arrow = (Arrow) event.getEntity();
arrow.getScoreboardTags().add("Should Teleport");
}
}
}
}
}
but how will you get the player you need to tp
?PASTE
😡 😡 😡
?paste
?paste
mb
I see
Yes
nothing new with discord 
dont rewrite
Discord is completly trash since last updates
always struggles with discord
oh mb
and issues
ty for the tip
np
new UI updates are so weird
they feel less smooth and shit
its not even new but still
LETS GOOOOOOOOOOOOOOOOOOOOOOOOOOOO
🙂
wait does ProjectileHitEvent get called when colliding with a block (stopping the projectile so it technically 'hit')?
now you might wanna customize the tag youre adding and checking to something no other person would add or remove
something like <yourPluginName>:<PlayerWasSneaking>
just in the rare and odd case another plugin did the same thing but different
like Telebow:Telearrow or smth
exactly
they persist
not sure
the name would suggest either of the latter
ive never heard of a scoreboard tag though
I would call them Metadata, its more sophisticated name
I would call them Pebbles, because its just as sophisticated as a rock
although its pretty useful pebbles
i guess its a form of metadata
isnt everything tho?
if everything is meta, nothing is
welp, something else I will probably need 50 times from now on, yet I never thought to google it myself
how would i teleport a player to their last position in a world
cache their location
define "last position"
the last position they were at before they left the world
no
teleport event has a from and to method. just store the from Location when they teleport to another world
is the teleport event triggered when you enter a nether portal?
yes
then thats a viable solution
but do like minecarts count as livingentites?
google is your best source, its what I do to answer these questions
Why give a Minecart equipment???
it does not
but isnt there a category of entites that have an inventory?
Living entities
but a minecart isnt a livingentity
some do
chest minecarts
inventories not equipment
lets say the Interface "Entity" does not contain any inventory or equipment related methods
alright... basically what i wanted to do is detect in a for loop if any entites have an item
for what purpose?
just....
if they are instanceof InventoryHolder or special cases like ItemFrames
oh so i just do instanceof check?
yeah
yes
wait itemframes are inv holders?
no
oh okay
they are special cases like jukeboxes
?1.8
Too old! (Click the link to get the exact time)
can someone help me
Caused by: java.lang.NoSuchMethodError: 'org.bukkit.Location org.bukkit.entity.Player.getLastDeathLocation()'
?stracktrace
ye but y?
?
Why?
Are u making it for a client right?
haha
Now that i code on 1.19 i would charge them $20 only by the reason of using legacy versions + the price of what they want
Oh that thing is really shity
What?
You have to learn maths for coding a plugin?
😐
LMAo
I would defintly take a good amm of money if i were u
Looks like a transformation matrix
how can i get the last location the player was when they died
already tried that
thats it
i get this
I'm not downloading files
use paste it's too annoying to read in discord
whats discord
um
you are running it on a version of Paper thatdoesn't have the method
im in like 1.18 or smh
The answer hasn;t changed
Caused by: java.lang.NoSuchMethodError: 'org.bukkit.Location org.bukkit.entity.Player.getLastDeathLocation()'
found it 🙂 (Didnt ping darth)
how do I use hex color codes in a chat format?
https://www.spigotmc.org/threads/hex-color-code-translate.449748/
The answer is on this.
question
is there any way
for
when an arrow is fired
to get the power that is loaded into the bow
Enchantment?
huh?
Power enchantment?
no im trying to make a bow that doesnt need to be pulled back all the way to have max power
Oh I see.
and that determines
how far the bow arrow will go
im trying to make something that i saw on another server
I'm not sure, have you checked the docs?
?jd-s
I already gave you the link
well
i looked on the docs and its not a thing
but somehow the guy made it with skript
-_-
;P
of course its a thing. getForce()
Hey, how could I give a certain percentage of strength to a player?
huh
what does that mean
attributes
Not giving strength but like 10% of strength
Okay thx
you want to add a modifier
anyone have a copy of that book that essentials gives you when you do /colors?
i feel really lazy and I want to know what light blue is
without looking it up
thanks
me when bored:
p.sendMessage( "§9§l[§1§lOwner§9§l]" + "§4§l" + player.getName() + "§8§l:" + "§4§l" + message);
can you setForce();?
try it 😮
fine 😐
there is a max velocity pre-set i guess
you just need to get the arrow on BowShootEvent
and reset it's velocity
arrow.setVelocity(arrow.getVelocity().normalize().multiply(3));```
someone uses PlotSquared help me?
bowshootevent apparently does not exist
?
ok
worked
so now i need to get the arrow
or is arrow already set
because its a bow shoot event
event.getProjectile()
Arrow arrow = event.getProjectile();
arrow.setVelocity(...);
how do i set a velocity
because i have never used velocity ever.
i dont want to multiply the velocity
i just want it to be like a fully charged bow
even if the player didnt fully charge it
.
you do normalize() to make vector length 1
and then multiply by 3
i guess velocity should be 3 in direction
so this line might work
try it
alright thanks
also
im having an issue completely unrelated to this
im unable to register the event
in my main class
for some reaosn
show code
idk why
show error
no error
show code
show your main class
what does that mean
getServer().getPluginManager().registerEvents(new mlb(), this);
that's completely related to java core
its red
show error
omg chat manager
what would i put here if there's an error that says its null which it is. But the tutorial says i should do it like this?
public WorkloadRunnable workloadRunnable;
this.workloadRunnable.addWorkLoad(placeableBlock);```
and their github
oh wait
im dumb
nvm
Yw <3
so um idk why its red
wait
fuck
i pressed a button
and now its not red
and no more errors
welp
no more error
and it builds
🤦
import it?
what does that mean
hover your mouse on error
there is no more error
IDE would suggest you IMPORT
yeah that was import button
ok nice ty
you definitely don't know java
i guess
and coding plugins
you are violating like every convention
How can I remove the < >'s around the players displayname like essentials?
if (player.hasPermission("betterprefixes.owner")) {
for (Player p : Bukkit.getOnlinePlayers()) {
p.setDisplayName("§9§l[§1§lOwner§9§l]" + "§4§l" + player.getName() + "§8§l:" );
p.sendMessage("§c§l" + message);
}
is that in AsyncPlayerChatEvent
on player chat
?
PlayerChatEvent
well you need to use event.setFormat() insteadd of changing displayname
format is the entire line
event.setFormat(prefix + event.getPlayer().getName() + ":" + event.getMessage());```
alr
you should be able to use %s as well for the name and message
use %1s and %2s (I think) don;t set teh actual message in the format
i personally cancel the event
that works too
evnt.setFormat("§9§l[§1§lOwner§9§l]" + "§4§l" + player.getName() + "§8§l:" + "§c§l" + message);
?
question
yeah
how do i add the lore to the item
but not set it
ilke if the item already has the lore
how do i just add a new line
youd have to clone the list and set the new item meta
lore is a List
acc im not sure if the list is modifiable or not but either way you'd have to setitemmeta again
ItemStack item = yourItem;
ItemMeta meta = item.getItemMeta();
List<String> newLore = meta.getLore();
newLore.add("yourLine");
meta.setLore(newLore);
item.setItemMeta(meta);```
i copied previous lore
Is it against TOS to remove this?
and added new line to it
you can use
declaration: package: org.bukkit.event.player, class: AsyncPlayerChatPreviewEvent
?paste
my plugin doesnt pick up inventoryClickEvents if i move my mouse while clicking, is there anything im missing here?
or smth like this
drag event
whoops
didnt do anything @fluid river
@ event tHandler
public void OnPlayerChat(AsyncPlayerChatEvent evnt) {
ah makes sense, thanks
PlaceableBlock class:
https://paste.md-5.net/xonewiyixo.java
WorkloadRunnable class:
https://paste.md-5.net/netikigiye.java
DistrubtedFiller class:
https://paste.md-5.net/janikuzemo.java
Why isn't this working?
no errors but doesn't do anything
followed the tutorial
you tried relogging to server after block change @quaint mantle
i restarted it
wdym
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I restarted it..
after relog
so?
yep :)
what exactly is not working
thanks lmao
show full code and result
don't use Chunk for updating
players would need to relog to see changes
you need to update using NMSWorld's method
so after relog nothing happened
BlockPosition bp = new BlockPosition(x, y, z);
IBlockData ibd = net.minecraft.server.v1_14_R1.Block.getByCombinedId(blockId + (data << 12));
nmsWorld.setTypeAndData(bp, ibd, applyPhysics ? 3 : 2);
that's changed
im guessing its with the WorkloadRUnnable class
but idk
well idk then
well, that works
i've tested the method
but im testing out the workload
which doesn't but i'm following the tutorial
i'll try with setType ig
one sec
it didnt work nuker
it didnt add anything to the lore
this did not work
@echo basalt sorry to bother but any comment?
hey firedragon
your a smart guy right
sure
what's up
im making a custom enchants plugin right
dont mind the Workload troubles 
so im using lore to check for enchants
and of course i want more then 1 enchant per item
so im trying to figure out
how to add to the lore
but not necessarily set it
like add a new line
I fixed it
sure whats up
so im using lore to check for enchants
and of course i want more then 1 enchant per item
so im trying to figure out
how to add to the lore
but not necessarily set it
like add a new line
Player plr = Bukkit.getPlayer("Outspending");
ItemStack itemStack = new ItemStack(Material.DIAMOND_PICKAXE);
ItemMeta meta = itemStack.getItemMeta();
var lores = meta.getLore();
lores.add("testing"); // add a line
lores.get(2); // get the line
itemStack.setLore(lores);
plr.getInventory().setItemInHand(itemStack);```
Player plr = Bukkit.getPlayer("Outspending");
ItemStack itemStack = new ItemStack(Material.DIAMOND_PICKAXE);
ItemMeta meta = itemStack.getItemMeta();
var lores = meta.getLore();
lores.add("testing"); // add a line
lores.get(2); // get the line
itemStack.setLore(lores);
plr.getInventory().setItemInHand(itemStack);
totally original
can you do itemStack.setLore() lol
anyone want to make a plugin together with intellij code with me?
sure!
no you cant
iCalling dm me
but is this you trying to get somebody else to fix your problems of your already existing code
right
original
but i want to finish this one im working on rn
ItemStack item = inventory.getItem(slot);
ItemMeta meta = item.getItemMeta();
List<String> newLore = meta.getLore();
newLore.add("yourLine");
meta.setLore(newLore);
item.setItemMeta(meta);
// idk if that's needed. But in case you modify clone or just new itemstack, you need this: inventory.setItem(slot, item);```
that im having issues with
ez
did not work
all good ill just dm you some information
invetnory.setItem(slot, item);
?
bruh
learn java
idk which item are you modfiying
there are all just variables
name them whatever you want
here let me elaborate
this is what ive written
and does not work
ItemStack item = new ItemStack(Material.BOW);
if (itemInMainHand.getType() == Material.BOW) {
ItemMeta meta = itemInMainHand.getItemMeta();
List<String> newLore = meta.getLore();
newLore.add(ChatColor.LIGHT_PURPLE + "RARE! " + ChatColor.BLUE + "MegaLongBow III");
meta.setLore(newLore);
item.setItemMeta(meta);```
?paste
By updating to 1.19 
@vocal cloud halp
idk why not working
you need to use itemInMainHand.setItemMeta instead
dumb 👉 👈
what happening here?
