#help-development

1 messages · Page 196 of 1

grim ice
#

just saying

#

if u do what the guy did

#

itll be a very easy dupe bug

#

for any one to abuse

eternal oxide
#

yes, you don't need all that code. Only the code to get the contents

tardy delta
#

isnt a shulkerbox an invholder?

fresh timber
#

how do I use these?

grim ice
eternal oxide
#

Not easily

grim ice
#

idk

fresh timber
#

I've been trying to make it and ppl are using GameProfile object on a variable but I cannot seem to find this

eternal oxide
#

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.

fresh timber
#

bro why does this have to be so hard

eternal oxide
#

because its not vanilla behavior, or API

round finch
#

I need some guidance
where i find some tutorials for java with sql
idk sql 😦

fresh timber
round finch
quaint mantle
#

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

fresh timber
#

for some reason that link starts at end of vid just go to start

eternal oxide
round finch
#

the java part i do understand and connecting

fresh timber
#

literally dont even know what that is

eternal oxide
#

Then its something you should not really attempt. It requires NMS, remapping and packets

quaint mantle
fresh timber
#

sure

kind hatch
fresh timber
#

if !(args.isEmpty())
will run only if it has an arg

#

oop nvm

quaint mantle
#

thanks

fresh timber
#

I did that wrong hold on

quaint mantle
#

oh?

fresh timber
#

if (!(args.isEmpty())) {code}

#

there

#

that

quaint mantle
#

thanks

#

also

tardy delta
#

args is an array?

quaint mantle
#

yes because its a string right?

fresh timber
#

uh yea

eternal oxide
#

length

quaint mantle
#

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

kind hatch
# quaint mantle ```String customenchant = args[0];``` and ```String[] Enchants = {"Telebow", "Ex...

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.

gleaming grove
#

Is there any good approach/library for Integration tests with spigot plugin?

quaint mantle
gleaming grove
quaint mantle
mortal hare
#
* * * * 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
pallid oxide
kind hatch
quaint mantle
#

idk how to do the if enchantments contains args0 bit

kind hatch
#

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.

quaint mantle
#

oh

#

List<String> enchantments = Arrays.asList("Enchant1", "Enchant2", "etc")

#

this

#

ok

#

OH

#

I FIGURED IT OUT

#

I THINK

#

MAYBE

mortal hare
quaint mantle
#

wait

mortal hare
#

here's an example of turing's machine code which counts binary numbers

kind hatch
#

Dude, older instruction sets were crazy.

#

And they didn't even know it.

mortal hare
#

this is basically instructions for the oldest imaginable computing machine that can compute things.

quaint mantle
#

if(args[0] == "Telebow") {

kind hatch
quaint mantle
#

wdym

#

.equals

#

whats that

kind hatch
#

A method that will compare string contents.

#

== compares addresses, not contents.

quaint mantle
#

oh

#

so like this?

kind hatch
#

Yes

quaint mantle
#

kk

#

so now

#

i can do like

#

mk

#

im a step closer to figuring this out

quaint mantle
#

so if i want to change the lore of the item

#

how would i do that

hasty prawn
#

Get the ItemMeta and call setLore

wary topaz
#
    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
quaint mantle
#

because

#

ive done ItemStack itemInMainHand = player.getInventory().getItemInMainHand();

hasty prawn
#

Yeah thats right

wary topaz
#

ping me if you find a answer to my question*

kind hatch
#

Just get the ItemMeta of that item.

hasty prawn
#

^

hasty prawn
#

Use .contains() would probably be the best way to do that.

quaint mantle
#

Is this the correct use of getitemmeta

hasty prawn
#

It won't actually set it because getItemMeta returns a copy, so you have to re-set it also.

quaint mantle
#

what does that mean

hasty prawn
#
ItemMeta meta = item.getItemMeta();
meta.setLore();
item.setItemMeta(meta);
quaint mantle
#

so

#

if i pasted this into my code

#

it would change the lore of the item?

#

i mean like

hasty prawn
#

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.

quaint mantle
#

so i dont have to do anything with iteminmainhand

hasty prawn
#

You do

kind hatch
#

No, you will have something to do with it.

#

It's the item you want to compare against and then modify.

quaint mantle
hasty prawn
#

2 days NotLikeThis

quaint mantle
#

but

#

where do i apply itemInMainHand

#

i would do

#

ItemMeta meta = iteminMainHand.getItemMeta();

hasty prawn
#

Yes

quaint mantle
#

k nice

kind hatch
#

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.

quaint mantle
#

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 ?

hasty prawn
#

Yes

hasty prawn
quaint mantle
#

oh

#

a copy

#

so then

#

why not just do

#

itemInMainHand.setlore

hasty prawn
#

Well, try it and you'll see why.

kind hatch
#

Because that is the ItemStack itself, not the ItemMeta.

quaint mantle
#

oh it doesnt exist

#

oh

#

wait so then what is itemstack

#

is it litterally the item

kind hatch
#

More or less.

quaint mantle
#

and meta is just the "elements" of the item

kind hatch
#

The ItemMeta is all of the "extra" data.

quaint mantle
#

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...

kind hatch
#

Depends on how you are looking for things.

quaint mantle
#

if(itemInMainHand.getItemMeta().getLore().equals

kind hatch
#

That way would require the exact lore.

quaint mantle
#

how do i make it search for part of the lore

kind hatch
#

If you want to look for individual lines, you have to iterate over the list.

quaint mantle
#

what does that mean

#

because i have it like

#

lore.add
lore.add

#

lore.add

kind hatch
#

iterate = loop over

quaint mantle
#

oh ok

#

so how do i do that

kind hatch
#

There's two ways, but the easiest is with a foreach loop.

for (String s : meta.getLore()) {
  // do your comparisons
}
quaint mantle
#

wait

#

what if i did

#

nl in my lore.add thing

#

so that

#

i dont have to use a loop

kind hatch
#

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.

quaint mantle
#

I'm not adding enchantments

kind hatch
#

Well, unless you use the PDC, then you wouldn't need to, but that's a separate topic.

quaint mantle
#

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?

kind hatch
#

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

quaint mantle
#

wdym by adding the enchantment

#

im just adding a lore

kind hatch
#

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.

quaint mantle
#

oh ok

#

the thing doesnt work for some reason

#

uh

#

where did i go wrong

#

oh wait i forgot

#

itemInMainHand.setItemMeta(meta);

quaint mantle
#

so

#

when i went to test it out

#

it doesnt do anythign

kind hatch
#

Share your code.

quaint mantle
pallid oxide
quaint mantle
#

uh basically

#

im trying to make a command

#

that changes the lore of the held item

kind hatch
#

You are checking if the argument length is 0. Meaning that the player only typed in the command and nothing else.

pallid oxide
#

okay thanks. wait 2 seconds ill make you some code

quaint mantle
#

or greater then 1?

kind hatch
#

You need to check if the length is equal to 1.
/command args0 args1 args2

wary topaz
tardy delta
#

also hover over the yellow thing

kind hatch
#

Oh, well you are also comparing item materials with #equals. You should be comparing the item material.
ItemStack#getType()

wary topaz
#

"/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

sterile token
kind hatch
#
ItemStack item = new ItemStack(Material.BOW);

if (item.getType() == Material.BOW) {
  // Do whatever you need.
}
sterile token
kind hatch
quaint mantle
#

what is lambda ????

kind hatch
#

Don't worry about it.

sterile token
grim ice
#

what is a neural network that learns with trial and error, instead of having an example to go with calledÉ

kind hatch
tardy delta
quaint mantle
#

regarding this i have a question

sterile token
tardy delta
#

::forEach just adds another level of indentation and its ugly when you cannot immediately pass in a method ref

fresh timber
#

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?

quaint mantle
fresh timber
#

k

tardy delta
#

current item being null

hasty prawn
#

If you called it that then use that.

fresh timber
# pallid oxide show your code
@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);
    }
}
tardy delta
#

dont compare view names smh but ye your choice

quaint mantle
tardy delta
#

this being null event.getCurrentItem()

kind hatch
fresh timber
pallid oxide
fresh timber
#

is that why I get the error in console?

tardy delta
#

dunno exact explenation, its generally bad in terms of scalability ig

pallid oxide
#

add null check

kind hatch
pallid oxide
#

if event.getcurrent item is null, return;

fresh timber
#

but that should still give error right cus im tryina use .getCurrentItem()

quaint mantle
#

the lore thing works

#

finally

#

i mean its not done

#

but

#

its what ive been looking for, for over 15 hours

pallid oxide
#

wtf is wrong with my intellijj keeps crashing omg

fresh timber
#

restart pc xD

#

always works

pallid oxide
#

going to sleep soon:D dont want to

tardy delta
#

intellij kept giving me errors for a bugged database plugin

wary topaz
#

is there a way to get player permissions in a switch case?

fresh timber
#

ok

quaint mantle
#

litterally spent 15 hours for 46 lines of code this includes the imports

pallid oxide
#

i mean it happens

quaint mantle
#

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

wary topaz
#

Did you test it?

quaint mantle
#

it no work

kind hatch
#

Oh, you shouldn't be using stings in #equals when checking lore. You should pass in a List<String> for comparisons.

wary topaz
#

.contains

wary topaz
quaint mantle
#

FINALLY

#

I MADE IT WORK

#

HOLY

#

LETS GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

wary topaz
#

love that feeling

quaint mantle
#

if i ever realese it

#

im gonna max out the number of authors

#

there is

sterile token
wary topaz
#
switch (evnt.getPlayer().getEffectivePermissions()) {
            case "betterprefixes.owner" -> {

            }

            case "betterprefixes.admin" -> {

            }
        }```
#

like that

pallid oxide
#

omg again crash 😭

wary topaz
#

but that doesnt work

quaint mantle
#

also

sterile token
undone axleBOT
#

"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.

kind hatch
sterile token
wary topaz
#

I asked a simple question

wary topaz
#

can you yes or no?

fresh timber
stuck flax
#
for (ItemStack itemStack : player.getInventory()) {
}

How would one know which slot the itemstack is in?

fresh timber
#

if (event.getCurrentItem().equals(null)) {return;}

quaint mantle
#

Well i like thinking that i did all of thise

#

also

#

im going to have fun using my totally not spoon fed plugin

sterile token
quaint mantle
#

?google

undone axleBOT
sterile token
#

bing which is?

quaint mantle
#

ip is localhost btw if you want to join and play with me

kind hatch
# wary topaz can you yes or no?

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.

quaint mantle
#

:xd:

sterile token
quaint mantle
#

wdym bro its the ip of the server im connecting too?

sterile token
fresh timber
#

nah its the ip of your loacal network

#

local

wary topaz
#

How can I turn this into a switch statement

if (player.hasPermission("betterprefixes.owner")) {

        }
        if (player.hasPermission("betterprefixes.admin")) {
            
        }
sterile token
#

Yes that why, how would you connect thru remote using localhost?

undone axleBOT
wary topaz
#

??

quaint mantle
#

i think your a genius ngl

crimson terrace
#

switches are for enums and Strings, etc. I believe

sterile token
#

You can use char, string, int, etc

wary topaz
#

oh wait I can just use a .contains, brain fart lol

crimson terrace
sterile token
#

I woudl straighntly recommend learning java before starting coding

sterile token
wary topaz
#

are you ?learnjava ing me?

quaint mantle
#

?learnjava

undone axleBOT
crimson terrace
sterile token
#

🤣 🤣 🤣

sterile token
# wary topaz ;-;

I suppouse u are trolling because i dont understand what u talk about

crimson terrace
sterile token
#

Either that nor dont understanding my humor

wary topaz
#

can we just end this convo and go on with our day

sterile token
sterile token
crimson terrace
atomic swift
#

why cant i get the killer from EntityDeathEvent

#

or cause

crimson terrace
wary topaz
#

event.getEntity

crimson terrace
#

also the same with doing getLastDamageCause() on the same entity

atomic swift
crimson terrace
#

ye

#

may be null

atomic swift
#

ik

quaint mantle
#

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...

sterile token
#

U want to do your own event?

quaint mantle
#

no

#

what

#

huh

sterile token
#

?custom-events

crimson terrace
#

you want the player to only tp when they were sneaking while shooting?

#

not quite sure

quaint mantle
#

but right now

#

it only tps if they are sneaking on land

#

and i dont want it like that

crimson terrace
#

then only tag the arrow with whatever if they were sneaking while shooting

#

seems like a no-brainer

quaint mantle
#

huh

crimson terrace
#

you gave one line of code that I can see

#

unless you posted it earlier, could you link it?

quaint mantle
#
    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

crimson terrace
#

we need the shoot event

quaint mantle
#

and as you can see it uses hitevent

quaint mantle
#

so then do i just replace ProjectileHitEvent with ProjectileLaunchEvent

#

and then boom it works?

crimson terrace
#

no

#

hold on

pallid oxide
#

you want to teleport where the arrow lands? use projejctilehitevent

crimson terrace
#

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

quaint mantle
#

but i want to have a check

#

if the player was sneaking when shooting

kind hatch
#

You can still have that.

crimson terrace
#

lemme spell it out

kind hatch
#

Also, I'm not sure if the #isSneaking method works if the player is in the air.

pallid oxide
#

it should work in air, idk why wouldnt it

crimson terrace
#

Player shoots -> if sneaking -> arrow.getScoreboardTags.add("ShouldTeleport") -> when arrow hit -> arrow.getScoreboardTags().contains("ShouldTeleport") -> true -> teleport

quaint mantle
#

oh ok

#

lemme test this out

kind hatch
#

Wait, are scoreboard tags that easy? I haven't ever used them

crimson terrace
#

not sure how to explain it any clearer XD

crimson terrace
#

its not the normal scoreboard tho

sterile token
crimson terrace
#

I use that for persisting data that doesnt need to persist for long

round finch
#

i would just taken the arrow entity location

crimson terrace
round finch
crimson terrace
quaint mantle
#

how do i get the playershoots thing

crimson terrace
sterile token
#

Is posible to save List<UUID> thru ConfigurationSerializable objects?

quaint mantle
#
        if(event.getEntity() instanceof Arrow) {
            ``` because this is where im at right now
#

so

crimson terrace
#

yes

quaint mantle
#

then do i add

sterile token
crimson terrace
#

you

#

you can make it a list of strings

#

not sure if UUID is ConfigurationSerializable

quaint mantle
#

il just do

#

if(event.getEntity().getShooter() instanceof Player player) {

sterile token
crimson terrace
#

yea thats probably the best way

crimson terrace
round finch
#

ProjectileHitEvent

get hit Block location?

sterile token
#

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

crimson terrace
#

and toString() isnt always implemented in the best way

quaint mantle
#

if my code looks like this shouldnt the code that is on bottom should be on top since im adding an effect?

sterile token
#

I dont udnerstand ur point

crimson terrace
#

Or it just uses the objects name

#

which is nonsense to us

sterile token
#

shity libraries 😡

kind hatch
atomic swift
#

there isnt a getConfig().getFloat

quaint mantle
sterile token
crimson terrace
#

youre listening to 2 events which are called at different times

quaint mantle
#

so then the bottom code goes first right?

round finch
#

are you guys trying to assign things to the arrow?

quaint mantle
#

yes?

sterile token
#

Float and Double are the same, but one has more numbers support after the coma

quaint mantle
crimson terrace
#

the top one goes when a projectile hits a block or something

quaint mantle
#

ok

#

so then i have it setup correctly

crimson terrace
#

yes, the order does not matter

quaint mantle
#

alrightly thanks

crimson terrace
#

now you only need to replace the top isSneaking call with a arrow.getScoreboard().contains(SomeTag) check

glossy venture
quaint mantle
#

so whats the check for the arrow has thing

glossy venture
#

yeah

#

an enum value has an ordinal

#

which is an int

#

unique per field

quaint mantle
#

because right now im at if(arrow.getScoreboardTags().contains("ShouldTeleport") )

glossy venture
#

it uses that

quaint mantle
#

what do i write next

glossy venture
#

i think

crimson terrace
#

we werent arguing about why enums work, we were saying that they work

glossy venture
#

ah

#

lmao

crimson terrace
#

for teleporting

quaint mantle
#

yeah i know that

#

but

#

the check

#

to see if the arrow

#

has the thing

crimson terrace
#

seems correct

#

try it out

quaint mantle
#

wdym seems correct

glossy venture
#

that it looks like it would work on the surface

crimson terrace
#

I cant know without knowing the entirety of your code

glossy venture
#

but we dont know for sure

quaint mantle
#

your telling me if(arrow.getScoreboardTags().contains("ShouldTeleport") ) { would work?

glossy venture
#

so you have to try it

crimson terrace
#

but it seems correct enough XD

round finch
#

the Event triggers then hitting

glossy venture
#

i bet it would

sterile token
#

I love how some parts of spigot api is designed i also think and think that the api was designed by a 9y child

glossy venture
#

you think and think

quaint mantle
#

I think im overthinking this way to much

crimson terrace
#

yes

sterile token
#

By the technogly we have the spigot api should be even better than now

quaint mantle
#

looking for a problem when there isnt one

crimson terrace
#

try it out and get back to us

sterile token
undone axleBOT
sterile token
#

I mean when have dudes, just try the code!!

#

Dont ask if it will work or not

glossy venture
#

i think

#

the concept works

#

you could use PDC

crimson terrace
quaint mantle
#

either way doesnt work

crimson terrace
sterile token
glossy venture
quaint mantle
glossy venture
#

simplest way would be PDC or scoreboard tags

sterile token
quaint mantle
#

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");
                }
            }
        }
    }
}
glossy venture
#

but how will you get the player you need to tp

quaint mantle
#

?paste

undone axleBOT
glossy venture
#

?paste

quaint mantle
#

mb

undone axleBOT
glossy venture
#

discord hello

#

laggy as fuck

sterile token
quaint mantle
crimson terrace
#

you used 2 different tags

#

copy paste them

round finch
crimson terrace
#

dont rewrite

sterile token
#

Discord is completly trash since last updates

round finch
#

always struggles with discord

quaint mantle
round finch
#

and issues

quaint mantle
#

ty for the tip

crimson terrace
#

np

glossy venture
#

they feel less smooth and shit

quaint mantle
#

OMGEE

#

IT WORKS

glossy venture
#

its not even new but still

quaint mantle
#

LETS GOOOOOOOOOOOOOOOOOOOOOOOOOOOO

crimson terrace
#

🙂

quaint mantle
#

ok im going to eat dinner

#

il bother you with more dumb stuff in 20 or so minutes

glossy venture
#

wait does ProjectileHitEvent get called when colliding with a block (stopping the projectile so it technically 'hit')?

crimson terrace
#

something like <yourPluginName>:<PlayerWasSneaking>

#

just in the rare and odd case another plugin did the same thing but different

glossy venture
#

like Telebow:Telearrow or smth

crimson terrace
glossy venture
#

are scoreboard tags discarded when the entity is unloaded

#

or saved

crimson terrace
#

they persist

glossy venture
#

ah

#

nbt?

crimson terrace
#

not sure

glossy venture
#

or in the world scoreboard

#

or game scoreboard idk

crimson terrace
#

the name would suggest either of the latter

glossy venture
#

ive never heard of a scoreboard tag though

sterile token
#

I would call them Metadata, its more sophisticated name

crimson terrace
#

I would call them Pebbles, because its just as sophisticated as a rock

glossy venture
#

its not full on metadata

#

literally a list of strings

crimson terrace
#

although its pretty useful pebbles

glossy venture
#

i guess its a form of metadata

crimson terrace
#

isnt everything tho?

glossy venture
#

idk isnt metadata extra or something

#

otherwise why not call it data

crimson terrace
#

if everything is meta, nothing is

glossy venture
#

epic

crimson terrace
#

welp, something else I will probably need 50 times from now on, yet I never thought to google it myself

torn oyster
#

how would i teleport a player to their last position in a world

crimson terrace
#

define "last position"

torn oyster
#

the last position they were at before they left the world

crimson terrace
#

cache their location for every world every second or so

#

is anything unclear?

torn oyster
#

no

eternal oxide
#

teleport event has a from and to method. just store the from Location when they teleport to another world

crimson terrace
#

is the teleport event triggered when you enter a nether portal?

eternal oxide
#

yes

crimson terrace
#

then thats a viable solution

serene sigil
#

is there a way to getEquiptment of an entity?

#

(not LivingEntity)

crimson terrace
#

no

#

Entity does not have Equipment I think

serene sigil
#

but do like minecarts count as livingentites?

crimson terrace
#

google is your best source, its what I do to answer these questions

chrome beacon
#

Why give a Minecart equipment???

crimson terrace
#

it does not

serene sigil
#

but isnt there a category of entites that have an inventory?

crimson terrace
#

Living entities

serene sigil
#

but a minecart isnt a livingentity

crimson terrace
#

and?

#

does it have an inventory?

eternal oxide
#

some do

serene sigil
#

chest minecarts

eternal oxide
#

inventories not equipment

crimson terrace
#

lets say the Interface "Entity" does not contain any inventory or equipment related methods

serene sigil
#

alright... basically what i wanted to do is detect in a for loop if any entites have an item

crimson terrace
#

for what purpose?

serene sigil
#

just....

eternal oxide
#

if they are instanceof InventoryHolder or special cases like ItemFrames

serene sigil
#

oh so i just do instanceof check?

crimson terrace
#

yeah

eternal oxide
#

yes

serene sigil
eternal oxide
#

no

serene sigil
#

oh okay

eternal oxide
#

they are special cases like jukeboxes

sterile token
#

?1.8

undone axleBOT
sterile token
#

haha ignore me bro 👉 👈 +

#

Im just having exams and really stressed with that 🥺

atomic swift
sterile token
#

Caused by: java.lang.NoSuchMethodError: 'org.bukkit.Location org.bukkit.entity.Player.getLastDeathLocation()'

#

?stracktrace

atomic swift
#

ye but y?

sterile token
#

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

round finch
#

sounds fun

#

Math arrays

sterile token
#

What?

#

You have to learn maths for coding a plugin?

#

😐

#

LMAo

#

I would defintly take a good amm of money if i were u

drowsy helm
#

Looks like a transformation matrix

round finch
#

whats a?

#

area?

atomic swift
#

how can i get the last location the player was when they died

river oracle
#

You can't unless you save it manually

#

Afaik

eternal oxide
#

thats it

atomic swift
river oracle
#

Please

#

?paste

undone axleBOT
river oracle
#

I'm not downloading files

eternal oxide
#

use paste it's too annoying to read in discord

atomic swift
#

whats discord

eternal oxide
#

um

atomic swift
eternal oxide
#

you are running it on a version of Paper thatdoesn't have the method

atomic swift
eternal oxide
#

The answer hasn;t changed

#

Caused by: java.lang.NoSuchMethodError: 'org.bukkit.Location org.bukkit.entity.Player.getLastDeathLocation()'

wary topaz
#

found it 🙂 (Didnt ping darth)

fresh timber
#

how do I use hex color codes in a chat format?

wary topaz
quaint mantle
#

question

#

is there any way

#

for

#

when an arrow is fired

#

to get the power that is loaded into the bow

wary topaz
#

Enchantment?

quaint mantle
#

huh?

wary topaz
#

Power enchantment?

quaint mantle
#

no im trying to make a bow that doesnt need to be pulled back all the way to have max power

quaint mantle
#

you know how like you pull back a bow

wary topaz
#

Oh I see.

quaint mantle
#

and that determines

#

how far the bow arrow will go

#

im trying to make something that i saw on another server

wary topaz
#

I'm not sure, have you checked the docs?

quaint mantle
#

link?

#

for the docs

eternal oxide
#

?jd-s

undone axleBOT
wary topaz
#

not 1.12*

#

1.19

eternal oxide
#

I already gave you the link

quaint mantle
#

well

#

i looked on the docs and its not a thing

#

but somehow the guy made it with skript

#

-_-

wary topaz
#

;P

eternal oxide
#

of course its a thing. getForce()

quaint mantle
#

oh

#

so

bright cedar
#

Hey, how could I give a certain percentage of strength to a player?

quaint mantle
#

huh

quaint mantle
bright cedar
eternal oxide
#

attributes

#

search spigot player attributes

bright cedar
#

Okay thx

eternal oxide
#

you want to add a modifier

wary topaz
#

anyone have a copy of that book that essentials gives you when you do /colors?

quaint mantle
#

Why do you want the color code?

wary topaz
#

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);

quaint mantle
wary topaz
#

try it 😮

quaint mantle
#

fine 😐

fluid river
#

you just need to get the arrow on BowShootEvent

#

and reset it's velocity

#
arrow.setVelocity(arrow.getVelocity().normalize().multiply(3));```
river arch
#

someone uses PlotSquared help me?

fluid river
#

wrong channel

quaint mantle
#

bowshootevent apparently does not exist

#

?

fluid river
#

EntityBowShootEvent i guess

#

or ShootBow

#

don't remember

quaint mantle
#

ok

quaint mantle
#

so now i need to get the arrow

#

or is arrow already set

#

because its a bow shoot event

fluid river
#

event.getProjectile()

#

Arrow arrow = event.getProjectile();

#

arrow.setVelocity(...);

quaint mantle
#

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

fluid river
#

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

quaint mantle
#

alright thanks

#

also

#

im having an issue completely unrelated to this

#

im unable to register the event

#

in my main class

#

for some reaosn

fluid river
#

show code

quaint mantle
#

idk why

fluid river
#

show error

quaint mantle
#

no error

fluid river
#

show code

quaint mantle
#

just when i try to register my class

#

it just wont show up

fluid river
#

show your main class

quaint mantle
fluid river
#

you didn't register mlb

quaint mantle
#

what does that mean

fluid river
#

getServer().getPluginManager().registerEvents(new mlb(), this);

quaint mantle
#

well

#

when i try to do that

fluid river
quaint mantle
#

its red

fluid river
#

show error

wary topaz
fluid river
#

omg chat manager

quaint mantle
#

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

quaint mantle
#

wait

#

fuck

#

i pressed a button

#

and now its not red

#

and no more errors

#

welp

#

no more error

#

and it builds

#

🤦

fluid river
quaint mantle
#

what does that mean

fluid river
#

hover your mouse on error

quaint mantle
#

there is no more error

fluid river
#

IDE would suggest you IMPORT

quaint mantle
#

error gone

#

i pressed something

#

idk what

#

and error gone

fluid river
#

yeah that was import button

quaint mantle
#

ok nice ty

fluid river
#

you definitely don't know java

#

i guess

#

and coding plugins

#

you are violating like every convention

wary topaz
#

How can I remove the < >'s around the players displayname like essentials?

fluid river
#

show your current chatmanger code

#

which sets message format

wary topaz
#

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);
}

fluid river
#

is that in AsyncPlayerChatEvent

wary topaz
#

on player chat

fluid river
#

?

wary topaz
#

PlayerChatEvent

fluid river
#

well you need to use event.setFormat() insteadd of changing displayname

#

format is the entire line

wary topaz
#

o

#

but I dont want to replace the message

fluid river
#
event.setFormat(prefix + event.getPlayer().getName() + ":" + event.getMessage());```
wary topaz
#

alr

upper vale
#

you should be able to use %s as well for the name and message

eternal oxide
#

use %1s and %2s (I think) don;t set teh actual message in the format

fluid river
#

i personally cancel the event

eternal oxide
#

that works too

fluid river
#

and just do bukkit.broadcastMessage

#

with format i need

wary topaz
#

evnt.setFormat("§9§l[§1§lOwner§9§l]" + "§4§l" + player.getName() + "§8§l:" + "§c§l" + message);

#

?

quaint mantle
#

question

fluid river
#

yeah

quaint mantle
#

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

upper vale
#

youd have to clone the list and set the new item meta

eternal oxide
#

lore is a List

upper vale
#

acc im not sure if the list is modifiable or not but either way you'd have to setitemmeta again

fluid river
#
ItemStack item = yourItem;
ItemMeta meta = item.getItemMeta();
List<String> newLore = meta.getLore();
newLore.add("yourLine");
meta.setLore(newLore);
item.setItemMeta(meta);```
quaint mantle
#

why did you add newlore

#

does that add to new old one??

fluid river
#

i copied previous lore

wary topaz
#

Is it against TOS to remove this?

fluid river
#

and added new line to it

quaint mantle
#

?paste

undone axleBOT
torpid sapphire
#

my plugin doesnt pick up inventoryClickEvents if i move my mouse while clicking, is there anything im missing here?

fluid river
#

or smth like this

eternal oxide
#

drag event

quaint mantle
#

whoops

wary topaz
#

didnt do anything @fluid river

#

@ event tHandler
public void OnPlayerChat(AsyncPlayerChatEvent evnt) {

torpid sapphire
quaint mantle
#

no errors but doesn't do anything

#

followed the tutorial

fluid river
#

you tried relogging to server after block change @quaint mantle

wary topaz
#

i restarted it

fluid river
undone axleBOT
#

"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.

fluid river
#

try relogging to server

#

leave and enter

#

does anything happen

wary topaz
#

I restarted it..

fluid river
#

after relog

quaint mantle
#

oh

#

okay

fluid river
#

so?

quaint mantle
#

yep :)

fluid river
quaint mantle
#

thanks lmao

fluid river
#

show full code and result

fluid river
#

players would need to relog to see changes

wary topaz
fluid river
#

idk tho

#

i thought you need to work around AsyncPlayerChatPreviewEvent

fluid river
quaint mantle
#

wait

#

wait

#

sorry i had other testing plugins :/

#

that didn't fix it

fluid river
#

so after relog nothing happened

quaint mantle
#

no errors still

#

no

#

has something to do with the WorkloadRunnable im guessing

fluid river
#

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);

quaint mantle
#

im guessing its with the WorkloadRUnnable class

#

but idk

fluid river
#

well idk then

quaint mantle
#

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

quaint mantle
#

@echo basalt sorry to bother but any comment?

quaint mantle
#

your a smart guy right

#

sure

#

what's up

#

im making a custom enchants plugin right

#

dont mind the Workload troubles catChill

#

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

wary topaz
#

I fixed it

quaint mantle
#

ggs

#

can you um help me

wary topaz
#

sure whats up

quaint mantle
#

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);```
wary topaz
#
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);
quaint mantle
#

lmao

#

did you just copy paste

wary topaz
#

totally original

quaint mantle
#

breh

#

do i need the Player plr = Bukkit.getPlayer("Outspending");

#

?

#

no

#

kk ty

wary topaz
#

remove the quotes

#

and outspending

quaint mantle
#

wait

#

are you outspending?\

#

like is that your username

fluid river
#

can you do itemStack.setLore() lol

wary topaz
#

anyone want to make a plugin together with intellij code with me?

fluid river
#

no you cant

wary topaz
#

iCalling dm me

quaint mantle
wary topaz
#

nope

#

completely new plugin

quaint mantle
#

right

wary topaz
#

original

quaint mantle
#

but i want to finish this one im working on rn

fluid river
#
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);```
quaint mantle
#

that im having issues with

fluid river
#

ez

wary topaz
#

all good ill just dm you some information

fluid river
#

i changed the code

#

it's not same

quaint mantle
#

invetnory.setItem(slot, item);

fluid river
#

?

quaint mantle
#

invetnory. should i type it like this or?

#

also

fluid river
#

bruh

#

learn java

#

idk which item are you modfiying

#

there are all just variables

#

name them whatever you want

quaint mantle
#

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

undone axleBOT
quaint mantle
#

this is my full code

vocal cloud
#

By updating to 1.19 KEKLEO

quaint mantle
#

idk why not working

fluid river
#

dumb 👉 👈

round finch
#

what happening here?

fluid river
#

who knows

#

free java lessons

#

hehe

#

free linear algebra lessons

#

free calculus lessons

round finch
#

ItemStack ItemMainHand = getting the item in hand something

#

?