#help-development

1 messages · Page 98 of 1

arctic moth
#

looked through nms code, turns out i dont need to use nbt

river oracle
#

May be dumb but your package names are also fucked don't use capitals in the future though that's prob not the issue

torpid sapphire
#

is there a way to cancel a PlayerItemBreakEvent? its not cancelable so i tried to work around that by setting the stack size to 2, but then the durability completely resets and is impossible to change since its reset after the event

torn jewel
#

ik its dumb

young knoll
#

Cancel the durability event instead

wary topaz
#

Guys I got a question, if I return false does it use config.yml default usage?

eternal oxide
#

That question makes no sense

#

usage? as in command? Thats plugin.yml not config

wary topaz
#

I dont want /tp <player> there

young knoll
#

return true then

wary topaz
#

Oh I mean plugin

#

okay thats what I was asking, thanks

torpid sapphire
#

thanks

torn jewel
#

does PlayerTabCompleteEvent get its name changed?

sterile token
eternal oxide
#
This event is no longer fired due to client changes
sterile token
#

I think

sterile token
#

And what you can do for that so?

torn jewel
#

is there a way around it

eternal oxide
#

there Chat tab complete and Tab complete

#

chat tab is depreciated and no longer fires

sterile token
#

Also

torn jewel
#

so how can i make my plugin with that event work for 1.8 and 1.19

eternal oxide
#

TabComplete is on commands

sterile token
#

I suppouse

torn jewel
#

yes

sterile token
#

why would you need to tab complete if not a command

#

🤔

eternal oxide
#

What are you trying to achieve?

sterile token
young knoll
#

It used to be fired for tab completing player names in chat

torn jewel
young knoll
#

But now the client gets all that info and stores it

eternal oxide
#

implement TabExecutor instead of CommandExecutor

sterile token
young knoll
#

The regular method certain does work

sterile token
young knoll
#

Okay well

#
  1. implements is not a super class
eternal oxide
torn jewel
young knoll
#
  1. They said instead
sterile token
#

oh i always confuse them

young knoll
#

I mean

#

It still works

#

I’ve done tab completion with direct injection to the command map

sterile token
#

super class is extends and implements is for interfaces

sterile token
torn jewel
young knoll
#

What

eternal oxide
#

If you want to remove commands you should remove the command permission from that player.
If you want to simple control tab completion of command arguments then implement TabExecutor

sterile token
#

And then each command extends that class. Finally register each CustomExecutor thru CommandMap

torn jewel
#

yes but the tabcompletor thing doesnt run

sterile token
young knoll
#

?paste

undone axleBOT
sterile token
#

I think you are not registering the tab completer for the command

torn jewel
sterile token
#

I mean you should be only registering the command executor

#

yeah

#

As i suppoused

young knoll
#

That’s what I used

torn jewel
#

due to not having a command class

sterile token
#

I wondering a modular system for spigot and bungee plugins

#

haha

young knoll
#

Mhm

#

That’s an older plugin, don’t remember much of it

sterile token
young knoll
#

Like why there is a tab complete method with a location argument

sterile token
#

i have looked on github

#

And i cannot find it

young knoll
#

Either way, it worked

#

It’s a private repo

sterile token
#

oh

#

that why :sad:

#

😮‍💨

#

i dont think you can show it to another

#

This encapsulation will provide them for adding/removing right?

young knoll
#

I believe so

sterile token
#

I need to buy friends where i can do it?

young knoll
#

You should return an immutable copy instead

sterile token
onyx fjord
#

Can I somehow add a message to error that comes from shaded library?

#

Additional message

worldly ingot
#

i.e. a runtime exception?

onyx fjord
#

Let's say shaded dependency throws exception, I want to add few lines to tell people not to report bugs to the library team

#

So yea

#

Runtime exception

worldly ingot
#

You can catch and rethrow with a new message if you want

sterile token
onyx fjord
#

What why set level off lol

sterile token
#

Oh its an exception

#

I thought it was a logger message

onyx fjord
sterile token
worldly ingot
#

Are you not running any code that throws it?

sterile token
#

And re throw it

onyx fjord
#

Yes kinda

#

But the library works on its own in meantime

#

Some errors come from it without my code

sterile token
#

Choco do you want to be paid for being a friend?

onyx fjord
#

Bruh

vocal cloud
onyx fjord
#

That sounds abstract

#

Like choco was real estate

sterile token
#

what?

#

i dont have friends

river oracle
#

Make some get out and socialize

#

You probably can even if you think you can't slightly altering your personality helps

sterile token
#

I have to pay them because they are falser than me getting out with a girl having a gf

river oracle
sterile token
#

is it more false?

#

Because false is a shot adjetive

river oracle
#

Still doesn't make sense why pay someone to be your friend because they are false

sterile token
#

I making ref that a paid friend would be less false than one of those that said that you are his best friend when they are talking in front of your noose

young knoll
#

I

#

Disagree

river oracle
#

I still don't get that sentence lol but making friends is fairly easy given you are a smooth talker though I'll admit that isn't everyone's thing

sterile token
#

Im not talktive

#

I mean i dont really talk much

river oracle
#

Me either but in perfectly willing to talk to someone if they initiate with me

echo basalt
#

I met my homie when one day he pulled up in programming class and aced the tests after watching a python video over the weekend

#

I then showed him mzunguhosting (a troll web hosting website) and he thought it was goofy

dire marsh
#

humans are not real

onyx fjord
#

Me neither

dire marsh
#

nop

#

i sit inside all day programming never seen one so cant be real

onyx fjord
#

@dire marsh you saw this?

#

Bruh

dire marsh
#

no

onyx fjord
#

Minecraft apparently has unused dupe fixes

dire marsh
#

lol

#

what class that in

waxen plinth
#

That means they were left in intentionally

onyx fjord
#

They were

waxen plinth
#

TNT dupers are known to be left intentionally now

wary topaz
onyx fjord
#

But sand is too broken

dire marsh
#

so

onyx fjord
#

It's just laggy

dire marsh
#

papermc bad

waxen plinth
#

Sliced lime said himself that they're going to leave it in so long as there's no other way to fully automatically mine blocks and get drops

dire marsh
#

not following vanilla

#

smh

waxen plinth
young knoll
#

Moveable tile entities plz

onyx fjord
#

What about sand

waxen plinth
#

Not sure

young knoll
#

Sand is not renewable

#

Afaik

#

Hence them leaving it

onyx fjord
#

But the world is huge

waxen plinth
#

True but does it need to be?

dire marsh
waxen plinth
#

Find one desert and you should literally never run out

onyx fjord
#

Diamond ores are also not renewable

wary topaz
#

Guys if I do /tp e, How can I make it autofill so when I say in chat arg1 or something it says the full username of the target (ethanog)

onyx fjord
#

0 logic

young knoll
#

Diamond ore isn't a basic resource like sand

#

Which is used for a bunch of stuff

waxen plinth
#

Diamond is a basic resource

onyx fjord
#

The world is big enough

young knoll
#

Not on servers with a border

onyx fjord
#

Skill issue

young knoll
#

Either way idk if that's the reason

onyx fjord
#

Add admin shop then

young knoll
#

I'm just guessing

dire marsh
#

coal should convert to diamond over time 👍

wary topaz
# waxen plinth Could you elaborate more

Usage: /tp <player>
If I do /tp E
My chat will say, "You successfully teleported to E"
I want it to autofill and say the full playername that it used, such as EthanOG.

waxen plinth
wary topaz
onyx fjord
waxen plinth
#

And then sent args[0] as the name too

wary topaz
#

Correct.

waxen plinth
#

Ok

#

Just call getName() on the Player returned by Bukkit.getPlayer(String)

wary topaz
#

But than it will be set to "e"

waxen plinth
#

That will get the full name of the player

wary topaz
#

But if I use arg it wont say that

onyx fjord
young knoll
onyx fjord
#

Lol

#

Rly

wary topaz
#

Idk how to do that

young knoll
#

mhm

wary topaz
#

I'm new to coding

waxen plinth
#

You don't know how to call getName()?

wary topaz
#

ya

onyx fjord
#

Rich api

waxen plinth
#

Well if you're that new you shouldn't be writing plugins

young knoll
#

getPlayer does some funky stuff

waxen plinth
#

You should learn the fundamentals

wary topaz
#

I'm not that new

young knoll
#

getPlayerExact is well, exact

wary topaz
#

I know java

waxen plinth
#

Clearly not

young knoll
#

I know java

waxen plinth
#

If you don't know how to call getName() on the player object

wary topaz
#
p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "You successfully teleported " + ChatColor.DARK_AQUA + "" + ChatColor.BOLD + args[0] + ChatColor.YELLOW + "" + ChatColor.BOLD + " to " + ChatColor.DARK_AQUA + "" + ChatColor.BOLD + args[1] + ChatColor.YELLOW + "" + ChatColor.BOLD + ".");
        return true;
onyx fjord
#

Holly shit

upper vale
#

wha tthe fuck

onyx fjord
#

Ever heard of translating colour codes?

wary topaz
#

They dont work

onyx fjord
#

Bruh

young knoll
#

tbf you should technically use the enum

#

But still

waxen plinth
#

I know java
clearly does not know java

dire marsh
#

looks worse than adventure

wary topaz
waxen plinth
#

Go learn java

dire marsh
#

impossible

waxen plinth
upper vale
#

alternate

waxen plinth
#

God damn what a long method name

onyx fjord
upper vale
#

yeah

wary topaz
#

bro can you help me with the problems I did not ask for you to rerattle me

waxen plinth
#

Well if you don't know how to call a method

onyx fjord
#

We give good advice

waxen plinth
#

Maybe that's the problem to address first

onyx fjord
#

At least try to

dire marsh
#

welcome to spigot where we give sarcastic help

waxen plinth
#

If we just tell you what the answer is, you will walk away without any gained knowledge

#

Increasing your dependence on us

wary topaz
#

So explain it again.

onyx fjord
#

@waxen plinth there are people for sure that will put Player#getName() in the code literally when you tell them to

waxen plinth
#

You get the player object from Bukkit.getPlayer

onyx fjord
#

With the #

waxen plinth
#

You can then call getName() on the returned player

#

Which will return the name of that player

#

I'm not going to break it down any simpler than that because we're already straying into the territory of helping you with fundamental java rather than anything spigot-specific

onyx fjord
#

Autocomplete should've told you

#

Ctrl space is your friend

waxen plinth
#

There's also no real reason to allow incomplete player names in the command

dire marsh
#

inb4 paint ide

wary topaz
#

Didn't work yo

waxen plinth
#

.-.

#

Instead of just saying "didn't work"

#

Post your full code

onyx fjord
#

Is there player that name starts with et thp

wary topaz
#

uhh you mean the 300 line madness?

onyx fjord
#

Oh god

waxen plinth
#

Matter of fact, posting the full code is probably the first thing you should have done

upper vale
#

you have a 300 line teleport command?

onyx fjord
#

?paste

undone axleBOT
wary topaz
#

Sarcastic answer

onyx fjord
#

I wanna see it badly

waxen plinth
#

You don't need to show literally everything, show what's relevant

wary topaz
upper vale
#

you literally did not do what redempt told you to do

onyx fjord
#

I expected worse

wary topaz
#

wait I gave you the non updated thing

#

let me fix thast

waxen plinth
#

Call getName() on the Player, it will return the player's full name

onyx fjord
#

Am I tripping or he doesn't even have what redempt said in code

upper vale
#

there are 0 occurrences of getName lmao

wary topaz
#

bruh it deleted let me do it again

waxen plinth
#

I really wish there was a separate help channel for intermediate-advanced questions

dire marsh
#

need to be verified + min 3 resources

onyx fjord
#

We help as we can

waxen plinth
#

Nah

dire marsh
#

and pay md_5 10$

onyx fjord
#

Donate*

dire marsh
#

bribe*

wary topaz
onyx fjord
#

Fixed you mean it works?

wary topaz
#

no

waxen plinth
#

What the fuck

#

I didn't even know Bukkit.getName() was a thing

upper vale
#

what the fuck

#

LMAO

waxen plinth
#

But anyways that's not even close to what I told you to do and demonstrates a lack of understanding of fundamental java

#

So again, I'm going to tell you to go back and brush up on the basics

onyx fjord
#

Java rabbit hole

waxen plinth
#

Specifically classes and methods

onyx fjord
#

Remind me to make java iceberg

wary topaz
#

You're supposed to help me, not rerittle me,

upper vale
#

sorry im not trying to like discourage you but you can't say you know java and then do that

waxen plinth
#

I am helping you

#

If I gave you the answer your understanding of java would not improve

#

Stop expecting us to just tell you what the right answer is

upper vale
#

redempt has given you MORE than crystal clear instructions

wary topaz
#

My knowledge is not the factor here, My question is.

upper vale
#

who

#

what

vocal cloud
#

It absolutely is

waxen plinth
#

The answer is incredibly obvious to anyone who understands the basics of java

onyx fjord
#

You expect us to write it for you?

waxen plinth
#

If you don't understand it, then you don't understand the basics of java

#

And if you don't understand the basics of java, you shouldn't be trying to write plugins yet

#

We're not going to sit here and tell you what to type character-by-character

#

Because if we do that, you're just going to keep expecting that of us

wary topaz
#

Listen, I've just moved on from script and I wanted to give plugin java development a try.

onyx fjord
#

I didn't know java when I started, I mean I did but not stuff like OOP concepts

waxen plinth
onyx fjord
#

But i knew js that helped me start

waxen plinth
#

If you don't understand java then you won't be able to write plugins effectively

wary topaz
#

I took a java course for 3 hours

waxen plinth
#

Yeah that's not sufficient

onyx fjord
#

3 hours non stop?

wary topaz
#

It was a video

waxen plinth
#

I'd say it takes ~1 week minimum to have a solid enough grasp of java to write plugins

wary topaz
#

first explaining how to start a minecraft plugin

vocal cloud
#

Is this a troll?

onyx fjord
#

Don't use school learning practices

wary topaz
#

No....

waxen plinth
#

Ethan

#

I'm sorry that this is going to sound rude

#

But please stop wasting our time

#

There are TONS of online learning resources for java

onyx fjord
#

?learnjava

undone axleBOT
waxen plinth
#

I'm not going to teach it to you myself because I have better things to do, and I'm not going to give away answers because then you're just going to keep asking us to solve things for you that you don't understand

onyx fjord
#

Codeacademy is good because it teaches by writing

wary topaz
#

😮‍💨

waxen plinth
#

Programming isn't something you learn in a day

#

It's going to take time to develop an understanding of the concepts, especially OOP

#

Don't let it discourage you, and don't take the easy way out

onyx fjord
#

Some words sounds scary like lambda

wary topaz
#

It's just a chat command though.

waxen plinth
#

And next time it'll be something else

onyx fjord
#

Yeah totally basics

waxen plinth
#

Look, basically I'm telling you that you have a gun pointed at your foot

wary topaz
#

tf

waxen plinth
#

And I'm trying to tell you to take a gun safety class, but you're really insisting on shooting yourself in the foot

wary topaz
#

🦶 🔫

waxen plinth
#

If I give you the answer, that's what happens

#

Your code works but you don't understand why

wary topaz
#

I do though

waxen plinth
#

If you would have understood why, then you'd have understood what I said the solution was

onyx fjord
#

Bukkit.getPlayer(...).getName()
Isn't it basically it

#

On mobile can't tell ya

#

I need to print spigot javadocs

gray merlin
#

I've followed the stuff over at ?buildtools but it seems like it is to install the servers? I'm not sure if i'm missing something here, but is that how I install the API to develop?

onyx fjord
#

It builds the server jar

#

API is in sonatype I believe

dire marsh
onyx fjord
#

@gray merlin Google spigot gradle or spigot maven depending what you use

worldly ingot
#

?maven

undone axleBOT
gray merlin
worldly ingot
#

It's been on the Spigot repo since 1.8

#

Only the API though. The server was never on the repo

onyx fjord
#

DMCA?

gray merlin
#

But I see

worldly ingot
onyx fjord
#

Weird i think my setup uses sonatype

#

Repo

worldly ingot
#

Oh. The CraftBukkit artifacts on Maven Central? Entirely unaffiliated with us and those should not be on there

gray merlin
#

Ah nevermind, I was thinking of craftbukkit

worldly ingot
#

All our stuff is on our own Sonatype repo

onyx fjord
#

Yee

worldly ingot
gray merlin
#

I thought Bukkit, CB and Spigot were all from the same team of people though?

worldly ingot
#

We maintain all three, yeah

onyx fjord
#

Currently yes

worldly ingot
#

Though we've never published on Maven Central

#

You'll find the Bukkit & Spigot APIs on the Nexus there, but you won't find the servers

#

Servers are built with BuildTools and installed to your local Maven repo

onyx fjord
#

You also need to build if you want remapped jaes

#

Jars

gray merlin
worldly ingot
#

Ye

onyx fjord
#

They wouldn't mind I think

worldly ingot
#

Though those people should be less afraid of us, more of Mojang lol

gray merlin
#

I'll keep that in mind going forward, I thought those were official

onyx fjord
#

It's just that legality is questionable

#

Ye

gray merlin
#

Oh? Mojang can take them down?

worldly ingot
#

If it were up to us, we'd have a straight up download for these things.

#

Only thing stopping us is that CraftBukkit contains Mojang's code

onyx fjord
#

It's modified mojang server at the end of the day

young knoll
#

Cough cough paperclip

#

hehe

onyx fjord
#

🤓

worldly ingot
#

Even that downloads the vanilla server

young knoll
#

Yeah but it's still a straight download to the average user

onyx fjord
#

Building jar is a good lesson

#

You learn a lot

#

It's basically the same command as to start server

gray merlin
#

I see.

onyx fjord
#

But if you only need spigot API you don't need bt

#

That's publicly available

gray merlin
#

Does craftbukkit include apache commons and spigot not?

waxen plinth
#

I think spigot no longer includes apache commons as of pretty recently

#

Unless I'm thinking of something else

young knoll
#

IIrc it does at runtime

upper vale
#

replaced by lang3 iirc

young knoll
#

Yeah I have it in gradle as compileOnly

waxen plinth
#

Is it in the libraries folder

#

Yep

#

I love how that's a thing now, genuinely great feature

scarlet creek
#

Is there an event to cancel arrow collision?

arctic moth
#

i left my pc afk for a few hours and my server is slowly getting laggier

#

is this a sign of a memory leak?

river oracle
#

arrow collisions? afaik collision is done client sided no?

river oracle
gaunt hatch
#

Any know what event is fired when MANGROVE_PROPAGULE grows from MANGROVE leaves? I dont see it fire on GrowEvent, thinking maybe something in hanging, but not see anyting fired

river oracle
#

StructureGrowEvent

arctic moth
#

mobs are starting to fall through the map

gaunt hatch
#

That is the tree, but i mean the part that grows from under the leaves.

river oracle
#

hmmm Idk if that'd trigger an event 🤔

#

I mean you could see if its under Structure Grow event

gaunt hatch
#

That is what i am seeing I can't find it in spigot code anywhere or see a event. And was thinking i might be missing someting. Might need to put in a request for a change to spigot for it

river oracle
#

its quite possible it is

gaunt hatch
#

it's not

river oracle
#

than pr it yourself is probably best option

gaunt hatch
#

okey dokey

eternal oxide
#

theres probably no event as its Ageable

gaunt hatch
#

Crops are agable and it fired a grow event.

#

Thinking maybe it was forgotten or missed.

young knoll
#

It might be like

#

BlockToFrom or BlockForm

gaunt hatch
#

not those either

#

I have tired the following

BlockSpreadEvent
BlockGrowEvent
StructureGrowEvent
BlockFadeEvent
BlockFormEvent
BlockFromToEvent

eternal oxide
#

I'll assume you also checked the BlockGrowEvent

gaunt hatch
#

Yea

#

I have a plugin i made that lets me listen to those events (along with others) and show me what block its trying to use so I can find it the event and stop it.

sharp portal
#

Does using § in strings still work in spigot 1.19? Or is it my java version that is breaking it?

young knoll
#

It should

#

But like, I wouldn't recommend it

worldly ingot
#

I don't think propagules grow from the trees randomly

#

Only with bonemeal

sharp portal
drowsy helm
#

just being lazy lol

#

§ is super inconvenient in the longterm

sharp portal
#

But like § worked universally. With fabric, spigot, bukkit, bungee, forge

#

and windows has a shortcut to type §

#

and on linux it is easy to add (depending on de)

worldly ingot
#

And it will break entirely if your system encoding is incorrect

#

ChatColor makes use of the section symbol internally and it's easier to read

drowsy helm
#

^

sharp portal
#

Okay here is what my issue was.

#

When checking the name of an item that has a custom name with chat color

#

using chatcolor translate alternate color codes doesn't return true on a .equals

drowsy helm
#

in most cases if you are checking the name, you are doing it wrong

#

use pdc

sharp portal
#

I'm not sure what pdc is

drowsy helm
#

?pdc

drowsy helm
#

wrapper for nbt

sharp portal
#

Yeah that works.

#

Thank you

drowsy helm
#

im guessing you are doing custom items?

sharp portal
#

Yeah

drowsy helm
#

yeah, using nbt allows your items to have any name oyu want aswell

#

will stop anvil renaming issues

terse panther
#

About Scoreboard API integred on Spigot, what is the difference between MainScoreboard and a new scoreboard created?

#

Could be the main scoreboard always shows at player and a new scoreboard I have to set it to the player?

ornate patio
#

i can use private methods as event handlers right

worldly ingot
#

Yes

ornate patio
#

k thanks

wary topaz
river oracle
#

A usable alternative to the hell hole that is that damn scoreboard api

#

I for the life of me still can not figure it out ive sunken hours into research and attempts and docs to figure it out and I just can't

#

I honestly am scared at the nms behind that shit more than anything else on earth

terse panther
#

But according Mickey (fastboard creator) it can't create teams :(

river oracle
#

Why is it I can learn bungee messaging channels faster than damn scoreboards

river oracle
terse panther
#

anyway thanks for the advice, and yes, scoreboards with Fastboard is veryyy good

terse panther
river oracle
#

Ahhh yep have fun best of luck to you

terse panther
#

thanks man! :)

river oracle
#

I spent 5 hours tryna figure that shit out and gave up smh

drowsy helm
#

just use a team prefix

terse panther
river oracle
#

Iirc luckpe3ms is open source it'd probably be very convoluted but check in there code

terse panther
#

Okay, really thanks!

wary topaz
#

?

river oracle
#

I'm cheap though 15 dollars an hour

wary topaz
#

Oh I meant the error in the code

#

I need someone to fix that

river oracle
#

Bro it's a syntax error lol

#

Literally tells you what's wrong mate

#

Line 20 it says oncommand is already defined

flint coyote
#

Saying "I'm cheap" sounds very wrong in that context.

wary topaz
#

Y2k the error marker isn't fixing it, it's just making more errors

drowsy helm
#

jsut use acf bruh

river oracle
#

Also I wouldn't do commissions before actually contributing good open source free content

river oracle
drowsy helm
#

either way

#

a command lib is miles better than bukkit command stuff

river oracle
#

I was confused for a second lmao I saw my name first than read your sentence

wary topaz
#

Can someone make me a ontabcomplete thnig?

#

Thing*

river oracle
#

Acf

drowsy helm
#

no one is going to make it for you

#

learn how to do it

river oracle
#

Hell u know what just for you ill do 14.99 an hour chap

wary topaz
#

I just want a online player array and picked one to be arg 1

eternal oxide
#

I'll do it for 15.25

river oracle
#

Fuck yoh I'll do it for 20

eternal oxide
#

21!

river oracle
#

24

flint coyote
#

I won't touch code before 25

wary topaz
#

its four fucking lines of code

river oracle
#

No one beate my project

eternal oxide
#

ok you win. I can;t beat that

river oracle
#

At least

drowsy helm
wary topaz
#

oh yeah forgot return true;

river oracle
#

Lmfao comedic

#

The amount of times I do that shit lol

wary topaz
#

all i want is when the player does /tp e the return message will be you teleported to ethanog

eternal oxide
#

u, thats nothign to do with tabcomplete

flint coyote
#

And we told you how to do it

wary topaz
#

uhh you did/

#

?

flint coyote
#

getPlayer(args[0]).getName()

#

or displayName. whatever you prefer

wary topaz
#

where in chat was that

flint coyote
#

nvm that was another guy. I recently read old messages since I just woke up. My bad

wary topaz
#

should i put that in p.sendMessage(getPlayer(args[0]).getName(); + "");
?
Will that work?

flint coyote
#

uhm you should be getting a syntax error on that

#

Bukkit.getPlayer()

wary topaz
#

No errors

#

but will it work as intended?

flint coyote
#

yes it should

wary topaz
#

ok tyvm

flint coyote
#

Guess you don't need Bukkit then. I always used it. woops

river oracle
#

Bruh remember to try catch player get attempts

wary topaz
#

could ya help me fix this error

flint coyote
#

it doesn't find a player

drowsy helm
#

        Player target = Bukkit.getServer().getPlayer(args[0]);
        if (target == null) {
            p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[0]).getName() + ChatColor.RED + ChatColor.BOLD + "!");
            return true;
        }```
#

makes no sense

#

you are checking if the player is null

#

then getting the name of the null player

#

use args[0] instead of getPlayer(args[0]).getName()

wary topaz
#

ah shit I did mass replace so that's why

flint coyote
#

Yeah you can only use getPlayer().getName() when it actually found a player

wary topaz
#

Should I do the same for target2?

flint coyote
#

otherwise you have to stick with args[0]

wary topaz
drowsy helm
#

no

#

on the second bit

wary topaz
#

keep the second bit the same?

drowsy helm
#

other way around

#

keep the first one, change the second

flint coyote
#

getPlayer(args[0]) is fine. Just don't call getName on it unless it's non null

wary topaz
#

But I never called getname?

#

for that

drowsy helm
#
            p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[0]).getName() + ChatColor.RED + ChatColor.BOLD + "!");```
#

right there

#

you call it

wary topaz
#

ah shit

#

Wait

#

but that's a message

flint coyote
#

so?

#

same rules apply

wary topaz
#

It's trying to call the player's name with the autocorrect

drowsy helm
#

which wont work

#

since thte player doesnt exist

wary topaz
#

holly shit

#

i feel so stupid

#

LMFAO

flint coyote
#

If I give you a book with an empty cover and tell you to tell me the name on the cover you won't be able to either

#

You can however tell me that you got a book

#

So as long as nobody asks for the name you are fine. It's the same in here

wary topaz
#

It's looking for a empty var which nulls

#

did I do that on the target 2 check?

#

yes I did

#

fuck

flint coyote
#

Well ok my example lacks something. Lets retry:

I'll tell you that I'll give you a book. Then instead I give you nothing and ask you: What's the name of the book?

#

Ofc you'll say wtf you didn't give me a book, how am I supposed to tell you the title?

wary topaz
#

uhh I got the same error

#

I might've compiled from

flint coyote
#

Or you still didn't fix it^^

wary topaz
#

testing ingame rn

drowsy helm
#

        if (target2 == null) {
            p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[1]).getName() + ChatColor.RED + ChatColor.BOLD + ".");
            return true;
        }```
wary topaz
#

still errored

#

DID I NOT -

#

ah fuck I changed it for the successful
message,

drowsy helm
#

also you already have teh target and target 2 variables

#

use them

#

instead of getPlayer

#

each time

wary topaz
#

oo alright

#

Error: Method call expected

drowsy helm
#

what line

wary topaz
#

I did not type null -

#

oh waeit

flint coyote
#

Player target = Bukkit.getServer().getPlayer(args[0]);
if (target == null) {
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[0]) + ChatColor.RED + ChatColor.BOLD + "!");
return true;
}
You don't wanna use getPlayer here

wary topaz
#

wait

flint coyote
#

while it works you will get "null"

#

use args[0] without getplayer there

wary topaz
#

ya ik

#

i just fixed that

drowsy helm
#

check this out

#

will make your life much easier

wary topaz
#

what does it do

drowsy helm
#

a command framework

#

one sec ill show that same command with this framework

eternal oxide
#
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + args[0] + ChatColor.RED + ChatColor.BOLD + "!");```
wary topaz
#

I ran my code and now have no errors 😄

#

now to do the finishing touches,.

drowsy helm
#
@CommandAlias("tp|teleport")
public class TeleportCommand extends BaseCommand {

    @Default
    public void tp(Player player, OnlinePlayer target){
        player.teleport(target.getPlayer().getLocation());
        player.sendMessage("Successfully teleported to " + target.getPlayer().getName());
    }

    @Default
    public void tp(Player player, OnlinePlayer from, OnlinePlayer target){
        from.getPlayer().teleport(target.getPlayer().getLocation());
        player.sendMessage("Successfully teleported " from.getPlayer().getName() + "  to " + target.getPlayer().getName());
    }
}
#

same command

wary topaz
#

Wait what

#

Is there a way to make my command more complex?

flint coyote
#

uhm yes but doesnt make sense on a tp

wary topaz
#

code*

drowsy helm
#

make it more complex?

flint coyote
#

??

drowsy helm
#

in what sense

flint coyote
#

make it more code?

wary topaz
#

Well I have multible duplicate lines

#

of messages

drowsy helm
#

less complex you mean?

wary topaz
#

Complex = less space

flint coyote
#

uhm no

drowsy helm
#

no it doesnt lol

#

complex means more complicated

wary topaz
#

oh I mean that

#

I need it to be more complicated and smaller

flint coyote
#

Usually smaller means less complicated

wary topaz
#

BIgger than ;-;

#

LOL

drowsy helm
#

probably

#

i can write an example up if oyu want

wary topaz
#

everything works, surprisingly

#

more complex for example, if target == null, We can duplicate that line to also have target2 == null

#

than the rest of the code is basically the same but for the differences we add a colon

#

I just- dont know how to do that

#

if target2 and target == p, they have the exact same lines of code

drowsy helm
#

somethingl ike this

#

but again, a command framework would be better

wary topaz
#

How would I make this work/

drowsy helm
#

what are you trying to do

wary topaz
#

make target 2 and target get checked if they both = p and run that command down on the bottom without using too much space

drowsy helm
#

if(target == p || target2 == p)

wary topaz
#

tysm

earnest forum
#

use && if you want both conditions to be true

#

|| is if one of them (one OR the other)

wary topaz
#

Ya || is what I needed

#

I cant figure out what's wrong

drowsy helm
#

Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1

#

learn how to read errors, they are super useful

#

line 28

wary topaz
#

ty

#

I'm having trouble fixing that issue

#

wait nvm I got it

earnest forum
#

with the array index out of bounds?

#

remember that an array starts at 0

#

so the first value is array[0]

#

the error is your trying to call array[1] which is the second value, for an array that has only 1 value

wary topaz
#

ya thats why it erroed

#

errored*

#

yay time to make a message system

torn shuttle
#

Quick q: anyone have any idea why I'm getting "Cannot create a world while worlds are being ticked"?

#

I am dead sure I've seen this error before but it's been years

torn shuttle
#

hrm

cobalt thorn
#

how i can put custom UUID inside the Item NBT and then check it?

torn shuttle
#

guess I'll ask them

valid sorrel
#

I'm trying to make a plugin with protocollib and trying to modify packets

#

but I'm having some trouble

valid sorrel
#

so I get a boolean field from a PacketContainer by doing .getBooleans().getField(n) but then I don't get how to use setBoolean()

chrome beacon
valid sorrel
#

specifically there is an argument that accepts an Object and I don't get what that is for

#

ohhh

#

I can do .write

#

I was confused because of read&write instead of get&set

cobalt thorn
chrome beacon
#

You will need to create your own DataType for UUID

cobalt thorn
#

how?

chrome beacon
#

Now I recommend you actually read the page I sent

valid sorrel
#

hmm

#

why does it say the packet has 0 fields

#

it's a login start packet

tardy delta
#

Byte[]

fiery prairie
#

How would I check if the player has a cracked account or real minecraft account in PlayerJoinEvent

#

?

harsh totem
#

does anyone else get this error? idk what to do, I have already relaunched my game and it didn't fix it. please help

#

i can't join any server

onyx fjord
#

Can you enter other servers¿

harsh totem
onyx fjord
#

Then mojangs fault

#

Most likely

harsh totem
#

but anyone else can join servers now

onyx fjord
#

Hm

#

Firewall maybe?

harsh totem
onyx fjord
#

Are you running any firewall tho

harsh totem
#

nope

onyx fjord
#

What OS

harsh totem
#

what is OS

onyx fjord
#

Operating system

harsh totem
#

windows

onyx fjord
#

Then you have fireworks by default, faulty one

#

Firewall*

harsh totem
#

but then why would it cause this problem only now?

#

i have been playing for years

onyx fjord
#

Not sure

#

Can't think of anything else

harsh totem
#

i don't think it is related to the default firewall

onyx fjord
#

Can you try pinging mojangs Auth server?

harsh totem
#

i'll try restart my pc

harsh totem
onyx fjord
#

💀

buoyant viper
boreal sparrow
#

how would you clear the console of the server?

rough drift
#

send a lot of messages?

tardy delta
#

Ctrl + l works on my Linux console

#

F discord on phone sucks

boreal sparrow
rough drift
#

with enough messages not

boreal sparrow
#

yea true

#

i tried 10k

#

still not enough

#

neither was 100k

#

1 mil time

scarlet creek
#

I noticed that playerInteractEvent would be called twice if you look at the ground with a block underneath you

#

I think this is because the event checks for both clicking in air and on a block, how do I make it only choose 1 so the event doesn’t fire twice?

flint coyote
#

no it's for both hands

#

you will always get 2 events. You have to choose what hand matters for your case by an if statement

#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
scarlet creek
#

Oh I see

#

Thanks!

smoky oak
#

i recall that i always did some sort of 'right click only' check on my interact events

flint coyote
#

Yeah but you would still get a right click for both hands

scarlet creek
grim ice
#

u cant even use both hands

#

in mc

#

except for shields and stuff

#

u cant dual wield

flint coyote
undone spindle
#

one of my plugins is not working and i dont understand what it wants

flint coyote
#

also you can technically hold a torch in both hands

flint coyote
# undone spindle
  • do you have the same plugin on your server multiple times?
  • do you create an instance of your main class manually?
  • do you have the same package structure for multiple of your plugins?
undone spindle
#
package com.dami.kingdomManager;

import java.util.ArrayList;

import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

import com.dami.KingdomInfo.Kingdom;
import com.dami.Permissions.Permissions;

public class KingdomManager extends JavaPlugin{
    private static KingdomManager instance;
    
    public ArrayList<Kingdom> kingdoms = new ArrayList<Kingdom>();
    
    private Permissions permissions = new Permissions(this);
     public KingdomManager() 
     {
         instance = this;
     }
     
    public void onEnable() {
        getServer().getPluginManager().registerEvents(permissions, this);
    }
    
     
     public static KingdomManager getInstance() {
            return instance;
        }
     
     public Permissions getPermissions() {
         return permissions;
     }

}
#

thats the line saying private Permissions permissions = new Permissions(this);

flint coyote
#

actually the Permissions constructor should be fine

#

I think him defining a constructor is the problem

undone spindle
#

defining this?

flint coyote
#

Defining
public KingdomManager()

undone spindle
# flint coyote Defining public KingdomManager()

that should be allowed

package com.dami.main;

import org.bukkit.plugin.java.JavaPlugin;

import com.dami.claiming.ClaimSelectedArea;
import com.dami.selecting.CancelEvents;
import com.dami.selecting.Select;


public class KingdomClaims extends JavaPlugin {
    public Select select = new Select(this);
    public ClaimSelectedArea claimSelectedArea = new ClaimSelectedArea(this);
    private static KingdomClaims instance;
     
     public KingdomClaims() 
     {
         instance = this;
            
         this.select = new Select(this);
         this.claimSelectedArea = new ClaimSelectedArea(this);
     }
     
    @Override
    public void onEnable()
    {
        getServer().getPluginManager().registerEvents(new CancelEvents(this), this);
        getServer().getPluginManager().registerEvents(select, this);
    }
    
    
    public static KingdomClaims getInstance() {
        return instance;
    }
    
    public Select getSelect() {
        return select;
    }
    
    public ClaimSelectedArea getClaimSA() {
        return claimSelectedArea;
    }
  
    

}
#

this is another script that does work where i do the same thing

flint coyote
#

Hmm alright

undone spindle
#

wait i think i know where i messed up i cant extend javaplugin in permissions unless i put it as main right?

flint coyote
#

yes

#

Why would you extend JavaPlugin in Permissions anyway?

undone spindle
#

i was trying something out

#

cus something didnt owrk

#

work

flint coyote
#

what if you need multiple permissions for subcommands?

undone spindle
#

wait i need to put in the permissions that are in my config?

flint coyote
#

I did all the checks myself so far. So if that would work completely from the plugin.yml that would be cool

#

how would it work for
/money requiring example.money
and
/money add requiring example.money.add ?

#

just as a basic example

#

I'll also accept a guide if you have one :)

#

But you know it works?

#

can you still change the message?

#

Like the no permission message

#

Yeah I'd like my own one. I guess that's configurable?

#

Yeah makes sense. currently looking for a config with subcommands

smoky oak
#

huh

#

what does <number> do in config? Is it a macro, or just a placeholder?

eternal night
#

usually a placeholder

#

but like

#

depends entirely on the config and the plugin that parses it

#

<number> certainly isn't a yaml level spec or anything

smoky oak
#

k thx

flint coyote
#

not even the official wiki says anything about subcommands. I doubt it's possible

misty ingot
#

hey so I have a listener which listens to when a player right clicks a certain mob and then it runs a piece of code, but the code is running twice

#

how can I prevent this

#

I want it to only run once

#

I hate the offhand

eternal night
#

Yea, just check the hand ^

misty ingot
#

how do I check hands

eternal night
misty ingot
#

if(hand.equals(EquipmentSlot.HAND)) {
used this

#

still runs twice

#

no errors

smoky oak
#

check for right hand

#

not hand

misty ingot
#

nvm HAND worked

#

there was a diff error

chrome beacon
#

Use the spawn method with a consumer

#

That will ensure that the entity properties are changed before the entity is spawned

#

Yeah that's a functional interface

undone spindle
#

this is my permissions script

#

and uh it wont set the permissions

#
kingdom:
  general:
    world:
      - world.blockbreak
      - world.blockplace
      - world.iteminteract
      - world.animalkill
      - world.animalbreed
      - world.killplayers
      - world.killteam
      - world.verified
      - world.spawnProt  
      - world.inventories
      - world.respawn
      - world.sleep 
     
  villager:
    kingdom:
      - kingdom.maintaintasks
    classes:
      - class.upgrade
     
     
  ambassadeur:
    kingdom:
      - kingdom.maintaintasks
      - kingdom.invite
      - kingdom.kick
    claim:
      - claim.claim
      - claim.unclaim
      - claim.setprovince
      - class.upgrade
      
  general:
    kingdom:
      - kingdom.maintaintasks
      - kingdom.invite
      - kingdom.kick
    claim:
      - claim.claim
      - claim.unclaim
      - claim.setprovince
      - class.upgrade
      
      
  king:
    kingdom:
      - kingdom.maintaintasks
      - kingdom.invite
      - kingdom.kick
      - kingdom.upgrade
      - kingdom.setrank
      - kingdom.idiology
      - kingdom.maintaintasks
    classes:
      - class.upgrade
      - class.set
      - class.remove
    claim:
      - claim.claim
      - claim.unclaim
      - claim.setprovince
      - class.upgrade
#

and this is config

left swift
#

What is the best way for naturally spawning a lot of custom mobs? I mean listening EntitySpawnEvent/CreatureSpawnEvent is enough or should I use any other way?

agile anvil
left swift
#

spawn custom entities

#

naturally

sterile token
#

Hi

#

What the best way for tracking player items?

chrome beacon
#

PDC

#

Do what I told you earlier and you won't have that problem

chrome beacon
#

It is the issue here

#

I'm not here to argue

#

It is the problem

#

It is you're causing an infinite loop by spawning the entity that way

#

That error is the only thing stopping the infinite loop

#

Yeah

#

The entity is spawned and triggers the spawn event before the name is set

#

And then repeat that for infinity

#

Which is why you should do what I said

round finch
#

Oh no infinity loops curse of it

chrome beacon
#

If you just want to replace all vexes what you're doing is fine

round finch
#

Get the vex

#

Change it

#

Put spawn into a timer?

#

Maybe a location

chrome beacon
#

I'd still spawn a new one. That helps with other plugins trying to use the spawn event

round finch
#

You're trigger spawnevent with spawning

chrome beacon
round finch
#

Then he is spawning again

chrome beacon
#

I've already said how to fix that problem

sterile token
round finch
#

Looping

chrome beacon
#

You can store a UUID for example

round finch
#

Just store entity list outside of event

#

Make it Accessible to different places

#

But world is already storing entities

onyx fjord
#

how much does it take for bstats to detect server using my plugin?

#

30 minutes

#

at least random spigot post says so

#

☕ time to drink some java then

chrome beacon
round finch
#

Is data container permeant on entities?

chrome beacon
#

pdc?

#

If so yes

round finch
#

I forgor ☠️

round finch
onyx fjord
#

it is tho if you set it up wrongly you will only realize on restart 💀

#

at least i did

round finch
#

I were thinking about tracking data

paper falcon
#

hey spigoteers,
I'm trying to make my custom mob break doors but it's obviously not working, I'm not sure what's with this difficulty stuff

#

could I get some insight on this?

quaint mantle
#

you return false if the you don't want the mob to break doors on that difficutly

#

pretty sure

sterile token
#

PDC != 1.13

onyx fjord
#

what

sterile token
#

Bigpro lem

quaint mantle
onyx fjord
#

reject legacy

paper falcon
quaint mantle
#

are you in survival?

sterile token
paper falcon
#

yes

quaint mantle
#

hmmmm hmmm

#

maybe look how it's used in nms code

#

i can't look at the code rn

#

school blocks spigot dependency download 😭

paper falcon
#

ohh rip

#

okay thank you very much though I'll try

round finch
#

Save entity uuid

#

Store entity uuid in list

#

So it won't trigger twice

chrome beacon
chrome beacon
round finch
#

I would do it differently

#

Thb

#

Probably use a runnable

round finch
chrome beacon
#

They're already doing a name check which should be sufficient

#

though I would use a PDC tag

round finch
#

my apologies for confusing
Very tired

sterile token
#

I want to track each item that player have or give yo another player

round finch
#

Good job!!

chrome beacon
#

You're better off looping online players

#

Also why do you need the player?

#

Just to send a message?

round finch
#

(Player p : Bukkit.getOnlinePlayers)?

onyx fjord
#

thats a for loop

#

idk your goal

round finch
#

It a loop for all your online players

#

But it depends your design and goal

onyx fjord
#

loop thru online players and check if theyre in the chunk ig?

#

more efficient it sounds

#

there can be a lot of entities in chunk 😄

round finch
#

Uh

onyx fjord
#

wait how can location be instanceof Player

#

oh

round finch
#

🤣

onyx fjord
#

use more proper variable names

#

like entity instead of loc LOL

#

i rather avoid short var names too

#

proguard should be the one minifying if ever doing so

#

but proguard shouldnt be used for such small projects

#

ye but what if chunk is very very loaded with entities

#

doesnt sound efficient to me

wet breach
#

use chunksnapshot

#

so that you don't lag the main thread

misty ingot
#

is there a way to detect whenever cobble is formed from a cobble gen? (and get the formed blocks' position)

wet breach
#

chunksnapshot is thread safe

#

and it still allows you to look up entities in the chunk

#

you can use it async, but recommend using a separate thread

smoky oak
quaint mantle
#

how can I allow a void parameter to be any object type ?

public class database{

    private static FileConfiguration config;
    private static File database;

    public database(){
        File dataFolder = Main.getFolder();
        database = new File(dataFolder, "data.yml");
        config = YamlConfiguration.loadConfiguration(database);
        if (!database.exists()) {
            try{
                database.createNewFile();


            }
            catch (IOException e){
                System.out.println("cannot create a data file Exception:" + e.getMessage());
            }
        }

    }

    public void update(String path, String data){ // how to allow "data" to be any object type, not just string
        config.set(path, data);
        try{
            config.save(database);
        }catch (IOException e){
            System.out.println("could not update database" + e.getMessage());
        }
    }
}
wet breach
#

while that may be true, have enough entities in the chunk and it will lag the main thread while its searching that chunk 🙂

tardy delta
#

ah yes naming conventions are gone again

round finch
#

Data object

wet breach
#

not much you need to do other then just using it and either toss it into an async task or in a separate thread

round finch
#

Set a object

tardy delta
#

Object instead of String

round finch
wet breach
quaint mantle
tardy delta
#

static abuse lol

#

yes

#

and not using ?di

wet breach
#

the only difference between a chunksnapshot and a chunk, is that a snapshot isn't live which makes it safe for async

quaint mantle
wet breach
#

it will contain all the entities up until you called that method

round finch
#

What is bad code writing practices?

#

Unclear and messy?

smoky oak
#

do not do these:

  1. writing uncommented code
  2. using unclear variable names
  3. trying to use fancy stuff (three element operator for more complex things for example)
  4. using if else if a switch could be used
  5. being incosnsitent with naming stuff, especially in the same project
  6. using static variables if theyre not necessary
  7. violating the one-function-rule (there should only be one function for a class, and only one reason for it to change)
wet breach
round finch
#

Yeah gimme a list

#

I would like to avoid issues

dim bronze
wet breach
#

why?

smoky oak
#

i said it right there

dim bronze
#

oh I was reading function as a synonym for method

#

and got confused

wet breach
#

I do have plenty

young knoll
#

Loop all players in the world and determine the closest using distanceSquared?

round finch
#

Location closet?

wet breach
#

So, what you do is create a boundingbox around the location of the boss and keep a reference to that. The box can be as large as you want. Then just listen for playermoveevent, and check it against your boundingbox if they are inside it. If they are, initiate the boss fight, if not ignore it.

round finch
#

There is many ways

#

And many ideas

wet breach
round finch
#

close enough with key?

#

Click to start?

#

Or command

#

Different ways to interact

#

Sounds pretty cool

#

Inventory way

#

So freaking Tru

#

Bahaha

#

If snow ball hits freez effect

#

Custom attacks?
Throw snow block 🤨

#

Nice rewards

#

Yeah sounds like a idea making it more fun and interesting

amber bronze
#

still easy to kill

#

still easy to kill

round finch
#

New stuff to do besides default

young knoll
#

You still have that useless array of entities from the chunk

wet breach
#

why not make a player wrapper that keeps track if they have a key or not

#

then when you use playermovevent, its just a matter of using your player wrapper to check if they have a key or not

#

this eliminates having an item specifically as well as not having the need for a command

smoky oak
#

how do i get the height of the water in a cauldron