#help-development

1 messages · Page 1856 of 1

young knoll
#

reaplceAll is regex :p

dusk flicker
#

Still, stupid

golden turret
#

yes, our minecraft plugin must save some milliseconds of runtime

#

????

#

getDislayName from the ItemMeta will return §

dusk flicker
#

in that specific case sure

young knoll
#

If you use another char I guess you could use replaceAll

dusk flicker
#

or you use the actual method that will do it EVERY time

paper viper
#

but still.. dumb

young knoll
paper viper
#

why not use a provided method

#

?

golden turret
paper viper
#

Or use the same fucking method?

#

Lol?

dusk flicker
#

or just use the provided method\

#

that requires NO CHANGING

golden turret
#

ok

#

and no

#

the stripColor dont translate the & to §

#

also, it uses the replaceAll

quaint mantle
#

do you have any point in this conversation

golden turret
#

is that a question?

quaint mantle
#

no its a statement

patent horizon
#

is there a way i can find all instances of a set of characters in my strings and then replace all those instances at once in intellij?

upper vale
#

control shift R

#

i think thats what ur looking for?

paper viper
#

You can do

#

Edit -> Find -> Replace in Files

golden turret
#

i would use the ctrl f "select all occurrences"

upper vale
#

yea ctrl shift r is shortcut for that iirc (what pulsebeat said)

winged sedge
golden turret
quaint mantle
#

is there a method like this in map

NamespacedKey key = namespacedKeys.get(keyStr);
if (key == null) {
    namespacedKeys.put(keyStr, key = new NamespacedKey(plugin, keyStr));
}
young knoll
#

putIfAbsent?

quaint mantle
rough basin
#

Can you summon a snowman with a pumpkin peeled off?

young knoll
golden turret
#

derp

gentle oriole
#

hi, for example if I have 2 points of Yaw, one is -125, and the other is -170. How do I know if player is looking in between those two. I know how to get the yaw of the player. But I don't know how to Boolean it.

rough basin
#

Thanks

dusk flicker
#

less than and greater than signs

#

will do this

gentle oriole
# dusk flicker < >

Ok now, I have two more Yaws. -170, and 170. How do I know if the player is looking inbetween them

quaint mantle
#

monke < human > money

patent horizon
#

why did it put an A in front of all the characters

young knoll
#

Idk, why did it

#

What should it be

dusk flicker
#

use greater than and less than signs

young knoll
#

And have you saved the file with the right encoding

quaint mantle
#

why shouldnt it

golden turret
dusk flicker
#

this is like basic math

quaint mantle
#

?learnmeth

patent horizon
quaint mantle
# young knoll putIfAbsent?

i needed computeIfAbsent to return the value no matter what in one line

public <KT, VT> void set(PersistentDataContainer pdc, String keyStr, PersistentDataType<KT, VT> type, VT value) {
    NamespacedKey key = namespacedKeys.computeIfAbsent(keyStr, (v) -> new NamespacedKey(plugin, keyStr));
    pdc.set(key, type, value);
}
#

?learnmath

undone axleBOT
quaint mantle
#

?learnjava

golden turret
gentle oriole
#

Dude

quaint mantle
#

imagine not learning math before making plugins.

dusk flicker
#

bruh

patent horizon
quaint mantle
#

it is bro

gentle oriole
#

minecraft yaw is not

dusk flicker
#

its a number

#

between two numbers

golden turret
dusk flicker
#

literally simple as shit

quaint mantle
#

if it isnt basic math then you probably grade 2 or even less

young knoll
#

Gosh imagine I though you did the code goodly

dusk flicker
#

Minecraft yaw is prob easier than an actual gyroscope used on a robot that I had to program using the exact same thing I said above

gentle oriole
#

How do I know if player is looking in red?

quaint mantle
gentle oriole
#

you cant use < > because -170 and 170

quaint mantle
#

sadge bro learn math

dusk flicker
#

yes you can...

young knoll
#

I do the code welly

gentle oriole
#

if you do 170 to -170 its 340 numbers

#

not 20 numbers

patent horizon
#

is there a way i can do it for all my class files

quaint mantle
#
if (player.getPitch() > 170 && player.getPitch() < 190) {

}
young knoll
#

I wish java had a quick way to check a range

gentle oriole
young knoll
#

Well, quick and not cursed

dusk flicker
#

Pitch cant be

#

yaw can

gentle oriole
#

AH YAW

quaint mantle
#

yeah but yaw isnt pitch

gentle oriole
#

Yaw cant be greater than 180

winged sedge
dusk flicker
#

?jd

winged sedge
#

Great

quaint mantle
#

i have never interacted with bungeecord in my life

#

never plan to

winged sedge
#

You're a spigot discord helper and you haven't interacted with bungeecord?

quaint mantle
#

correct

dusk flicker
#

hello?

quaint mantle
#

pitch is -

young knoll
#

Yaw in game is -180 to 180

#

IIRC the spigot method returns 0 - 360

echo ingot
quaint mantle
#

Ok

dusk flicker
quaint mantle
#

a quick google search led me to this

dusk flicker
#

yaw should be rotation around the center point

quaint mantle
#
anglediff = (facingAngle - angleOfTarget + 180 + 360) % 360 - 180

if (anglediff <= 45 && anglediff>=-45) ....

The reason is that the difference in angles is facingAngle - angleOfTarget although due to wrapping effects, might be off by 360 degrees.

The add 180+360 then modulo 360 then subtract 180, effectively just converts everything to the range -180 to 180 degrees (by adding or subtracting 360 degrees).

Then you can check the angle difference easily, whether it is within -45 to 45 degrees.

paper viper
patent horizon
#

ok i did the ctrl shift f way

winged sedge
#

Who the hell picks helpers in this discord? What's the point of this discord if I can't even get some support on a fairly important issue...

patent horizon
quaint mantle
#

im not a helper im a moderation helper

dusk flicker
#

they arent here for support

#

this is, literally a community help forum

quaint mantle
#

we arent super engineers

patent horizon
# patent horizon

i've gotten all the occurrences i just dont know how to replace them

quaint mantle
#

well i mean redempt is pretty smart

dusk flicker
#

yeah

#

optic is as well

#

sometimes

patent horizon
quaint mantle
#

Im so proud

patent horizon
#

lol

quaint mantle
#

made it in 5 minutes

#

anyways @gentle oriole i found your solution

gentle oriole
quaint mantle
young knoll
quaint mantle
#

so

dusk flicker
dusk flicker
paper viper
#

its clearly not code related

winged sedge
dusk flicker
#

programming/development

paper viper
#

Is that not clear enough?

quaint mantle
#

do you even read all of that?

winged sedge
#

This is literally the spigot discord... this is a development channel...this is a development issue...

echo ingot
quaint mantle
#

but i dont sometime i thought this was general chat because #general is just #help-development but better

echo ingot
#

there is nothing on the ops side of the server that is causing this issue

paper viper
#

he has provided no code at all

echo ingot
#

that does not mean it is not a code related issue

winged sedge
#

Here it is

paper viper
#

??

dusk flicker
#

you act like we work on that

gentle oriole
#

My question is simply how do I consider 180 as being in between -170 and 170??

quaint mantle
#

if -170 < player get yaw > 170?

#

pitch*

quaint mantle
#

idk people was using pitch and yaw too much i forgot which one

gentle oriole
#

oh gosh

quaint mantle
gentle oriole
quaint mantle
#

add 360 to each side

#

random numbers generator

#

i think in your case facingAngle would just be 0

gentle oriole
#

yes probably

#

and fecing angle is 45

#

i cant even spell facing correctly

#

getYaw returns -180 to 180 right?

quaint mantle
#

-170 + 360 = 190
360 + 170 = 530

190 <= 360 && 360 <= 530
try this?

#

wait you need the angle in there too

#

the angle of target would be the pitch i would assume

gentle oriole
#

pitch is not important

quaint mantle
gentle oriole
#

Yaw

quaint mantle
#

ok you want yaw thats fine

gentle oriole
#

well you cant turn around in mineraft by just moving your mouse down and doing a backflip but reverse

quaint mantle
#

doesnt the yaw lock at 180

gentle oriole
#

yeah

quaint mantle
#

im pretty sure you'd just change 360 to 180

gentle oriole
#
                if (minYaw < -180 || minYaw > 180 || maxYaw < -180 || maxYaw > 180) {
                    if (minYaw < -180) {
                        float extra = minYaw + 180;
                        minYaw = extra + 180;
                    }
                    if (minYaw > 180) {
                        float extra = minYaw - 180;
                        minYaw = extra - 180;
                    }
                    if (maxYaw < -180) {
                        float extra = maxYaw + 180;
                        maxYaw = extra + 180;
                    }
                    if (maxYaw > 180) {
                        float extra = maxYaw - 180;
                        maxYaw = extra - 180;
                    }
                }
quaint mantle
#

ok you solved your problem

#

noice

rough basin
#

I have this BukkitRunnable now, How can I run init of this class and run runTaskTimer?
My smol brain reached new sentryTask().init(entity); but I can't think of it anymore.

young knoll
#

Why do you have an init method and not a constructor

dusk flicker
#

also CONVENTIONS

#

PLEASE DEAR LORD

#

?conventions

undone axleBOT
rough basin
quaint mantle
#

change class name to SentryTask to follow UpperCamelCase naming convention
instead of an init method, create a constructor

gentle oriole
quaint mantle
quaint mantle
young knoll
#

Generally at the top, but they can go anywhere

dusk flicker
quaint mantle
undone axleBOT
gentle oriole
quaint mantle
#

oh i mean it isnt that necessary to learn java just to know where to place a method lol

#

sorry

dusk flicker
#

theres a lot of other commands, sam disabled the list sadly a few months back

quaint mantle
#

give list

gentle oriole
#

I cant see any 180 or 540?

quaint mantle
#

?list

#

?cmd-list

#

where

#

why

quaint mantle
#

which locks to 180

#

if i want the range to be between 160 and 20

#

im no genius here

dusk flicker
quaint mantle
#

but i think u add the full range to both numbers

#

which is 180 in this case

dusk flicker
#

i wonder

quaint mantle
#

160 + 180 | (the degrees to compare) | 20 + 180

undone axleBOT
#

Yes Sam is real. I was not programmed to say this by Sam.

#

No, Choco is not real. I was not programmed to say this by Sam.

visual tide
#

?ismd5real

#

?ismd_5real

#

?ismdreal

quaint mantle
#

then

gentle oriole
#

wait, what is the range you mean?

visual tide
#

got a question with custom events
if your event is cancellable and you dont want to do anything if a plugin cancels it how do you wait for every handler to do their thing?

gentle oriole
#

160 and 20?

quaint mantle
#
if (340 >= degrees && 200 <= degrees) {

}
quaint mantle
#

like

#

160 is 20 less than a full 180, then resetting to 0

mellow gulch
rough basin
#

is private LivingEntity entity is not a constructor?

quaint mantle
#

ill try and give a better example

#

do you understand python

gentle oriole
#

yes

quaint mantle
#

k wlel first lemme see if what im rambling on about works

unreal quartz
#

What are you rambling on about

gentle oriole
#

how do I prove that 180 is in between -170 and 170

mellow gulch
unreal quartz
#

Well it clearly isn't

gentle oriole
gentle oriole
#

it is.

visual tide
#

if a custom event is cancellable and you dont want to do anything if a plugin cancels it how do you wait for every handler to do their thing?

or does callevent block?

unreal quartz
gentle oriole
#

yeas

unreal quartz
#

Why don't you just normalise it to between 0 and 360

#

Make your life easier

gentle oriole
#

and now i have to prove that 360 is in between 10 and 350

quaint mantle
#

This is so fucking simple but nobody has an answer for it not even me

#

how did i forget this

unreal quartz
#

Because their question does not make sense

quaint mantle
#

Mr bishop answer this

gentle oriole
#

it DOES make sense

#

minecraft did this

dusk flicker
#

minecraft does not make sense

quaint mantle
#

his image

#

nice drawing btw

dusk flicker
#

why dont you just check if its from 170 to 180 and -170 to -180

#

like

#

simple?

unreal quartz
#

You have 340 degrees of freedom and you want to rotate 360 degrees is what you're saying?

quaint mantle
#

i forgot how to calculate this

#

help

#

like

unreal quartz
#

Calculate what

quaint mantle
#

for ex: 4^8/4^6 =?

dusk flicker
#

4^2

quaint mantle
#

i think it is 1/16 (4^2)?

#

okay

quaint mantle
#

or bodmas

gentle oriole
quaint mantle
#

or bedmas

quaint mantle
#

sexy

unreal quartz
quaint mantle
gentle oriole
quaint mantle
#

:sadge

gentle oriole
# quaint mantle snapped neck plugin

but there are more than snapped neck...

    static ArrayList<String> modules = new ArrayList<>(Arrays.asList("playerPunchedAir", "playerTooHigh", "playerBrokeTooSlow", "playerAteTooMuch", "playerOverworked", "playerSlipped", "playerTookDamage", "playerTooHealthy", "playerSwam", "playerNeckBroke", "playerCrouched"));

quaint mantle
dusk flicker
#

technically pemdas doesnt apply to that

quaint mantle
#

Shutup

#

shut up

#

shutup rack

dusk flicker
#

diving exponents is just subtraction for them

#

hehe

quaint mantle
#

4^2 = 16

#

Oh i see

#

you devil

#

1/16(16) could be left to right or 16(16) then divide

dusk flicker
#

it would end up being 16 yeah

#

you divide them first and then do the remainder

unreal quartz
quaint mantle
#

which doesnt make any sense to me

#

i would just go left to right, right

dusk flicker
#

how I learned it would be 4^8 / 4^6 which would end up as 4^2 which is 16 ¯_(ツ)_/¯

quaint mantle
#

yea what i learned back then was like 4^8 - 4^6 = 4^2 so that i can get 16

dusk flicker
#

ye

#

would be division rather than - but ye

quaint mantle
#

n^a * n^b = n^(a + b)
n^a / n^b = n^(a - b)

dusk flicker
#

define ur vars

#

lol

#

(im kidding)

quaint mantle
#

n = 4
a = 8
b = 6

#

kk

#

4^(8 - 6) = 4^2 = 16

#

why are we doing elementary math in discord

#

dunno

dusk flicker
#

why not

quaint mantle
#

because i forgot it?

#

i cheated on every test last year

#

passed with a d

dusk flicker
#

lmao

quaint mantle
quaint mantle
#

mine is secondary, in grade 6 or 7 i think

#

so i just googled math stuff to impress my teachers

#

🐲

young knoll
#

Spigot staff encourage cheating

#

#exposed

vocal cloud
quaint mantle
#

i cant understand that system we still use numbers for scores and stuff

#

dunno A or B,C,D+

unreal quartz
#

Z

charred echo
#

Is there an event like PlayerCommandPreprocessEvent

#

but for console

unreal quartz
#

ServerCommandEvent

charred echo
#

just found it

#

thx

gentle oriole
#
def isMiddle (a, b, target):
    a = a+360
    while a > b:
        a = a-1
        print(a)
        if a == target:
            return True
    return False


print(isMiddle(10, 350, 360))

FINALLY LMAO

#

@quaint mantle

unreal quartz
#

That just looks like a lengthy way of writing a + 360 > b && target > b

gentle oriole
#

YES BUT IT WORKS

unreal quartz
#

Right

young knoll
#

Left

lavish hemlock
#

politics

spare marsh
#

Anyone familiar with bstats?

bright jasper
#

So I know about ways to spawn in entities which are custom models through blockbench but I was wondering if there was an equivalent for that for blocks

#

or structures placed around the world instead

young knoll
#

Noteblocks is the common method

bright jasper
#

any links to guides or info on this?

gentle oriole
#

how do I know if player crouched?

#

ExhaustionReason.CROUCHED only fires when player is walking and crouching at the same time

young knoll
#

What is that even from

#

There’s a PlayerToggleSneakEvent

gentle oriole
#

Toggle?

young knoll
#

Yes?

#

Or do you want to know if they are currently crouching

gentle oriole
#

dont that only fire if they set their crouch to toggle mode?

young knoll
#

No

gentle oriole
#

AH

#

thank you

quaint mantle
#

does anyone know how to check the player a snowball hits

#

they dont do damage anymore im pretty sure

young knoll
#

Are you sure

#

You can use the ProjectileHitEvent either way

quaint mantle
#

nvm 😄

winged flint
#

ip

#

?ip

quaint mantle
#

u dont even need damage for this event

winged flint
#

what is a ip

quaint mantle
#

i didnt even try but it works now, i think it was broken one patch

young knoll
#

You want to know what an IP is?

winged flint
#

mcpe

young knoll
#
  1. This is spigot, a server software, not a server
#
  1. Spigot is for java edition
winged flint
#

ok but do you have the ip?

young knoll
#

No?

#

IP for what

#

I have to wonder how they even ended up here

storm nest
#

Hi :) I've been trying to use Genson in a plugin for a while today, and it only works up to a point, which I'm trying to debug

Here's a small code snippet:

                Genson genson = new Genson();
                String serialized = genson.serialize(playerWarpList);

                List<warpObj> listhappy = genson.deserialize(serialized, List.class);

                player.sendMessage(listhappy.get(0).getWarpName());

and here's the errors: https://hastebin.skyra.pw/rolafexure.css

Basically everything works perfectly fine until the last time where it's unable to do .getWarpName() which is just a getter which returns a String.
deserializing works fine, in the debugger I see my listhappy and its full content, perfectly deserialized, and if I try to print listhappy.size, it works, but as soon as I try to get a specific parameter inside warpObj is prints errors, even if I can see in the debugger that they're all perfectly set.

Anyone got any idea what's happening? Me and a team of 2 other friends have been googling for hours without success.

sullen marlin
#

No idea wtf genson is, but you likely need additional work to deserialize generics

#

With gson it would be, eg, a typetoken

rough basin
#

I want to bring all the entities in the server as a Collection.

#

What method i should use?

lavish hemlock
#

although one of the first commits

#

the .gitattributes

#

was 9 years ago

mellow gulch
storm nest
#

it seems to be an issue that arrived with Java 9, so downloaded and switched my project to Java 8 to no avail

young knoll
#

That’s an issue with newer java, is genson updated to support that

storm nest
#

Maybe, at least it didn't seem to cause any issue, while with Gson as soon as we tried serializing it directly gave that error

sullen marlin
#

Not helpful without the full error

#

Are you trying to serialize a class with a non primitive field

sullen marlin
#

More specifically a Reference

storm nest
stone light
#

what did the STATIONARY_WATER and STATIONARY_LAVA materials turn into?

sullen marlin
#

You can't just throw a bukkit location in and expect it to work

#

Because that contains a World and how is that gonna get serialized

stone light
#

thats what I thought I just wanted to check

sullen marlin
#

Also how badly do you need json

next zinc
#

Anyone know a way to move a players velocity towards another

#

Not quite sure how to do it logically

sullen marlin
#

The API contains extensive yaml infrastructure, which will handle such things automatically

storm nest
#

I'll have to look into that, thank you, I tried to go with something I already knew a little, but I see how that's not a great idea

young knoll
next zinc
#

so basically subtract the players velocity with the other players and use the difference as a midpoint?

torn shuttle
#

wasn't there a trick to giving entities unbreakable hats by giving them a material could be put in the hat slot but didn't actually display in-game, though it still counted as a helmet so it wouldn't break in sunlight?

young knoll
#

Yes

#

Buttons work well

torn shuttle
#

ah yeah

#

so they do

young knoll
#

Or you can just cancel the combust event

torn shuttle
#

thanks, couldn't find anything

#

the combust event, is it?

young knoll
#

EntityCombustEvent

torn shuttle
#

does that prevent the visual combustion as well?

young knoll
#

Should

torn shuttle
#

my entities with fire resist are still always on fire which is a bit upsetting

quaint mantle
#

hey im trying to use the player.sendtitle. is the int fade. fadeout and stay time in seconds?

#

ticks

quaint mantle
gentle oriole
#

is it just me or the sun in minecraft movement is not linnear

lucid bane
#

is there any way to make ShapelessRecipe or ShapedRecipe has ingredient of ItemStack?

#

RecipeChoice.ExactChoice says it can be allowed only in ShapedRecipe

young knoll
#

Pretty sure it actually works in other recipes now

#

Try it

lucid bane
#

thx

gentle oriole
#

WHY IS THE SUN MOVEMENT NOT LINEAR

hasty prawn
#

How do you know it's not linear

candid plover
#

How to fix this?

hasty prawn
candid plover
#

my economy plugin

#

put 72.2338485757850 in money

#

how to fix this?

young knoll
#

Format it

#

Using String.format or DecimalFormat

candid plover
#

hm

gentle oriole
# hasty prawn How do you know it's not linear

ive gotten the time at when the sun is at 0 pitch, and the same but on the other direction. I get the time per pitch, then I set the time, and Time and Pitch does not match... They only match when it's noon...

hasty prawn
#

That's a 9 year old thread...

gentle oriole
#

yes

hasty prawn
#

What are you trying to do

gentle oriole
#

trying to kill the player if the player look directly at the sun

#

xd

storm nest
young knoll
#

Yes

#

Spigot 1.16 does not support java 17

young knoll
hasty prawn
#

Do java -version and see what it says

#

17 is probably your default

young knoll
#

Either change that or run the server with the full path

hasty prawn
#

Do what Coll suggested

young knoll
#

Have you tried googling it

storm nest
# young knoll That’s exactly what spigot does for you

Do you perhaps have a wiki page or something like that to kickstart my learning? I've been looking around and from what I see it all just repeats the same idea "You can't serialize a block, you need to [break it up into its component]" for example and I don't see where that would be done automatically

young knoll
#

How to change default java version?

gentle oriole
#

the sun is not linear :<<

dark arrow
#

is it legal to open plugin code and take help from it?

quaint mantle
#

yes

#

as long as you are following the license and in most cases not redistributing it

young knoll
#

You can’t take the code directly thought

#

Unless the license allows it

#

In which case it’s probably open source already

dark arrow
#

i wont be uploading it anywhere

quaint mantle
#

then you're fine

dark arrow
#

i just want to see the working

#

and learn from it

young knoll
#

Oh look default profile picture buddies

dark arrow
#

lol

#

xD

quaint mantle
#

idk what to set as my pfp

#

imma just turn into a catfish again

young knoll
#

A catfish or a catfish

quaint mantle
#

like

#

set my profile pic to a woman

#

last time this desperate dude wanted to date

#

only on spigot grove

gentle oriole
#

is there any event that fires if the player looks at the sun

#

or something that tells the sun location?

#

not getTime(). the sun movement is nonlinear and it sucks...

young knoll
#

You’ll have to do math using the time

rough basin
#

Didn't it work normally without putting anything inside getWorld() ?

gentle oriole
young knoll
#

Non linear equations exist

quaint mantle
#

f(x) = x^2

young knoll
#

A server has many worlds

gentle oriole
quaint mantle
#

alright

#

dababy car

#

back to my old self

rough basin
#

lmao

young knoll
#

Looks like there is a method for it

#

Not sure if it’s part of forge or vanilla

rough basin
#

my server have only one map, then just input 0?

young knoll
#

Yes

#

Or you can loop each world

#

In case you ever have more

young knoll
gentle oriole
#

so much for killing players when they look at the sun

young knoll
#

What do you mean “nope”

gentle oriole
young knoll
#

Then take the code from forge

gentle oriole
#

NOPE

young knoll
#

Also no, it does look like it’s in the vanilla server

#

Yep, it is

#

Not exposed in the Bukkit API thought I assume

rough basin
#

If the server is forcibly turned off with task manager, etc., may onDisable() not work properly?

young knoll
#

Yes

rough basin
#

Thanks

#

:)

young knoll
#

It will only fire during a proper shutdown

candid plover
#

How to format a double?

#

my double return 72.2338485757850

#

in mysql

#

😔

sullen marlin
#

DecimalFormat

young knoll
#

Or String.format

#

Didn’t we already tell you this

lucid bane
#

can i make a nbt-different coal can't smelt anything?

young knoll
#

Probably

#

There are furnace events

lucid bane
#

OH

#

why i didnt think bout that sry

jagged monolith
#

What's the best way to check if a player is falling when they login (using the playerjoinevent)

lucid bane
#

isOnGround() may be useful

young knoll
#

(Deprecated, but good enough for this purpose)

lucid bane
#

or Number.isInteger(int) can be useful i think

young knoll
#

Not reliable

#

Non-full blocks exist

jagged monolith
quaint mantle
#

anyoine know how to stop the left click event on item drop

#

?

candid plover
#

How do I hide specific tab commands?

torn shuttle
#

the attack method for living entities just simulates an attack from the entity directly regardless of circumstances right

#

it's not going to actually make it walk up to the player and attack?

sullen marlin
#

Correct

rough basin
#

Isvaild True if LivingEntity is Unloaded?

#

i have no idea what is 'despawn'

young knoll
#

What?

rough basin
#

I really Hate google Translator

#

wait a sec

quaint mantle
#

oh no

#

google translator?

rough basin
#

if entity Unloaded by some reason, what return entity.Isvaild will?

rough basin
#

hmm

#

Thanks

young knoll
#

Yes

#

isValid will return false of the entity is dead, no longer loaded, or removed for some other reason

quaint mantle
#

pdc is persistent

#

even after restart

candid plover
#

Its, cause lag?

quaint mantle
#

what about when the entity dies 🙂

young knoll
#

Did you not read the docs

hardy swan
#

It is still there

young knoll
#

It clearly says “returns false if the entity has died”

young knoll
#

Make that array outside the event

candid plover
young knoll
#

Probably not

#

The event is by called often

quaint mantle
#

😒

young knoll
#

Then no

#

Of course it’s gone if the entity is gone

rough basin
young knoll
#

But no, most other methods will probably fail

rough basin
#

so sad

quaint mantle
#

can i post a pastebin link here? I need help with a little code

mellow gulch
# rough basin so sad

a terrible idea, but something you could do if you need the entity to remain valid would be to keep the chunks loaded that the entities are in, but this could use up lots of ram if you have lots of entities in different chunks

quaint mantle
sullen marlin
#

Post the full console error

sullen marlin
#

Not running Spigot

quaint mantle
sullen marlin
#

You're not running spigot server software

quaint mantle
#

is that the problem?

sullen marlin
#

Right and this is spigot

quaint mantle
#

ok thanks

maiden thicket
#

ur running paperspigot and using spigot api i assume

#

paper changed their methods to kyori

#

oh 1.8.8

#

nvm then

quaint mantle
#

im using the api version 1.12

young knoll
#

Well that’s why

#

sendTitle didn’t exist in 1.8.8

#

You can’t just magically use it by referencing a newer API

#

Also, we don’t support ancient versions

quaint mantle
#

qq all

#

How do I get the placed blocks?

#

player.getStatistic

lost matrix
#

Do you want to get the amount of Blocks placed for a specific type?

lost matrix
lost matrix
#

idk iterate over all blocks and sum the statistics

quaint mantle
lost matrix
# quaint mantle ok, thanks

Something like

  public long getTotalAmountOfBlocksPlaced(Player player) {
    return Arrays.stream(Material.values())
        .filter(Material::isBlock)
        .mapToLong(type -> player.getStatistic(Statistic.USE_ITEM, type))
        .sum();
  }
topaz cape
#

i mean.. that's actually quit insane holy crap thanks

next fossil
#

How would I be able to spawn a Client Side Armor Stand in 1.18 Mojang Mappings?

        
        armorStand.setGravity(false);
        armorStand.setCustomName(text);
        armorStand.setCustomNameVisible(true);
        armorStand.setInvisible(true);
        armorStand.setSmall(true);```
#

WorldServer is outdated and I don't know what the new Mojang Mapping for it is

quaint mantle
#

How can I make a count of how many blocks have been passed? flight and walk

#

@lost matrix

#

@ivory sleet

spiral light
terse ore
#

Hey

#

is there a way I can make this variable?

#
String tpa.p.getName() = player.getName();```
#

being able to use a variable inside the declaration of another variable

spiral light
#

you want to names to be the same variable ?

#

or you wanne set the tpa.p name to player.getName() ?

terse ore
#

for example

#

with my name

#

String tpa.Akex06 = Test123

#

I was able to do it in skript

spiral light
#

what the heck are you doing

#

you want to set a String ?

terse ore
#

I am a noob

#

I wanted to start with Java and leave skript

#

I have skript mentality

spiral light
#

yeah the problem is that you cant rly descripe what you want to do

#

?learnjava

undone axleBOT
terse ore
#

ik python and js

spiral light
#

java is a bit different

#

if you want to set a String you can do this:

String playername = player.getName();

terse ore
#

but my idea was to do
String tpa.sender.getName() = player.getName();

#

and like this when I used the var

#

tpa.Akex06

spiral light
#

thats not possible

terse ore
#

could you give me a hint on how could I make it?

spiral light
#

you define variable names once and fixed .... not changeable or smth

#

what do you want to achieve with a variable like this is the problem

small talon
#

In which event and how should I order an item to be smelted regardless of whether there is a recipe using it?

spiral light
#

i dont think there is an event for this (you could try listen to inventoryclickevent and check if there is an item .... but its a bit complicated) .... you could add a recipe for that ^^

small talon
#

Okay, but still without a recipe, what function(s) can I use to start smelting an item? I'm already handling burn and smelted, but I haven't found a way to start burning

spiral light
#

like i told you ... there is no automic event that get called if there is an item every time .... you will need to listen for InventoryClickEvent/InventoryMoveItemEvent too and check if there is a item at the furnace burn slot

then check if furnace is not burning and reduce the burn-slot by 1
if the process is finished you can listen for a Furnace event probably and check if it should start a new one

small talon
#

Reducing the itemstack's amount by one does nothing, would setSmelting work?

spiral light
#

itemstack.setAmount(amount-1) should work unless you dont have a copy of the burn-slot
you will also need to set the Burnticks of the furnace ^^

terse ore
#

So I have this

        player.setAllowFlight(true);```
How would I detect that the player has flight mode activated?
spiral light
#

player.isFlying()

terse ore
#

ty

terse ore
grim ice
#

No

terse ore
#

can I detect that?

grim ice
#

getallowflight?

#

If that exists

spiral light
#

flight mode activated is that the player is flying or generally allowed to fly ?

grim ice
#

allowed to fly

#

That's what he means probably

spiral light
#

then its player.getAllowFlight()

terse ore
#

By default getAllowFlight(); is null or false?

spiral light
#

true or false O.o

spiral light
quaint mantle
#

How can I make a count of how many blocks have been passed? walk

misty current
spiral light
terse ore
#

intellij xd

#

i've been using intellij before even starting to code on java

#

for compiling plugins

spiral light
#

then you rly need to learn java .... you should know what a boolean is and that it can only be true/false

small talon
spiral light
small talon
#

Oh actually no i was reading for recipechoice, my mistake and yeah I'll definitely use that, thank you!

thorny python
#

is there any event called when block destroyed (triggered by any approach)?

spiral light
thorny python
#

BlockBreakEvent seems only be called when player destroy it

#

so I want to include things such as crop break by water flow etc. as well

spiral light
#

BlockFromToEvent is smth you can look for
BlockExplode/EntityExplode ...

thorny python
#

uh

#

seems like there are alot

spiral light
#

for what do you need this ?

#

you can also listen to BlockDropItemsEvent ... if you think there are always items that drop

thorny python
#

hmm I am making a plugin which can custom drop item for users

spiral light
#

BlockDropItemsEvent would be the best then

thorny python
#

but like, what if that block doesnt drop anything? is it still will be called?

#

for example, mining stone by hand

spiral light
#

no

#

then BlockBreakEvent

thorny python
#

uh so maybe I need listen to both of them and work out how to resolve potential been called twice?

eternal oxide
#

If BlockBreakEvent is canceled then no Drop Items event will be fired

thorny python
#

seems reasonable

#

I will look into it, thanks

#

seems both event does not triggered by water flow destory crops

spiral light
#

yes because no player is involved

thorny python
#

._.

spiral light
#

for water try BlockFromToEvent

thorny python
#

ok...

#

is there any more I may need pay attention?

dark arrow
#

i have created a gui but i can only access it with a command how can i make it accsessable by clicking on a item?

eternal oxide
dark arrow
#

ok thx

quaint mantle
#

Spigot 1.12

How can I set slab position top or bottom?

torn shuttle
#

ok, I am not too experienced with resource packs, do you have to use the SHA1 option to get the server to update resource packs at all?

chrome beacon
#

Yeah I belive it's used to know when to update the existing pack

torn shuttle
#

boy these are a bit of a hassle

chrome beacon
#

How so?

torn shuttle
#

additional loading screens upon joining the server, having to generating a new SHA1 every time you modify the pack, having to deal with the possibility that users aren't using the pack...

lean gull
#

anyone?

torn shuttle
#

if a user has the resource pack installed and activated upon logging in would that bypass the extra loading screen?

chrome beacon
lean gull
dark arrow
torn shuttle
#

that's fun

#

dumb question but why do I get two loading screens every time

lean gull
#

if you're on a server that has one resource pack, and while in the server you switch to another server that has another resource pack, you will get 2 loading screens

torn shuttle
#

ah I assume the same is true if you're on a server that has no packs and a server that has a pack?

lean gull
#

idk

#

i don't think so

torn shuttle
#

it looks like it is the case

#

going from no texture pack to no texture pack I have 0 loading screens but no texture pack to texture pack and from texture pack to no texture pack I get 2 loading screens each time

lean gull
#

do you make resource packs for servers?

torn shuttle
#

I do now I guess

lean gull
#

what style?

torn shuttle
#

custom boss model style

lean gull
#

wdym

opaque grove
#

Is it possible to get a entity by its custom tag?

torn shuttle
#

I'm being facetious, I am just dealing with resource packs because I just added custom boss models to my plugin

#

and I need to worry about distribution

lean gull
#

you speakin big words there pal

quaint mantle
#

Hello i need som help, is there a way for the consol to know who has done a certain event, OnRightClick i want the consol to execute a command on the player that rightclicked but idk how

tardy delta
#

Check the PlayerInteractEvent

#

::getAction

quaint mantle
#

ty!

misty current
#

hey, i'm a bit confused, in the ChannelDuplexHandler, what method handles incoming packets (client -> server) and which one handles outgoing ones? (server -> client)

misty current
#

google how to use config files

#

or yaml

#

it does

#

you read a line from config.yml

#

and you send that on enable

#

why properties

#

and what is the reason why you need a .properties file

#

well anyways if you really want properties file, there are probably libs online

spiral light
#

is it a json file or just properties ?

tame shoal
#
public class Info implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender cmdS, Command cmd, String s, String[] args) {
        if (cmd.getName().equalsIgnoreCase("info")) {
            Bukkit.broadcastMessage("1");
            if (args.length == 1) {
                System.out.println("<AC+> Checks.Info command was run by" + cmdS.getName().toString());
                Player tPlayer = (Player) Bukkit.getPlayerExact(args[0]);
                Bukkit.broadcastMessage("2");
                if (!(tPlayer == null)) {
                    Bukkit.broadcastMessage("3");
                    if (cmdS.isOp()) {
                        System.out.println("<AC+> Checks.Info command was run by server staff");
                        //staff Info
                    } else if (cmdS.hasPermission("Player.info")) {
                        System.out.println("<AC+> Checks.Info command was run by standard user");
                        //player info
                    } else {
                        cmdS.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e<!> Warning, You don't haver permissions to run this command."));
                    }
                } else {
                    cmdS.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e<!> Warning, player " + args[0].toString() + "&edoes not exist." ));
                }
            } else {
                //info of self
            }
        }
        return false;
    }
}

Command show up... but doesn't print anything into console. No errors. nothing

#

Idk what happens

#

I put like checks in there : Bukkit.broadcastmessage("1")

#

etc...

#

Nothing

#

Please help lol

spiral light
#

did you register the cmd in plugin-yml and onEnable ?

misty current
#

if AC+ stands for anticheat, i'd reconsider your choices until you become more experienced

#

huh?

#

you mean save data inside blocks?

tame shoal
misty current
#

blocks are saved in chunks tho

tame shoal
misty current
#

then you need to have a reference to some custom blocks

spiral light
misty current
#

you can use an hashmap

#

save it to a yml file

#

ok

#

also it's not true that all blocks don't have a pcd

#

only tile entities do

#

anyways you can use NBTapi

#

it has support for custom nbt in blocks

tame shoal
misty current
#

it's not persistent

#

nbtapi offers persistent data saving for blocks

#

nah

#

the dev is a great guy and i've never had any issues with it

young knoll
#

May I introduce you to

misty current
#

you can put whatever you like

#

from 1.16.4+

#

i've personally used it and it worked fin

young knoll
#

Why is there and NBTAPI for 1.16.4

#

We’ve had PDC since 1.14

misty current
#

i have no idea, but persistent nbt on non tile entity blocks only works from 1.16.4 and above

#

don't ask me, ask the dev of nbt api

young knoll
#

Saves it in the chunk

quaint mantle
young knoll
#

True

undone axleBOT
eternal oxide
#

Create yoru NamespacedKey as a Field so you only create it once

quaint mantle
#

What api is that

eternal oxide
#

ClipboardFormats is WorldEdit. I've never used it

delicate cargo
#

The method sendMessage(ChatMessageType, BaseComponent) in the type Player.Spigot is not applicable for the arguments (ChatMessageType, String)

#

the line of code: java owner.spigot().sendMessage(ChatMessageType.ACTION_BAR, Utils.chat(actionBar));

quaint mantle
#

the problem is literally written in that error

delicate cargo
#

utils.chat returns a string

quaint mantle
#

Yeah

#

But there must be BaseComponent

#

Not String

delicate cargo
#

look

#
public static String chat(final String s) {
    return ChatColor.translateAlternateColorCodes('&', s);
}```
#

oh

#

wait

#

i read that wrong lmao

quaint mantle
#

😄

delicate cargo
#

i thought it needed a string and it was saying that it returned a basecomponent

quaint mantle
#

Yea, i told you

left swift
#

is it possible to lower some entity on the y axis? I mean actually lower it, but that it behaves as if it was not lowered. For example a pig that walks normally on the ground / blocks, but its texture and hitbox is slightly underground. I don't want to use packet teleporting here as the server still thinks entity is above and it doesn't allow me to build there.

tardy delta
#

should i do all my db queries async?

opal juniper
#

yes

#

or at least off main

tardy delta
#

isnt that how the scheduler works with async?

young knoll
#

Yes

tardy delta
#

i'm making like help methods to execute queries 💀

dusk flicker
#

prob not a bad idea tbh

#

I dont do sql as I think it sucks, for Mongo at least, I do all m queries automatically in methods so I dont have a chance to screw it up

tardy delta
#

i'm doing stuff like

delicate cargo
#
java.lang.UnsupportedOperationException: null
        at java.util.AbstractList.add(AbstractList.java:153) ~[?:?]
        at java.util.AbstractList.add(AbstractList.java:111) ~[?:?]
        at me.generallyblinky.realmofeternia.stats.PlayerStats.calculateStats(PlayerStats.java:62) ~[?:?]
        at me.generallyblinky.realmofeternia.Main.calcStats(Main.java:62) ~[?:?]
        at me.generallyblinky.realmofeternia.Main.lambda$0(Main.java:45) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:81) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:400) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
        at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1179) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
        at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:394) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1127) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:966) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
        at java.lang.Thread.run(Thread.java:831) [?:?]```
#

that line is: ```java
equipment.add(owner.getInventory().getItemInMainHand());

tardy delta
valid sorrel
#

how can I send people to another server from spigot api (the server is behind bungeecord)

delicate cargo
#

what does mutable mean?

young knoll
#

Modifiable

valid sorrel
dusk flicker
#

google

#

Never sorry

dusk flicker
delicate cargo
#

here's equipment: ```java
List<ItemStack> equipment = Arrays.asList(owner.getInventory().getArmorContents());

#

oh wait

tardy delta
#

Arrays.asList is immutable for some operations?

#

i forgot which ones

delicate cargo
#

thats not the line which throws an error

tardy delta
#

ImmutableList#add probably

delicate cargo
#

im not setting contents

tardy delta
#

kinda

delicate cargo
#

cloning their armor contents, then adding to it

dusk flicker
#

but do you want that to be on the player?

delicate cargo
#

then looping through, getting stats and adding their stats to bonus stat variables

tardy delta
#

new ArrayList<>(Arrays.asList(owner.getInv().getarmor()))

young knoll
#

Arrays.asList returns an immutable list

quaint mantle
dusk flicker
#

obv dont forget the capitalization of Armor but yeah

tardy delta
#

i know thats not even the method

tardy delta
quaint mantle
#

single responsibility. The storage byitself shouldnt run async tasks

tardy delta
#

yea i'm too lazy to type that whole thing

#

or just to prevent implementing it in every class?

lean gull
#

does anyone know what's the packet for when a blockstate updates? (using protocollib)

#

i did, i thought it was block change but turns out it wasn't

quaint mantle
# tardy delta or just to prevent implementing it in every class?

Kinda.. For example, what if you have multiple storage implementations? Then in every implementation you'd have to write the same code which can share same bugs, to run async tasks. Also, sometimes you may want to run operation synchronously, but, you cant because async is controlled by storage itself

tardy delta
#

i dont even know why i would run queries sync

quaint mantle
#

If you want to run them step by step, all of them in the same thread?

tardy delta
#

so like multiple operations after each other which may effect eachother?

quaint mantle
young knoll
#

Also you probably want them to be sync on shutdown

tardy delta
#

i dunno if that would matter

valid sorrel
#

as always forgetting to register the listener

lean gull
#

how do i read from MultiBlockChange packet in protocollib?

chrome beacon
#

Check PacketWrapper

wispy plume
#

Hey, I'm making a plugin that will cancel item despawn event, if the item is dropped by a player.
When a player dies, are they the thrower of an item?

chrome beacon
wispy plume
#

I was gonna send this

#

xD

#

So you don't know? ok

#

Waiting for them to despawn is too much for me xD

chrome beacon
#

You can lower the despawn time in the spigot.yml

#

or was it the bukkit one?

wispy plume
#

spigot

chrome beacon
#

Can't remember... one of them

wispy plume
#

but I want to cancel it forever, so the items remain on ground when they die or drop it

young knoll
#

Lower it for testing

torn shuttle
#

well my project is now sitting at 54k lines

#

it looks like I've finally gone past rewriting to be under 50k

red sedge
#

How can I loop blocks around player

#

with a radius of x

young knoll
#

Nested for loops

#

One for x, y, and z

tidal skiff
#

how do i cancel a block from being destroyed from a createExplosion() explosion

young knoll
#

One or all of them

tidal skiff
#

just one

young knoll
#

Remove it from the list on BlockExplodeEvent

red sedge
young knoll
#

Maths

young knoll
#
    //stuff
}```
quaint mantle
#

Are anyone good at luckperms because i kinda need help

ivory sleet
#

luckperms api?

quaint mantle
#

So basically what i am trying to do is i am trying to make a permission paper so when you right click on it you will recive essentials.fly for a week. But for example if I am in the default group I dont have permissions for /fly but i want the player that used the paper to have /fly

#

It doesnt allow it

dusk flicker
#

custom made or using plugins to do it?

quaint mantle
#

plugin

dusk flicker
quaint mantle
#

okey thanks

red sedge
young knoll
#

It’s just the variable the example I copied used

red sedge
#

oh well i kinda need to know what its used for

young knoll
#

x y and z?

red sedge
#

no but like

#

(cx - x)
it removes x from a valuea

young knoll
#

Center

red sedge
#

ohh oka

tender shard
#

I love those forums posts like "I tried xy but it doesn't work, plz heeeelp"

left swift
#

how can i cancel planned task (runTaskLater), for example

                        new BukkitRunnable() {

                            @Override
                            public void run() {
                                //cancel it here
                            }
                        }.runTaskLater(plugin, delay);```
tender shard
#
            public void run() {
                if(shouldCancelNow()) cancel();
            }
ivory sleet
#

BukkitTask task = new BukkitRunnable().runTaskLater(); since any of the runX instance methods from BukkitRunnable returns a BukkitTask instance

young knoll
#

No reason if you are canceling from within the task tho

ivory sleet
#

yeah you don't even need to use BukkitRunnable::cancel in first place as the task is already in the state of running

left swift
#
                            @Override
                            public void run() {
                                cancel();
                                System.out.println("test");
                            }````System.out.println("test");` is executed, it is not canceled :/
young knoll
#

Yes

tender shard
#

you don't understand what cancel does

#

you must return if you just want to stop there

young knoll
#

Cancel stops future runs, but not the current execution

#

You need to return too

left swift
#

oh, ok

tender shard
#

I thought you wanted to cancel repeating tasks

ivory sleet
#

just return

#

cancel is redundant here

young knoll
#

Oh yeah it’s a delayed task

stone sinew
#

Why can a variable be changed in a for loop but not a lambda? Not getting very specific answers off google.

ivory sleet
#

well lambdas actually copy the variable

#

so if you mutate it, the lambda will not know which state to copy

#

thus the effectively final state on the variable is needed

stone sinew
#

👍 thx

left swift
#

and how can i do this so that if this task was called but not done and if it is called again then the previous one will be canceled?

ivory sleet
#

by called you mean it ran?

left swift
#

yeah

young knoll
#

Save it to a variable

left swift
#

task, or task ID maybe?

young knoll
#

Then you can use variable#isQueued and variable#isRunning

tender shard
stone sinew
#

I don't "need" it really lol Was just questioning it.

tender shard
#

Kk, and I just wanted to mention how you could change "that" variable anyway^^

ivory sleet
left swift
rough basin
#

Running delayed init tasks?

#

What is it?

young knoll
dusk flicker
#

tasks that were delayed

left swift
ivory sleet
# rough basin

tasks that were scheduled with the bukkitscheduler to the main server thread during plugin startups

stone sinew
quaint mantle
#

''l0

ivory sleet
#

for instance

@Overridew public void onEnable() {
  this.getServer().getScheduler().runTask(this,() -> sout("hi"));
}

@rough basin

rough basin
#

Oh then it must invoked it

young knoll
#

Or isQueued, etc

tender shard
ivory sleet
dusk flicker
#

dear lord conventions

#

please

rough basin
#

Forgive me lmao

tender shard
#

getLoadedSentry getLoadedSentry = new getLoadedSentry()
RIP java

dusk flicker
#

no

#

fix it and be forgived

solid cargo
#

here is my issue:
I have a getter and a setter for a boolean.
Everyting of that works fine and all. But now im making a player chat event thing.
and the boolean returns false in every scenario, even if i set the boolean to true. any ideas? I had an idea that it is Thread Safety, but i havent encountered that issue ever so idk how to fix it

dense notch
#

Any suggestion to how can my server support 1.8.9+ versions?

solid cargo
#

ViaVersion

dense notch
#

Ok

quaint mantle
#

Do not support 1.8.9

dense notch
young knoll
dense notch
#

Ig it support

solid cargo
quaint mantle
#

boolean[] bool = new boolean[] {true};

young knoll
#

Oh god why

solid cargo
#

sure