#help-development

1 messages · Page 1715 of 1

gusty bough
#

There is something i can't make with spigot so idk what to do

ivory sleet
#

I just pushed it, but yeah that should give you an idea

vagrant stratus
#

You get the src when running buildtools

quaint mantle
#

Anyone?

young knoll
#

Sign is a state

#

Or a block data, don’t remember

tardy flame
#

try Block.getState()

#

!(block.getState() instanceof Sign

quaint mantle
#

I did that

#

But I can't seem to cast the block to Sign

young knoll
#

You can’t cast a block to a sign

#

You have to cast the state

tardy flame
#

^^

#

Something like this ```java
((Sign) block.getState())

muted idol
#

hey there quick question is there any way to add custom text on this screen?

#

since i would like to check my sql db there so it dosen't disturb ingame

eternal night
#

resource packs might be able to change this

#

servers cannot

young knoll
#

They can

#

But server resources packs are applied too late

vestal dome
#

ok so uhm, can someone help me, I'm trying to make a plugin where I'm trying to use modules to create an EnchantmentAPI using Bukkit's api, but I cannot make it work using modules...

ivory sleet
#

is it gradle or maven?

vestal dome
#

I'm stuck because my api and the modules rely on each other, and maven for some reason, is a dumbass, and I don't know how to make maven build the revisions and api to put into a jar.

#

maven

ivory sleet
#

aww maven

#

ok @eternal oxide I summon you (sry for the innocent ping)

eternal oxide
#

Yeah, I don;t use modules I'm afraid

ivory sleet
#

oh

vestal dome
#

oh fu** my life

ivory sleet
#

But yeah, in short, gradle 😄

vagrant stratus
#

fuck gradle lol

ivory sleet
#

no 😦

vagrant stratus
#

ye

vestal dome
#

I like maven

ivory sleet
#

yeah me too

#

but there's only so much you can do with maven

eternal oxide
#

What issues are you having?

vestal dome
#

I actually hate my life, I've been trying to find this stupid solution for like 5 days already.

vestal dome
#

because maven doesn't want to compile the revisions and api at the same time.

#

I NEED maven to compile them at the same time because I want to create shitpack (jitpack)...

#

well

#

not create

#

you understand me

eternal oxide
#

There was a demo of multi version maven

#

I can;t remember the devs name. but its a well known dev

#

let me think a sec

vestal dome
#

just please do because I'm already having 2 mental breakdowns with this stupid maven conversations.

vestal dome
#

Awhhhhh

#

I love you.

#

I love you so fu**ing much

shadow tide
#

I can't figure out how to get all of the online players in a list of strings i have been asking for so long and I cant understand please help me

solar sable
#

guys i want to make a sound plays when i execute my command but how to do it?

#

i want it like a bell sound or something

shadow tide
#

use something like this, java Location playerLocation = player.getLocation(); player.playSound(playerLocation, Sound.BLOCK_BELL_USE, 10, 5)

young knoll
#

Use world.playSound if you want others to hear it

solar sable
#

well i did something but for some reason instead of sending a message i told it, it insteads send a message of /meow in the chat

young knoll
#

don't return false

#

Or it will send the command usage

solar sable
#

ooh

#

my bad

eternal oxide
solar sable
#
@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("Meow")){
            Player p = (Player)sender;
            if (sender instanceof Player){
                p.sendMessage(ChatColor.RED + "Playing cat meowing sound");
                p.playSound(p.getLocation(), Sound.ENTITY_CAT_BEG_FOR_FOOD, 2F, 1F);
                return true;
            }
        }
        return true;
    }
``` well the return true; at the bottom was false but its changed to true now so now it will be fixed right?
eternal oxide
#

Bukkit.getOnlinePlayers().stream().map(Player::getName)

crude hound
#

hello it's still me with another problem : I want that an entity AI make that the entity never go away from a chunk

wispy plume
quaint mantle
#

How would i add tab completion for an second argument?

#

I have an command, /sign

#

where if you use /sign copy, it does not require any arguments

#

but with /sign paste

#

it requires an UUID as argument

young knoll
#

Same way you do it with 1 arg

quaint mantle
#

and i want to autocomplete the 1st argument, ("copy" or "paste"), and the 2nd argument (the uuid)

young knoll
#

Just check the length of args in the tab complete method

quaint mantle
#

im bad at math so idk what expression to make

#

can you help me with this?

#

i figured it out

#

I have to make the if statement args.length == 1 and the switch args[0]

vestal dome
#
[ERROR] [ERROR] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='ml.jadss:API:1.0-JadLaxyDev'}' and 'Vertex{label='ml.jadss:EnchantmentRev1:1.0-JadLaxy'}' introduces to cycle in the graph ml.jadss:EnchantmentRev1:1.0-JadLaxy --> ml.jadss:API:1.0-JadLaxyDev --> ml.jadss:EnchantmentRev1:1.0-JadLaxy @ 
#

can someone help me?

#

I'm having this

hasty jackal
#

your modules/projects are depending on another in a cyclic way

vestal dome
#

what am I even supposed to do IN THAT CASE?

#

because they DEPEND ON EACH OTHER.

hasty jackal
#

well ... make only one depend on the other

vestal dome
#

can't

hasty jackal
#

tough luck

subtle folio
#

How do I check if a material is Oak Planks?

vestal dome
vestal dome
hasty jackal
#

you refactor your code so you get a tree structure instead of a graph

#

so that A -> B but B -/-> A

vestal dome
#

ehhhhhhhhhhhhhhhhhhhh

#

hates life

shadow tide
#

also, how do I check if a string is equal to anything inside a list of strings

#

@eternal oxide

burnt current
#

quick question: how can I get a compass to point to a specific location?

eternal oxide
stone sinew
burnt current
#

then every compass in the player's inventory points there right?

hasty jackal
burnt current
#

ok thank you

shadow tide
#

also, how do I check if a string is equal to anything inside a list of strings

eternal oxide
#

.contains

shadow tide
hasty jackal
#

it's a method on list, what are you saying

shadow tide
#

i'm doing args[0].contains it isn't a method

eternal oxide
#

of course not, thatrs a String

shadow tide
#

wait

#

no

shadow tide
#

I should have been doing something else, I was doing it backwards

#

what do I put in place of this?

#

Player::getName

paper viper
#

thats completely different...

shadow tide
#

i know

paper viper
#

this is why you learn basics first

#

what you described is an array

eternal oxide
#

you don;t put anything in place of that

paper viper
#

and retreiving an element

shadow tide
#

ok, then can you explain what that means

#

?

#

so I know in the future

eternal oxide
#

its calling the getName method of Player

paper viper
#

Are you trying to find if a player is in a list or something?

#

Dont check by name in that case

shadow tide
#

ok, but why two ":"s?

paper viper
#

its called a method reference

#

🙄

eternal oxide
shadow tide
eternal oxide
#

same as player -> player.getName()

shadow tide
#

yeah, I... have... no idea what, or how to use a "->" (forgot what its called)

paper viper
#

lambda notation

shadow tide
#

yeah

paper viper
#

well lets start of with just a normal for loop instead

#

if you cant do a normal for loop

#

dont think about the shortcuts

shadow tide
#

I can

paper viper
#

Ok then show us first

shadow tide
#

for loops = ez

eternal oxide
#

then loop over Bukkit.getOnlinePlayers() and pull all names placing them in a List

hardy pivot
#

Hi i was wondering how i can use multi args like one?

like /msg hi rob

using all the args after msg like on

#

one*

shadow tide
#
for (int a = 0; a < 10; a++) {
//code here
}```
paper viper
#

Now apply that for your use case

#

not just a simple for loop

eternal oxide
#
for (Player player: Bukkit.getOnlinePlayers())```
paper viper
#

^

shadow tide
#

ok, then idk how to use a for loop lol

paper viper
#

dude for loops are the second thing you learn

eternal oxide
#

both of those are for loops

paper viper
#

right after sysout

#

lmao

young knoll
#

Maybe for you

eternal oxide
#

one you are incrementing a counter, the other you are looping over player objects

shadow tide
#

?learnjava only showed me ez for loops

young knoll
#

Trying to remember what my college taught first

#

Probably if

paper viper
#

thats kinda dumb. Like usually they give us the problem, oh how do we print this out 100 times now?

shadow tide
#

i'm not even in high

young knoll
#

I mean I've been in this course for 3 years and I haven't learned much above what they taught me in grade 12

#

¯_(ツ)_/¯

#

At least I get the paper

shadow tide
#

lol

crimson terrace
#

People have been teaching me java for years and I still had to find out about foreach loops myself. sometimes people just dont teach you the good stuff

young knoll
#

Technically they are called "Enhanced for loops"

#

Which is a weird name

eternal oxide
#

Java is nice that it has so many way of doing things

paper viper
#

foreach loops

young knoll
#

And yet there are still some things I really want :p

paper viper
#

Who tf thought of the idea of adding semicolons

#

so stupid

young knoll
#

Okay python

paper viper
#

i prefer java much over python

#

lol

young knoll
#

Weakly typed languages are still weird to me

#

Things just kind of work

shadow tide
#

can you give me a link on the difference of a list, an array, and a stream?

quaint mantle
#

Questions about lag with finding OfflinePlayer via username

arctic moth
#

anyone know if PlayerDeathEvent is cancellable

paper viper
#

an array is a data structure with a fixed length

arctic moth
#

cuz on stuff like hypixel it puts ppl in spectator when they die

shadow tide
#

got it

paper viper
#

a list is a data structure which is a subtype of Collection and you can add or remove from it

#

and some other methods

young knoll
arctic moth
#

ok

paper viper
#

and a stream is a structure which allows you to perform many useful operations on, but not actually used in the context of storing data, but manipulating it

#

if that makes sense

arctic moth
#

how do u detect if it would kill tho

young knoll
#

getHealth - event.getFinalDamage

arctic moth
#

and then like that <= 0

young knoll
#

<=

shadow tide
#

PLEASE tell me this would work java if (!(onlinePlayers.toList().contains(args[0]))) { return false; }

#

onlinePlayers is equal to Stream<String> onlinePlayers = Bukkit.getOnlinePlayers().stream().map(Player::getName);

paper viper
#

if args[0] is a string, no

shadow tide
#

ugh

paper viper
#

you are literally comparing apples to fruits

#

that is basically saying

eternal oxide
#

depends what onlinePlayers is and if toList() returns an actual list, and theres no case on any of that so upper/lower

paper viper
#

i have a basket of apples

#

and i want to see if there is a banana in it

shadow tide
#

I HAVE NO IDEA HOW STREAMS WORK

quaint mantle
#

is args[0] like a username passed to a command?

young knoll
#

Then don't use them

vagrant stratus
young knoll
#

Is toList a thing with streams

#

I always use collect

paper viper
eternal oxide
#
List<String> playerNames = new ArrayList<>();
for (Player player: Bukkit.getOnlinePlayers()) {
  playerNames.add(player.getName().toLowerCase());
}```
paper viper
#

in fact its recommended to use it

shadow tide
#

i'm sorry, I'm just getting frustrated, so please forgive me if I'm a jerk/burden.

young knoll
#

TIL

#

Where is my find and replace

quaint mantle
#

toList is like brand new

eternal oxide
#

then if (playerNames.contains(args[0].toLowerCase()))

paper viper
#

Its in Java 16

#

and it creates an immutable list

#

the collectors creates a mutable list

#

so use toList()

#

cause immutable good

shadow tide
#

please explain this Player player: Bukkit.getOnlinePlayers() or give me something that does, I want to learn not copy

young knoll
#

Is there a toSet as well

paper viper
#

Stream.collect(Collectors.toUnmodifiableList()) == Stream.toList()

eternal oxide
#

its a for loop, over the Collection returned by getOnlinePlayers()

quaint mantle
#

in use of streams, it being mutable usually doesn't matter so its a safe option and cleaner

shadow tide
#

what does this part do? Player player:

eternal oxide
#

Seriously?

shadow tide
#

yes

#

please

eternal oxide
#

?learnjava

undone axleBOT
eternal oxide
#

google for loops in java

shadow tide
#

it feels like you are insulting me, please stop

eternal oxide
#

I'm not, this is really basic java

shadow tide
#

🧠 == small

eternal oxide
#

its literally about as basic java as you can get

paper viper
#

ok, you are being a straight up jerk right now. For loops are one of the basic things, and they are universal to any language. Not even just java. It should be a embedded into your brain how to use them

#

we arent insulting you, but if you are trying to say we are, we cant help you

shadow tide
#

i'm not trying to say you are are

#

sorry

#

I'm gonna take a break

arctic moth
#

how do you make an entity drop all of its items

quaint mantle
#

They're not insulting you, a lot of this stuff comes with learning Java. Whether you're brain is small like you say or you're inexperienced or you are just new to it, all 3 of them have the important thing in common that you need to go learn ❤️ - The server here is designed to support how you implement Spigot into your existing knowledge of Java, I highly suggest to learn a bit more on Java in the mean time because that will help you make the best of your plugins, otherwise they'll just be half hacked together in a bad way

Player player: Bukkit.getOnlinePlayer() = For each(:) object Player named player in the list Bukkit.getOnlinePlayers() then do {}

arctic moth
#

lol

quartz pike
#

?learnjava

undone axleBOT
arctic moth
#

why me

quartz pike
arctic moth
#

im talking about making it drop all of its stuff without dying

#

(doing it for players btw if that helps)

quartz pike
#

i like how the dumbest people always have "minecraft dev" or whatever in bio .. bruh you are not a dev if you need to ask simple java stuff on here

arctic moth
#

im not rlly good at java

quartz pike
arctic moth
#

lol

#

wut like loop or smth

quartz pike
#

😛

arctic moth
#

o

paper viper
#

i only recently put stuff into my bio

arctic moth
#

there is player.dropItem() but i think it only drops one item

young knoll
#

What is your goal

arctic moth
#

me?

young knoll
#

mhm

quartz pike
#

I'm not sure and i'm tired but i guess you could iterate using getInventory().iterator() and on each iteration call
remove​(ItemStack item)

#

and then
player.getInventory().updateInventory();

#

i never worked with inventories so yeah idk

paper viper
#

||
final Location location = player.getLocation();
for (ItemStack itemstack : player.getInventory()) {
player.getWorld().dropItemNaturally(location, itemstack);
player.getInventory().removeItem(itemstack);
}
||

#

i dont think an update is necessary

#

@young knoll im sryyy

#

i felt lazy

#

I put it in a spoiler

young knoll
#

:p

arctic moth
#
for (ItemStack itemStack : player.getInventory().getArmorContents()) {
                    player.getWorld().dropItemNaturally(player.getLocation(), itemStack);
                    player.getInventory().removeItem(itemStack);
                }
young knoll
#

Delete

arctic moth
#

would something like this work

young knoll
#

Hence the dropItem

arctic moth
#

god discord screws up tabs so bad lol

#

would this work

#

wait will that just get the armor

#

lol

#

o

#

i can just do another loop with getContents()

#

ok so should something like this work

#

lol forgot the () on catch but ignoring that is it right

#

should this work

paper viper
#

Do you want only armor or all?

quartz pike
#

oh yeah you want to drop , i said to remove.. lol i'm tired srry

arctic moth
#

is there any way to spawn a mob without it doing damage

#

like lightning

#

ok so ik its if(event.getCause() == something) but what is the lightning damage cause called

#

nvm im dumb

#

lol

#

DamageCause.LIGHTNING

#

anyone know why this isnt spawning anything theres no errors

subtle kite
#

is there a event to make lighting

#

what causes the spawning of lighting?

arctic moth
#

?

#

its in damage event

#

but the things after it happen

subtle kite
#

all I see is player.getworld().spawnentity(player.getLocation(),...

arctic moth
#

i cant find whats wrong

somber hull
#

can anyone help me with regex

#

i want to remove the spaces from in between <>

#

so /test <option1 | option2> becomes /test <option1|option2>

arctic moth
#

also how do you get what the death msg would have been

somber hull
#

pretty sure

arctic moth
#

but its in damage event

somber hull
#

o

#

set uyp a deatyh event

arctic moth
#

but it cant be in death event cuz technically ppl dont die

#

it sets them to spectator when they die and play a death effect

#

could it be something to do with event.getCause()

somber hull
#

make a death eevnt

#

and cancel it

#

set them to spectator

arctic moth
#

u cant cancel death event

somber hull
#

you cant?

#

have you tried?

arctic moth
#

ye

somber hull
#

oh ye

#

i see

#

so damage event

#

check if the health of the player is less than or equal to 0

#

if so

#

cancel the damage event

#

set the gamemode to spectator

#

and whats the problem your having?

arctic moth
#

making a death message

#

@somber hull

barren nacelle
#

Does anyone know how to make an enderdragon ride a player? Like what I tried to do here EnderDragon enderdragon = e.getPlayer().addPassenger(EnderDragon.class);

somber hull
#

send out a regualr message

#

make it yellow or whatever

#

or no

#

just white

rugged topaz
#

if i want to hide all NPCs with the name Click!,

i know i do that with teams, and by adding the entry by name and setting the visibility, but who do i apply the team to? or wha. i just want Click! to be invisible to all players, but players would be able to see one another

team.addEntry("Click!");
team.setNameTagVisibility(NameTagVisibility.NEVER);
arctic moth
#

like <player1> was killed by <player2>

somber hull
#

so get the last damage cause

#

if it was by player

#

then send message plr was kiklled by plr

arctic moth
#

but theres only entity

somber hull
arctic moth
#

bruh do i have to do all of it lol

somber hull
#
if(!(entity instanceof Player)) return;
Player plr = (Player) entity;
arctic moth
#

how do u get who the damager is

somber hull
arctic moth
#

but thats the person being damaged

somber hull
#

i think

arctic moth
#

k

#

nope

subtle folio
#

How do i reference a spicifc world

arctic moth
somber hull
arctic moth
#

lol

#

Bukkit.getWorld("world")

#

@subtle folio

subtle folio
#

yep ty

young knoll
#

IIRC you can check if the event is an instance of EntityDamageByEntityEvent

arctic moth
young knoll
#

And then cast to that, which has getDamager

somber hull
#

ok

#

do what he said

#

event instance of

#

ye

arctic moth
#

wait can i just like do event.getDamager().toString() and then like clip off the start

young knoll
#

I would use getType

shadow tide
#

I'm back and I have done what you said to, I understand for and for-each loops now and I have calmed down.

arctic moth
#

Bukkit.getServer().broadcastMessage(ChatColor.RED + player.getName() + " was rekt by " + entityevent.getDamager().toString().substring(5));

#

lol thats a lot for one line

#

btw how do you stop lightning from starting a fire

young knoll
#

You will still get some ugly output with that

shadow tide
#

would this work? java List<String> onlinePlayers = new ArrayList<>(); for (Player player: Bukkit.getOnlinePlayers()) { onlinePlayers.add(player.getName().toLowerCase()); } if (!(onlinePlayers.contains(args[0]))) { return false; }

arctic moth
#

and also why doesnt the lightning spawn when i do this

young knoll
#

world has a strikeLightning method

young knoll
shadow tide
#

YESSSS

#

THANK GOD

#

I HAVE BEEN STUCK ON THIS FOR A DAY AND A HALF

#

AHHHHHHH

arctic moth
#

lol

arctic moth
young knoll
#

What is what

shadow tide
#

player.getWorld().lightningStrike lol

arctic moth
#

like is it the same as spawnEntity with the location and stuff

young knoll
#

Why not look?

indigo cave
#

better code

young knoll
#

Not necessarily

#

Also we have established they are not ready for streams

shadow tide
indigo cave
young knoll
#

Copying code from someone else is not learning

shadow tide
#

^ yes

indigo cave
#

^true but how should you know something exists, if no one showed you

shadow tide
#

also streams don't even work for my situation lol

young knoll
#

There are plenty of things that will show you

shadow tide
#

I have already tried

young knoll
#

Without writing it for you

indigo cave
young knoll
#

They do, but if you aren't comfortable with them then don't use them

shadow tide
#

oh

indigo cave
#

^ true

young knoll
#

They are also slightly slower if you want to be pedantic

indigo cave
#

:(

#

the list and for is slower

shadow tide
#

well how would I use them, I already have a solution but I would like to see

young knoll
#

Avoid them in very hot locations, which is a trap Mojang fell in to

arctic moth
#

now how do i stop lightning from making fire and setting entities on fire

shadow tide
#

yes

arctic moth
#

lol

young knoll
#

There is strikeLightningEffect iirc

young knoll
#

But that also doesn't deal damage

#

You could deal the damage manually though

shadow tide
#

you can manually deal damage to the player

arctic moth
#

im not trying to make it deal damage

shadow tide
arctic moth
#

just make it look like lightning strikes

indigo cave
#

packets

indigo cave
# shadow tide yes

public boolean idk(String name) {
return Bukkit.getOnlinePlayers().stream().anyMatch(player -> player.getName().equals(name));
}

arctic moth
#

lol

shadow tide
indigo cave
#

does it exist in 1.8 btw?

shadow tide
#

i'm not comfortable using lambdas either lol

indigo cave
shadow tide
#

I have no idea how they work or what they do

paper viper
#

Bukkit.getPlayer(name) != null

indigo cave
paper viper
#
public boolean idk(String name) {
        return Bukkit.getPlayer(name) != null;
}
indigo cave
#

you know that onlineplayers means only online players

paper viper
#

you dont have to do that loop

#

Bukkit has a method for it

indigo cave
#

ik, but he wanted a showcase for streams

paper viper
#

Oh

#

well thats a bad example

#

cause a better thing could be used

#

XD

indigo cave
#

yea but still in his case it is just a showcase

arctic moth
#

whats DamageCause.CONTACT

shadow tide
#

I don't care if this java List<String> onlinePlayers = new ArrayList<>(); for (Player player: Bukkit.getOnlinePlayers()) { onlinePlayers.add(player.getName().toLowerCase()); } if (!(onlinePlayers.contains(args[0]))) { sender.sendMessage("That is not a player!"); return false; } is bulky, I understand it.

arctic moth
#

lol whats iirc btw u keep saying it

paper viper
#

if i recall correctly

shadow tide
#

How would I use TabExecutor to tab complete only one argument?

young knoll
#

Return an empty list for any other argument

#

Or null, but some servers will list players names if you return null

shadow tide
#

I am not familiar with TabExecutor so how do I return a list for only one argument. I assume when I return it tab completes everything in my command.

young knoll
#

Check the args length

ancient plank
#

what's a java

#

pls teach

shadow tide
#

I think you are joking, I can't tell lol

young knoll
#

Java is an informal North American word for coffee

shadow tide
#

yes

ancient plank
#

what this do

for(int i = 0; i < userMap.size(); i++) {
    System.out.println("ur mom dumb lol");
]
shadow tide
#

well, what is userMap?

young knoll
#

Probably throws an error because userMap is not defined

ancient plank
#

?paste

undone axleBOT
shadow tide
#

with error code Error at line 1, with error code: "You dumb lol"

young knoll
#

Hey it actually got the file extension right for once

ancient plank
#

tru

golden turret
#

if you are using player.getInventory.clear

#

there is no need to manually remove the item in the fors

austere bone
#

hey, need some help :3. i have just huge chunka code durring the PlayerDeathEvent, when a player dies they don't actually 'die'. they get the respawn screen and all, but they don't 'fall' over or turn read, the player just stands there and respawns in the location they're standing in, its kinda hard to explain but..

subtle kite
#

if (!p.hasPermission()
did I do that right , I just want to double check

#

! = no permission

young knoll
#

It takes a string

ancient plank
#

hasPermission("ur.mom.haha.funny.word")

subtle kite
#

I know it creates a string and the string is the name of the node . I just wanted to ask if ! was in the right place

young knoll
#

Yes

ancient plank
#

!p.hasPermission("dawd") :drakeNo:
p.hasPermission("dawd") == false :drakeYes:

young knoll
#

if (!(!String.valueOf(true).equals("false")))

ivory sleet
#

oh god

steady smelt
#
java.lang.NullPointerException: null
        at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
        at me.fuzyjaguar.test.items.Click.onRightClick(Click.java:40) ~[test-1.0-SNAPSHOT.jar:?]
        at com.destroystokyo.paper.event.executor.StaticMethodHandleEventExecutor.execute(StaticMethodHandleEventExecutor.java:38) ~[patched_1.17.1.jar:git-Paper-266]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.1.jar:git-Paper-266]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.1.jar:git-Paper-266]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.1.jar:git-Paper-266]
        at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:542) ~[patched_1.17.1.jar:git-Paper-266]
        at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:505) ~[patched_1.17.1.jar:git-Paper-266]
        at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:500) ~[patched_1.17.1.jar:git-Paper-266]
        at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:496) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2295) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.network.protocol.game.PacketPlayInArmAnimation.a(PacketPlayInArmAnimation.java:25) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.network.protocol.game.PacketPlayInArmAnimation.a(PacketPlayInArmAnimation.java:7) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$ensureRunningOnSameThread$1(PlayerConnectionUtils.java:56) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:149) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(IAsyncTaskHandlerReentrant.java:23) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:1418) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:122) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1396) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1389) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:132) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1367) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1278) ~[patched_1.17.1.jar:git-Paper-266]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-266]
        at java.lang.Thread.run(Thread.java:831) [?:?]```
#
            if (event.getItem() != null) {
                if (Objects.equals(event.getItem().getItemMeta(), (ItemManager.eStick.getItemMeta()))) {
                    Player player = event.getPlayer();

                    Block block = Objects.requireNonNull(event.getPlayer().rayTraceBlocks(50)).getHitBlock();
                    assert block != null;
                    player.getWorld().createExplosion(block.getLocation(), 4f, true);
                    event.setCancelled(true);
                }
            }
        }```
young knoll
#

Which is line 28

steady smelt
#

my code and when i

#

wat

young knoll
#

Rather than requiring the block to not be null (and using an assert for some reason?)

#

Just check if block is null before you try and do anything with it

#

RayTracing always has the possibility to return null, a player may not be looking at a block

steady smelt
#

ok

#

i.. am kinda new and my ide suggested it

#

uh

#

it wont paste

young knoll
#

Check the block

#

Not its location

steady smelt
#

like

#

if (block != null) {

#

?

shadow tide
#

is it possible to turn a string into an int?

young knoll
steady smelt
#

ok tanks btw

young knoll
shadow tide
#

uhh wut

#

wut would be in place of Integer

young knoll
#

Nothing

#

Integer is a class

shadow tide
#

oh

#

but, like where would I put that then

#

oh

#

wait

shadow tide
#

Integer.parseInt(string)?

#

yes

#

I was right

steady smelt
#

ok so im not sure that someone will answer this, but how do you run server, intellij and mc at the same time

shadow tide
#

yay

steady smelt
#

with 8 gb

golden turret
golden turret
#

and gg

steady smelt
#

wat

young knoll
#

I don't think a string will ever == a boolean

golden turret
#

i used my phone to program

#

at the start of the year

young knoll
#

Oh wait you parse a boolean from the string

#

Wonderful

shadow tide
#

Integer.parseInt(str); would throw an error if the string is not a number, which error is this?

#

so I can catch it

somber hull
#

so i added a discord bot to my plugin, but im having some trouble with a help command

shadow tide
#

thx

vast shale
shadow tide
#

I'm using the API so no apache for me 🙂

somber hull
#
    public List<EmbedBuilder> registerHelpPages() {
        List<EmbedBuilder> embeds = new ArrayList<>();
        int i = 0;
        EmbedBuilder curEmbed = new EmbedBuilder()
                .setTitle("Help")
                .setColor(Color.BLUE)
                .setFooter("Made by Silent Program!");
        for (Command c : commandList) {
            curEmbed.addField(c.getName(), c.getDescription());
            i++;
            if (i > 6) {
                i = 0;
                embeds.add(curEmbed);
                curEmbed = new EmbedBuilder()
                        .setTitle("Help")
                        .setColor(Color.BLUE)
                        .setFooter("Made by Silent Program!");
            }
        }
        return embeds;
    }

so
i have this
wich is supposed to create a list of embeds each containing at most 7 command information fields
(this is for a discord bot help command)
So it loops through the commands i have, then adds a field for each fo them. then once it reaches 7 fields, it adds the embed to a list, and creates a new embed, and repeats
but for some reason
it keeps returning a list of 0
commandList has 2 commands in it
and i know thats working
i added a print to check the size

young knoll
shadow tide
#

only if you aren't using the API

#

it doesn't

young knoll
#

I disagree

#

One moment

#

Huh I guess I normally just depend on the entire thing

shadow tide
#

StringUtils cannot be resolved

young knoll
#

You can always add it as a seperate dependency

#

Or just switch to the full spigot

shadow tide
#

depending on the entire thing gives me a warning at module-info lol

#

bc its the file name

somber hull
#

it says Object has protected access

shadow tide
#

bad name check

steady smelt
#

sure (deeted)

#

rite

#

dis to?

shadow tide
#

bruh

somber hull
undone axleBOT
young knoll
#

You still have told us what line 28 is

#

Line 40 now, actually

steady smelt
#

oh sori

shadow tide
#

bbbruh

#

rolls the bs

shadow tide
somber hull
#

tbh

shadow tide
#

I do

somber hull
#

like

#

just leave it

#

boom its gone

young knoll
#

Ah

somber hull
#

why ping a helper for something that will be gone in 2 seconds

young knoll
#

event.getPlayer().rayTraceBlocks(50).getHitBlock();

event.getPlayer().rayTraceBlocks(50) may be null

steady smelt
#

hm

young knoll
#

The javadocs have nullability annotations, you should look at them

steady smelt
#

ok

#

@NotNull is this it?

paper viper
#

if you use intellij, intellij warns you if something could be null

young knoll
#

So does eclipse if you have the javadocs linked

#

I think

ivory sleet
shadow tide
#

why does this throw an error at NumberFormatExeption? ```java
try {
int ammount = Integer.parseInt(args[1]);
} catch (NumberFormatException) {

            }```
ivory sleet
#

the string args[1] might not be a valid integer

young knoll
#

You need a name

shadow tide
#

?

young knoll
#

catch (Exception name)

shadow tide
#

NumberFormatException is the exeption name

young knoll
#

Yes

paper viper
#

🤦‍♂️

young knoll
#

But you need a variable name

somber hull
shadow tide
#

ok?

somber hull
#

...

#

name the variable

#

the exception is a variable

shadow tide
#

didn't know that, thanks

paper viper
#

we really shouldnt be helping you about syntax

#

try/catch is part of the basic java course too

somber hull
#

i mean

somber hull
shadow tide
#

^ thank u

paper viper
somber hull
#

tru

shadow tide
#

can I just make a new user and, like, not have everyone annoyed when I ask a stupid question?

somber hull
#

well

#

you should really take a course in java

#

or look things up

paper viper
#

its not our job for you to learn foreach loops

somber hull
#

before asking

paper viper
#

after all, this is Spigot API help

#

not Java help

#

unless its a serious Java question, then sure

ivory sleet
#

Self teaching is a crucially important skill, this channel should generally not be regarded as the primary goto source whenever you struggle with things, google it first, search for other people on the internet who wrote about the issues you may have, maybe even watch a video. If you then fail to understand or address the problem, ask here.

somber hull
#

i have been working on a thing for an hour now

somber hull
ivory sleet
#

What’s the issue there?

somber hull
#

idk

#

thats the problem

#

the returned list is length 0

ivory sleet
#

Debug it with print statements or something

paper viper
#

try printing the list after each addition

somber hull
ivory sleet
#

But feels like it never reaches the 7th iteration

somber hull
#

It wont

#

yet

#

i havent added 7 commands yet

ivory sleet
#

Yeah and that explains why it’s 0

somber hull
#

fuck

young knoll
somber hull
#

i put the add in the wrong spot

ancient plank
#

is that javacord

somber hull
ancient plank
#

ic ic

cold tartan
#

if i wanted to get all spectator players in a server how would i do that?

young knoll
#

Loop all online players and check their gamemode

#

Add the matching ones to a new list

cold tartan
#

k, ty

golden turret
#

stream

#

😋

#

Bukkit.getOnlinePlayers().stream().filter(player -> player.getGameMode() == GameMode.SPECTATOR).collect(Collectors.toList())

young knoll
#

If I don't see an entire plugin made in streams in the next year I will be terribly upset

#

Bukkit.getOnlinePlayers().stream().filter(player -> player.getGameMode() == GameMode.SPECTATOR).toList()

#

The bytes have been reduced

#

And yes, I just learned about toList today

shadow tide
young knoll
#

Seems there is a toArray too

#

no toSet though

shadow tide
#

yes

#

sad

#

I like lists better than arrays

#

just cuz

#

arrays are very useful aswell tho

#

but I would rather use lists

#

if possible

young knoll
#

Lists are technically just fancy arrays :p

shadow tide
#

how would I remove a set amount of one item from a player's inventory

young knoll
#

The size of the stack you pass in is the number it will remove

#

Or, it will try to

shadow tide
#

size?

young knoll
#

Yes, item stacks have a stack size

shadow tide
#

ItemStack item = new ItemStack(Material.BOOK); no stack size

ancient plank
#

kek

shadow tide
#

stfu @ancient plank I didn't ask for you to join this conversation

young knoll
#

Look at the other constructors

ancient plank
#

yikes

ancient plank
#

1/1 warnings

shadow tide
#

please

#

just

#

no

#

also, where do I set this amount, what if I want to clear a different ammount of the itemstack in different places?

#

I'm not getting this

#

it should be removeItem(int, ItemStack)

#

and I stand by that

young knoll
#

Then you change the amount for those other locations

#

That would have to be a seperate method since removeItem is a vararg

#

Which can be quite convenient

shadow tide
#

whats a vararg, variable something?

#

variable argument?

young knoll
#

Yes

#

You can pass any number of itemstacks to it, and it will be treated as an array inside the method

quaint mantle
#
//   Varargs declaration, must be last parameter of function.
//                          |
void exampleFunction(String... strings) {
    for (String i : strings) {
        System.out.println(i);
    }
}
shadow tide
#

I typed in a correct player name and it said "That is not a player!" here is my code java if (!(onlinePlayers.contains(args[0]))) { sender.sendMessage("That is not a player!"); return false; }

#

thats not enough info lol

#

here is my class

#

onTabComplete is a W.I.P. So don't worry about it

#

I really don't want to at any1

#

please help

ancient plank
#

patience young padawan

shadow tide
#

lol

ancient plank
#

did you put a capital letter in args[0] because #contains() is case sensitive iirc

#

better yet, copy paste the command you typed to not get the result you want

spare marsh
#

So, I have a question. Does InventoryCloseEvent run whenever another inventory is opened to a player?

ancient plank
#

args[0]#toLowerCase()

#

gg problem solved

shadow tide
#

thanks

#

I did the command without caps and it worked lol

spare marsh
#

Damn it, So there is no way to create like a menu that will go back to like a Main Menu? So I have like a menu that when you click on it it open menu3, and if you close that menu, it will take you back to menu2, and I want it to take you to menu1 if menu2 is closed but I have an issue which is that if I click on an item in menu2 to open menu3, it will call the close event on menu 2 so it will open menu1 instead of menu3, but the menu2 then will open back again because when menu3 was opened it was close to open menu1 so its a mess

shadow tide
#

I did java if (onlinePlayers.contains(args[0].toLowerCase())) { and it still isn't working with capitals 🤔

somber hull
#

So

#

I have a question not related to spigot

shadow tide
#

ok

somber hull
#

but related to java

#

Im getting a noclassdeffound error

shadow tide
somber hull
#

well

#

this is a discord server about spigot

#

so some people yell at you for asking questions unrelated to spigot

shadow tide
#

we don't care if its like a serious not dumb java question

somber hull
#

this is my main method

#
    public static void main(String[] args) {
        AutoRunFromConsole.runYourselfInConsole(true);
        Bot client = new Bot("");
        client.login();
    }
shadow tide
#

thats all?

#

no package

somber hull
#

pretty sure its throwing the rror on the Bot client = new Bot

shadow tide
#

no class identifier

somber hull
#

yea, cause thats line 12

shadow tide
#

dude

young knoll
#

Have you shaded javacord

shadow tide
#

thats a constructor

somber hull
#

i dont think i did

#

thanks coll

shadow tide
#

[public/private] class Main {}

young knoll
#

toLowerCase will strip all caps

#

So if the username is meant to have some caps, it will not match

shadow tide
#

it isn't

ancient plank
#

you removed the ! from the if statement so now its checking if onlinePlayers contains args[0]

#

schleep time 😴

shadow tide
#

I had one checking if it didn't and one checking if it did so I could check if there was a random error.

#

go offline if you going to sleep lol

#

how do I only tab complete one argument

#

put it in this thread so I can find it bc I have to go lol

austere bone
#

hey, need some help :3. i have just huge chunka code durring the PlayerDeathEvent, when a player dies they don't actually 'die'. they get the respawn screen and all, but they don't 'fall' over or turn read, the player just stands there and respawns in the location they're standing in, its kinda hard to explain but..

young knoll
#

Gonna need to see the code

austere bone
young knoll
#

I would imagine it’s due to modifying their health in the death event

austere bone
#

oooooh crap, maybee

#

let me test that real quicklly

austere bone
quaint mantle
#

How to reset color of item name?

#

ChatColor.RESET

#

not working

golden turret
#

§r

snow ember
#

meta.setName(ChatColor.RESET + "Item")
item.setItemMeta(meta)

quaint mantle
#

i need reset color

#

in item.getdisplayname

quaint mantle
golden turret
#

§f

#

wont reset

#

but the name color is white so...

quaint mantle
#

no work

golden turret
#

gradle?

quaint mantle
#

no

#

maven

young knoll
#

Why would that matter

#

Reset should clear any color and formatting

snow ember
#

@quaint mantle can you provide your full code for that?

#

and is console logging any errs

weak mauve
#

is there any way to change the BlockFace in Player#sendBlockChange()
for example: stair

young knoll
#

Yes, set up the blockdata for it

weak mauve
#

0x0?

weak mauve
young knoll
#

Stairs stairs = Material.OAK_STAIRS.createBlockData

#

Then modify the stairs as needed

weak mauve
#

ok

#

thanks

weak mauve
young knoll
#

Ah

#

You need to use the other method then

#

It takes a byte for the block data

weak mauve
#

ye

#

it's byte BlcokData = 0x0;

#

i think

young knoll
#

No idea, I pushed the old system out of my head a long time ago

sullen dome
#

what exactly is this? the 3 rows above the hotbar, or the inventory from for example an opened chest?

eternal night
#

the opened chest

sullen dome
#

so... what would it return when no inventory is opened? cant be null

eternal night
#

there is always a top inventory o.O

#

if you open your player inventory, that would be the 2x2 crafting grid

sullen dome
#

ahh

#

ah i see, didnt knew about the existing of this. my bad

quaint mantle
#

i want to make a multiarg, how to

eternal night
#

multiarg ?

quaint mantle
#

for example /holo create test <arg>

#

yes

#

not the arg

#

it self

#

let me explain wait

#

if i check for <arg>

#

it only gets the arg

#

but i want the arguments in front of it

#

for example
/holo create test test1 test2 test3

#

i want the test1 test2 test3 included in my string with a string builder

young knoll
#

Loop through all the args and join them

quaint mantle
#

not all the args

#

the problem is here

young knoll
#

Then loop from where you want to start

eternal night
#

your loop can start at an index that isn't 0

quaint mantle
#

how to do that

eternal night
#

for(int i = 1; i < args.length; i++)

quaint mantle
#

so 1 is the index

eternal night
#

would start at index 1 instead of 0

quaint mantle
#

right ?

young knoll
#

Yes

quaint mantle
#

thanks

#

stringb.append(part + " ");

#

like this

#

right ?

#

or " " + part

young knoll
#

Either one works

#

You either have a leading or trailing white space

quaint mantle
eternal night
#

the string at that index of the array ?

quaint mantle
#

how to get it

eternal night
#

?leanjava

quaint mantle
#

oh wait

eternal night
#

well I failed

#

but still

quaint mantle
#

int i :

#

or something else

#

before it

eternal night
#

this is pretty basic java/can easily be googled

quaint mantle
#

and args[i]

#

?

#

nah

somber hull
#

ok so, not a spigot related question

#

but i have no where else to go

#

Im getting a noclassdeffounderror

#

wich im pretty sure is a problem with my shading

#
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>me.silentprogram.discordbot.MainClass</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <properties>
        <maven.compiler.source>15</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>15</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.javacord</groupId>
            <artifactId>javacord</artifactId>
            <version>3.3.2</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
eternal night
somber hull
quaint mantle
#

so like this

#

?

somber hull
quaint mantle
#

it is arg 4 i guess

#
/holo create <name> <update-interval> <text>
                                       ^^^ 3
#

?

somber hull
#

4

#

/holo[0] create[1] <update>[2] <text>[3]

#

oh

#

ye

#

3

somber hull
quaint mantle
#

i guess provided is the problem

eternal night
#

a) why type pom

quaint mantle
#

i dont know maven

eternal night
#

b) provided

#

yea

somber hull
#

so ye it would be 4

#

damn i cant count 😔

somber hull
eternal night
#

/holo create[0] <name>[1] <update-interval>[2] <text>[3]

somber hull
#

Provided is used for shading no?

quaint mantle
#

holo is not an arg

somber hull
#

lol

eternal night
#

it isn't

#

it is the command

somber hull
#

if your getting it from the command

#

wait

#

it isnt

#

😳

eternal night
#

it isn't no

somber hull
#

hmmm

#

i need sleep

#

but first i need to figure out the maven shade thing

#

wdym provided

eternal night
#

provided is also not used for shading, rather it states that the artefact/classes will already be provided at runtime

somber hull
#

so should i let it default to jar?

#

or whatever it defaults to

eternal night
#

just remove the line

#

you can also set it to compile

somber hull
#

oh ye

#

if i remove the line

#

it gives a bunch of errors

eternal night
#

👀

#

what

#

you are editing a file

#

how is that error thrown

somber hull
#

nah

#

its a jar

#

i said its not spigot related

eternal night
#

?? you are editing a pom file

somber hull
#

ye

eternal night
#

yes

somber hull
#

then im packaging it

#

and running the jar

eternal night
#

aha. Well a) why is the <type>pom</type> set ?

#

and b) set it the <scope>compile</scope>

quaint mantle
#

i know plugin is limited
but can you open a gui in plugin ?
i mean gui on the server host not in game gui

somber hull
eternal night
#

interesting

somber hull
eternal night
#

well no clue what the pom file you are importing there is doing

#

¯_(ツ)_/¯

#

I guess just follow their basic layout for now ?

#

also for setting the main class, I'd recommend the maven-jar-plugin

somber hull
eternal night
#

You can still use the maven shade plugin

quaint mantle
#

epic gradle shadowjar

somber hull
#

well on the maven shade plugin on the maven website

#

it has what i did to set the main class

young knoll
#

The limitation comes from the client server relationship

quaint mantle
#

i use stringbuilders to do it. is there anyway to fix the space at the end of line ?

young knoll
#

Substring

quaint mantle
#

and what is that

young knoll
#

It’s a method in the string class

quaint mantle
#

oh

#

so what should i do with it

young knoll
#

Use substring to cut off the last character

solid cargo
quaint mantle
#

ok

young knoll
#

Actually you can probably just use .trim

somber hull
#

@young knoll thank goodness your here

#

please help me

somber hull
#

im getting a noclassdeffounderror

young knoll
#

Don’t look at me, I don’t use maven

somber hull
#

AAAAAAAAAA

#

melts

#

can i easily switch to gradle?

solid cargo
#

try {
} catch {
}
😈

#

ok jk

somber hull
subtle kite
#

Talking about string any have any ideas/useful info , on how to like change different chat groups (staff chat ) /f chat ect
I looked at like at least 10 different plugins , and they each have like 50+ lines just for the chat it's self

young knoll
#

I think you can automatically convert maven files to gradle somehow

#

But it’s fairly straightforward, and you can find tons of samples online

somber hull
#

ye

tardy delta
#

wew the wifi is back

young knoll
somber hull
#

wait how do you build with gradle?

#

i could look it up

#

but

#

lazy

young knoll
#

Your ide probably has integration for it

#

Otherwise you can just run gradle build from the command line in the root folder

somber hull
#

uh oh

#

everything is goine

#

all my packages dissapeared

chrome beacon
#

Is it indexing

somber hull
#

no

#

how do i make it?

chrome beacon
#

Should do that when you open the project

somber hull
#

i fixed it