#help-development

1 messages · Page 192 of 1

subtle tapir
#

That seems to do the trick.

delicate badger
#

I try again that

vocal cloud
#

Saves the need to call 2 methods

delicate badger
#

Tried getConfig() without removing the config and still it's empty

subtle tapir
#

copyDefaults copies the section to RAM so you are saving a blank config file

delicate badger
#

Oh

#

How do I then create the config file with defaults

eternal oxide
#

I don;t see anywhere you actually load any config

#

no resource

subtle tapir
eternal oxide
#

if you have a config.yml in your jar just call saveDefaultConfig(). It will create folders and export the config

subtle tapir
#

Yes. The Plugin object already does the "heavy" lifting.

delicate badger
#

Do I then remove the saveConfig() method in ConfigWrapper

#

which is used on loadConfig()

subtle tapir
#

call plugin.saveDefaultConfig() on start and use plugin.getConfig() to retrive the config later in you code

#

Note: If the plugins config.yml already exists in your plugin's directory saveDefaultConfig() won't overwrite it.

vast raven
#

Is there a way to change the player skin, I mean that one you see in the tab.

quaint mantle
#

.

bright jasper
#

Anyone know if there is a way to load a nested settings.gradle.kts seems it only works in root project

#

Adding a plugin that should only be used in one project, not globally. Also needs to read from nested gradle.properties

frail gale
#

hey guys

#

I am making a GUI where it will display all items available in Spigot

quaint mantle
frail gale
#

by the Material ENUM

#

but there's very strange thing

#

there are some items which are like fully ghost

#

they don't either display

#

or have any properties

#

just a name

#

and it is showing like nothing in the inventory

remote swallow
quaint mantle
#

?

#

oh

#

@Override
public void onEnable() {
enable();
events();
commands();
setConfig();
getServer().getMessenger().registerOutgoingPluginChannel(this, "bungeecord");
}

undone axleBOT
remote swallow
#

also use di

#

its easier

quaint mantle
#

i use the code from a youtube tuto

frail gale
#

does someone know what Warped Wall Sign is?

#

this is then a BlockState

#

why is it in the Material Enum

eternal night
#

it is its own material

quaint mantle
eternal night
#

makes pretty good sense to not have nbt there

remote swallow
# remote swallow also use di
public class MyCommandClass implements CommandExecutor {
    private final Main plugin;

     public MyCommandClass(Main plugin) { this.plugin = plugin } 
}
frail gale
#

I prefer BlockState

eternal night
#

¯_(ツ)_/¯

#

wall and standing signs are different types

frail gale
#

this explain then why when I display all the items in the Material Enum there are some blank pages

eternal night
#

what

#

no

remote swallow
#

player heads yes, idk about torches

eternal night
#

oh

#

yes

#

I just got what you mean

#

torches yea

frail gale
#

is there a way to check these?

#

I mean for warped sign wall e.g.

#

ehh, is there a category?

eternal night
#

don#t think so ?

#

signs aren't

#

those are rotatable

#

oop

#

is sign only for standing signs ?

#

TIL

#

Well

#

not like directional helps you tho

#

there are a bunch of other block datas that are directional

frail gale
#

okay so I looked more for the Material Enum

#

and I found out that there are more of these

#

I think it would have been better if Spigot has made a BlockState Enum for these cases

#

the good thing is that these are filtered

#

as I see they're last

#

I mean

#

like

#

BlockState.WALL_SIGN etc

#

just type the Material like SIGN then set the state

#

I think it would be more organized cause the Material class contains all those things and you cannot detect super easily if the Material can be an Item

ocean ginkgo
#

how to loop through all online players?

frail gale
sterile token
ocean ginkgo
#

ty

remote swallow
#

for (Plater player : Bukkit.getOnlinePlayers())

sterile token
#

🤢

frail gale
#

xD

sterile token
#

Bukkit.getOnlinePlayers().forEach() ❤️

ocean ginkgo
#

x

#

d

frail gale
#

You know what? You're lifesaver

ocean ginkgo
sterile token
#

what?

frail gale
#

seems like I should look more into the methods

sterile token
#

I dont even know what he is doing

#

Im like those one that just disturb when u need help

ocean ginkgo
#

gotcha

quaint mantle
sterile token
#

I have a small question no?

#

If a have a user UUID on every List<UUID> from many random object (same object many instances) ? How would i really know which to get for the event?

quaint mantle
#

huh

sterile token
#

Yeah its confuse

#

I also confuse

#

I will make a code eample

#

Do i have explained now?

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

i changed somethinfs

#

like Bungeecord is now BungeeCord

#

ecc

chrome beacon
#

Looks like Main.getPlugin is null

remote swallow
#

didnt we just say to use di like 10 min ago

undone axleBOT
sterile token
#

I would heavly recommend using Di over singleton

chrome beacon
#

?main

chrome beacon
#

?di

undone axleBOT
sterile token
#

?main

quaint mantle
#

I'm confused

sterile token
#
quaint mantle
#

tha

remote swallow
chrome beacon
#

?spoon ;/

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

remote swallow
#

yeah i hate it too

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

remote swallow
#

guess what

#

thats not my code

sterile token
#

Okay

remote swallow
#

cant really force someone to change their file name

sterile token
#

So he must read many things before start coding

river oracle
sterile token
minor garnet
#

does anyone have an idea how to rotate a location by 90 degrees, I have 3 points on the axis of a cube, I need to rotate it being proportional to the center

echo basalt
#

Vector#rotateAroundAxis

minor garnet
#

but this dont align the center

drowsy helm
#

Pretty sure theres a matrix translation for that

minor garnet
#

so..

drowsy helm
#

Treat center if block as origin

#

Rotate

minor garnet
#

getBlock#getLocation?

drowsy helm
#

You never done cartesian math?

#

0,0

minor garnet
hybrid spoke
minor garnet
#

i was never good with these things, i believe not remember

drowsy helm
#

So get your local offset

#

Which is something like .5 .5 0

#

Rotate around the axis

minor garnet
drowsy helm
#

Add back to global space

#

No your offset relative to the local center

minor garnet
#

sometimes the teacher asked me if she preferred to draw herself

drowsy helm
#

Your drawing wont help if you are working on 3 axis

minor garnet
minor garnet
drowsy helm
#

Then why worry about y axis

minor garnet
drowsy helm
#

Z would be more important in your diagram

minor garnet
#

sorry

#

now i notice this

minor garnet
#

the y would be the z, ignore it then

tardy delta
minor garnet
#

...

red sedge
#

how would I go about sending a light packet to a player

#

cant seem to figure it out

drowsy helm
#

I can give a demo with actual numbers if you want a visualisation

minor garnet
drowsy helm
#

It has to be 3d

#

You are working in a 3d space

minor garnet
drowsy helm
#

Even if you ignore y it is still 3d

minor garnet
#

just forget that there will be no depth

drowsy helm
#

x’ = x cos(theta) - y sin(theta)

#

y’ = y cos(theta) + x sin(theta)

tardy delta
minor garnet
#

what is theta?

drowsy helm
#

Degrees in radians

red sedge
tardy delta
#

other way

minor garnet
drowsy helm
#

Rotates a point about the origin

red sedge
minor garnet
drowsy helm
#

Probs

minor garnet
#

nmvm this is hard

normal loom
#

Folks, I've a question (about performance): Is it better to check a variable value rather than risk giving the same value?

drowsy helm
#

In what context

normal loom
#

like:
setfoodlevel(20) and not if(foodlevel!=20) setfoodlevel(20)

drowsy helm
#

Oh it’s negligible

eternal oxide
#

micro optimization is pointless in that instance

#

you are literally counting clock states at that point.

drowsy helm
#

Reading first would probably be like micro seconds faster

normal loom
tardy delta
#

just write clean code

ocean ginkgo
#

hey so im having a an issue:
I want an armorstand to follow an arc instead of a having its velocity rapidly decline because im using it for a projectile.
However, when I set the armorstand to ride a snowball, the snowball breaks instantly on impact with the armorstand even after setting .isInvulnurable
Is there another way for it do follow the arc, or for it to ride the snowball without it breaking?

robust sinew
#

Try an arrow

#

Like riding an arrow

#

I’m not sure if that would work for you but might as well try

main dew
#

How I can disable open trapdoor?

sterile token
#

Wrong channel

#

Wait wait

#

Are u coding a plugin?

dusk flicker
#
  1. Wrong Channel
  2. Go to FAWEs support server
fluid river
sterile token
river oracle
#

Anyone know what packet I would use to send totem animation with NMS
I see the ClientboundAnimatePacket but everything only has to do with player animation in hte constants or do I just have to guess the arbitrary number

#

wait its a particle effect apparently 😭 i'm dumb

#

no nms needed

#

always nice when stuff is in the api xD

sterile token
echo basalt
#

think it's entity effect

river oracle
#

yep

delicate badger
hybrid spoke
#

in your EPCommand class on line 27 ...getConfig() is null

delicate badger
#

Yeah I know I can read

#

Came here because I don't know how to fix

hybrid spoke
#

make it actually return something?

sterile token
delicate badger
#

No it's returning config

sterile token
#

For sure

#

if something is null, its because its not returning what should be

delicate badger
#

This is the getConfig() I use

    public FileConfiguration getConfig() {
        if (this.config == null) {
            reloadConfig();
        }
        return this.config;
    }
raw prairie
#

I tried making a world generator and generate something at y level 40 but nothin generates

#

no errors either

sterile token
raw prairie
#

?paste

undone axleBOT
sterile token
#

Im 100% that he is trying to code without learnt java before

quaint mantle
#

👍👍👍

sterile token
#

I remember that i used to be like that

quaint mantle
#

Cant agree more

sterile token
#

Now im a bit annoying but i used to be 100 worst

raw prairie
sterile token
raw prairie
#

I feel left out lmao

sterile token
#

But i couldnt understand it

#

i mean im going to sleep right now, maybe another can help

raw prairie
sterile token
#

Also remember to be pacient

raw prairie
#

oh

#

oki

sterile token
#

I mean i dont have problem about tagging me

quaint mantle
#

I would help but im on my phone 😅

raw prairie
#

;-;

sterile token
#

But im like womens "i have my days" were i can literally swear you full day or just be trying to help full day

#

🤣 🤣

#

Im also on cellpgone

#

LMAO i cannot use this shit, cellphone dicord is more trash than it used to be

raw prairie
#

i have a deadline

sterile token
sterile token
#

So with more reason you should be pacient

#

I mean if you want fast help you should pay someone to finish it or give you a hand with it

desert loom
quaint mantle
#

Lmao

#

👏

sterile token
#

shit

#

idk why i didnt realize that

quaint mantle
#

I didn't even try to attempt to help, trying to help someone on a phone is terrible

#

I cant do it for the life of me

raw prairie
#

@sterile token

#

its a project for my server

#

thats why deadline

vocal cloud
#

Intellij "decompiles" it. You need to fully decompile it in order to edit it

#

You should probably just obtain the source from the author

fresh timber
#

I keep getting similar errors/warns to this when I try to load my plugin that is being set up to save data to a mysql database on a paper server. It does not do this on my spigot server... anyone know how I can fix this?

vocal cloud
fresh timber
#

ah ok

#

so I'm not allowed to use that

#

does it want me to use bukkit getlogger thing

vocal cloud
#

It's not that you're not allowed it's just bad practice lol

#

Hence it's a WARN and not a FATAL

fresh timber
#

yea

#

is this better? Bukkit.getLogger().info("");

vocal cloud
#

Sure, anything that's a logger

fresh timber
#

ok

vocal cloud
#

You can even use a regular logger pattern per class

#

Something like raw SL4J

fresh timber
#

hm ok

#

thx

river oracle
#

player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 20 * 20, 1)); Why wouldn't this effect be applying I tested my code it works it should apply the effect debugged before and after the call and both were triggered meaning this is the issue I swear I'm stupid or something

quaint mantle
naive badger
#

how to get chest of a structure ?

civic wind
quaint mantle
#

stronghold type etc.

grim ice
glad prawn
#

🤓

frail gale
#

Hello Guys is there a way to get Anvil Input bigger than 32 chars? Because you can write more characters than the 32 limit but after completing they get removed

drowsy helm
#

Might be clientsided

#

Listen to the packet and see if it’s long

frail gale
#

Currently I don’t listen for any packets

#

I just listen when the player clicks the 3 slot and then get the ItemMeta and the name

#

do you know which Packet is?

vocal cloud
#

It's likely the client reduces the size and sends it. You can always check but I imagine the packet is the constraint here

hybrid spoke
#

client doesnt like long strings

frail gale
#

There’s an intresting thing in 1.18 and up when I have been looking through the AnvilMenu NMS I found a filed called rename limit or rename char limit idk but I will try it to see I think the server reduces the text

#

if I can remove the Anvil char limit then this will be really cool

#

because its the only one remained which can be used without opening the chat and putting little long Strings

hybrid spoke
#

you could take a look at AnvilGui and see if they already do it

frail gale
#

Signs are also cool but too short. I also read about Command Blocks and Books but since 1.8 they’re Client Sided but the Command Block GUI would have been fitting perfectly

frail gale
#

I’m also using it but I don’t like the char limit

hybrid spoke
#

then you have to search for another alternative

frail gale
hybrid spoke
#

i'll anticipate the excitement and save you some time: no its not

frail gale
drowsy helm
#

Probably a final field

hybrid spoke
#

and even if not changing the field would boom other stuff in the background

#

and the way minecraft is developed i wouldnt wonder if the client has the rename limit too, trims the text and sends it to the server which already knows whats the max possible length

frail gale
#

Minecraft Client has too many limits

#

but still I will try

drowsy helm
#

whats the usecase anyway?"

#

is it just for renaming an item

#

or for text input

frail gale
#

Renaming an item adding Lore to the item

#

can be used for other things too

naive badger
chrome beacon
naive badger
#

ik

#

i am thankful

undone aspen
#

I am sommuning a dragon with a custom name but the bossbar is not appearing, how can i get the bossbar to show?

honest echo
#

hey so im trying to spawn armour stands each 30 block away from each other in front of them using this code

 Location location = world.getSpawnLocation();
        for (int i = 0; i < 30; i++) {
world.spawn(new Location(world, location.getX()+(i*30), location.getBlockY()+(i*30), location.getBlockZ()+(i*30), location.getYaw(), location.getPitch()))), ArmorStand.class);
        }
#

but instead of infront its instead creating digonally

#

is there any better way to get coords of 30 blocks away in north direction of a entity

echo basalt
#

of course it will move diagonally if you're adding to all 3 axis at once

agile anvil
#

Go in game
Check when you go towards north how x y and z change
Figure out which one you need to increase or decrease by 30

echo basalt
#

north is +Z

honest echo
#

north is Z yep

echo basalt
#

if you want to spawn it in the player's direction then just get the direction, normalize, multiply by 30 and that's your offset

honest echo
#

anyways Thanks for your help

#

have a great day

tardy delta
#

i fucked up

echo basalt
#

rip

#

I've been working on profiling

#

makes fancy graphs on grafana

tardy delta
#

things seem to work

#

crazy 111ms for 8 queries

echo basalt
#

iirc mysql takes forever to connect but queries are fast

#

like 1-2 ms / query but connection is around 80-100ms

#

redis was like 120ms connection but 0.2ms latency per call

tardy delta
#

trying it with sqlite

#

i might implement hikaricp too

echo basalt
#

mans writing into a floppy disk or something idk

opal juniper
#

TIL CompleteableFuture.completedFuture

#

is a thing

tardy delta
#

lol ye

echo basalt
#

I gotta do some profiling 👀

#

just gonna make fancy ahh graphs

echo basalt
#

it's useful because thenCompose doesn't like null values

tardy delta
#

early return lol

echo basalt
#

thenCompose(null) throws errors but thenCompose(completedFuture(null)) does not

tardy delta
#

oh

echo basalt
#

took me like 4 hours to debug

#

had to break apart my enture infra

tardy delta
#

took me days to write a reflection thingie and now its still full of bugs

echo basalt
tardy delta
#

ah now i see why it's that slow, pushQuery reopens the connection

echo basalt
#

just make a lazy singleton for the connection

#

type deal

#

timeout is in seconds and I'm dumb btw

tardy delta
#

ye i have a lazy connection thingie

#

im closing conn afterwards so ye

#

bruh bird sitting next to me on chair

echo basalt
#

why do you close the conn

#

it literally only adds latency

tardy delta
#

redempt told me it was a good practice

echo basalt
#

only more reasons for me to hate the guy

tardy delta
#

lmfao

#

its yelling that the conn is closed now :/ i mean im not closing it in between iterations

#

on the last iteration it closes before executing the query lol

wet breach
#

Put it in a finally

#

Finally can be added after catch

sterile token
#

A ing student have told me that his teacher explained him that closing the connection and re open it makes more latency than the resources used by leaving the connection open?

eternal oxide
#

correct

sterile token
#

It was not a question sorry

molten hearth
#

I do not see the reason to ever close a connection unless your program is terminating

sterile token
#

Agree with you paradise

eternal oxide
#

Connection pools keep connections alive for as long as they can. Its pointless to close them if you can use them again

molten hearth
#

I've never really seen that done in other programming languages it seems to be common in java for some reason though

sterile token
#

Yeah

tardy delta
#

so doing try (Connection conn = hikaricp.getConnection()) is pointless?

eternal oxide
#

no

#

that returns it to hikariCP

sterile token
#

My mate that code on .net framework told me that he open the connection and leave it open. Until program restart or shutdown

eternal oxide
#

it doesn;t close it

tardy delta
#

ahhh

#

im confused how it closes twice

molten hearth
#

I mean if you already have one open why would you be a bozo and close it just to re open it a second later

eternal oxide
#

If you use any kind of batch update with hikari you will want to increase yoru connection pool size

sterile token
#

What is batch

#

Isnt called bash

tardy delta
#

multiple statements executing at once or smthg basically

sterile token
#

Oh ok

tardy delta
#

well idk how to explain

sterile token
#

Yes I understand what you mean

eternal oxide
sterile token
#

What does it?

#

Im currently on cellphone

eternal oxide
#

pushes all changes in a single batch query

#

instead of issuing multiple individual ones

tardy delta
#

kinda weird but my connection closes on the prev last query

#

this doesnt make sense at all

eternal oxide
#

sounds odd. What is the actual query you are performing?

molten hearth
#

Instead of inserting player achievements wait for a crash shutdown and insert them all

tardy delta
#

looks like whenever i pass more than 4 queries it says the conn is closed or whatever

sterile token
molten hearth
#

that was a joke

#

you wait for the server to shut down to do inserts but it crashes so you lose all the data kek

tardy delta
sterile token
#

I dont like jokes

molten hearth
#

you do now

eternal oxide
#

damn it. PC just bluescreened 😦

tardy delta
#

now 4 queries makes it crash too

#

im only closing the conn in one place so wtf

molten hearth
#

maybe its connectionphobic

tardy delta
sterile token
#

Fourten

#

Ahh shity cellphone discord

#

Its so bug that repeat the. Essave

tardy delta
#

?

#

wifi

sterile token
#

No

#

Discord for cellphone is I the shit

#

Its really brokened

#

Fourten I need help creating a functional interface for executing tasks and allowing them to throw checked exceptions with no need to caching them manually

tardy delta
#

throwing function like thing

#

and sneakythrow

#

smth like this?

@FunctionInterface
public interface ThrowingRunnable {
  void run() throws Exception;
}```
```java
public <E extends Throwable> void executeTask(ThrowingRunnable task) throws E {
  try {
    task.run();
  } catch (Exception e) {
    throw (E) e;
  }
}```
sterile token
#

Oh yes fourten smth like that

#

Wait forget my code

#

I was writing an example

tardy delta
#

made a whole bunch of those interfaces

#

you might even want to specifiy ThrowingRunnable with a generic parameter <E extends Exception>

sterile token
#

Fourten my idea is to have a task class which allow you to run things throwing checked exceptions. And then use a custom executor for the task which add an id to every task, allow you to start/stop, run async/sync, etc

tardy delta
#

ig your task class will implement that throwingrunnable thing

brazen hollow
#

How can I fixx that?

sterile token
#

Ig?

tardy delta
#

and the executor will have to handle the unchecked exceptions

#

youll have to catch them at some point

sterile token
#

?no-var

remote swallow
#

not a command

sterile token
#

Oh ok

tardy delta
#

dont remove while iterating over a collection

remote swallow
sterile token
#

They should add onr

tardy delta
#

use an iterator and iterator::remove

brazen hollow
#

Okay

tardy delta
#

is it an arraylist? they you might use ArrayList::removeIf which takes a predicate

sterile token
#

And please stop rigty now using va

#

You are making your code to take more time during compilation process

tardy delta
#

lol

sterile token
brazen hollow
#

but faster to write

brazen hollow
#

That still gives me the java.util.ConcurrentModificationException

sterile token
#

@tardy delta

ServiceExecutor executor = new ServiceExecutor.builder().delay(10, TimeUnit.SECONDS). pool(10).async(true).build();

executor.queue(task).catch(ex -> logger.severe(ex.getMessage()));

#

What u think?

eternal oxide
brazen hollow
#

Ill just use an iterator xd

eternal oxide
#

you can do it all in the removeIf

sterile token
#

Are u spsnish?

eternal oxide
#

no just terrible typing

sterile token
#

smth like this?

@FunctionInterface
public interface ThrowingRunnable {
  void run() throws Exception;
}```
```java
public <E extends Throwable> void executeTask(ThrowingRunnable task) throws E {
  try {
    task.run();
  } catch (Exception e) {
    throw (E) e;
  }
}```
brazen hollow
#

okay

#

Ill try

raw prairie
#

@elg

#

@eternal oxide

#

I got no errors but nothing showed up at y 40

eternal oxide
#

add debug. a sysout when it pastes

raw prairie
#

K

eternal oxide
#

remember it will only paste in new chunks

raw prairie
eternal oxide
#

so listener has to be registered before you gen/load the world

eternal oxide
#

it looks fine. add a debug in teh place runnable

#

you may have to pass e into the lambda runnable.

raw prairie
#

Isn't 0urs bukkit?

eternal oxide
#

() -> {} is a lambda

raw prairie
#

Oki

raw prairie
#

In the runnable

eternal oxide
#

no

#

first add a sysout so you can see if the runnable is being run

raw prairie
eternal oxide
#

UK

raw prairie
remote swallow
#

EST is 5 hours behind BST

eternal oxide
#

est? is that like NewYork time?

remote swallow
#

its like 11pm here

raw prairie
#

Its 7 am here

#

8 am here

remote swallow
#

6pm est is 11pm uk time

raw prairie
#

O

eternal oxide
#

possibly. I tend to go to bed sometime between 10pm and 2am

raw prairie
#

K

eternal oxide
#

events are raised in one plugin and listened to in another

ornate mantle
#

what's the equivalent of the else statement in a switch clause

rough drift
#

default

ornate mantle
#

aight

rough drift
#

you can only have one

red sedge
#

how would i display a fake light

crimson terrace
#

what do you mean "fake"

red sedge
#

uh

#

like

#

a light..?

#

that players cant interact with

crimson terrace
#

because iirc theres a packet for light level and a light block in the newest versions that you cant interact with

red sedge
#

hm?

#

me confused

crimson terrace
#

the light block is invisible and not collidable but it still gives off light

red sedge
#

I see

#

but like

#

im trying to uh

#

spawn a light source at the player

#

constantly

#

so it looks like theres always a light following the player

crimson terrace
#

well then its probably gonna be packets

red sedge
#

scary~

crimson terrace
#

use protocolib and you should be fine

red sedge
#

thats scarier than nms

red sedge
#

I think im gonna try nms

#

thanks for letting me know theres a packet for i t

crimson terrace
#

maybe look at that

red sedge
#

Yeah I also found that

#

Dont think I want to use an external api for a small thing tho

crimson terrace
#

have fun recreating the api or protocolib then 🙂

red sedge
#

Idk

#

There seems to be a packet called Update Light

crimson terrace
#

alternatively just set the block at the head of the player to a light block whenever its just air or something

red sedge
#

that wont work

#

mostly it wont work when theyre underwater

crimson terrace
#

theres lore you could explain that with

#

but you do you 😄

red sedge
#

ah yes

#

"the fish eat light underwater"

crimson terrace
#

make it be an auto-igniting candle

#

idk

tardy delta
#

hmm i was thinking about my db lib, so should i have a connection open the whole time or should i just close it after x minutes or something?

#

like right now i'm closing it immediately but that goes brr when reopening it frequently

wet breach
tardy delta
#

ye i was thinking about using hikaricp too, anyways im using an sqlite db now

wet breach
#

connections can't be opened for an infinite time as there is a max time for them, so the connection pool has to always check to make sure the connection is still valid

#

but you only need connection pooling if you know you will be using the DB often

#

the reason for keeping connections open, is because it guarantees a connection and less time is spent opening one up as there can be significant delays in doing so

tardy delta
#

im not using it very often

#

might even have a task that closes it after x time instead of immediately after executing a query

elfin atlas
#

Is there a way to make goats always aggressiv?

crimson terrace
#

I think setTarget() would work

#

and just run a timer to set them agressive to people nearby

quaint mantle
#

hello, i write this:
for (String string : main.getConfig().getStringList("scoreboard")){

}

but i want create a variable they count a number of cycle

#

how i can?

hazy parrot
#

or use normal for loop

#

but what is the use case ?

#

if you want to see how much enteties you have in list

#

just do List#size()

quaint mantle
#

I want to create an editable score in the config

wet breach
#

more specific, obviously everything in a config is editable and you appear to know how to save and load from a config. So need more details on the nature of your problem

#

currently it sounds like so far you want to be spoonfed because what it seems like what you asking is relatively a basic java question meaning you probably need to learn more in using Java. Getting help here should be last resort in that you have attempted to solve the problem on your own as well as research yourself

quaint mantle
#

okay, thanks

brave goblet
#

How would i get all materials in a list? i want to get the statistic blocks mined but i need to supply a material

grim oak
#

hi im making a plugin and i need to store data, and i wanna know what the best way to do this is. i feel like theres so many ways, like csv files, yaml, json, sqlite dbs etc, and i dont know which one would be best to use

waxen plinth
#

there's basically only 3 I can recommend

#

pdc for small-medium scale data attached to in-game objects

#

yaml for data that will generally remain unchanged most of the time (config, mostly)

#

databases for "hot" data that will change frequently, needs to be shared across more than one server, and/or is large scale

crimson terrace
#

for real small things you can also use txt files but as soon as you need key value pairs its yml

grim oak
waxen plinth
#

sqlite if it's medium-scale or smaller and doesn't need concurrent access

#

mysql otherwise

crimson terrace
#

you could theoretically also save data in hashmaps and save it less frequently if you wanna use yml files for simplicity

#

of course under threat of data loss

wet breach
#

it is all dependent on what is required and what you are comfortable with using

red sedge
#

Not really spigot related, what does % do like 5 % 3

brave goblet
brave goblet
red sedge
#

wdym?

#

so like

#

would that return 2?

brave goblet
#

so 5 % 3 = 2

brave goblet
red sedge
#

is there anyway to iterate over each value in an enum

vocal cloud
#

.values or something?

eternal night
#

there is API for this ?

#

oh

#

you can ignore that usually

#

there are a bunch of overloads

#

should be one with just an int after the location for the count

#

the data is for like, redstone data (their colour)

#

or block break particles and their material

strange sigil
#

Not sure why I am getting this

org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
Caused by: java.util.zip.ZipException: zip END header not found
        at java.util.zip.ZipFile$Source.findEND(ZipFile.java:1469) ~[?:?]
        at java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1477) ~[?:?]
        at java.util.zip.ZipFile$Source.<init>(ZipFile.java:1315) ~[?:?]
        at java.util.zip.ZipFile$Source.get(ZipFile.java:1277) ~[?:?]
        at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:709) ~[?:?]
        at java.util.zip.ZipFile.<init>(ZipFile.java:243) ~[?:?]
        at java.util.zip.ZipFile.<init>(ZipFile.java:172) ~[?:?]
        at java.util.jar.JarFile.<init>(JarFile.java:347) ~[?:?]
        at java.util.jar.JarFile.<init>(JarFile.java:318) ~[?:?]
        at java.util.jar.JarFile.<init>(JarFile.java:284) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:174) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
remote swallow
#

read the first line

strange sigil
#

The plugin.yml is not invaild

#

...

#

I've already checked that

remote swallow
#

send it here

#

?paste

undone axleBOT
strange sigil
#

I suppose i should've stated that beforehand

civic wind
#

Does anyone know how i can make a landing entity explode on hit like a creeper does?

strange sigil
civic wind
remote swallow
#

also

#

?main

strange sigil
#

nope

strange sigil
#

It's a private plugin so it's really just for cleanliness

strange sigil
#

But I'm still really not sure why I am getting that still

#

I think it has to do with the Instance stuff i'm using

#

Not really sure what else I should do to access it tho

#
    public static Main getInstance() {
        return INSTANCE;
    }

// in onEnable
     if (INSTANCE == null) {
         INSTANCE = this;
     }
civic wind
#

Show full main class

strange sigil
#

sdc

#

sec

remote swallow
#

use di

#

?di

undone axleBOT
strange sigil
civic wind
#

I guess you know best

crystal salmon
strange sigil
remote swallow
#

register it on the command registration

strange sigil
#

👍

#

thanks

remote swallow
#

Its on the create JDABuilder.createDefault sorry, thought it was command registering .addEventListeners(new CommandClss(this))

hazy parrot
strange sigil
#

also that wont change anything

#

xD

hazy parrot
#

Looks like it does, but ig ok if it doesn't change anything

#

maybe corrupted jar

strange sigil
#

I've already fixed it and the jar is not corrupted

echo basalt
tender shard
#

a simple mvn clean package fixes broken jars in 99% of cases

hazy parrot
strange sigil
tardy delta
#

iterate over the config section map

crimson terrace
#

you can get it directly as a Hashmap

#

hold on, i have an example here

#

this should work for you

#

then you just do .get("map") and you should be good

#

you will have to cast it tho

#

no

#

put it to false

#

that will make the only value in it be the one with the key "map"

#

when you use .get("map") on what you get from the getValues(false) method you will get a Map with values of the type Location

vast raven
#

Is CraftPlayer class only avaible in CraftBukkit?

crimson terrace
#

youre casting a configurationsection to String?

#

because IntelliJ doesnt know you cant

vast raven
crimson terrace
#

cuz I dont know :/ how about you google it 🙂

remote swallow
#

?jd-s

undone axleBOT
crimson terrace
#

honestly I am still confused as to what youre doing

vast raven
crimson terrace
vast raven
crimson terrace
#

lemme break it down for ya

vast raven
crimson terrace
#

Spigot is a fork of Bukkit -> Spigot has all the code that Bukkit has

vast raven
crimson terrace
#

you searched for bukkit, I searched for CraftPlayer. we are not the same

remote swallow
#

iirc CraftBukkit isnt Bukkit

#

CraftBukkit is a fork of Bukkit iirc

#

Spigot is a fork of bukkit

crimson terrace
#

oh didnt think of that dynamic

vast raven
#

Omg everyone say something opposite, or maybe I'm just getting confused, btw can I use the CraftPlayer class on Spigot/Paper?

remote swallow
#

No

eternal night
echo basalt
#

CraftBukkit is an implementation of Bukkit's interfaces

eternal night
#

^

vast raven
#

ok, fine, maybe if I explain my problem someone could actually help me

echo basalt
#

CraftBukkit got DMCA'd and spigot was born, revamping the build system to comply

vast raven
#

Simply, I need to change the head of the skin, I mean the one you see in the TAB next to the player nickname

echo basalt
#

Spigot had some rules for PRs that some people didn't like, so paper made their own fork

#

implementing and maintaining those changes themselves

vast raven
#

Looking up even in spigot forum, they say to use the CraftPlayer class

#

Since I can't use it in Spigot, idk how I can get out of this

echo basalt
#

Paper also had some forks for tiny obsessions in performance

vast raven
#

I'm using TAB API

echo basalt
#

CraftPlayer is the implementation of the Player interface

vast raven
echo basalt
#

import spigot not spigot-api

#

and welcome to nms

vast raven
#

nms stands for?

cerulean quarry
#

Yo, is there a way to increase the entity distance of something without forcing the player to change their entity-distance setting client side?

crimson terrace
#

actually hold on

echo basalt
#

if it doesn't work:

run buildtools (java -jar buildtools.jar --rev <version>
if using gradle, add mavenLocal() to your deps

crimson terrace
#

is this wrong then?

cerulean quarry
#

activation and tracking range seems to have no effect

echo basalt
#

basically the code that spigot is abstracting away

echo basalt
vast raven
echo basalt
#

Minecraft Server -> Bukkit -> Bukkit but interfaces && CraftBukkit as an implementation of them -> Spigot

vast raven
echo basalt
#

idek what you're tryna do I just pulled up randomly

vast raven
#

I mean TAB API docs have lack of info about skin changhing

remote swallow
#

look at the code or jds

echo basalt
#

Skin changing is a pain

vast raven
echo basalt
#

I mean not necessarily but no point in using TAB for it

vast raven
#

I'm not doing Skin Changhing it self

#

I'm trying just to change the head of the skin in the tab next to player, I've found on google like just 3 pages, and they all say to use the CraftPlayer class, readding in the server a gameprofile modified

echo basalt
#

yeah no that's changing the skin itself

vast raven
#

actually I'm using TAB API and SkinRestorer API, but I can't still find a way to do it

echo basalt
#

you basically want the tab to display some fake players that have a different skin

#

and hide your real players from tab

cerulean quarry
#

is there a way to increase the entity distance of something without forcing the player to change their entity-distance setting client side?

echo basalt
#

so yeah it's basically a mix of NPCs and tab manipulation

vast raven
#

It's a disguise pl

vast raven
#

And since is for a big rp server, I need to make it perfect

echo basalt
#

I mean if you want disguises just use libsdisquises

vast raven
#

This perfect includes even small details, like when you disguise you must keep the skin you have, you're still in the tab

vast raven
echo basalt
#

but others should see you differently?

#

yeah you can do that

#

in that case you'd uhh...

#

do some packet trickery

#

delete your player and respawn it as someone else with the same entity id to all players type deal

#

so all packets match the same id

#

all solutions are hacky

vast raven
# echo basalt but others should see you differently?

No basically, you're still "ok" in the TAB, you just change skin, tagname and prefix/suffix (already done with skinrestorer and TAB api), the problem is that in the tab even if you don't change tag or prefix, you change the skin

#

The skin mustn't change

echo basalt
#

yeah so back to the fake player in tab situation

vast raven
#

Even if I change the skin by my self, it changes in tab right?

echo basalt
#

yeah

#

tab skin is just something the client fetches from the skin data itself

vast raven
#

so basically I must readd the player in the tab

echo basalt
#

re-add the old skin into the tab as a fake player while hiding the real one

#

type deal

vast raven
#

What do you suggest me

#

I mean as I can see there is only 1 solution

echo basalt
#

idfk it's something hacky and will use like 200 lines of nms

vast raven
#

Maybe you can look up in the TAB or SkinRestorer API

#

a sec

echo basalt
#

not in the mood neither do I have the time for that

vast raven
# echo basalt not in the mood neither do I have the time for that
GitHub

Learn how to use the SkinsRestorer API! Contribute to SkinsRestorer/SkinsRestorerAPIExample development by creating an account on GitHub.

GitHub

"That" TAB plugin. Contribute to NEZNAMY/TAB development by creating an account on GitHub.

#

If you have time give them a look

#

Meanwhile, if you want to explain how to do in the "vanilla" way, I would be honored

echo basalt
#

there's no vanilla way

vast raven
#

just with nms

echo basalt
#

yeah nms

vast raven
#

well, so, I need to..?

brisk estuary
#

Hi, I'm trying to listen to a custom event from a plugin that is a dependency of my plugin, but every time the event is triggered I get an error like this:

#
Could not pass event CreateClanEvent to MyPlugin```
#

Does anyone know what might be wrong?

#
@EventHandler
    public void onClanCreate(CreateClanEvent e){
        Clan clan = e.getClan();
        registerClan(clan);
    }
#

this is the method called when a clan is created

chrome beacon
#

?paste

undone axleBOT
tardy delta
#

paste the whole thing

brisk estuary
maiden thicket
#

and createClan

opal juniper
#

you are creating a clan on the event causing an infinite loop

maiden thicket
#

oh right

#

💀

brisk estuary
maiden thicket
#

and is getClanData an arraylist

hasty prawn
brisk estuary
#

I don't understand which part of the code creates a new clan

#

the registerClan method just updates an ArrayList of clans and saves it in a json file

brisk estuary
brisk estuary
#
public void save(){
        try(FileWriter writer = new FileWriter(this.file, false)){
            gson.toJson(clanData, writer);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
hasty prawn
#

Where is the event fired?

tardy delta
#

have a map

strange sigil
#

How am i supposed to get the content of a chat message with AsyncChatEvent

hasty prawn
#

AsyncPlayerChatEvent#getMessage

strange sigil
#

Dosent exist

#

that's older versions

#

not 1.19.2

vocal cloud
#

?jd-s

undone axleBOT
vocal cloud
#

1.19.2 getMessage

strange sigil
#

It legit does not exist

#

I need to send an image but i cant

vocal cloud
#

It legit does exist

strange sigil
#

dms

vocal cloud
#

You can verify

strange sigil
#

No

#

I don't know my passwd

#

nor do i have the motivation to reset it

vocal cloud
#

Then reset it?

strange sigil
#

No point

#

I dont use the site anymore

#

lol

vocal cloud
#

Use a screenshot website

pseudo hazel
#

then why would we have motivation to help you out

strange sigil
#

I have 0 reason to reset my password

#

anyway thats off topic now

vocal cloud
#

Use a screenshot websitr

pseudo hazel
#

well the issue is why would we wanna spend time helping someone who doesnt care in the first place

#

but yeah

strange sigil
#

😂

hasty prawn
#

If you have no motivation to help us understand your problem, which we already answered, why would we have motivation to assist you further?

pseudo hazel
strange sigil
#

Never said i didnt care

#

i said i did not want to reset my password

#

and apparently all of you feel the need to blow this up into a huge issue witch didnt need to happen in the first place

vocal cloud
#

The solution to your issue is quite simple
Use the correct version of the spigot dep

hasty prawn
#

Yep

vocal cloud
#

?paste your pom

undone axleBOT
vocal cloud
#

or build.gradle or w/e package manager config

#

It seems extremely unlikely you do if you're missing something like getMessage()

#

Cause either you're trolling or you've imported some 3rd party spigot.

maiden thicket
#

AsyncChatEvent is paper

#

AsyncPlayerChatEvent is spigot

#

it should be just .message()

vocal cloud
#

Certified paper moment

maiden thicket
#

and to convert that to plain text it should be PlainTextComponentSerializer.plainText().something that takes a component param

remote swallow
#

hmmmm

#

?whereami

quaint mantle
#

?paste

undone axleBOT
quaint mantle
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

quaint mantle
#

yes

#

i do

#

nothing changes

#

okay

#

this is my main class

quaint mantle
#

1.19

wind blaze
#

Does anyone know how to color my name tag (above head) with luckperms?

#

Ever since I got luckperms on my server scoreboard teams don’t color shit anymore

quaint mantle
#

i try with a things

wind blaze
#

Side scoreboard?

quaint mantle
#

seeing the documentation I fixed everything, I do not understand why it does not give me errors, the message sends it to me but it does not send me in the bungee

wind blaze
#

I did /scoreboard players and objectives and all where empty sooo

drowsy python
#

With the lands plugin when I try create a land it says "[lands] this is deactivated in this world. world: Finalriskmc "

raw prairie
#

@eternal oxide

#

ok

#

im back

raw prairie
#

@eternal oxide

#

quick question

#

how can I make it so the structure file is embedded in the plugin?

eternal oxide
#

include it as a resource

#

then extract it at startup

raw prairie
#

oh

#

put in the resources area?

#

@eternal oxide how do I extract it on startup?

eternal oxide
#

Plugin#saveResource

raw prairie
eternal oxide
#

no

vale anchor
#

Hey folks! I have a hunger games server setup and I'm trying to figure out how to change the settings to allow for multiple lives. Any advice?

eternal oxide
#

Your main class has a method saveResource

raw prairie
eternal oxide
#

yes

raw prairie
#

false?

eternal oxide
#

false, you only want to extract it once

raw prairie
vale anchor
#

No - I'm trying to devise a way that when a player dies in the game, they're actually just put back in, up to 2 times (like having 3 chances in the game)

shadow gate
#

Tell me how to mention the main class

undone axleBOT
vale anchor
#

ohhhhh I see! Okay, so I'm basically spoofing them back into the game by changing their role from spectator upon death to survival? How would this affect the gametype - IE, if it ends when all players are killed, will it end if I brought them back?

#

And where would I add this UUID? I'm a little bit new to this - I'm hosting something for a charity event and it's all a little beyond me lol

raw prairie
#

@eternal oxide

#

[ERROR] Error occurred while enabling Backrooms v1.0-SNAPSHOT (Is it up to date?)

java.lang.IllegalArgumentException: The embedded resource 'src/main/resources/backrooms.nbt' cannot be found in plugins/Backrooms-1.0-SNAPSHOT.jar

at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:193) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]

eternal oxide
vale anchor
#

Okay, I'm in a pickle because I'm using apex, which has some preset arenas/maps, so I'm trying to find the place to put all this lol

#

yes! I'm using their preset hunger games gametype

#

I can jump in and change/update files

#

Which is what I've been doing

raw prairie
#

@eternal oxide it isnt printing the sys out and no errors

vale anchor
#

I know! It's wild!

eternal oxide
raw prairie
#

yea ik

eternal oxide
#

fly around to force new chunks to generate

#

if you get no message then

raw prairie
#

*didnt

eternal oxide
#

ok, the error is you replacing the default worldgen then

#

oh didn't

#

no clue then if you get no debug message, your code isn;t running

raw prairie
#

maybe listener isnt active

eternal oxide
#

void generating is seperate

raw prairie
eternal oxide
#

no

raw prairie
#

or the generator isnt calling on the lister?

eternal oxide
#

no

#

you register the listener fine

#

show me teh Listner with the debug code

raw prairie
# eternal oxide show me teh Listner with the debug code

public class BackroomsListener implements Listener {

    Structure backroom;
    Plugin plugin;

    public BackroomsListener(Plugin plugin) {
        this.plugin = plugin;
        this.backroom = Bukkit.getStructureManager().loadStructure(new NamespacedKey(plugin, "backrooms"));



    }
    @EventHandler

    public void BackroomsGenLoad (ChunkLoadEvent e){
        if(e.isNewChunk()){
            Bukkit.getScheduler().runTask(plugin, () -> {
                    Location loc = new Location(e.getWorld(), e.getChunk().getX() * 16, 40, e.getChunk().getZ() * 16);
                    backroom.place(loc, false, StructureRotation.NONE, Mirror.NONE, 0, 1, new Random());
                    System.out.println("Hi, this means that the code for structure placement works, sort of!");
            });
        }
    }

}
eternal oxide
#

move the debug up so it prints before you try to place, but still in the runnable

#

also add a debug at the start of the event to see if is even firing

torn shuttle
#

now this is spigot dev

#

I've got nearly fatal amounts of caffeine running through my veins

#

sitting here, writing inventory code

#

quintessential spigot dev stuff

shadow gate
#

I need the text to start appearing only after the music starts playing. The music, in turn, plays when the resource packs are loaded and the download window is coming to an end. Is there some kind of transition operator?

raw prairie
#

@eternal oxide

#

no errors, no sys out

eternal oxide
#

not even from the beginning of the event?

raw prairie
eternal oxide
#

then I'll need to see all your code with the debug in it too

#

The only thing I can think it because you are running at startup the listener can;t register properly

torn shuttle
#

did he actually register the listener?

eternal oxide
#

yes

raw prairie
#

?paste

undone axleBOT
eternal oxide
#

Which is why the code is designed to run on its own world not on world

torn shuttle
#

and we're sure these are new chunks?