#help-development

1 messages · Page 901 of 1

bleak eagle
#

it could work, but not directly

wet breach
#

well you could make the nogui, just set the system property lol

#

but, at least I found the JVM flag though

bleak eagle
#

yee

wet breach
#

so I am happy that while I remembered incorrectly I wasn't completely wrong XD

torn shuttle
#

I guess it doesn't matter if there is specific parameters for instantiating the object actually

eternal night
#

That it decides to be a gui long before parsing it's flags

river oracle
eternal night
#

No it does not make sense

torn shuttle
#

aw interfaces can't implement each other? weak

river oracle
#

If BT had more customized flags to control more functionality it'd make sense to let them be. Parsed first

eternal night
#

You do a lot of checks to even figure out if it's supposed to be a gui

torn shuttle
#

oh wait they just extend nvm

eternal night
#

Which is what they want

#

But like, can be fixed nicely with an options type or whatever

#

So w/e

shadow night
river oracle
#

It uses the extends keyword

#

Interface1 extends Interface2

eternal night
#

Because it's not an implementation 5Head

torn shuttle
#

yeah I noticed

#

man I really want to go to bed

minor junco
shadow night
#

Hmm, what if something that has no implementation implemented another thing that has no implementation lmao

minor junco
torn shuttle
#

it's 1:40pm my dude, time is a social construct

#

I woke up at 9 pm

#

or earlier, I don't remember

#

it's not important

minor junco
#

For me it's 2:40 tbf

minor junco
#

To be fair I'm like that too so what am I yapping

torn shuttle
#

I don't have a sleep schedule

minor junco
#

Sleep schedule? What is that?

torn shuttle
#

on average for the last 10 years I've gone to bed 2 hours later than the previous day

#

that's my schedule

torn shuttle
#

so it doesn't matter if I wake up at 9 am or midday or 3 pm or 1 am

#

and likewise it doesn't matter if I go to bed at 11 am

minor junco
#

I see

bleak eagle
remote swallow
#

md wanted the --nogui flag to be added iirc

#

so that part wouldnt get merged

inner mulch
#

I want to use classes instead of enums, do i just pass a new instance of said class everytime, or is there another approach?

icy beacon
#

more context needed

chrome beacon
#

^^

inner mulch
#

I want to use classes instead of enums to not break the open close principle, now i dont know how to pass the classes as parameters as they have static values and new instances would be stupid

icy beacon
#

I'd still prefer more context e.g. exactly what you are trying to accomplish

inner mulch
#

nothing

icy beacon
#

?

fluid river
#

does TCP create Connection(or smth similar) objects?

inner mulch
icy beacon
#

Yeah it's quite hard to answer your question then

lost matrix
#

Static values can just be used through the class.
For example:

double value = Math.PI + 3;

Where PI is a public static final value in the Math.class

inner mulch
#

yes, but when i inherit from the superclass i cannot have these methods static

#

abstract static methods dont work

hazy parrot
#

static methods are not inherited

#

its tied to class

icy beacon
#

Why should they be abstract

#

If they are static

fluid river
inner mulch
#

tahts my problem

fluid river
#

you are breaking even more principles this way

icy beacon
#

Well it is

#

But like

#

It's not tied to an instance

inner mulch
#

i know how java works

#

i dont want to use enums

#

i want to replace them

icy beacon
#

Then why are you trying to make it abstract

#

You are talking about abstract methods, then enums

inner mulch
#

BRO

icy beacon
#

Where is the middle ground

inner mulch
#

when i want to replace enums i need to have a superclass

icy beacon
#

I give up I don't understand a fucking word

inner mulch
#

ok

lost matrix
#

Ok lets paddle back one step. Enums are classes. They are only used in cases where the open-closed principle is of no concern in the first place, meaning
there is no reason to substitute them with a regular class.

#

So why are you trying to substitute enums with regular classes?

inner mulch
#

because i have enums like values, that im for sure gonna add more to

fluid river
#

You mean you dont want to update all switch-cases which work based on enum value?

inner mulch
#

no for these cases i use state pattern

fluid river
#

Then what's the problem with just adding more enum values

inner mulch
#

simply because it breaks the open closed principle

fluid river
#

How?

lost matrix
inner mulch
#

enums are modified if i need more of them

#

classes can extend from a superclass

fluid river
#

Oh thats what you mean

#

You need more values at runtime

inner mulch
#

no its just that i dont want to break the principles, as im trying to improve my code quality, maintainability and readability

fluid river
#

can you send a code maybe

icy beacon
#

Well if you don't want to use enums that badly just go

public class MyClass {
  public static final MyClass THIS_IS_A_CONSTANT = new MyClass();
}

// use
MyClass.THIS_IS_A_CONSTANT 
inner mulch
chrome beacon
lost matrix
inner mulch
#

open for modification closed for extension

icy beacon
#

Fair enough ig

icy beacon
fluid river
#

ig if you are on this stage rn, then you already made your system wrong so it leads to that kind of problem

#

maybe problem is somewhere else

inner mulch
#

wdym? there is no problem

icy beacon
inner mulch
#

i just want to improve on what i currently have

fluid river
icy beacon
#

Same

fluid river
#

it's too hard bruh

#

i need more explaination

inner mulch
#

i want to replace enums, simple as that

#

with classes

fluid river
#

why

inner mulch
#

SOLID

fluid river
#

enums have own use-cases

icy beacon
#

It's not like enums are inherently bad...

fluid river
#

you can use them when needed

icy beacon
#

They weren't made for you to not use them

fluid river
#

without breaking patterns

icy beacon
#

Quite the contrary I'd assume

inner mulch
#

but other things might change

#

therefore enum breaks principles

fluid river
#

yeah then don't use enums for stuff which is changing at runtime

icy beacon
#

Use like a registry or something idk

fluid river
#

enums are not made for that

inner mulch
#

im not modifying at runtime

lost matrix
# inner mulch open for modification closed for extension

If you want to design your plugins strictly following all SOLID principles, then you will have to create quite complicated structures.
SOLID should be used as a guide and not a strict rule set. Anyways your solution would require An additional abstract layer like an interface
with multiple Enums implementing this interface. If you give use more information regarding your design, then we can probably work something out.

fluid river
#

which are?

inner mulch
# fluid river

bro, what is so hard to understand about open closed principle?

icy beacon
#

With this attitude you are not getting help

slender elbow
#

i think you are the one misunderstanding tbh

#

"just because" is not really a strong enough reason to refactor your codebase

#

you change it because there is a need that needs to be addressed

#

not creating a solution for a problem that might never arrive

icy beacon
#

Premature optimization video deja vu

slender elbow
#

and yeah, optimisation is not just about performance :p

icy beacon
lost matrix
#

I understand his concern. Its a valid one if you want to design solid.

fluid river
inner mulch
#

yes that why i dont want to use enums

fluid river
#

🙂

#

1:1

icy beacon
#

Please give one example of where you are going to implement this refactoring so that it's easier to understand what solution could be used for your problem

#

If there is a problem even

inner mulch
#

i dont have any problems, there are none, i just want to improve on my code

slender elbow
#

you keep saying you want to get rid of some enum in your codebase to follow the open/closed principle, my question to you is, how does the OCP help you in this are of your project?

lost matrix
icy beacon
#

There's no one-size-fits-all solution

inner mulch
#

there is no design problem, im certain tho that some enums may be modified in the future which violates the principle

lost matrix
#

Well, that sounds like a design problem to me

icy beacon
#

Then try to solve this problem in the future when you will be designing

lost matrix
#

I would def not tackle design problems like performance problems

twin venture
#

hi so i have a repo in my repo... folder and i want to update it i did mvn install but that does not seem to do anything , how i can fix it?
i mean i want to use it in my other plugin

icy beacon
#

What I mean is if there's no problem then there's no solution

umbral ridge
#

how do you create custom events? eg. this is not what I want to create, it'll serve as an example: create an event that fires only when player eats an apple - PlayerEatAppleEvent.

so what do I do? use the existing consume event and filter things out and then manually call the PlayerEatAppleEvent (onPlayerEatApple) function? how is this done?

fluid river
#

omg

enum Planets {
   EARTH,
   MERCURY
}```
#

i'm so scared that scinetists will add one more to the list oh noooo

inner mulch
#

open closed principle

fluid river
#

doesn't break here

icy beacon
#

I'd do

class Planet {}
class Registry<T> {}
class Registries {
  public static Registry<Planet> PLANET
}
#

Something along the lines of that

icy beacon
#

I like registries

#

xD

fluid river
#

it's so compilcated lol

#

it's literally oneliner bruh

icy beacon
#

Yeah but not too bad for extension

slender elbow
#

mfw Set exists

inner mulch
fluid river
#

fuck collections and enums, all my homies use

planet* planets = (8 * sizeof(planet));```
icy beacon
#

Just.. add a method to Registry<T>

#

this is pseudocode dude

inner mulch
#

but then it would violate the principle again, right, you'd need to add it for every new planet you extend from its superclass

icy beacon
#

What

inner mulch
#

how are you adding it then?

#

.add(planet)?

lost matrix
# inner mulch there is no design problem, im certain tho that some enums may be modified in th...

Ok just to be sure we are all on the same page what the open-closed Principle is for.

What it means:
You should be able to extend your class, without having to modify your class.

What it doesn't mean:
Your class should not be modified later on after writing it once

This means: If your class is never meant to be extended (like enums), then there is no way of it violating this principle.
You can add new values to enums (or any other class) later in time.

icy beacon
#

Yes?

fluid river
inner mulch
# icy beacon Yes?

when you create a new planet, you'd modify the code again, which will result in it breaking the principle

icy beacon
#

What code do you modify by creating a new class

slender elbow
#

that is not what OCP is about

fluid river
#

can anybody explain me some tcp basics here

inner mulch
fluid river
#

a little bit at list

slender elbow
#

man socket.7

lost matrix
icy beacon
#

You cannot add anything to it

worldly ingot
#

I think you're overthinking this lol

icy beacon
#

Literally ever

fluid river
inner mulch
icy beacon
#

Especially when you just created it

inner mulch
#

to you registry

#

???

umbral ridge
#

boilerplate code

#

imo

lost matrix
fluid river
#

too hard mate

#

i don't get it

icy beacon
#

I literally do not understand what the fuck you mean. You create a registry class and you add a method .add to it. You didn't violate anything just because you added a method to a class with 0 methods

minor junco
icy beacon
#

Are you saying that when a version of an app is published, every class in there is finalized forever

fluid river
#

i know how to make my code better

worldly ingot
#

Yeah, ain't no way you need a 20 minute discussion on code architecture

fluid river
#

i stop coding so i don't make any mistakes

worldly ingot
#

Just like... do your best lol

fluid river
#

perfect solution

inner mulch
minor junco
#

And refactor if needed

slender elbow
icy beacon
slender elbow
#

not the registry

icy beacon
#

^^^^

fluid river
#

^^^^^

umbral ridge
#

^^^^^^

inner mulch
#

it was his example of a enum replacement

minor junco
slender elbow
#

the registry has nothing to do with ocp

#

extending from planet does

icy beacon
fluid river
inner mulch
#

okay thats never what i said

slender elbow
#

YOU need TO MODIFY the registry to add the planet

inner mulch
#

yes, because it was his enums replacement

slender elbow
#

and that is not what ocp is about

inner mulch
#

in an enum you expect every kind of planet to be there

minor junco
#

OCP just means open for extension closed for modification

fluid river
#

he knows that bruh

lost matrix
# fluid river what does it mean

TCP is a protocol build on IP. Its used to transport data from A to B and assures that packets
are sent by letting the receiver acknowledge every packet they receive.

Thats the basics.

slender elbow
#

ocp is about "i am able to extend from Planet without having to modify the Planet class"

fluid river
#

does it create some kind of connection object

slender elbow
#

the registry has NOTHING to do with it

inner mulch
#

bro emily

icy beacon
#
array[0] = 2; // this does not violate ocp
list.add(2); // this does not violate ocp

class MyPlanet extends Planet{}
registry.add(new MyPlanet()); // THIS STILLL DOES NOT VIOLATE OCP
fluid river
#

which i can store in a list

fluid river
minor junco
fluid river
#

or it doesn't

inner mulch
#

he showed me an enum replacement, when he creates a new planet he needs to add the planet to his fake enum therefore modifying the code that modifies the registry

slender elbow
#

yes and?

#

that does not violate the ocp

#

because that is not what ocp is about

hazy parrot
#

this is just too much overthinking

#

if you need enums, use enums

fluid river
#

if not, use static constants xd

slender elbow
fluid river
#

how many priciples did i break here

river oracle
#

I tend to find enums annoying if I ever want to allow registries but they're fairly easy to convert down the line if you need

slender elbow
#

then you use it to connect to a remote peer

fluid river
icy beacon
#

ok let's go over this one more time insanely slowly

enum Planets {
EARTH, MERCURY
} // ooo bad!! ocp violation!! fuck!!!! i cant add new planets!

// so...
class Planet {} // i will extend this and make new planets but where do i put it
class Registry<T> {} // this is a registry but like a registry of nothing
class Registries { // let this be a storage for all registries. basically a Constants object
  public static Registry<Planet> PLANETS; // i will call Registries.PLANETS.add(new CoolPlanet()) and NOT violate ocp!! i'm officially cool!
}
#

or if you don't like registries let it be a set or a list idfc

lost matrix
# fluid river <@220605553368498176>

There is a negotiation protocol.
So A listens for anything on a certain port.
If it receives a SYN packet, then it starts a negotiation protocol. Cant remember exactly how it goes.
After that they can send payload packets to each other.
But in java this is all abstracted away from you. Way to low level.

river oracle
#

Wtf is OCP

icy beacon
#

i'm not adding a single word to this convo this is useless

icy beacon
fluid river
river oracle
icy beacon
#

second thing in solid

river oracle
#

Is this some stupid OOP principle

slender elbow
inner mulch
#

it does

slender elbow
#

how

fluid river
inner mulch
#

because code is changed when new planet exists

river oracle
# inner mulch it does

Please run from effective java or whatever you've been reading bro just write code lol

slender elbow
#

lmao

#

okat sure yeah

#

that is NOT what OCP is about

inner mulch
#

ok it is

slender elbow
#

mate

minor junco
lost matrix
# inner mulch it violates ocp

Didnt we just resolve the misunderstanding about this?
It does not mean that your class wont have new fields in the future.
Its perfectly fine to add new values to your classes later on (as long as they are not extended).

slender elbow
#

get that idea off your brain

icy beacon
#

if yall didn't understand yet yoursalvation is smarter than everybody in this chat

ivory sleet
#

lol what is this

icy beacon
#

so please stop arguing

#

and do not modify your code

#

like

#

ever

#

none o it

inner mulch
slender elbow
#

no it is not

inner mulch
#

it does

slender elbow
#

OCP is not about not modifying ANY code

lost matrix
minor junco
#

Stop the crap you're spamming this channel or make a thread please

inner mulch
#

okay emily, when he extends from the planet class, is the planet added automatically to the registry?

ivory sleet
#

YourSalvation whats ur definition of OCP?

river oracle
fluid river
slender elbow
inner mulch
#

ok

fluid river
#

Because you are changing code

slender elbow
#

OCP is not about "things should happen automatically"

inner mulch
#

for me it is

icy beacon
#

oh

slender elbow
#

oh your OCP

icy beacon
#

well that's what you should;ve started with

slender elbow
#

not the OCP

icy beacon
#

^

slender elbow
#

sure yeah

minor junco
slender elbow
#

then you can do whatever

ivory sleet
#

OCP is that a class should be open for extension closed for modification, by that we should be able to modify the class by extending it, this inherently means that we don’t need to recompile the superclass we’re extending in order for us to modify it

fluid river
#

But don't break the actual ocp please

slender elbow
#

then you might wanna look into annotation processors and service loading and factories stuff

icy beacon
slender elbow
#

to automate your code flow

inner mulch
fluid river
lost matrix
icy beacon
#

that'[s just kotlin

ivory sleet
fluid river
ivory sleet
#

Semantically and infrastructurally

river oracle
molten hearth
#

These concepts provide too much yapping and too little usefulness

ivory sleet
#

fr

fluid river
#

Write on assembly

fluid river
#

Ignore oop

ivory sleet
#

ill go abuse my statics now

icy beacon
fluid river
#

How do i compile my memory and send it to end user

icy beacon
#

for a second i thought i was tweaking and looked up ocp during this convo

ivory sleet
icy beacon
#

turns out i wasn't thankfully

lost matrix
# ivory sleet i think it depends on how we use the enum

Example:

public enum Direction {
  UP, DOWN
}

Is it a violation if you would have to later on add

public enum Direction {
  UP, DOWN, LEFT, RIGHT
}

to me this has nothing to do with the principle, but i think this is where the confusion comes from

river oracle
#

They'll flip out

ivory sleet
#

well enums is a hard one, they’re not very object oriented in the first place

ivory sleet
minor junco
slender elbow
slender elbow
#

me coping

fluid river
#

electricity is not really object oriented

ivory sleet
fluid river
#

it's just electrons moving

slender elbow
#

static electricity?

fluid river
#

private static final

ivory sleet
#

object oriented electricity ⚡️

fluid river
#

Is universe single-threaded?

minor junco
#

Or no?

fluid river
#

if there is a god then no

minor junco
#

It's Schrödingers Single Thread theory

fluid river
#

he is on parallel thread

minor junco
#

The universe is single and multi threaded simultaneously

icy beacon
#

stop writing messages into this channel

#

you're breaking ocp

minor junco
ivory sleet
#

Anyhow aparx, I don’t think it’s useful and meaningful to apply the OCP to enums presumed you use enums like a normal dev and not a yandere one

fluid river
#

forget how to think abstractly

#

you are breaking ocp

grim hound
#

does anyone know how this is caused?

torn shuttle
#

you know this channel is up to something productive when people are 1 comment removed from debating whether there is only one electron in the universe

icy beacon
fluid river
#

go back to monke

minor junco
fluid river
ivory sleet
#

:,)

fluid river
#

at runtime

#

i mean lifetime

icy beacon
lost matrix
icy beacon
#

not sure which yet

#

but i'll come up with it

#

i have my own solid after all

fluid river
#

go back to monkey

icy beacon
#

that would ALSO violate some principle

fluid river
#

no

#

monkey code is functional

minor junco
minor junco
river oracle
#

Liquid inhalation 😨

minor junco
#

😭

icy beacon
# minor junco Soldier On Liquid Inhaled Dopamine

Certainly! Let's reframe the OOP SOLID principles using the new interpretation:

Soldier - Single Responsibility Principle (SRP)

A soldier (class) should have a single responsibility, just like a real soldier who has a specific role or duty to perform.

On - Open/Closed Principle (OCP)

This principle is about being "on" for extension but "closed" for modification, much like a system that is open for new features (extension) but closed for altering existing code (modification).

Liquid - Liskov Substitution Principle (LSP)

The "liquid" here represents the flexibility of substitution. Just as a liquid takes the shape of its container, classes should be substitutable for their base classes without altering the desired behavior.

Inhaled - Interface Segregation Principle (ISP)

"Inhaled" signifies the need for interfaces to be inhaled or accepted only by those who use them. Interfaces should be specific to the requirements of the classes that use them.

Dopamine - Dependency Inversion Principle (DIP)

The "Dopamine" principle is about the high of dependency inversion. High-level modules should not depend on low-level modules; instead, both should depend on abstractions, bringing a sense of dependency euphoria.

This fun reinterpretation captures the essence of the SOLID principles in a more relatable and memorable way!

ivory sleet
#

No GPT?

#

🙄

icy beacon
#

Writesonic does the job for me

#

ok I really should start working I intended to do that 2 hours ago

river oracle
#

How about you work on getting a job

icy beacon
#

im 15

torn shuttle
#

chatgpt

can't
hassle
ah
trust
generativeai
ponderings
thereupon

river oracle
#

Exactly

#

It's about time

torn shuttle
#

few people know what chatgpt stands for

icy beacon
#

i mean i do plugin commissions

#

but literally no one wants plugins

#

lol

#

my last commission was like in december

gritty current
#

Can anyone help me out
im trying to check my item for itemmeta but it keeps outputting unspecified meta what can i do to fix it?

fluid river
#

chat Goes Political, Terminate!!!

river oracle
#

Skull emojiiiiii

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

icy beacon
#

ok y2k you take over from here

river oracle
icy beacon
#

i am closing discord for good

river oracle
#

I'm in class

#

I can't

icy beacon
#

did i ask where you were though

#

i only pointed you in the right direction

river oracle
#

No :(

icy beacon
#

now i did

river oracle
#

Class

torn shuttle
#

behind you

#

with a knife

icy beacon
#

in your walls

fluid river
#

on earth

icy beacon
#

this is top notch help-development

fluid river
#

in your toilet taking a hard shit

proud badge
#

When did they rename grass to short grass?

lost matrix
river oracle
fluid river
river oracle
#

It's funny

icy beacon
#

i agree

fluid river
#

he is in class, solving problems

river oracle
ivory sleet
fluid river
#

does main() violate ocp?

proud badge
#

Hi I have a question, if I have a custom item like this that extends item stack is it possible to later in the future check if item instanceof MyItemClass, or is this not possible?

fluid river
#

by existing

lost matrix
icy beacon
#

when you create a program...

#

you make do with what your ide gives you

#

you cannot write any code

fluid river
icy beacon
#

it wil violate ocp

worldly ingot
lost matrix
proud badge
echo basalt
worldly ingot
#

You're thinking of grass -> grass_block

proud badge
lost matrix
icy beacon
#

undo

fluid river
#

revert

lost matrix
#

ctrl + z

late sonnet
proud badge
#

Also the code just looks cleaner this way

#

A class per item

icy beacon
#

do not do it

#

just don't

fluid river
#

if (myItemIsThat(key, itemStack))

ivory sleet
gritty current
#
        ItemStack item2 = new ItemStack(Material.NETHER_STAR);
        ItemMeta meta2 = item2.getItemMeta();
        meta2.setDisplayName(ChatColor.GOLD + "Revive Token");
        ArrayList<String> lore = new ArrayList<String>();
        lore.add(ChatColor.DARK_PURPLE + "Gives you +1 hearts");
        meta2.setLore(lore);
        item2.setItemMeta(meta2);

        Revive_Token = item2;```

This is one part and the other part is 

```if (player.getItemInHand().getData().equals(itemManager.Revive_Token.getData() != null))```

And it ouputs when i print it out
```Item Meta: UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"Revive Token","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"gold","bold":false}]}, lore=[{"text":"","extra":[{"text":"Gives you +1 hearts","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"dark_purple","bold":false}]}]}
[14:49:36 INFO]: Player Item Meta: UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"Revive Token","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"gold","bold":false}]}}```
lost matrix
ivory sleet
#

Suffering leads to pain

#

Pain leads to anger

lost matrix
#

pain leads to anger

icy beacon
ivory sleet
#

Hahaha

lost matrix
#

^^

fluid river
#

and evertything leads to breaking ocp

lost matrix
#

true

ivory sleet
#

Well technically this dude is actually conforming to ocp

lost matrix
#

anger leads to breaking all solid principles

icy beacon
#

that dude will never live it down in this community 😂

ivory sleet
ivory sleet
#

Xin

icy beacon
#

7smile7

lost matrix
#

ZBLL

minor junco
#

I'm a genius

tribal zephyr
# ivory sleet Xin

Will your DeluxeAsyncJoinLeaveMessage cause lag when alot of people join the server?

ivory sleet
#

oh no you’ve found my hidden treasure

#

but no

lost matrix
#

Since it is Deluxe and Async i would assume that it doesnt

gritty current
#

the question was that i was trying to verify that the item the player is holding is the custom item but i cant bacuse meta data i null but i dont know how i can check for that specfic item

ivory sleet
#

its async, therefore it shouldn’t lag (/s)

young knoll
#

It may cause the end of the world though

fluid river
#

carefall

proud badge
#

Also is there a spigot method to promt a player the resource pack install screen?

icy beacon
#

coll you missed all the fun

fluid river
#

nobody used own nickname

#

i'm genius

tribal zephyr
lost matrix
#

?pdc

icy beacon
fluid river
#

ig you can't force player to open that while ingame

proud badge
#

Yeah but I want it to be promted when they run a command, not when they join

fluid river
#

ig not

proud badge
#

Rip

#

What if I send a packet with protocollib or something

gritty current
fluid river
#

tryit

#

how was that command

#

?tryandsee

undone axleBOT
fluid river
#

yeah

proud badge
#

Just found this

icy beacon
inner mulch
fluid river
#

lol

late sonnet
twin venture
#

Hi i really need help , so i got the ver 3.5.0 the new one i updated into my local repo , but everytime i try to use it i get this error

inner mulch
#

Im currently working on a chat system, i have chat filters and i want to make them swapable on runtime, when passing a new instance of a chatfilter all the patterns would get compiled again, which is bad, therefore, is there a solution to this, i cannot use static as these classes need to extend from a superclass and singleton feels bad to me as i would need to make the class singleton everytime i create a new filter and this is prone to error as i might forget some time.

worldly ingot
#

I mean you're probably fine to compile them again

twin venture
# warm mica Whats up

the lib i use , is not updated to latest version and i tried to update it to 1.20.4 , and i did but now i am not able to use it into my main plugin ..

worldly ingot
#

Or if you really, really care, keep the String around and check if the strings differ from the last instance and only recompile then

#

but I honestly don't think you'll notice a performance issue tbh

twin venture
#

i will get rid of using the lib , and make my own in the future after i graudate , cuz i don't have time for it ..

inner mulch
minor junco
#

Pattern compilation is not the most performant

worldly ingot
#

I mean yeah but you're also only doing it once manually when something is reloaded

#

It's not like you're compiling the pattern every tick

young knoll
#

Sure but you probably aren’t swapping filters every tick

worldly ingot
#

(I hope)

inner mulch
#

what if i do tho 😈

worldly ingot
#

Then uh...

short plover
#

anyone got a clue on why the swingMainHand function sometimes work and sometimes doesn't work?

worldly ingot
#

redesign 😅

minor junco
#

You could just precompile no?

#

If you have a static set of filters

#

If it's dynamic, you're screwed

icy beacon
minor junco
#

XD

#

U mean the soldier on liquid inhaled dopamine?

icy beacon
#

exactly

#

as to not violate on*

minor junco
#

Exactly

#

Amazing 😆

#

Love this meme already

icy beacon
#

my sense of humor revolves around doing too many sequels to a joke to the point where it becomes so unfunny that it's funny again

#

basically int overflow

minor junco
#

Same tho

inner mulch
minor junco
icy beacon
lost matrix
young knoll
#

?xy

undone axleBOT
minor junco
#

You could use certain data structures and compile each message into nodes

young knoll
#

Why are you swapping filters each tick

twin venture
short plover
#

its not swinging my hand sometimes, but sometimes it does

twin venture
#

ist not using the one on my local repo but insted its using the one from internet :L

torn shuttle
#

is an itemstack in an armor stand not a part of nondefault value of entity data in nms?

#

in this case leather horse armor on a head slot of an armorstand

inner mulch
lost matrix
young knoll
#

Isn’t entity equipment separate from the entity meta

torn shuttle
#

is it?

young knoll
#

There’s a different packet for it

torn shuttle
#

hmmm

#

well that's unfortunate if true

#

there is an equip item packet

short plover
#

I have the same issue on some other plugins that I run on my server aswell that use the swingMainhand function, and sometimes it works and sometimes it doesn't

torn shuttle
#

so I have to send that specifically?

#

that's what I was doing before

lost matrix
chrome beacon
twin venture
gritty current
#

i have a question how can i get all of the banned users on my server and display them as a head with their name on it
Code i have right now

                int i = 0;
                for(OfflinePlayer offlineUser : Bukkit.getBannedPlayers())
                {
                    ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
                    SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
                    meta.setOwnerProfile(player.getPlayerProfile());
                    meta.setDisplayName(offlineUser.hasPlayedBefore().getName()); <-- doesnt work
                    meta.setLore(Collections.singletonList("Revive this player"));
                    playerHead.setItemMeta(meta);
                    inv.setItem(i, playerHead);
                    i++;
                }
                player.openInventory(inv);```
chrome beacon
#

try clean install

twin venture
chrome beacon
#

did you bump your lib version

twin venture
#

?_?

chrome beacon
#

like change it

twin venture
#

i did , to 3.5.0

#

and that did not work eaither

chrome beacon
gritty current
lost matrix
serene garden
#

Hey, is there's any tutorial on automating Github releases using Github actions?

lethal iron
eternal night
young knoll
#

Relatable profile picture

inner mulch
lost matrix
# lethal iron I'm having a serious headache trying to make invisible armor stands via packet....

This looks like you are using an old approach with DataWatcher objects. Newer versions require a List of WrappedDataValues instead.
Here is an example on how to set the name and flags for an invisible ArmorStand (A line in a hologram)

  private PacketContainer createDataPacket() {
    PacketType type = PacketType.Play.Server.ENTITY_METADATA;
    PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(type);

    packet.getIntegers().write(0, this.entityId);

    WrappedDataWatcher.Serializer byteSerializer = WrappedDataWatcher.Registry.get(Byte.class);
    WrappedDataWatcher.Serializer chatSerializer = WrappedDataWatcher.Registry.getChatComponentSerializer(true);
    WrappedDataWatcher.Serializer boolSerializer = WrappedDataWatcher.Registry.get(Boolean.class);

    List<WrappedDataValue> dataValues = new ArrayList<>();

    Byte flags = 0x20;
    dataValues.add(new WrappedDataValue(0, byteSerializer, flags));

    Optional<?> optChat = Optional.of(WrappedChatComponent.fromChatMessage(this.text.replace("&", "§"))[0].getHandle());
    dataValues.add(new WrappedDataValue(2, chatSerializer, optChat));

    Boolean nameVisible = true;
    dataValues.add(new WrappedDataValue(3, boolSerializer, nameVisible));

    Byte armorStandTypeFlags = 0x10;
    dataValues.add(new WrappedDataValue(15, byteSerializer, armorStandTypeFlags));

    packet.getDataValueCollectionModifier().write(0, dataValues);

    return packet;
  }

PS: Equipment is updated with a different packet

#

Make sure to use ProtocolLib 5+ instead of 4

torn shuttle
#

ah yes

#

gee why does this equipment packet suddenly not work

#

oh yeah I never sent it

#

I think I'm just going to bed at this point

lethal iron
lost matrix
bleak eagle
#

first check offlineUser.hasPlayedBefore() in an if statement, and then use offlineUser.getName() separately

lethal iron
twin venture
#

Hello 7smile7 , can you help me with my problem? iam trying to use a local repo , that i updated , and its updated , but when i try to use it into my main plugin as a library , it does not use the new version

#

how i can fix it?

#

i have been trying for hours

#

i tried mvn install , mvn install -U mvn dependency:resolve -U

#

and everything i can think of

eternal oxide
#

When you built did you use mvn install ?

lost matrix
#

Did you try mvn clean

twin venture
#

yeah

lost matrix
#

Which part isnt working?

twin venture
lost matrix
twin venture
echo basalt
#

.

lost matrix
quaint mantle
#

Is he trying to use a local dependency

lost matrix
#

I am aware

twin venture
#

as you can see , it does create the new one .

#

but when i try to use it in my main plugin i put 3.5.1 but it does not work ..

quaint mantle
#

Did you reload mvn

twin venture
#

like the library does not exist in the repo link

#

i did

quaint mantle
#

show the pom

twin venture
#

mvn clean install :

quaint mantle
#

For the main

quaint mantle
twin venture
#

this is the library pom file :

lost matrix
#

You cant spawn NMS entities through the bukkit world object

quaint mantle
#

Oh it's looking in the spigot rep

young knoll
#

Technically you probably can with the virtual entity api

twin venture
#

yes why? is something wrong with the spigot repo?

quaint mantle
#

Prob not

lost matrix
young knoll
#

yes

twin venture
young knoll
#

It was merged a while ago

lost matrix
#

Noice

young knoll
#

You should be able to do

Entity entity = MakeYourNMSEntityHere.getBukkitEntity()
world.addEntity(entity);
quaint mantle
lost matrix
young knoll
#

don't believe so

lost matrix
lost matrix
twin venture
young knoll
#

yes

twin venture
young knoll
#

ServerLevel#addFreshEntity iirc

wet breach
twin venture
#

in the plugins folder and throw errors

wet breach
#

well either you shade it in, or provide it in the plugins directory

#

but for the purpose of your project to compile you can just provide it as a module

twin venture
#

not sure if its possible ,-,

#

as there are allot of moudle for the library iam using :p

wet breach
#

just use the module you need

#

you don't need all of them

#

or shouldn't anyways

twin venture
#

i do , cuz the plugin need to be working on every version :L

wet breach
#

ok, then use all of them. Just fyi you can compile more then one jar

#

nothing says when you compile a single jar must be the end result, so in other words you can compile your plugin and that plugin with all the modules

#

and if you really wanted to, shade everything all together as well

#

or leave them separate

#

this should pretty much solve all your problems

twin venture
#

my main problem really is i could not build 1.20.4 using buildtools

wet breach
#

well, that is entirely different from your project

twin venture
#

i dont think so , i have a problem with the system i guess

gritty current
#

how do i make this work?

                {
                    ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
                    SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
                    meta.setOwnerProfile(player.getPlayerProfile());
                    if (offlineUser.hasPlayedBefore());
                        meta.getDisplayName(); <-- offline players display name
                        meta.setLore(Collections.singletonList("Revive this player"));
                        playerHead.setItemMeta(meta);
                        inv.setItem(i, playerHead);
                        i++;
                }
                player.openInventory(inv);```
lethal iron
young knoll
#

Show code

serene garden
# eternal night https://github.com/softprops/action-gh-release
Run softprops/action-gh-release@v1
👩‍🏭 Creating new GitHub release for tag v1.0.0...
⚠️ GitHub release failed with status: 403
undefined
retrying... (2 retries remaining)
👩‍🏭 Creating new GitHub release for tag v1.0.0...
⚠️ GitHub release failed with status: 403
undefined
retrying... (1 retries remaining)
👩‍🏭 Creating new GitHub release for tag v1.0.0...
⚠️ GitHub release failed with status: 403
undefined
retrying... (0 retries remaining)
❌ Too many retries. Aborting...
Error: Too many retries.

Im now getting this error, any idea how can I resolve it?

eternal oxide
#

403 is you are not logged in

wet breach
#

forbidden

serene garden
#

I am logged in, not sure why it says forbidden

young knoll
#

That all looks okay, any errors?

echo basalt
#

isn't there a registerGoals method you should override?

gritty current
echo basalt
#

offlineUser.getName() ???

young knoll
#

?paste them

undone axleBOT
bleak eagle
#

String playerName = offlinePlayer.getName();

gritty current
onyx fjord
#

is it possible to teleport player without that animation thing?

eternal oxide
#

animation?

#

You mean the client interpolation?

young knoll
#

Please use the paste site and paste the entire thing

bleak eagle
#

well, does it work?

river oracle
#

you can do this with a quick hidePlayer showPlayer before and after the fact

onyx fjord
eternal oxide
# onyx fjord yup

Then no. If it's a short distance the client interpolates the movement.

river oracle
#

I mean to the client teleportation is just walking really fast I don't think there is any major distinguishable difference which is why teleports also can show as moving to fast on the server

minor junco
eternal oxide
#

If it's not cross world it's considered movement

gritty current
#

now everytime i right click it just opens the menu
Code

if (player.getItemInHand().getItemMeta().getPersistentDataContainer().equals(itemManager.Revive_Token.getItemMeta().getPersistentDataContainer())) {
                Inventory inv = Bukkit.createInventory(player, 45, ChatColor.AQUA + "Revive A Player");
                int i = 0;
                for(OfflinePlayer offlineUser : Bukkit.getBannedPlayers())
                {
                    ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
                    ItemMeta meta = playerHead.getItemMeta();
                    if (offlineUser.hasPlayedBefore()) {
                        String playerName = offlineUser.getName();
                        meta.setDisplayName(playerName);
                        meta.setLore(Collections.singletonList("Revive this player"));
                        playerHead.setItemMeta(meta);
                        inv.setItem(i, playerHead);
                        i++;
                    }

                }
                player.openInventory(inv);

            }```
quaint mantle
#

How can I register a new team at bungee api?

blazing ocean
#

and what do you mean it just opens menu

gritty current
#

it opens the inv gui

#

and it listens for if the player is using the specific item

#

but i dont think it works 😦

blazing ocean
#

so playerinteract?

blazing ocean
gritty current
#

yeah its a empty gui but i only want it to open when i right click with the specfic item

#

it doesnt do that

blazing ocean
bleak eagle
#

@river oracle need more help building craftbukkit

#

it builds fine, but errors out when started

Error: Unable to initialize main class org.bukkit.craftbukkit.Main
Caused by: java.lang.NoClassDefFoundError: joptsimple/OptionException
gritty current
#

public void onRightClick(PlayerInteractEvent event) {

bleak eagle
#

i've checked and joptsimple is a valid dep, although when i open the jar as an archive there is not a single external dep packed in there??

#

it wouldn't compile otherwise anyways. pom is cloned from upstream directly, as usual

blazing ocean
#

just add some println statements

gritty current
#

no

#

not totaly

gritty current
kind hatch
# twin venture

Is this the same issue from yesterday or is this a different one?

gritty current
twin venture
#

like a library for example i do mvn install , it do install it into local maven , but when i try to use it into my main plugin it not work

kind hatch
#

Did you refresh your other project after you installed the changes?

twin venture
#

in my main plugin :

#

in the local repo :

#

but it does not work 😢

kind hatch
#

What specifically doesn't work? Not being able to access changes that you made? Or?

twin venture
#

it tells me this :

#

but iam using 3.5.1 and it must be 3.5.1 the new version i updated , bcz it support 1.20.4

kind hatch
#

Is that framework another project that you made?

twin venture
#

not mine ,its for another dev its a library

kind hatch
#

Is it pulled from central?

#

Or is it local?

twin venture
#

i think so , cuz its not getting it from local

kind hatch
twin venture
gritty current
kind hatch
twin venture
gritty current
#

i have no idea what is wrong

kind hatch
eternal oxide
#

you compare whatever entry you put in the PDC

gritty current
#

ok can you show me an example please

twin venture
eternal oxide
#

?pdc

kind hatch
#

You can also try running maven in offline mode.

wet breach
#

it essentially solves all their problems to do it that way as they can shade it or just compile a jar of it which ever suits their needs

#

all the while compiling their project

eternal oxide
#

or change the order you list your repos

wet breach
#

either changing the repo ordering or change the dependency ordering

#

all three of these things should really do something to solve the issue 😛

pallid oxide
twin venture
#

can any of you join vc?

#

just to see if iam doing smth wrong?

pallid oxide
#

you could do your own checks, compare if itemstack is similar and has same persistent data for example

gritty current
teal venture
gritty current
#

yeah

#

but pretty new to spigot

teal venture
gritty current
#

im trying to make sure that the item the player is holding is the custom item and i also have a problem where if i place a any block it opens my gui

eternal oxide
#

did you set any data in the PDC?

gritty current
#

no

eternal oxide
#

then every PDC is going to match

#

its empty

gritty current
#

this is my custom item code

        ItemStack item2 = new ItemStack(Material.NETHER_STAR);
        ItemMeta meta2 = item2.getItemMeta();
        meta2.setDisplayName(ChatColor.GOLD + "Revive Token");
        ArrayList<String> lore = new ArrayList<String>();
        lore.add(ChatColor.DARK_PURPLE + "Revive A Player");
        meta2.setLore(lore);
        item2.setItemMeta(meta2);

        Revive_Token = item2;
eternal oxide
#

If you set no PDC data it is empty

#

you are comparing an empty PDC with an empty PDC

gritty current
#

how do i set a PDC

eternal oxide
#

?pdc

eternal oxide
#

I already linked it before

fallow gyro
#

Hi! How can I check whether an inventory object is the same as another inventory object?

Objects.equals(inv1, inv2) doesn't seem to work for this.

I understand that I'm able to get the title of the inventory, but this would create issues when two inventories share the same name. Any ideas? Thanks.

eternal oxide
#

==

hazy parrot
#

Objects.equals should work tho

timid berry
#

im trying to compile this one project but I get no pom file error, however it is there, im wondering where should I put it so maven can find it? This is my workflow file

hazy parrot
#

to your workflow command

fallow gyro
hazy parrot
#

oh u did

timid berry
#

yah

#

i was thinking maybe if i fixed the pom warning i could also fix this

hazy parrot
#

i can't seem to find it

#

try to remove -SNAPSHOT

timid berry
#

from what

#
  • name: Build with Maven
    run: mvn -B package --file pom.xml
    • name: Resolve .jar name
      id: prep
      run: |
      JAR_PATH=echo target/Mammoth*.jar
      JAR_NAME=basename ${JAR_PATH}

      echo ::set-output name=jar_path::${JAR_PATH}
      echo ::set-output name=jar_name::${JAR_NAME}

hazy parrot
#
<groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0-SNAPSHOT</version>
#

but u have snapshot repository tho, idk might worth a try

timid berry
#

<version>3.3.0</version>

#

like this?

hazy parrot
#

y

river oracle
#

Craftbukkit doesn't ship with local or broken deps so I highly reccomend making sure you have maven setup and installed on your system

wet breach
#

it makes too much sense to install maven outside the IDE

slender elbow
#

god, yes

bleak eagle
#

once again everything compiles just fine inside the buildtools clones

#

but i want my fork

#

i'm honestly just considering running buildtools once and then setting the git remote to my fork for craftbukkit and never running it again

#

why can't this process be more streamlined

#

i'll be in my room crying if you need me

#

nothing works there are errors everywhere!!! rahhh!!

rare rover
#

what's the difference on using enums and using an interface, example:

#

found this in alex's datacontainers api

#

i dont see an advantage

dry hazel
#

well how are you gonna make an enum of PersistentDataTypes

#

each constant has a different generic signature and a different backing implementation

ivory sleet
#

yeah i think the most obvious answer is enums dont support generic type parameters

rare rover
#

Fair enough

#

I forgot enums don't support generics

bleak eagle
#

@river oracle
check these logs out and tell me what i am doing wrong

bruno@arc:~/Documents/Dev/Spigot$ ls -lha
total 12K
drwxr-xr-x 3 bruno bruno 4,0K velj 19 19:08 .
drwxrwxr-x 5 bruno bruno 4,0K velj 18 23:31 ..
drwxrwxr-x 8 bruno bruno 4,0K velj 19 19:14 buildtools
bruno@arc:~/Documents/Dev/Spigot$ git clone --recursive https://hub.spigotmc.org/stash/scm/~brunoooooooo/craftbukkit.git
Cloning into 'craftbukkit'...
Username for 'https://hub.spigotmc.org': brunoooooooo
Password for 'https://brunoooooooo@hub.spigotmc.org': 
remote: Enumerating objects: 76513, done.
remote: Total 76513 (delta 0), reused 0 (delta 0), pack-reused 76513
Receiving objects: 100% (76513/76513), 11.48 MiB | 1.02 MiB/s, done.
Resolving deltas: 100% (43187/43187), done.
bruno@arc:~/Documents/Dev/Spigot$ cd craftbukkit/
bruno@arc:~/Documents/Dev/Spigot/craftbukkit$ ./applyPatches.sh ../buildtools/work/decompile-latest
Patching net/minecraft/CrashReport.java < net/minecraft/CrashReport.patch
patching file net/minecraft/CrashReport.java
Patching net/minecraft/world/effect/RegenerationMobEffect.java < net/minecraft/world/effect/RegenerationMobEffect.patch
patching file net/minecraft/world/effect/RegenerationMobEffect.java
(... blah blah ...)
bruno@arc:~/Documents/Dev/Spigot/craftbukkit$ mvn install
(... blah blah ...)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  14.592 s
[INFO] Finished at: 2024-02-19T19:16:37+01:00
[INFO] ------------------------------------------------------------------------
bruno@arc:~/Documents/Dev/Spigot/craftbukkit$ cd target/
bruno@arc:~/Documents/Dev/Spigot/craftbukkit/target$ java -jar craftbukkit-1.20.4-R0.1-SNAPSHOT.jar 
Error: Unable to initialize main class org.bukkit.craftbukkit.Main
Caused by: java.lang.NoClassDefFoundError: joptsimple/OptionException
#

buildtools are in Dev/Spigot/buildtools and they have been run prior to this

kind hatch
#

?1.8

undone axleBOT
charred blaze
#

is it possible to move player out of world to another without triggering PlayerTeleportEvent?

kind hatch
proud badge
#

Bruh why did bukkit api give enchantments such weird names now everytime I want to enchant an item I have to go on the javadocs to find its name

remote swallow
#

It matched internals at one point

uneven iris
#

no i figured it out sorry

#

just me being a dumbass

#

(also you forgot a semicolon)

bleak eagle
#

LOL sorry

bleak eagle
bleak eagle
twin venture
#

any idea?

zinc moat
#

Guys how do i set a varible to an argument of an command so i can use it in the same file but in a listener

bleak eagle
#

in a listener to what event?

river oracle
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

bleak eagle
#

neat thanks

#

no longer desparate

river oracle
zinc moat
bleak eagle
#

yup it works

bleak eagle
bleak eagle
#

make it separate and then make the command set a ?pdc

#

darn

zinc moat
#

like in the command set the arguments value to a variable

#

nooo

#

not pdc's again

bleak eagle
#

LOL if you wanna store something you gotta use them

zinc moat
#

fml

chrome beacon
#

You can always store data without pdc

river oracle
#

yeah but it looks like this should be persistent

#

based off the problem

bleak eagle
#

and then the player leaves and everything crashes and burns and resets

river oracle
#

I mean you could use a Database but that's overkill

#

you could use a flatfile but thats stupid

#

why not use PDC

chrome beacon
#

I never said you shouldn't use pdc

#

I just said you don't have to

bleak eagle
#

@zinc moat what you wanna do is, inside your onCommand, access the String[] that's passed to it, and then cast the CommandSender to a Player and set a PDC value on the player containing the desired argument from the command

chrome beacon
#

but I do recommend it

bleak eagle
#

then, in the event listener, access the PDC and based on its value set the particle you want

zinc moat
bleak eagle
#

want me to write an example?

#

i won't do an essay again don't worry

peak jetty
#

hi im having this issue when adding VaultAPI to my plugin:

[19:38:13 ERROR]: Error occurred while enabling PlutoTools v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.RegisteredServiceProvider.getProvider()" because "rsp" is null
        at net.plutocraft.plutotools.PlutoTools.setupPermissions(PlutoTools.java:218) ~[PlutoTools-1.0.jar:?]
        at net.plutocraft.plutotools.PlutoTools.onEnable(PlutoTools.java:131) ~[PlutoTools-1.0.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.1.jar:git-Paper-196]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-196]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:642) ~[paper-1.20.1.jar:git-Paper-196]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:553) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-196]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

can someone help?

zinc moat
#

sure, you want me to provide my code?

bleak eagle
#

no need i'll write my own and send it

#

give me a sec

#

ninja

zinc moat
#

Alrigth thanks

zinc moat
bleak eagle
#

i'll comment it out so you understand it, so read the comments

zinc moat
#

Will do.

peak jetty
#

its the same tho

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

bleak eagle
#

nuh uh

#

ninja x2

#

paper has over a thousand patches on top of spigot

peak jetty
#

but in my situation weather its paper or spigot it doesnt change

bleak eagle
#

how do you know?

peak jetty
#

still

#

im asking for help here theres no problem with that

bleak eagle
#

and why not in the paper server?

peak jetty
#

i asked in both

bleak eagle
#

so wait for an answer and don't expect one from here

chrome beacon
#

They got an answer in the Paper discord

regal lake
#

I need some help with the PlayerInteractEvent, it will be fired 3 times instead of 2 times.
It will be fired 2 times for the main hand and one time for the offhand (which i will check and end the function there).
But i don't understand why it will be fired 2 times for the main hand. Any ideas ?

slender elbow
#

what are you interacting with and how

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

lost matrix
regal lake
#
@EventHandler
    public void playerInteract(PlayerInteractEvent event) {
        if (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getHand() != EquipmentSlot.HAND) {
            return;
        }

        Bukkit.broadcastMessage("test");
    }

Right click on a block with main hand.

regal lake
lost matrix
regal lake
#

I already checked that and removed the if.
Then i get 3 messages, two for main hand and one for the off hand.

lost matrix
#

Show us your JavaPlugin class and the entire Listener class

#

?paste

undone axleBOT
regal lake
#

Maybe found the issue, let me debug that quickly.

fervent robin
#

Is there a way to reduce this "lag" or jerkiness of teleporting an armor stand in the player move event?

lost matrix
#

Dont teleport it. Mount the AS on the player.

fervent robin
lost matrix
#

Add an intermediate invisible mount.

fluid river
#

i'm here to break the ocp
and ask about tcp

lost matrix
regal lake
#

Found the issue, the example above was minimized, because to many classes are involved.
The event will be fired twice for the main hand if change the item in the main hand

inventory.setItemInMainHand(itemStack);
fluid river
#

problem is i'm on c# rn

regal lake
#
ItemStack finalItemStack = itemStack;
        Bukkit.getScheduler().runTaskLater(plugin, () -> {
            inventory.setItemInMainHand(finalItemStack);
        }, 1L);

Would fix the issue, but is that the right way ? (looks more like a workaround.

fluid river
#

as i can see, tcp clients do establish a connection first

lost matrix
fervent robin
fluid river
#

for real

lost matrix
lost matrix
fluid river
#

anyways

#

it's kinda harder than just sockets

#

one sec

#
By default currentPlayers = 1 (it's the host himself)

Player 2 opens a Lobby List window and requests all lan servers to send their parameters. When he gets the data, i spawn several objects which represent found lan servers

Player 2 tries to connect to the server -- game opens NonHostLobbyWindow for him

Server adds player to playerlist, spawns a gameobject in host's lobby window and sends notification packet to all currently connected players, so they also update their lobby windows```
lost matrix
#

Are you using some sort of game engine or is this just C#

fluid river
#

as i learned, i need a UDP client in the beginning

fluid river
#

but doing it using default c#

#

System.UdpClient

#

System.TcpClient

#

System.IPAddress

#

and so on

#

send and receive are also plain c#

#

but i run unity code when receiving a packet

lost matrix
#

Alright. jfyi Unity has a Netcode for Gameobjects api which lets you use one whole abstraction layer above TCP

fluid river
#

and that's a giant problem for me

#

Netcode For GameObjects doesn't provide NetworkDiscovery

#

unity provided it before Netcode For GameObjects

#

and gonna add it in future

#

but right now it doesn't exist

#

So i do it myself using default UDP and TCP clients

#

at least for lobby section

#

i'm gonna inject Netcode to the process later on when All players would actually spawn in server realm

#

rn i'm doing it this way:
server has endless while(true) where it receives all UDP packets

#

that's how it reacts to somebody refreshing the lobby list

#

the player sends a UDP ask packet each refresh

#

server responds with ping and name and other stuff

jagged bobcat
#

so many messages

fluid river
#

ok ok i'll collect next ones

#

So, player gets responses over UDP and builds up a list of all available servers.

Then when he decides to join any server, i WANT TO establish a TCP connection between server and player and temporarely disable his UDP client unless he leaves the server to search and join another one.

Then when i have some kind of Connection object, client can speak with host directly, and also it's easy to check if player's game crashed so connection is lost.

wet breach
fluid river
#

UdpClient.Dispose()

#

default c# function

#

then i can just do client = new UdpClient(stuff) again, so player starts listening to UDP responses again(if he pressed a refresh server list button of course, so player would ask for responses at least)

tame wolf
#

So, I saw some debate a while ago about which method is better to set a block, setType or setMaterial, and I'm just wondering, how do you go about determining which methods are better than others?

#

(I'm talking in general not just the example I gave)

fluid river
#

timings

#

on large operations

#

there is a giant post on spigotmc about how developer made async X million block replacement very fast without any lags

#

He avoided both setType and setMaterial afair

chrome beacon
#

yeah by using nms

fluid river
#

yeah

chrome beacon
#

and doing a lot of potentially unsafe operations

fluid river
#

he messed up with lighting and some other stuff to speed the replace up

chrome beacon
#

yeah minecraft lighting is very slow

fluid river
fluid river
#

where you just ask the lan if there are some servers currently online

fervent robin
#

?paste

undone axleBOT
fervent robin
river oracle
#

That sucks just have to update then

wet breach
river oracle
undone axleBOT
wet breach
#

just have a check to see if they are in a server

#

if so, discard any packets received

fervent robin