#help-development

1 messages · Page 1932 of 1

blazing scarab
#

Well, ok, an immutable state which dont take depenencies is acceptable

paper viper
#

mhm

blazing scarab
#

I never called them singletones though

paper viper
#

i mean yeah the point of a singleton is that it should be immutable (so thread safe, constant, etc), and there is only a "single" instance in a program (hence the "single"ton)

ivory sleet
#

are we talking about singleton or static singleton?

paper viper
#

static singleton prolly

ivory sleet
#

ah

#

yeah those are a bit nasty

#

but eventually justifiable sometimes

brave sparrow
paper viper
#

ok honest question here

#

but do you guys ever use protected variables?

ivory sleet
#

yep

paper viper
#

for example, if i want my child classes to access a protected variables from the parent class

#

is it fine?

ivory sleet
#

yeah

#

sure thats tight coupling

#

to some extent

#

but its not always horrible

brave sparrow
#

Protected variables are fine yes

paper viper
#

i mean i just think its tedious if i have to retype it

blazing scarab
#

yeah i do that

ivory sleet
#

I mean they are in the language for a reason

blazing scarab
#

however im not always sure that implementation inheritance is good

ivory sleet
#

we should favor composition to inheritance, but we do not rigorously avoid inheritance

#

(talking about impl inheritance obv)

paper viper
#

im gonna get back into programming lol

#

had some life issues the past month, stuff is much better now cause friend and i are healing now

ivory sleet
#

yeah pulse, you feelin better?

paper viper
#

yeap

#

the story is complex, dates back to mid-december of last year

#

basically irl friend had depression and she said some toxic stuff to me

#

but i know its just her depression which is doing that

#

and now we are getting better

ivory sleet
#

ah ye, well best of luck, I hope can thrive still :p

paper viper
#

yep

ivory sleet
#

Friends and love come first ofc, no doubt

paper viper
#

she liked me at one point, and i still like her, and i know of a cool event happening next month so i might try to land a shot

#

XD

ivory sleet
#

ah, that sucked

paper viper
#

yep but as long as we are healing ya know

#

she knows it's her fault which is good

#

been through a lot of pain and stuff but i got other good friends and also playing piano helped me

ivory sleet
#

sounds excellent, keep healing 💪

paper viper
#

yep

blazing scarab
#

Hmm today i will move to kotlin qnd code a plugin 100% following elegant object principles

ivory sleet
#

@blazing scarab still wanna play?

#

I just saw your message in general now

blazing scarab
#

Sorry, cant, going to bed soon

ivory sleet
#

ah no worries, well I hope you sleep well dreaming about perfect object orientation

paper viper
#

ive been playing a ton of skyblock

#

XD

ivory sleet
#

oo

#

hypixel sb?

paper viper
#

yep

#

i stopped playing for a year

#

came back

ivory sleet
#

ah

#

nice

paper viper
#

u play sb?

ivory sleet
#

used to

paper viper
#

ahh

ivory sleet
#

first month

paper viper
#

ic

ivory sleet
#

I played with knattekalle, sirdeadly and onlyskelett

paper viper
#

sb is very grindy

ivory sleet
#

indeed

#

probably why I stopped

paper viper
#

very hard for beginners

ivory sleet
#

lol

paper viper
#

i remember when i started

ivory sleet
#

yeah

#

it isnt

#

but no one is asking a question

young knoll
#

Because we’re making a new skyblock

#

Hypixel skyblock is canceled

paper viper
#

Yeah

young knoll
#

🦀 🦀 🦀

wet breach
#

this is an important concept in terms of multi-threading

#

if you support multiple threads but need to ensure that all threads have the same instance, singleton is one of the ways to ensure that

blazing scarab
#

sounds like a design issue

wet breach
#

reusability isn't a factor if the object isn't intended to be thrown away to begin with

blazing scarab
#

This can be achieved without singletone

wet breach
rigid loom
#

?code

#

whats the cmd?

wet breach
#

?paste

undone axleBOT
rigid loom
#

thx

wet breach
#

might be an mcreator specific problem

#

I really couldn't tell you the issue here other then it involves some kind of reflection

neon minnow
#

what are the inventory sizes we can use in spigot api

minor otter
#

I'm thinking maybe I give the player permenant-1 mining fatigue when they join then upon blockdamage event depending on what block it is I change the level of the effect on a mushroom block or remove the effect if its a normal block then reapply it I would have to test how well it works

young knoll
ivory sleet
young knoll
#

And then the special containers like hoppers and dispensers

hasty prawn
minor otter
hasty prawn
#

Their hand will be slow all the time

minor otter
#

Doesn't -1 solve that?

hasty prawn
#

You can't give a negative effect amplifier

#

Or atleast you can't with the command

minor otter
#

I'll have to see if that's still a thing I read up and people used it and it worked fine

young knoll
#

You can

#

Pretty sure you just give a value above 128

#

And it’ll overflow to negative

hasty prawn
#

Well 129 makes my hand disappear entirely so not sure thats gonna work lOL

#

And even if -1 does make it look normal, won't they still break the mushroom block instantly?

wet breach
minor otter
#

I'll have to test it real fast

ivory sleet
#

true, conceptually its an easy way to address given problem

wet breach
#

but I was also just giving an example where a singleton is useful

#

there are other reasons for using singletons

ivory sleet
#

indeed

wide beacon
#

how can I make particles and potion effects(glowing in particular) appear for a specific player?

wet breach
#

one of my favorite places for using singletons is management classes

#

like for files or for queue like systems where you have the one class that is responsible for doing things and you really don't want another instance of said class

#

because writing to a file from two different classes generally is a no-go 😛

blazing scarab
#

😬 😬 😬

#

procedural programming

ivory sleet
#

I mean java is somewhat procedural

blazing scarab
#

it can be object oriented if yoy want

minor otter
#

not sure if it will work on every version but it seems to do exactly what I want it to

ivory sleet
#

well in reality, methods are just functions where their nullary argument is the invoker itself

hasty prawn
blazing scarab
blazing scarab
#

Objects encapsulates logic inside them, so we dont have to keep in mind it

ivory sleet
#

which also sucks ass from time to time but yeah

neon minnow
#

what event is on right click with a specific item

hasty prawn
#

PlayerInteractEvent

neon minnow
#

ty

neon minnow
#

How do i check

#

Item in hand

young knoll
#

Player#getEquipment#getItemInMainHand

#

Or offhand

sterile token
#

?gson javadocs

lavish hemlock
#

?jd gson

lavish hemlock
#

Okay so I don't think ?gson is a command

#

and ?jddoesn't give you info on any ol' dependency

sterile token
#

Oh ok

#

It would great to implement that

#

I will create a thread for that

lavish hemlock
#

I think everyone has suggested that feature

sterile token
#

But thanks for answering

lavish hemlock
#

And nothing has been done about it

#

so gg

sterile token
#

Im dude

lavish hemlock
#

Same

sterile token
#

Its Gson.fromJson(json, Object) right?

#

Im tryin to serialize and deserialize with Gson

blazing scarab
#

fork paper then

lavish hemlock
#

"Forking Bukkit" hmmm

#

I think

sterile token
#

Isnt bukkit died?

lavish hemlock
#

you probably lack the experience required to make a "better" server jar

#

if you say shit like "forking Bukkit"

#

Okay first of all

blazing scarab
#

(paper)

lavish hemlock
#

Bukkit: The interfaces used to communicate between plugins and the server

#

CraftBukkit: An implementation of Bukkit that uses modified Mojang server code

#

Spigot: A continuation and fork of CraftBukkit

#

So essentially always Spigot or Paper :p

#

Forking Bukkit would be adding new API features and forking CraftBukkit is pointless

#

We should have a ?forks command or smthn

#

To explain Bukkit/CraftBukkit/Spigot

#

Yes

#

Actually fuck it gimme a sec

blazing scarab
#

Well, if you care about performance, paper would be the best. It already has dozens of optimizations

twilit nexus
#

I am trying to make a plugin that sends a custom join message customized for each person using UUID's and was wondering how I would set up the UUID part

lavish hemlock
#

There's a couple of other interesting forks like Purpur as well

blazing scarab
#

Also providing best api tor your developers

#

Ehh.. Its just easier to disable it

lavish hemlock
#

Paper's API is a big improvement over Spigot/Bukkit's

sterile token
#

?jd Gson.toJson()

lavish hemlock
#

I would never recommend developing plugins specifically for Paper unless you're working on internal server plugins.

blazing scarab
#

Verano that doesnt work

twilit nexus
sterile token
blazing scarab
#

I would recommend developing plufins for paper, especially when hangar will come out

sterile token
#

I would never fork paper. Cuz no many plugins doesnt support it

lavish hemlock
#

I'd personally recommend developing plugins for multiple platforms :)

blazing scarab
lavish hemlock
#

You can create multi-module projects in Maven or Gradle

sterile token
lavish hemlock
#

So common, spigot, paper, etc.

sterile token
lavish hemlock
#

Problem is that for a few forks, you need to heavily abstract common

blazing scarab
sterile token
blazing scarab
#

Especially with components

lavish hemlock
#

Like uhhh Krypton for example.

#

Just use Adventure :p

blazing scarab
#

Who cares about krypton

#

SpongeAPI 🤝

lavish hemlock
#

I don't 🤷‍♂️ I was listing it as an example

blazing scarab
lavish hemlock
#

I mean I'm eventually planning on doing that for my own framework, Limestone

sterile token
#

How would i serialize class with Gson.toJson() and Gson.fromJson()?

lavish hemlock
lavish hemlock
sterile token
#

Why ouputstream?

lavish hemlock
#

Because toJson serializes :p

sterile token
#

Every packet class im creating its implementing my interface

lavish hemlock
#

What is your interface

sterile token
lavish hemlock
#

But

hybrid ledge
#

When I run CompletableFuture.supplyAsync, does it coordinate with Bukkit scheduler somehow ?

lavish hemlock
#

What is your fuckin' interface

#

:p

#

Like

sterile token
lavish hemlock
#

What does it have to do with Gson

sterile token
#

🤔

lavish hemlock
#

Okay

#

Does your redis library have any IO classes?

sterile token
#

I think i was mixing you everything

lavish hemlock
#

Like idk

#

RedisOutputStream or RedisInputStream?

sterile token
#

Redis only allow you send and receiving strings

young knoll
#

You can turn an object into a string with gson

lavish hemlock
#

Something like that?

sterile token
lavish hemlock
#

Okay then uhhh

sterile token
#

But i dont remember how it was

lavish hemlock
#

okay so it is literally

sterile token
#

I know that Gson.toJson() - return json string

lavish hemlock
#

gson.toJson(myObj)

sterile token
#

Oh ok

#

And them: gson.fromJson(JsonString, Class<T>)?

#

thanks

lavish hemlock
#

and then serialization is gson.fromJson(myStr, MyObject.class)

#

yeah

sterile token
#

THANKS

young knoll
#

Deserialization*

sterile token
#

I was looking this for hours

lavish hemlock
#

anyway

#

I don't know how you managed to miss it

sterile token
lavish hemlock
#

Legit just google the javadocs

#

find Gson

sterile token
lavish hemlock
#

and it shows you all the methods

sterile token
#

But didnt work*

lavish hemlock
#

Yeah that's why you google it

#

Because that command doesn't work like that

sterile token
#

Oh really?

lavish hemlock
#

Yes

#

I feel like you should've picked up on that by the fact you tried it 3 different times and we told you multiple times it did not work that way

sterile token
#

What would you recommend me

lavish hemlock
#

Google

sterile token
#

Im creating a packet system. With a listener where you listen to that packets

young knoll
#

Google knows all

sterile token
#

Not talking anymore about Gson

sterile token
#

What would you recommend me?

#

Yeah @quaint mantle

#

Im making it based on Redis. Cuz i get tired of getting shity erros with sockets

elder oyster
#

How can I modify the players name tag when the scoreboard is already in use (Each player has his own scoreboard so teams won't work)?

#

Do I have to use packets or is there a simpler way?

sacred shard
#

What's the best way I could add cooldown to an event? I'm unfortunately still on 1.8 and want to implement something that already exists in 1.9 which is the hit delay, but only on a specific entity.

elder oyster
#

If difference is greater or equal to cooldown/delay then proceed with event

sacred shard
#

It seemed to caused some lag when I tried implementing it. I'll try using LocalTime.

young knoll
#

I use currentTimeMills and a simple map

elder oyster
#

If each player has his own delay you can use key value pairs (hashmaps) with UUID as key and Localtime.now (or a class) for value

sacred shard
#

I actually tried using a map to store player uuids, added a check between values and just wrapped what I wanted to update in that event and it kind of worked but there was some lag so that was concerning.

elder oyster
#

Depends on where you put it and how often it was being used I guess. Mine is connected to a large class and gets called quite often. Doesn't seem to be laggy

young knoll
#

Map lookups are quick

sacred shard
#

It was used in the EntityDamageByEntityEvent event, so whenever a player hit a mob.

#

*not every mob, only one specific

young knoll
#

Yeah that should certainly not be causing lag

sacred shard
#

Oh well then, I guess I rollbacked that solution for no reason and didn't save the code so gonna have to rewrite it! Thank you.

minor otter
#

how would i tell once the player has stopped mining a block

young knoll
#

There’s a packet

minor otter
#

armanimation?

young knoll
#

Someone PRed an event for it but I’m not sure it’s accepted yet

golden kelp
#

How can I make a itemstack (Lingering potion) which has a effect.

sullen marlin
#

though I'm really not sure of the obsession with stopped mining a block

#

I really can't think of a proper use for it

young knoll
#

Ah the event is in

#

Ignore me

golden kelp
young knoll
elder oyster
minor otter
#

exactly what I needed it for

sullen marlin
#

there is already a damage event

golden kelp
young knoll
#

When I did it I used the damage event to start a runnable and the abort event to stop it

young knoll
#

Since the damage event only fires at the start I need a runnable to keep damaging the block

sullen marlin
#

just damage it more each time the event fires

young knoll
#

It only fires at the start

#

Afaik

sullen marlin
#

no it fires each damage increment

young knoll
#

Ah

#

Still not ideal if I want to change the increments

hasty prawn
#

Nope, Coll is right. It only fires when they start.

young knoll
#

I just used the runnable to increment the damage each tick

tranquil dome
#

I'm planning to make a pvp related plugin, but I'm not so sure on which version to go with. I'd like it to be compatible with 1.7/1.8 servers but also with newer versions. What's the best version to pick for backward and/or forward compatibility?

young knoll
#

Gives precise control over how many ticks to break the block

hasty prawn
#

Same, I added Mining Fatigue when they start and everything needs to stop when they abort! The event is useful :>

young knoll
#

Yeah that’s what I did

#

But with packets before the event existed

hasty prawn
#

I suppose now I can remove my custom event considering it's in Spigot now huh

sterile token
#

That what i was making refence

elder oyster
#

Ah I can't use the scoreboard cause the KitPvP plugin is hoarding it 😄

sterile token
#

So you are doing your own scoreboard api or tags?

young knoll
sterile token
#

Im confused now

elder oyster
#

Since each player has his own scoreboard and the scoreboard changes every kill/death I cannot use teams for name tag color changes
Was asking if there's some other way (if possible other than packets) to change name tags

sterile token
#

I dont udnerstand that

elder oyster
#

Player name above the players head

#

press tab when the intellisense pops up for the classes you want to import

sterile token
#

You are trying to update player name tag

#

Not scoreboard so

young knoll
#

You can modify the nametag with scoreboards

tranquil dome
#

What plugin version should I go with to support 1.7 to latest version servers?

young knoll
#

1.7

dusk flicker
#

yikes

lavish hemlock
young knoll
#

Or

#

You could not do that

dusk flicker
#

just support 1.13+

#

it'll be easier

#

or just latest

lavish hemlock
#

I've found 1.14 is a good version

#

Apparently 1.13 is unstable or smthn? At least that's what I've heard

tranquil dome
#

well, it's a plugin for pvp

dusk flicker
#

1.14's performance = shit

lavish hemlock
#

But yeah with older versions you lose out on stuff like PDC

tranquil dome
#

so I'd like to support those versions as well

sterile token
#

its possible to do a custom thread executor that allow me throws Exception? Cuz by default if i do:

new Thread(new ConnectionHandler()).start(); Say me that i need to try-catch and its fucking annoying doing try-catch everywhere

young knoll
#

Well if you wanna support 1.7

#

You gotta use 1.7 API

ivory sleet
#

Verano

#

just use SingleThreadExecutor

lavish hemlock
#

Don't support 1.7, just have server owners use ViaVersion like they already should be doing.

ivory sleet
#

or whatever they called

elder oyster
tranquil dome
#

and 1.7 API will work fine with later versions?

ivory sleet
#

fixed thread pool with 1 thread perhaps

lavish hemlock
#

If you work on server backends like I was going to

young knoll
#

Who knows, 1.7 was like 7 years ago

ivory sleet
#

then pass an uncaught exception handler to the executor service verano

dusk flicker
#

obv support is less to come by

lavish hemlock
#

It's fun because sometimes the owners are smart and use up-to-date versions w/ Paper

dusk flicker
#

as it isn't officially supported

lavish hemlock
#

So you can get Paper API w/ 1.18 and be ✨ modern ✨

dusk flicker
#

oh shit yesterday would have been 7 years, 7 months, and 7 days]

sterile token
young knoll
#

closer to 8 years

#

Dang

lavish hemlock
#

777 jackpot

ivory sleet
#

then you can pass a guava ThreadFactoryBuilder

sterile token
#

But that its for jdk 17

#

Big problems

lavish hemlock
#

Nah

sterile token
#

But anywhere thanks i will try

lavish hemlock
#

That's just the version of the javadocs

sterile token
ivory sleet
#

yes

#

look at the since documentation

lavish hemlock
#

Yeah

#

If there's no Since then it means it exists in all versions that class exists in

#

And java.util.concurrent has existed since Java 6 iirc

ivory sleet
sterile token
#

Smth im forgeting?

#

Or something you will change to that class?

paper viper
#

why not implement closeable

#

instead of manually add close method

lavish hemlock
paper viper
#

Yeah

lavish hemlock
#

I'm pretty sure there's no real difference but it's convention 🤷‍♂️

sterile token
#

Allright i will need to implement it there? or in class which implement connection?

terse ore
#

If I want a moving WorldBorder I need to use this right?

young knoll
#

Yes

terse ore
#

oki ty <3

paper viper
buoyant viper
lavish hemlock
buoyant viper
#

oh

young knoll
#

Wat

#

That’s

#

Weird

lavish hemlock
#

You're not technically supposed to use AutoCloseable

sterile token
#

Thanks

buoyant viper
#

thought it was the other way around lole

lavish hemlock
#

I think it's from a readability standpoint or smthn

#

But yeah it's like a backwards compat thing

sterile token
#

With this and ThreadExecutor i can execute code in separate threads right?

paper viper
#

you need to find the proper obfuscated name

#

it's going to be a or b or smthing like that

#

go into the class and try to find it

young knoll
#

Or use mojmap

chrome beacon
#

Are you on the same version

#

Then that's why

graceful turret
#

how to teleport entity in inverted player direction 100 block further?

chrome beacon
#

Pulse and Coll have given you your options

paper viper
#

look into the class

#

and tried to find the playerconnection variable

#

or use mappings

#

like Col said

#

If you are using Intellij just open class declaration

#

i cant explain it any simpler than that breh

buoyant viper
#

control click it

ivory sleet
#

double shift click

#

search PlayerConnection and check in all files and non project files

sterile token
#

Isnt it player.getHandle().playerConnection__()__.sendPacket(packet); ?

sterile token
#

playerConnection with ()?

paper viper
#

its not a method...

sterile token
#

for me it working with playerConnection()

#

If not use Protocol Lib

#

With protocol lib, you can send and receive packets really easy

young knoll
#

Ehhh

#

Honestly sending packets with protocollib is kinda a pain

paper viper
lost matrix
#

The connection is just a public field in ServerPlayer. Depends on the mappings you are using.

paper viper
#

i found it from my 1.18 code

sterile token
#

:/

paper viper
#

that's not my issue

dusk flicker
#

?...

paper viper
#

update

dusk flicker
#

Im so confused lmao

sterile token
lost matrix
#
ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;

(If you use mojang mappings)

dusk flicker
#

VERANO im confused as you injected yourself into the problem but it's not you that is having the problem

#

and for fase Pulse gave you the code above (for 1.18 that is)

paper viper
#

it depends at least if you use mappings or not

#

i wasnt using mappings

sterile token
paper viper
#

and yeah you should use mappings, i was just lazy :p

young knoll
#

Check the 1.18 spigot post

dusk flicker
#

?1.18

undone axleBOT
dusk flicker
#

thats useless

#

thanks spigot

paper viper
#

a lot of this you cannot just follow a simple tutorial to figure everything out

#

you have to put the time to read stuff

#

and search things

ionic dagger
#

anyone recommend any tutorials for plugin dev in general?

#

everything im seeing is like

dusk flicker
#

do you know Java?

ionic dagger
#

made a year ago

paper viper
#

i never watched tutorials

ionic dagger
#

c++

dusk flicker
#

learn java basics first then

#

C++ should transfer a bit over

ionic dagger
#

yeah im looking over all that rn

paper viper
#

syntax for basic stuff like loops and things are mostly the same

ionic dagger
#

c++ and java r very similar syntax wise

paper viper
#

the big thing is OOP

#

tho

ionic dagger
#

ya

paper viper
#

interfaces, abstract classes, etc

dusk flicker
#

Once you know the basics it will be much easier to work with, and those tutorials from a year ago are prob fine, generally most that dont touch packets will still work even if they were made for 1.8

paper viper
#

no

#

i do not recommend him

ionic dagger
#

😭

paper viper
#

lol

#

just no

#

i dont care

#

don't watch him

#

I found a good series earlier but im too lazy to pull it up

dusk flicker
#

There's tutorials on Spigot

#

just aren't videos

paper viper
#

and honestly, i dont really watch yt tutorials

#

copying is not good...

dusk flicker
#

some youtube tutorials are decent, but not many

ionic dagger
#

yall check out this guy before?

dusk flicker
#

Havent heard of them before, i'll watch a quick minute of it and see

ionic dagger
#

also, any of u guys run thru this? https://java-programming.mooc.fi/

dusk flicker
#

?learnjava

undone axleBOT
ionic dagger
#

heard it was good for java

dusk flicker
#

Good resources ^

dusk flicker
sterile token
dusk flicker
#

What?

paper viper
#

??

ivory sleet
#

he is good

ivory sleet
#

😉

dusk flicker
#

yes?

paper viper
#

Yes bob is good

young knoll
#

Bob the builder?

ionic dagger
#

bob? 💀

ivory sleet
#

pulsebeat, what does clean code mean to you?

young knoll
#

No soil on the code

ionic dagger
#

everything in main function

#

no include files

#

just namespace std

young knoll
#

No code

paper viper
young knoll
#

Can’t have messy code with no code

dusk flicker
# sterile token ...

Yes, you made another person's problem yours, for no apparent reason, when you arent even having the issue

ivory sleet
#

o fair

ivory sleet
sterile token
paper viper
#

easy to understand

dusk flicker
#

I'm not?

#

What?

ionic dagger
#

easy to understand imo

buoyant viper
ivory sleet
#

ah alr alr

#

nice

ionic dagger
#

i use notepad

dusk flicker
#

only true way to code

buoyant viper
#

i use vim

dusk flicker
#

good job

ionic dagger
#

i compile my code by hand

young knoll
sterile token
#

Does anyone know if exists an implementation of VIM with TabNine or gth Copilot?

sleek turret
#

I just write the machine code

dusk flicker
#

LMAO

ionic dagger
#

bro has cheese and peanut butter for breakfast

young knoll
#

What the fuck does that mean

ionic dagger
buoyant viper
#

bro thats kinda gay bro

ionic dagger
#

⏸️

buoyant viper
#

god i wish

sterile token
#

Wrong channel

ionic dagger
#

sativa

#

i live there too

#

are we like besties now

sterile token
#

Im the only one that think every girl is lesbian?

young knoll
#

Yes

#

Because I can assure you that is not the case

sterile token
#

So idk sometimes i dude lot about girls

ionic dagger
young knoll
#

If every girl was a lesbian I would be less nervous about moving to 🏳️‍⚧️

ionic dagger
#

⏸️

dusk flicker
#

what

#

did

#

I

#

just

#

read

ionic dagger
#

⏸️ bro

eternal night
#

spigot discord is as depressingly garbage as always 👀

ivory sleet
#

Yes let’s not continue this random discussion

eternal night
#

merci 🙏

dusk flicker
#

THIS IS A MINECRAFT SERVER FOR DEVELOPMENT

eternal night
#

conclure to the rescue

ivory sleet
#

?kick @grand flint stop already

undone axleBOT
#

Done. That felt good.

ionic dagger
#

i never stopped typing so fast

young knoll
#

I feel like I missed something

dusk flicker
#

you absolutely did

#

be glad you did

sterile token
#

A random question where should i mange the runnable interface? On my conenction class or another class?

lavish hemlock
#

I didn't know 🏳️‍⚧️ was a state

ivory sleet
#

but generally you wanna separate concerns verano

dusk flicker
#

🤦

#

I know that was a joke but lmao

buoyant viper
#

all the cute girls come from it

lavish hemlock
#

Mmm I disagree, I don't think any states are that good.

sterile token
ionic dagger
#

pa is the worst state

ivory sleet
#

Ye I saw

young knoll
#

I thought it was a country

lavish hemlock
#

And equality is about having no exceptions.

buoyant viper
sterile token
buoyant viper
#

its a country state

ivory sleet
young knoll
#

I see

ionic dagger
#

anyone wanna help me install intellij and make it look all pretty

sterile token
#

Sorry for tag

ivory sleet
#

I mean wym by thread lock

lavish hemlock
#

Do you mean deadlock?

ivory sleet
#

obv it’s gonna be blocking on the thread it’s called on

lavish hemlock
#

There's no chance that can cause a deadlock.

#

But it would be blocking.

sterile token
#

I know that when you send and read it block the thread until its finish

ivory sleet
#

Pretty much

#

I mean to some extent, every method is blocking, however methods may opt in to submit their actual task onto another thread

leaden falcon
#

how would I check if a player is typing a command?

#

like if a player types /a, does an event fire for that, and then /ab?

lavish hemlock
#

I mean the problem is when expensive tasks block the flow of the program

#

e.g. performing IO tasks on the render thread 😬

#

(that's what Minecraft does iirc)

ivory sleet
#

does it?

lavish hemlock
#

I'm pretty sure Minecraft doesn't utilize threads so, yeah maybe?

lost matrix
lavish hemlock
#

Minecraft is not optimized at all.

lost matrix
leaden falcon
#

TabCompleteEvent says it only works for arguments, not the main command name

young knoll
#

Minecraft utilizes threads

young knoll
#

Chat is a thread

lavish hemlock
young knoll
#

Worldgen is several worker threads

leaden falcon
#

is there an alternative one?

#

for command names themselves?

young knoll
#

No

#

It client side

lost matrix
leaden falcon
#

is there really no event that accomplishes this?

#

i just need to send a user a message if they do /h or something

young knoll
#

Nope

#

It’s all client side

lost matrix
buoyant viper
#

the client does not constantly send what the user types

leaden falcon
#

ouch

#

that sucks

buoyant viper
#

not rly

leaden falcon
#

its unfortunate it only works for command names and not arguments

young knoll
#

Arguments are looked up on the server

#

But the names are all cached client side on login

sterile token
leaden falcon
wary harness
#

Is there any short way to access spigot.yml thru api?

young knoll
#

Bukkit#getServer#spigot#getConfig

wary harness
#

Thanks

fallen thunder
#

Hello I want to dev an API for the servers with Proxy -> Servers. Idk what's the best id: Centralize the servers's data on the proxy (Bungee Cord or maybe Flam Corde) or server manage her data and send it to database ?

low temple
#

If I wanted to make an item un-stackable, would it be practical to put a UUID.random() into the persistent data container of the item? or is there a better way to do it?

young knoll
#

Yeah that works

#

Time stamp may also be an option

low temple
#

Oh true

#

like store the System.getTImeInMiliseconds() as the value

trail remnant
#

how can i make it so players can still break and place blocks even though there is an armorstand passenger?

        ArmorStand as2 = (ArmorStand) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.ARMOR_STAND);

        as2.setVisible(false);
        as2.setGravity(false);
        as2.setCollidable(false);
        as2.setCanPickupItems(false);

        as.setVisible(false);
        as.setCustomNameVisible(true);
        as.setCustomName(ChatColor.translateAlternateColorCodes('&', "&7Rank &9" + e.getPlayer().getLevel()));
        as.setGravity(false);
        as.setCollidable(false);
        as.setCanPickupItems(false);

        as2.addPassenger(as);
        e.getPlayer().addPassenger(as2);```
setting marker to true wont help me because i need to stack armorstands and setting marker to true makes them collapse into eachother since the hitbox is removed
wet breach
young knoll
#

But it would have to be different lore each time

young knoll
#

And lore is visible

low temple
low temple
lost matrix
low temple
#

yeah just prevent shift-clicking when crafting the item

fallen thunder
lost matrix
young knoll
lost matrix
low temple
lost matrix
#

And this is a weird setup

young knoll
#

I mean they did say the issue with marker

lost matrix
low temple
lost matrix
lost matrix
young knoll
#

That’s a lot of entities

lost matrix
#

all packet based ofc

young knoll
#

Oof

#

I wish there was a good way to do multi lines

wild grove
#

How can I make a piston be powered without redstone? (please ping me)
I've tried this but it glitches out and does the animation extremely quickly 🤔

PistonBaseMaterial piston = (PistonBaseMaterial) block.getState().getData();

piston.setPowered(true);
block.setData(piston.getData());

blockAbove.setType(Material.PISTON_EXTENSION);
PistonExtensionMaterial pe = (PistonExtensionMaterial);
blockAbove.getState().setRawData(pe.getData());

blockAbove.getState().update(true, true);
block.getState().update(true, true);
young knoll
#

Other than scoreboards

#

I wonder how wynncraft does multi line names, those are nice and smooth

lost matrix
#

[Marker]
[Marker] + [Endermite]
[Endermite]
[Player]

terse ore
#

Can I change world border's color¿

wild grove
terse ore
#

How?

lost matrix
terse ore
#

without a resourcepack

terse ore
#

with resourcepack ik

visual tide
#

its possible but i dont remember how

wild grove
#

Make it expand or contract slowly is my guess @terse ore

young knoll
#

Or negative sized slimes and normal armor stands

terse ore
#

uhm

#

ill try that

wild grove
#

Expand = Green
Contract = Red

visual tide
young knoll
#

Yeah just tell it to move a short distance with like, Integer.MAX_VALUE delay

lost matrix
#

Ah you just want to color it red or green. Expand it for 0.001 Block over a million seconds. ^

golden turret
#

is it possible to send a packet to a player saying that a player x left from the Team? (from the scoreboard)

dusk flicker
#

why would you need to use packets for it

golden turret
#

because i need that for specific players only

dusk flicker
#

Player#sendMessage?

#

Unless you mean it to be on the scoreboard, not fully sure of your question

golden turret
#

i mean something like

#
team.removeEntry("APlayerName", player /* the team will be updated only for the player */);```
dusk flicker
#

Oh so like remove it just from that players scoreboard?

golden turret
#

yes

dusk flicker
#

Hmm, I'm not experienced with scoreboards, but someone else might be able to help you

#

Only idea I would have is creating a team for every player and removing it when they leave but I doubt that is efficient

golden turret
#

🤡

young knoll
#

Check if it’s a sheep and then cast it to sheep

sleek turret
young knoll
#

Then use the methods from sheep

#

Yes

#

Yes?

sullen marlin
#

Why are you updating it

lost matrix
wild grove
lost matrix
sullen marlin
#

update(true is gonna trigger physics and undo any hacking you have done

#

Not to mention since states are copied each time you're just updating whatever the block currently is

sullen marlin
#

Read the docs

lost matrix
sullen marlin
#

But your update is completely pointless because of the copy issue

wild grove
# lost matrix No thats not what you did

What does this do then?

PistonBaseMaterial piston = (PistonBaseMaterial) block.getState().getData();
piston.setPowered(true);
block.setData(piston.getData());
lost matrix
wild grove
#

Ok but I did what you said to do no?

lost matrix
minor otter
#

Oh wow

lost matrix
golden turret
#

if my world.rayTrace hits nothing, will the RayTraceResult be null?

young knoll
#

Could be

lost matrix
young knoll
#

I assume if it hits neither an entity or block it’ll be null

golden turret
#

bruh

wild grove
golden turret
#

ok, i was using rayTraceEntity in async

#

but it was complaining being in async because of getNearbyEntities

#

does the rayTrace method uses getNearbyEntities too?

young knoll
#

?tryandsee

undone axleBOT
golden turret
dusk flicker
#

read the stacktrace

#

it should tell you

dry pike
#

Is there anywhere I can find minecrafts vanilla block class code? I found the interface in the api files but of course it shows no method code.

young knoll
#

In NMS

dry pike
golden turret
#

yes, it uses getNearbyEntities

young knoll
#

Isn’t there a rayTraceBlocks

#

Might just be getTargetBlock

golden turret
#

but i need it for enttity

#

specifically

#

players

#

i need to check if a player is looking at another player

young knoll
#

Well then you can’t do it async

#

Not with that method anyway

golden turret
#

maybe i can just copy the rayTraceEntitities method

#

and use Bukkit.getOnlinePlayers instead the nearby entities

lost matrix
#

Ray tracing async might break at some point. For entities it wont work for sure.
For blocks it might look fine but you will get serious issues if you try to trace into unloaded chunks for example.

golden turret
#

my goal is for loaded chunks only

lost matrix
young knoll
#

I mean

#

You can set a max range and hope nothing weird happens

lost matrix
young knoll
#

Or just check if the target area is loaded each time

golden turret
#

i think the client will use only a max of 3 blocks

#

and if the chunk is not loaded

#

that means no players is there

wild grove
young knoll
#

1.8 moment

golden turret
dusk flicker
#

yikes 1.8

wild grove
#

Tell me about it

dusk flicker
#

true developers only develop against 1.6.4

wild grove
#

I hate 1.8

#

It's so barebones

dusk flicker
#

Could you not update? I presume from your last message you cant

wild grove
#

My solution makes it glitch up and go up for a second

#

1/2 of a second actually

golden turret
#

i saw 🕵️

lost matrix
#

Wait there was a method with Set<Entity> for all tracked entities iirc

#

something something getTrackedPlayers

lost matrix
# golden turret

Do you mean looking directly at another player or is possibly visible for this one player (not obstructed by blocks)

golden turret
#

both

#

because i dont know the exact need of my client

young knoll
#

Heck em

#

If I ever do commissions I’m not doing pre 1.14

golden turret
#

i did

#
    private static RayTraceResult poorRayTrace(Location start, Vector direction, double maxDistance, double raySize, Predicate<Player> filter) {
        Validate.notNull(start, "Start location is null!");
        start.checkFinite();
        Validate.notNull(direction, "Direction is null!");
        direction.checkFinite();
        Validate.isTrue(direction.lengthSquared() > 0.0D, "Direction's magnitude is 0!");
        if (maxDistance < 0.0D) {
            return null;
        } else {
            Vector startPos = start.toVector();

            Collection<Player> entities = new ArrayList<>(Bukkit.getOnlinePlayers());
            entities.removeIf(entity -> !filter.test(entity));

            Entity nearestHitEntity = null;
            RayTraceResult nearestHitResult = null;
            double nearestDistanceSq = 1.7976931348623157E308D;

            for (Player player : entities) {
                BoundingBox boundingBox = player.getBoundingBox().expand(raySize);
                RayTraceResult hitResult = boundingBox.rayTrace(startPos, direction, maxDistance);
                if (hitResult != null) {
                    double distanceSq = startPos.distanceSquared(hitResult.getHitPosition());
                    if (distanceSq < nearestDistanceSq) {
                        nearestHitEntity = player;
                        nearestHitResult = hitResult;
                        nearestDistanceSq = distanceSq;
                    }
                }
            }

            return nearestHitEntity == null ? null : new RayTraceResult(nearestHitResult.getHitPosition(), nearestHitEntity, nearestHitResult.getHitBlockFace());
        }
    }
#

ctrl c trlc v

#

change something here and there

#

gg

sharp flare
# golden turret

You need to compare your distance between you and the player you're looking at, just do the math

golden turret
#

and see if he is looking directly

waxen plinth
#

Is there an API way to remove arrows stuck in a player?

golden turret
#

maybe the last

young knoll
#

setArrowsInBody

sleek pond
#

How would one prevent respawn anchor explosions in the overworld

paper viper
#

block interact event?

#

there might be another event tho

candid plover
#
    
    public void registerBossShop() {
        Plugin plugin = Bukkit.getPluginManager().getPlugin("BossShopPro"); // Get BossShopPro instance
        if (plugin == null) { // Not installed?
            console.sendMessage("§cLBActions: BossShopPro não foi carregado com sucesso.");
            return;
        }
        bs = (BossShop) plugin;
        console.sendMessage("§aLBActions: BossShopPro carregado com sucesso.");
    }```
sterile token
#

Who tag me? I couldnt see the tag

hardy swan
#

did you shade that dependency in unnecessarily?

#

if you really need it shaded in, you can consider relocation

young knoll
#

You don’t, this is an external plugin

candid plover
young knoll
#

Are you using maven

candid plover
#

Yes

#

But BossShoppro API doesn't have maven

river oracle
#

are you on linux or windows?

#

what IDE

#

try booting up intelij as administrator. There is probably a chance you created the project when you were running it as administrator. outside of running intelij as admin and trying to build from there I have no clue

#

does it work when you export elsewhere?

#

maven build? or just regular export

#

my only guess is when its going to use command prompt its not been given admin perms for some reason or another. As long as your the only use on the computer and have the highest permission levels there should be no issue with exporting it

#

have you tried exporting directly from command line

#

run command prompt as administrator cd into your directory and run the mvn compile command

#

what your trying to build

#

just use command prompt make sure its run as admin

#

if thats where your project is

#

yea project folder should do as long as you have maven installed

#

whatever your build arguments are

#

for example
mvn install -f /home/redacted/Desktop/Java/Project/project/pom.xml",

tranquil viper
#

Is there a way to track when someone switches worlds?

river oracle
#

your pom has all of the project settings output paths plugins dependencies etc ofcourse

tranquil viper
#

Oh awesome

#

but is that applied to every world?

#

or just the overworld nether or end

#

yea but I mean would it detect a change in someone like a different multiverse world

river oracle
#

the event names are very descripitive of its purpose

tranquil viper
#

Awesome thanks

river oracle
#

did you run command prompt as administrator

tranquil viper
#

@grand flint why would you export your projects to documents?

river oracle
#

or have some instance of command line open as admin

#

are you the only user on the PC?

sly trout
#

sus

tranquil viper
#

mvn deploy and move it to documents

river oracle
tranquil viper
river oracle
tranquil viper
#

compile and deploy the project and then you have the .jar in the generated file

#

don’t call me stupid when you don’t even know how to use mvn properly

#

send a ss

#

it saying acces denied

river oracle
#

its probably a firewall issue tbh

#

usually there is more lines that explains the reasoning error codes etc

#

makes it easier to solve the issue

tranquil viper
#

I’m just trying to help, maven is built into Intellij

river oracle
#

it should already be installed granted your using intellij

tranquil viper
#

you create a maven project

river oracle
#

are you using the command line given to youby intellij

stray sleet
#

br on ?

river oracle
#

there is a high likely hood its not being run as administrator how to do so on windows and intellij I have no clue.

stray sleet
#

I'm looking for someone to be a programmer on my server

#

ohh ok

river oracle
low temple
sleek pond
#

As long as it doesn't injure entities and break blocks, idk

muted sand
#

I am trying to only allow specific items in a chest, but this won't let me modify my own inventory while being in the chest
and it allows all items for some reason :(

    @EventHandler
    public void onClick(InventoryClickEvent event) {
            if (event.getCurrentItem() != null) {
                if (event.getCurrentItem().getType() == Material.AIR) return;
                if (event.getCurrentItem().getType() == Material.STONE) {
                    event.getWhoClicked().sendMessage(event.getCurrentItem().getType().toString());
                    event.setCancelled(true);
                }
            }
        
    } 

It should only allow stone blocks

low temple
low temple
muted sand
#

if (!(event.getClickedInventory() instanceof Chest)) return;

low temple
muted sand
#

oh-

low temple
#

so

@EventHandler
    public void onClick(InventoryClickEvent event) {
            if (event.getCurrentItem() != null) {
                if (!event.getClickedInventory().getType().equals(InventoryType.CHEST) return;
                if (event.getCurrentItem().getType() == Material.AIR) return;
                if (event.getCurrentItem().getType() == Material.STONE) {
                    event.getWhoClicked().sendMessage(event.getCurrentItem().getType().toString());
                    event.setCancelled(true);
                }
            }
        
    } 
#

should probably also check if event.getClickedInventory() is null but it shouldnt ever be

muted sand
#

hm
i think i may have messed up my stone check

#

well now i can move everything but the stone 🤡 -

    @EventHandler
    public void onClick(InventoryClickEvent event) {
        if (event.getClickedInventory().getType().equals(InventoryType.CHEST)) {
            if (event.getCurrentItem() != null) {
                if (event.getCurrentItem().getType() == Material.AIR) return;
                if (event.getCurrentItem().getType() == Material.STONE) {
                    event.getWhoClicked().sendMessage(event.getCurrentItem().getType().toString());
                    event.setCancelled(true);
                }
            }
        }

    }
fast temple
#

is there any way i could call this furnace burn event to happen after the last if statement?

muted sand
#

oh wait i do

#

i am smart

fast temple
#

the last if statement of the onFurnacePlace that is

muted sand
low temple
fast temple
#

prio?

low temple
low temple
muted sand
#

i want only stone to be added / removed
nothign else should go in the chest :thonk:

#

would i just check the instance of the inventory, see if it's a player inventory, and allow removing it if it is?

fast temple
# low temple event priority?

sorta, i want it to check if the block placed is the reinforced furnace then if it is do the bottom code (the furnace burn event)

low temple
muted sand
#

isn't that all just covered in InventoryClickEvent

low temple
#

no its also covered in InventoryDragEvents

muted sand
#

oh
alright thank you!

low temple
#

cause if you drag click to split into even stacks its handled under another event

low temple
fast temple
#

yeah i just didnt put that in the screen shot lol

low temple
#

you can set the prio of events by adding the priority parameter in the @fresh templetHandler annotation

#

so to make it run first you can do @fresh templetHandler(priority = EventPriority.HIGHEST)

#

sorry evan

fast temple
#

can i make it so that if the first thing comes out false then the other one doesnt run

fast temple
low temple
#

with event.isCancelled()

#

but make sure u cancel it in the other event

fast temple
#

so i set the prio of the thing i want to go first then i cancel the other event if it comes out false

#

?

low temple
low temple
fast temple
#

ok

low temple
#

if it is cancelled then return

fast temple
#

ill try that

#

how do i set another method to be cancelled

#

@low temple

low temple
#

what do u mean

#

ur not setting the method to be cancelled ur setting the event to be cancelled

#

then checking if it is

fast temple
#

so i do e.setCancelled?

#

wouldnt that just cancel the event im already on though, sorry this is what i meant

low temple
#

whats the condition you dont want the other method to run?

fast temple
#

yeah

#

so basically if a comes out false i dont want b to run

#

but if a comes out true i want b to run

low temple
#

so if the event is cancelled, u dont want the other handler to run?

fast temple
#

yes

#

and viceversa

low temple
#

probably isnt possible vice versa

#

cause one method will always run after the other

fast temple
#

well than how to other plugins make it so that you can have levels of furnaces or like better furnaced

#

furnaces

low temple
#

im not sure, ive never done anything with furnaces

fast temple
#

well crap

#

i guess ill just try some other things out

low temple
#

might wanna ask @ivory sleet

fast temple
#

ok

#

how?

#

do i just private message him

low temple
#

ping him when hes online

sterile token
#

For working with player profiles, what would i use Player or Offline Player?

vocal cloud
#

We talking NMS player profiles?

eternal night
#

probably the new player profile API added to spigot

dusk flicker
#

got a link to it?

#

Havent heard of that yet

eternal night
#

dunno if there is a tutorial for it yet

#

let me grab you the commit

dusk flicker
#

alr

dusk flicker
#

oh thats really interesting

#

I might have to do some work with that

#

oh cool capes as well

novel kite
#

Hi there, just checking here, plugins are required to follow GPLv3, right?

#

(Asking for a plugin of my own creation)

eternal oxide
#

no

eternal night
#

draw your own conclusions from that

#

might be good for elgar to also look at that

eternal oxide
#

Spigot is v2 isn;t it?

waxen plinth
#

too bad

#

MIT license best license

nova sparrow
#

What is the rare achievement sound called in the api?

eternal night
#

Try UI_TOAST_CHALLENGE_COMPLETE

nova sparrow
#

ok thanks

gloomy arch
#

Has anyone made a script by any chance to speed up development process? Currently, my process is

  1. stop currently running test server
  2. compile new jar
  3. manually drop new jar in server plugins
  4. restart server

Definitely could be automated was wondering if someone had already done it, save myself some effort.

granite burrow
#

how can I stop a event for a specific player? (AsyncPlayerChatEvent)

waxen plinth
#

/plug reload -c PluginName done

#

I mean I guess you can't replace the jar while the server is running on windows

#

Very cringe

waxen plinth
#

And if it is a specific player

#

Cancel the event

#

You can also use symlinks to prevent having to drop the new jar in every time by the way

gloomy arch
gloomy arch
waxen plinth
#

Windows is just terrible for development

#

If you want to work fast, set up linux dualboot

#

I hit ctrl twice to open up intellij's command prompt, then hit down and enter to run my last-run command (usually gradle build)

#

That updates the jar in the build folder and my running server has a symlink to it

#

Then on the server I just run /plug reload -c PluginName, or if it was my last-run command, I just hit enter-up-enter

#

It takes all of 3-5 seconds

#

That is the biggest advantage of using linux for plugin development

waxen plinth
#

It'll say it's in use