#help-development

1 messages · Page 1973 of 1

golden turret
#

tried this but did not worked

sterile token
golden turret
#

using sockets

sterile token
#

Dont complicate your life

golden turret
#

if i wanted a lib

#

i would use

paper zealot
#

i asked

sterile token
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

sterile token
paper zealot
#

ok

fierce salmon
#

yeah guys verano is working hard to make us all happy /s

low temple
#

Yeah not sure, havent seen an error like that before

next stratus
paper zealot
paper zealot
#

okeh

quaint mantle
#

some guy answered with: "Your config has a custom object without the type being specified" but what the actual fuck is that supoosed to mean????

next stratus
quaint mantle
#

bruh

#

wroong reply

#

jesus i hate discord

paper zealot
#

y prank

#

@next stratus

next stratus
#

You've not set your java home correctly

paper zealot
#

no

#

how

#

y?

sterile token
#

Why is he having that issue? I never had to setup Java_Home for using an IDE on Linux

quaint mantle
#

Your config has a custom object without the type being specified - what does this mean

#

please

sterile token
#

I hate windows

next stratus
#

No, the issue is a windows thing

sterile token
#

He is having issue on windos right?¡

next stratus
#

Yes..

sterile token
#

Ah that why lmao

next stratus
#

The java home thing is a issue on Windows....

sterile token
#

I see the console and thought he was on Linux

fierce salmon
#

What does the String part mean?

next stratus
#

Nah, it'll be terminal if it was Linux

quaint mantle
#

soldier

ivory sleet
#

Java isn’t useless still

sterile token
#

Best language for learning would be Python

ivory sleet
#

Nah

#

I mean sure kotlin looks great

#

But it has a lot of pitfalls also

#

Why?

quaint mantle
#

yeah when i am done this plugin i am never looking at java again, so many terms you need to know, the dumbass CoNvEntIons, people explain error solutions with a bunch of gibberish terms. there is nothing motivating me to learn this "language".

ivory sleet
#

The only real problem with Java is nullability and type erasure

paper zealot
brave sparrow
#

Java is not dying lmfao

sterile token
#

One of best minecraft developer for servers told me that. His custom license panel for java app is design there and have never been cracked their license. And the jars never got deobfuscated. Cuz he use a +$512 dollars obfuscator. hahaha

paper zealot
#

same

fierce salmon
#

it says that I am supposed to input a char sequence

next stratus
#

What have you done to try fix it

brave sparrow
paper zealot
fervent robin
brave sparrow
#

only a poor craftsman blames his tools

sterile token
paper zealot
#

to user variables

next stratus
#

And you refreshed it?

ivory sleet
paper zealot
fierce salmon
quaint mantle
next stratus
#

Try rebooting your pc if needed

sterile token
brave sparrow
#

Java is fast, it's powerful, and it has very wide adoption, it isn't going anywhere

fierce salmon
paper zealot
ivory sleet
#

I mean almost every language has conventions Magnumsrt

#

And in fact a lot of modern languages incorporate terms Java hasn’t even touched

brave sparrow
next stratus
sterile token
#

Python or javascript?

paper zealot
next stratus
#

Rebooting your pc will load in the new system variables.

ivory sleet
#

Learn Scala then

sterile token
#

oh never heard it

brave sparrow
#

Java is still widely used in backend web development, the two aren't mutually exclusive

quaint mantle
sterile token
#

I only know that website backends, where Php, Python and JavaScript

quaint mantle
#

like it has no functional value

brave sparrow
#

Java web servers are incredibly performant

quaint mantle
sterile token
brave sparrow
ivory sleet
ivory sleet
#

Even in maths, or in any normal language such as English

brave sparrow
sterile token
brave sparrow
#

you'd be surprised

ivory sleet
#

Java is also really fast

brave sparrow
#

Java is crazy fast these days

next stratus
# paper zealot now it say

I think there's another folder within it you need to point to is it lib? I can't remember try googling it

sterile token
ivory sleet
#

Yeah, and the difference is negligible

brave sparrow
valid solstice
#

What is the best way to make a player undergo the spinning riptide trident animaton?

ivory sleet
#

Over and above all, if you really need a low level language you probably wouldn’t go with golang, moreover rust would be what you’re looking for

brave sparrow
#

then why even bring up speed?

ivory sleet
#

Go eliminates too much verbosity imho

#

Like most other “modern” programming languages

brave sparrow
#

if you just like Go better that's fine, but that doesn't mean the industry as a whole is going to agree

sterile token
#

What would be better Vue.js? Next.js? Python? for backend dev (website)

brave sparrow
#

.

ivory sleet
#

Vue is frontend

sterile token
ivory sleet
#

But vue is nice

#

I suggest trying different backend and frontend frameworks to find out which one you favor the most

sterile token
#

I need to chose a powefull and good language for doing website

#

Im between Python and Javascript

brave sparrow
#

the real answer is that the framework and language you're going to use is whatever the person paying you says you're going to use

#

lmao

ivory sleet
#

Yeah Alex, but that’s what’s nice about personal projects, you can choose and reconfigure at any moment

fervent robin
ivory sleet
#

Learn Python

brave sparrow
ivory sleet
#

It’s incredibly powerful in spite of it being somewhat slow

fervent robin
#

true

brave sparrow
fervent robin
#

but js is nice for websites and api's

sterile token
#

Many people told me that forget getting a good job with php, so i thinked about Js and Python

#

That why im asking

ivory sleet
#

You probably wanna learn TypeScript over JavaScript, and then Python as its quite popular

brave sparrow
#

Personal project time has to come after my actual work obligations, so I don't have any time to expend on that at the moment

fervent robin
#

easiest way to learn js is just memorize every line of the docs for it 🤷‍♂️

brave sparrow
#

if I have a content update needing work I can't just tell my boss "hey im taking a week to dabble" lol

quaint mantle
# brave sparrow and i'm telling you that that's a dumb opinion, which is what i said i was doing...

i listed points why i think it is bad, i guess java's weakest point is the terms that beginners are just "supposed to understand" and i don't have "an inability to understand it" in fact i know the language decently, but it's just so unenjoyable to sit in front of a screen and get error after error. i am really considering stopping my plugin since mojang decided to go with java when something like c++ exist, ig thats what bedrocks for

brave sparrow
#

Spigot is an advanced API, it's not intended for beginners

quaint mantle
#

anyway i am not gonna argue i am just fucking annoyed that my plugin that i have spent a month on won't even save items

ivory sleet
#

Tbf, to learn anything you have to oversimplify before diving into the rabbit hole

brave sparrow
#

the only time I handhold somebody through programming is when a university is paying me to do so

ivory sleet
#

So the “supposed to understand” can to some degree make sense

brave sparrow
#

and if you think Java errors are bad, please try c++

#

you just get a number

#

lmao

ivory sleet
#

Hehe

dusk flicker
#

java errors arent bad at all

#

they can be overwelming

brave sparrow
#

Java errors are incredibly informative

#

I love it

dusk flicker
#

but they are really nice compared to others

brave sparrow
#

I can look at an error and figure out exactly what is wrong, and where it's wrong

ivory sleet
#

That’s besides the point I’d say

brave sparrow
#

whereas with C++ it's a case of "oh look, something's fucked"

coarse crow
#

^

brave sparrow
#

"Now to look at all my code line by line for an hour and figure out what the issue is"

patent horizon
#
        for (UUID uuid : gInter.members) {
            if (Bukkit.getOfflinePlayer(uuid) instanceof Player player) player.sendMessage(u.f(message));
        }``` would removing the .getPlayer() not work conclure?
sterile token
ivory sleet
#

Wally I am unsure

brave sparrow
#

i don't hate c++

ivory sleet
#

I don’t remember the implementation

brave sparrow
#

i can be productive with it, but Java will always be my favorite

quaint mantle
# brave sparrow Spigot is an advanced API, it's not intended for beginners

dude, i'm not saying it is, i'm saying that if someone asks what passing an instance is, you don't say "well that is a basic of java" or "well you take a TYPE and make a method and then return the type" like a beginner is not gonna know what that a return or method is and i'm not saying spigot should make it beginner friendly, just the way people answer my and other beginners questions makes me wanna explode.

ivory sleet
#

But using OfflinePlayer::getPlayer returns a player object if the player is online (specified by the docs also)

brave sparrow
patent horizon
#

ah yeah looks like it worked

brave sparrow
#

that's like asking someone how to write a concurrent webserver in c++ and not understanding the basics of the language

ivory sleet
brave sparrow
#

you don't understand the language at a level high enough for me to even explain to you what you want to do without writing out every step

#

and i'm just not going to do that

#

programming requires some self-starting

#

you should understand the basics of the language before you try and play with all the advanced toys

#

you wouldn't walk into a Calc II class and ask the teacher to write out all the steps for basic algebra, the same applies here

quaint mantle
#

well i have spent a month of my life on a fucking menu plugin that won't even work, i guess i was a bit stupid but fuck this is annoying like i am red in the face right now

#

sorry for the dumb statements tho

brave sparrow
#

i guarantee if you just took even a few hours and watched a beginner java tutorial you'd be at a level where someone in here could actually help you

dusk flicker
#

depends what tutorial

#

but yes

brave sparrow
#

😂

#

I'll tell you what my professor always tells students struggling in his class: "If programming was easy, everybody would do it, and then you wouldn't be making so much money"

#

he has far more patience than i do

#

lol

#

oh absolutely it is

#

i just don't think all the people he says that to will make money

#

some people will never be good at it lol

#

yep

ivory sleet
#

Magnumsrt I very well know what you mean by your arguments, it usually becomes this awkward case where some beginner is asking a lot of questions that really wouldn’t be asked if the user would have done their homework. It appears as quite toxic when you get thrown “oh learn this before doing that” but in reality people tell you that because it’s the best way for you to actually teach yourself and learn what you need to learn. I guess some people are being mean about it, but generally we tell beginners this because knowing the basics first is truly crucial. It helps you not to shoot yourself in the foot all the time and it saves others time.

sterile token
#

Who mentioned was using a custom Http request system?

brave sparrow
#

when I was 13 Algebra 2 was "advanced math", now I'm sitting in groups and rings proving that 3^-1 = 7 in U(20)

sterile token
#

Wasnt something like Ara4n?

#

the simbol before 3

#

that small coma

#

That one

brave sparrow
#

watch this madness:

#

U(20) is the group of integers under multiplication mod 20

#

the identity for that group is 1

ivory sleet
#

Oh you’re doing group theory?

brave sparrow
#

3 * 7 = 21

#

21 mod 20 = 1

#

so 3 * 7 produce the identity for the group

#

therefore 7 is the inverse of 3 in that group

#

isn't that horrifying?

ivory sleet
#

Sounds illogical if you don’t know what a group is and all that

#

😅

brave sparrow
quaint mantle
river oracle
#

java.lang.IllegalArgumentException: Args doesn't contain type key ('==')

quaint mantle
ivory sleet
#

I am still extremely confused

brave sparrow
#

@quaint mantle

ivory sleet
#

Like why are you combining the spigot serialization api with Gson serialization

brave sparrow
#

I knew that was too specific of an error to be anything but spigot/bukkit

#

lol

ivory sleet
#

🥲

quaint mantle
#

sorry i am dumb

brave sparrow
#

you put that into the hashmap

#

with "==" being the key

#

and the type of the thing being deserialized as the value

#

the reason this part seems unintuitive is that this is an internal part of craftbukkit and wasn't intended for people to be using manually if i'm reading this correctly

golden turret
#

how can i fix this

brave sparrow
#

show us the error

fickle ivy
#

.

#

.

golden turret
brave sparrow
#

the actual error

golden turret
#

i fixed it btw

#

i just needed more \r\n

brave sparrow
#

ok

wet breach
#

wasn't originally intended for people to use, but people always insist on using things they are not supposed to 😛

paper zealot
#

?learnjava

undone axleBOT
sterile token
#

Lovely shit, intellij its getting more bugs than mi life

#

I first get bug my projects, now i have bug the dependencies

#

I restarted linux, invalidate cache, nothing works

#

Only problems cause :/

#

I wanna rage LMAOO

paper zealot
#

ok

#

ok

sterile token
#

This are the moments when i wanna break my keyword

paper zealot
#

ok

valid solstice
#

Hi, anybody know what should be the value for Damegable#setDamage() for a leather leggings to get the same durability as Netherite leggings?

#

i tried 555 (as indicated in the wiki as the durability of netherite leggings) but it gets broken in 1 shot

sterile token
loud haven
#

setDamage just set how much damage the item has taken; it doesn't change the item's max durability.

valid solstice
#

is there a way to change the max durability?

valid solstice
sterile token
#

Via reflections?

hexed hatch
#

That said: if you set the damage to a negative value, it will increment as normal

#

Not even with reflections

sterile token
#

Oh

#

And what about my problem with bugged intellij?

#

Im nearly to rage again 😡

hexed hatch
#

So it’s kind of a yucky solution

patent horizon
#

what do i have to change in my gradle spigot links to go from the api to the full server

valid solstice
hexed hatch
#

When it comes to custom durability, I like to throw a PDC on the item, listen to damage events and such, and display the fraction basically

sterile token
hexed hatch
patent horizon
#

what

#

no like

valid solstice
patent horizon
#

in maven, you just change spigot-api to spigot to use nms and whatnot, what is the equivalent for gradle?

hexed hatch
#

Cast the meta to damageable, and you’ll be using setDamage

valid solstice
#

so for leather leggings, to make it have the durability of netherite, im going to do setDamage(-555)?

hexed hatch
#

That should work

sterile token
valid solstice
#

thanks

hexed hatch
#

That said: I only know negative damage values work because I’ve messed with it with vanilla commands

sterile token
hexed hatch
#

Not sure if Spigot is going to throw you an exception for trying to make it negative

valid solstice
#

i hope it does work

hexed hatch
sterile token
#

I prob will have to ask another

#

Thanks!

hexed hatch
#

I just throw google at my intellij issues until intellij does the thing

hybrid spoke
#

what do you need verano

sterile token
#

Im having this issue on top

sterile token
#

Idk what happening, i invalidate chace, reload files from disk, restarted linux

#

Nothing works

patent horizon
hybrid spoke
sterile token
hybrid spoke
#

otherwise try to force it

sterile token
#

Oh i will try that

#

Thanks

#

You always keep me alive

hybrid spoke
#

thats what god is for

hexed hatch
sterile token
hybrid spoke
#

depends on what you need

sterile token
#

No just to know, if you know how maven works

#

The repo let say

#

I have been told its a simple web-server which has a straight parameter url and that all. Do you agree?

hybrid spoke
#

more or less. just stuff i personally needed

sterile token
#

Because my plains for first week of vacations its to make my own maven repo system

hybrid spoke
#

i would not say that maven is a "simple web-server"

sterile token
#

Oh

#

I have seen that many of them are just a simple webserver that serve the files

#

And people told me that

#

It didnt work the maven thing

#

I dk what happening

hybrid spoke
#

so delete the lombok-dependency folder out of your maven folder

#

then invalidate caches

#

and try to force install it

sterile token
#

Oh ok

#

Thanks

#

I will try

#

Can be caused by the project itself?

#

Cuz i have another module using lombok and works without problems

#

BTww

hybrid spoke
#

hm, did you reload your maven?

sterile token
#

Yes

#

Its a multi module project, im every module lombok works, but on the new module doesnt work

#

Idk what happening

mighty bane
#

Okay so does anyone know how to get written book pages to work? Cause we're trying to program a custom craftable book however whenever we open the book. It always says * Invalid Book Tag *
Does anyone know how to fix this?

dusk flicker
mighty bane
dusk flicker
#

send code

hexed hatch
#

send code

mighty bane
#

Ah okay.

hexed hatch
#

have you tried restarting intellij?

sterile token
dusk flicker
#

what is exactly not working?

hexed hatch
#

that has fixed about 63% of my intellij issues

sterile token
dusk flicker
#

How is it not working

mighty bane
#

Okay, here it is.

sterile token
sterile token
dusk flicker
#

not sure why you are doing that in ur onenable

hexed hatch
#

ok so

#

you need to set up the pages before you build the recipe

#

so just throw that whole "set up the book" part above creating the recipe

mighty bane
#

Okay

hexed hatch
#

or really you need to put that inside there before you apply the meta

#

what needs to happen is this in this order:

  • create book
  • get book meta
  • apply pages to book meta
  • apply meta to itemstack
  • create recipe
mighty bane
#

We'll try that.

#

Hopefully it works.

#

Time to wait five years for the launcher to finish updating

sterile token
#

I cannot find the solution

#

I tried everything

#

Lmao it 1000k time i count to 10 until i broke my keyboard

#

I hate this shit problems

#

This problems make me loose money 😡😡

dusk flicker
#

then dont use lombok

#

like, its not the biggest thing

sterile token
#

It doesnt work with any depenency

#

I make another project and no depencies working

dusk flicker
#

something is fucked on your side then

sterile token
#

Maven prob?

dusk flicker
#

prob, considering it is related to dependencies

sterile token
#

It worked

#

5th i have rebooted

#

And work, as agent one said reloading/rebooting always works

delicate lynx
#

intellji decides on boot if it wants to work today

#

it has a random chance to not work and randomly break some function of the program

sterile token
#

Yeah

#

Idk what happening

warm trout
#

Is there a way to get the Visible name of an ItemStack? And I don't really mean the display name because if the name is not modified the display name returns null. For example, birch leaves would say Birch Leaves and a stone block would say Stone Block would say Stone Block. How would I get that name?

sterile token
#

Any good class for simple reflections?

mighty bane
#

So... what else could be causing the error?

sterile token
#

With pantient you fix everything

#

I said it because i was annoying with an inssue and i stay quiet and calm down and fiex the issue

fossil lily
#

Alright, im brand new at this so dont get mad at me. (Please)

How can I make it so the player is set to the player running the command? Ive looked all over google and I cant figure it out :(.

sterile token
fossil lily
#

👍

#

Thanks

sterile token
#

Also, if you are new you can read the javadocs

#

?jd

fossil lily
#

:D

sterile token
#

And yeah i would recommend before starting with spigot api, learning the basics about Java

fossil lily
#

I went through a crash course, I might need a little bit more. The whole object oriented thing is confusing me D:

sterile token
#

prob you are comming from not a non object oriented language

fossil lily
#

yea

sterile token
#

Which one?

fossil lily
#

Python

sterile token
#

If i can know

#

Oh yeah

#

I know it (the basics)

fossil lily
#

the beginner language

wet breach
#

my one free spoon feed for the month

sterile token
brave sparrow
#

I swear Java supports naming the variable in the instanceof now

fossil lily
#

amazing

brave sparrow
#

if (sender instanceof Player player)

wet breach
sterile token
wet breach
#

since you know its been relatively the same for quite some time lol

brave sparrow
#

Actually I know I’ve done that so yeah new Java does allow it

sterile token
wet breach
#

you mean tutorials?

warm trout
#

Think he means a util

wet breach
#

best way to learn reflection is just to actually do it on a random plugin

sterile token
#

Im creating my simple class for reflections

#

So i want to see some examples

wet breach
#

Oh I don't know of any utils off hand to help with it

#

I don't usually require its use

mighty bane
#

Okay, so we tried implementing the suggested fix, but the book still keeps saying * Invalid book tag *.
At this point, we have absolutely no clue what to do.

dawn hazel
#

anyone know how to "disable" a bungeecord plugin? getpluginmanager() on bungee doesnt have a disableplugin method

sterile token
#

But you can do it via reflections

dawn hazel
#

clarification?

sterile token
dawn hazel
#

yeah

#

kinda

sterile token
#

I recommend using a plugin from Spigotmc

#

So you can see the code

dry forum
#

would it be possible to "force" a player to take a screenshot or somehow take a screenshot at a location in a world then use the image so its uploaded/sent to the server?

sterile token
#

And try to understand

sterile token
dry forum
#

wdym custom client

wet breach
#

you can't force the client to do quite a bit of things

sterile token
dry forum
#

ah

sterile token
#

Big problem

#

Hahaha

#

What where you wondering to do?

dry forum
#

take a screenshot at a certain place in the world then upload it to the server so i can then send it to a discord

wet breach
#

what you could do

#

is get the view the player is looking at

#

and then take the screen shot server side

brave sparrow
#

That’s a lot more complicated

dry forum
#

i have an alt account if that helps

brave sparrow
#

The server doesn’t have the rendering or assets that the client has

sterile token
brave sparrow
#

You’d have to recreate all of that

sterile token
#

Wait a questions

#

Do you know how works hipixel recorder?

dry forum
#

ive seen a server do it with an invisible mc account facing the area with the photo

wet breach
sterile token
#

I have seen they transform the vip games into a video

brave sparrow
dry forum
#

ah

sterile token
brave sparrow
#

There is no way to force a client to take a screenshot from the server

dry forum
#

can the server not take a screenshot at a location? doesnt need to be specificly a client can be anything

brave sparrow
#

The server doesn’t render the world graphically

paper zealot
#

i cant open spigot.jar

mighty bane
wet breach
#

well technically it can, just need some client code and assets to make it possible

brave sparrow
#

Right

mighty bane
#

They probably have a custom client that records all of the chunks.

sterile token
#

So i dont agree with you

wet breach
brave sparrow
#

@sterile token is it saved to a video or playable in-game

wet breach
#

you can have a plugin be a mini client

#

not saying it is something easy to do

sterile token
#

idk how

wet breach
#

there are different ways to do it

fickle ivy
#

how do I make it so chunks don't go to sleep if there is a hopper moving items? I keep having to go back and forth to get all my stuff to move to the end of the hopper line

brave sparrow
#

Yeah so presumably they save all the actions and then just render it

#

Like it is possible

#

It’s just a lot of work

wet breach
#

yep lots of work and lots of debugging

#

possibly some head banging too

fickle ivy
#

granted its a LONG hopper line. lol

wet breach
#

because you can't figure out how to go from an action to an mp4 container etc lmao

wet breach
#

and if it contains one of your hoppers, cancel the unloading

sterile token
fickle ivy
#

No plugin. Just on my server.

sterile token
fickle ivy
#

thought they werent supposed to go to sleep if there was hoppers moving stuff through

sterile token
brave sparrow
fickle ivy
#

oops. sorry. thought thats where i was

brave sparrow
wet breach
brave sparrow
#

^

wet breach
#

which reminds me, I think I might update that wireless redstone plugin

#

now that its officially defunct

mighty bane
wet breach
mighty bane
#

Yes.

#

It's meant to be a craftable item.

wet breach
#

You need to first make the book, and then seal it after you put what you want into to give it the author tag

mighty bane
#

What?

#

Isn't that what we did?

sterile token
wet breach
#

lol

#

sometimes like right now I can't think of the proper word

sterile token
#

I have counted that message like 3-4 times

mighty bane
#

We made the book, added the pages, set author, then added crafting recipe. Exact order you stated.

wet breach
#

between the book types

mighty bane
#

We followed the exact order listed on reddit, youtube, and the forums. Even copied the code, and it still hates us.

wet breach
mighty bane
#

A written book containing certain information.

wet breach
#

ok, but written books can't be edited though, it has to be a book to edit it

kind hatch
#

Are you using Material.WRITTEN_BOOK?

mighty bane
kind hatch
#

You need to use Material.WRITEABLE_BOOK instead.

wet breach
#

yes just like in the game, it is the same in code

wet breach
#

anyways, you need to use writeable book first

#

add your pages

#

then you can turn it into Written_Book which lets you add the author tag

mighty bane
#

If this works... we're going to throw something.

brave sparrow
#

That seems incredibly strange if true

#

Sounds like someone screwed up when making the API

wet breach
#

Well, Mojang are notorious for strange things

mighty bane
brave sparrow
#

let me see how we do it and get back to you

mighty bane
#

It creates a writable book with meep...

#

Now how to convert it to written book?

hexed hatch
brave sparrow
#

yeah we definitely do not do it that way lol

mighty bane
wet breach
#

well that is how I remember it needing being done, I could be outdated then and need to update my knowledge lmao

kind hatch
#

Two ways you can make a book.

ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) book.getItemMeta();

BaseComponmenent[] page1 = new ComponentBuilder().append("Your Text Here").create();

bookMeta.spigot().addPage(page1);
bookMeta.setAuthor("The Author");
bookMeta.setTitle("Book Title");
book.setItemMeta(bookMeta);
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) book.getItemMeta();

bookMeta.addPage("Your Text", "Goes", "Here");

bookMeta.setAuthor("The Author");
bookMeta.setTitle("Book Title");
book.setItemMeta(bookMeta);
brave sparrow
mighty bane
#

1.18.1

brave sparrow
#

try the first method with the base components

mighty bane
kind hatch
#

You imported net.md_5.bungee.api.chat.BaseComponent correct?

brave sparrow
mighty bane
#

Thanks

brave sparrow
#

i'm looking at the client code to see if I can spot something obvious

mighty bane
brave sparrow
#

show us the error

mighty bane
#

Oh... you mistyped basecomponent.

#

F

#

It's fixed.

kind hatch
kind hatch
#

😛

brave sparrow
#

does it work now @mighty bane

mighty bane
kind hatch
# mighty bane uh... what

Some people depend on the wrong jar file or use the wrong imports sometimes. Wanted to see if you did that by mistake.

mighty bane
mighty bane
brave sparrow
#

figured

#

lol

mighty bane
#

Why did our original code not work though?

brave sparrow
#

somebody probably broke something converting between String pages and BaseComponent pages

mighty bane
#

Okay

#

^W^ Thank you

#

The past two days have been a veritable headache.

kind hatch
#

I haven't ever used the method with strings, so I can't say for certain, but I would lean towards an issue with the API. I've always used BaseComponents when it comes to books as it's what the wiki recommended.

mighty bane
#

Now time to figure out how to run code in books when certain lines are clicked.

brave sparrow
#

base components

#

fortunately for you

#

lol

mighty bane
# brave sparrow base components

Something we're still learning how to do. But hey, it's why we started this project in the first place. To learn through practice.

kind hatch
mighty bane
#

Thanks

brave sparrow
#

yeah that's right, spigot doesn't call them all base components

#

that's just the easily memorable name lol

mighty bane
#

Okay

#

Although our brain hurts enough as is. Probably going to take a break for the day. Who knows? Maybe our wifi will finally stop messing with us tomorrow and we can actually watch youtube tutorials.

silk mirage
#

imagine watching tutorials

#

use pdfs

mighty bane
muted brook
#

Air bubbles as thirst bar

silk mirage
#

I agree, but I don't like to follow a whole tutorial. It just makes it more complicated.

mighty bane
sterile token
#

If anyone had a simple utility class for doing reflections le me know

#

Thanks

waxen plinth
#

What are you planning on using it for

sterile token
#

But i think i dont need it

#

its really clean

#

Adding a class for reflections would be to overload it

young knoll
#

I mean you’ll have to handle exceptions when you call those methods

young knoll
#

Also you should create a class extending PluginCommand rather than reflecting it

sterile token
#

Why extra clases?

young knoll
#

Better than janky reflection

sterile token
#

Oh ok

waxen plinth
young knoll
#

Because the constructor of PluginCommand is protected

#

But you can make the constructor in your subclass public

waxen plinth
#

Right but how do you register it

young knoll
#

You still need to reflect the command map

waxen plinth
#

Okay

young knoll
#

It’s less reflection

#

But still reflection

sterile token
#

Lmao

#

Im fascinated with builders HAHAH

#
Command test = Command.builder().name("Test").aliases(Arrays.asList("test", "testCMD")).permission("command.test").description("Test command").executor(new TestCommand()).build();
#

🤔

waxen plinth
#

Why would you even do Arrays.asList

#

Why not just take a String... for aliases

#

Then you could do .aliases("test", "testCMD")

#

Honestly though I find builder-style command libraries to be the least enjoyable to work with

young knoll
#

Var args are fun

waxen plinth
#

They are

young knoll
#

It’s funny looking at some older java libraries that were made before them though

#

Just a million overloaded methods each with one more parameter

waxen plinth
#

String str1
String str1, String str2
String str1, String str2, String str3

#

Ad nauseum

#

Sadly that's still what Map.of looks like because no tuples

young knoll
#

When do we get multiple varargs

#

String... Integer...

waxen plinth
#

Never, that would be bad

#

Tuples though

#

(K, V)... 🤤

young knoll
#

Just uhh

#

Pass an Object... and then combine them in the method

waxen plinth
#

cringe

sterile token
#

I dont like varargs

#

Because i need to lost strings (have extra strings of code)

#

Doing the anottation

waxen plinth
#

what

young knoll
waxen plinth
#

Tuples are amazing and java should add them

young knoll
#

Tuples are like

#

A pair but without the need for a class

#

Right

hardy swan
#

tuples are just a set of attributes, but some languages treat it as a pair i think

waxen plinth
#

it has huge benefits

#

Java calls records "nominal tuples" but proper tuples would be much better

#

Object instantiation has a non-negligible overhead, whereas tuples can essentially be primitive

young knoll
#

So it’s an arbitrary length group of objects

sterile token
waxen plinth
#

Mhm

hardy swan
#

basically java expect you to create a class if you really need to enforce some kind of typing

#

don't see how they can be primitives

waxen plinth
#

Well we are getting value types soon™️

#

If you can make value records that would be incredible, they would basically be proper, effectively native tuples

tranquil viper
#

is there an event that listens for trident throw?

waxen plinth
#

ProjectileLaunchEvent most likely

quaint mantle
#

^^

sweet pike
#

i have made a plugin that basically allows you to spawn a mob that has an inventory with mob drops and whatnot, so instead of killing them, they'll drop loot depending on how happy they are (they have their own mood scale) and a few extra things.

when my plugin disables all the CadiaMobs which is the name of the object which contains the bukkit entity's UUID, get's written to a database, with one of the main columns being the entity's UUID.

when loading the plugin back up however, when iterating thru the MySQL uuid columns, the return of Bukkit.getEntity(uuid) is null no matter how much i delay that piece of code.

how can get the Entity object thru Bukkit.getEntity without it being null? i've tried loading the chunks before calling the getEntity method but it still returns null...

amber vale
#

How can I implement custom block breaking speed, e.g:

Changing the speed at which a block break?

quiet ice
#

I fear that that may be clientside

visual tide
#

uh

#

weellll

#

give em mining fatigue

#

and handle everything serveside

#

:))

#

a fricking nightmare to do

#

but powerful

#

is a neat guide

#

but you will need like a lil bit of experience in nms

lost matrix
# sweet pike i have made a plugin that basically allows you to spawn a mob that has an invent...

This happens because the entitiy with that ID might be in an unloaded chunk.
You cant just expect that all the thousands of entities stored in the chunks are accessible at all times.
They get loaded when their chunk gets loaded.
So you need to listen for the ChunkLoadEvent, then get all entities from the loaded chunks and see
if one of them is a special one of your mobs. You need to also listen for the WorldLoadEvent and
when your plugin is enabled then you need to iterate over all the spawn chunks because no events are fired for them.

I think using a database was the worst possible approach here. PDC and chunk events are way more reliable.
A DB would only make sense if you wanted to access the entities from a website or some external service or
if the mobs would be shared between servers. But they are strongly bound to their chunk which makes using a PDC
the far superior solution.

lost matrix
visual tide
lost matrix
#

*Also spigot now has api methods for that

visual tide
#

ye well depends on version

#

did it for 1.8 once at its a freakin nightmare

lost matrix
lost matrix
visual tide
#

well

visual tide
#

if the server tells you someone else is breaking the block youre breaking but you cant actually make a dent yourself because slow digging

lost matrix
visual tide
#

yes

#

i mean it works 🤷‍♀️

lost matrix
#

Problem is that it messes with guardians for example

visual tide
#

true but if you wanted it to work in a closed environment like "custom ore miningrealm" or smth it is still useful

lost matrix
#

Actually ill look into that. Maybe there is something in the protocol that could be exploited.

sweet pike
#

using a database means that I can consistently loop thru the UUID's, find the bukkit entity matching it, and then do my special mob stuff, but with a PDC, some sort of direct access would need to be establish (probably via event) correct?

sharp flare
#

Entity UUID changes every server restart

#

or the ID ig

sweet pike
sharp flare
#

try #getEntityID

#

I onced made a staff that can move entities and store its id in the lore, once a server restart is initiated that ID is not the same as before so thats just what I experienced

#

in case of UUID, its diff ig

lost matrix
#

Using a runnable for only the live mobs and computing the drops based on delta time when they are loaded is far more efficient.

#

Even a runnable for live mobs might be overkill depending on what you do. Just compute the drops when they are accessed.

sweet pike
sacred prairie
#

how can i let the npc look at the player if the player is in a 8 block range. I use this code to look at the player:

    public void move(PlayerMoveEvent e) {

        
        Player player = e.getPlayer();
        NPC.getNPCs().stream()
        .forEach(npc ->{
            
            Location npcloc = npc.getBukkitEntity().getLocation();
            
            npcloc = npcloc.setDirection(player.getLocation().subtract(npcloc).toVector());
            PlayerConnection connection = ((CraftPlayer) player).getHandle().b;
            float yaw = npcloc.getYaw();
            float pitch = npcloc.getPitch();
            connection.sendPacket(new PacketPlayOutEntity.PacketPlayOutEntityLook(npc.getId(), (byte) ((yaw%360.)*256/360), (byte) ((pitch%360.)*256/360), false));
            connection.sendPacket(new PacketPlayOutEntityHeadRotation(npc, (byte) ((yaw%360.)*256/360)));
            
        });
        

    }```
grim ice
#

Don't make a packet each forEach

#

Make one packet, send it in forEach

lost matrix
lost matrix
sacred prairie
lost matrix
#

You should use a runnable that determines the distance of the player to each npc which is in his world.
Make it evenly distributed. So not all players at once every 20 ticks. But some players every tick so that the time delta between two ticks
of the same player is 20 ticks. Then put those players which are near an npc in a Map<Player, List<NPC>>. From there on you can use the PlayerMoveEvent.

sacred prairie
#

i'll try this thank you

quiet ice
#

Another Thing to note is the dedicated Data structures can be used, unfortunately I forgot the Name of them

young knoll
#

Multi map?

quiet ice
#

Quadtrees and Octtrees

#

It only helps If the npcs are at the same position the entire time however. But it can reduce the costs of Iteration by a lot by Splitting down the npcs into batches

grim ice
#

uh

#

if im making a friends system

#

do I use a graph

lost matrix
#

Graph

grim ice
#

ok

#

but i dont really get how it works

lost matrix
#

Do you know how a LinkedList works?

#

Eh. You will get there. Plenty of tutorials out there 👍

grim ice
#

its like

#

a deque

#

i think?

#

but it allows null values

ivory sleet
#

Guava has graph data structures btw

grim ice
#

and slower than an arraydeque

#

thats mostly what i know

#

cant i just make something similar to

#

a hashmap of a uuid, arraylist<uuid>

lost matrix
#

Sure. But you will quickly realise what a hustle it is to maintain this properly.

grim ice
#

is it possible

#

to serialize it or something

lost matrix
#

Yes the structure you described can easily be serialized.

grim ice
#

cool

#

then what's the husle

#

hustle

#

You can use nio and distribute the work so it doesn't cost that much performance

grim ice
#

maybe it's laggy

lost matrix
lost matrix
grim ice
#

Yeah but nevermind

#

I guess its not laggy

#

What i was thinking is

#

writing on files might've been costy, but it probably isnt a lot of text

lost matrix
#

You should never do any IO on the main thread anyways. Doesnt matter if its 10ms or 100ms

grim ice
#

yea

#

i wouldnt

#

i would do it on an other thread and distribute it i assume

lost matrix
#

Nothing to distribute. Just do a fat single batch.

grim ice
#

o

#

so u can do whatever u want if its in a new thread

lost matrix
#

You wont get better writing performance with multiple threads. Your hard drive has a very limited throughput.

grim ice
#

but the thread resources will be taken from the system resources though

#

o

#

then do i just use nio

lost matrix
#

Sure. Whatever you fancy for writing files to disk.

quiet ice
#

Hm, what exactly do you want to serialize?

grim ice
#

HashMap<UUID, ArrayList<UUID>>

#

or is there another data structure that has better performance

quiet ice
#

Like mutual friend uuid <-> friend uuid pairs? Or is it asymetric?

grim ice
#

for this kind of thing

#

nah i want each player to have a list of players friended

quiet ice
#

You might want to go ConcurrentHashMap<UUID, ConcurrentHashMap.KeySet<UUID>>, but that may be overkill

grim ice
#

want to keep things simple

quiet ice
#

So asymetric? Then yes, Just go with Map<UUID, Set<UUID>>.

quiet ice
grim ice
#

Async saving?

#

you mean distributed, or multithreading, and what do you mean by async saving

quiet ice
#

Off-thread

#

My bad for using the really dum word

grim ice
#

"ConcurrentHashMap: It allows concurrent access to the map. Part of the map called Segment (internal data structure) is only getting locked while adding or updating the map. So ConcurrentHashMap allows concurrent threads to read the value without locking at all. This data structure was introduced to improve performance.Sep 6, 2016"

quiet ice
#

Sure, File IO is kinda fast these days, but if you have a lot of data, saving the database in an off-thread manner can save a small lagspike or two

grim ice
#

alr that made sense to me

quiet ice
#

The actual cool thing that goes for CMH is that you can iterate over the keyset/entryset while modifying it

grim ice
#

wdym

grim ice
#

but dont threads take some amount of resources?

#

running every small task in a new thread would make performance worse, or better?

eternal oxide
#

Depends

quaint mantle
#

thats why you use a thread pool

grim ice
#

Like Bukkit Scheduler?

#

and ExecutorService?

lost matrix
quiet ice
#
Map<Object, Integer> hashmap = new HashMap<>();
// Put some stuff in the map
for (Object key : hashmap.keySet()) {
    hashmap.put(key, 100); // ILLEGAL!
}
Map<Object, Integer> concurrentHashMap = new ConcurrentHashMap<>();
// Put some stuff in the map
for (Object key : concurrentHashMap.keySet()) {
    concurrentHashMap.put(key, 100); // LEGAL!
}
grim ice
#

what

#

thats illegal

#

how

#

what

quiet ice
#

ConcurrentModificationException

grim ice
#

ic

quiet ice
#

Well, it is illegal at runtime, you can fully compile that

quiet ice
lost matrix
#
    Map<String, Integer> stuff = new HashMap<>();
    stuff.put("1", 1);
    stuff.put("2", 3);
    stuff.put("3", 1);

    stuff.entrySet().removeIf(entry -> entry.getValue().equals(1));

If you use the iterator then you can also do that with a normal hashmap

tardy delta
#

Love that method

quaint mantle
#

Me2

quiet ice
#

That requires that the iterator removes it and not something in the background. But yes, this is a valid way of doing things like that

grim ice
#

but uh

#

can someone explain thread pools

#

I want to understand them more

#

I know they like help you manage your threads life cycle and stuff

#

but how

lost matrix
#

Its like every other object pool.
You have a bunch of threads.
If you need one then the pool gives you a random free one.
Thread creation can be expensive. Objects with expensive
creation methods get pooled.

grim ice
#

so it doesnt exit the thread??

lost matrix
#

And you dont need to manually go through all the threads to see which one is free right now because the pool gives you one.

grim ice
#

how does it give me a free one, doesnt it eliminate free ones

lost matrix
#

No. If all threads are occupied then you get a random one and your execution might need to wait until the previous workload is done.

quiet ice
#

sun.misc.Unsafe ftw

grim ice
#

so does it exit free threads

grim ice
quiet ice
#

It probably parks them via the unsafe class

grim ice
#

what is parking

lost matrix
#

Thread pools are used for threads that have short lifetimes.
For example -> you give it a task like calculate 1000 fibonacci numbers. After the thread is done, its parked for the next task.
Or "write xyz to disk". You dont occupy threads from a thread pool for tasks that have a non deterministic lifetime.
For that you would create a single thread.

grim ice
#

or does it create a thread when you need one, but it doesnt eliminate it

#

instead it parks it

#

after some time if u never use it it eliminates it

#

otherwise it uses it next time u need it

lost matrix
#

It creates N threads when you instantiate the thread pool.
Those are always the same N threads.

quiet ice
#

It depends on the nature of the pool

grim ice
#

thats what i assume

#

o

lost matrix
#

Oh righ. You can define Thread factories

grim ice
#

so a fixed amount of threads, damn that must suck resources though

#

what if i need only one

quiet ice
#

The fixed thread pool has N threads, however others may create more threads as needed

lost matrix
#

But usually you would use a fixed thread pool.

quiet ice
#

Yes

lost matrix
#

Unless you plan on using the thread indefinitely. Then you just instantiate a new Thread object.

grim ice
#

i see

#

so if i wanna use way too many threads i use a thread pool

#

otherwise just make a thread on my own

lost matrix
grim ice
#

parking is basically lik

#

sleep mode

#

right?

#

u just put it to sleep, then wake it up if u need it

#

right?

quiet ice
#

To some degree yes, though it depends on the underlying OS

lost matrix
grim ice
#

and when its on "sleep mode" it doesnt require many resources

grim ice
#

what if its a small task

#

a threadpool?

#

i know it wont last long

glossy venture
#

Thread pool is useful there

#

Cuz you dont have to constantly allocate new threads

faint aspen
lost matrix
grim ice
#

what is better, returning an object that can be null and if so return null or return a collection that has an element which is the result object, or an empty one if its null

#

i want to check == null later, but i think isEmpty might be better or smth

glossy venture
sterile token
#

If you want to compare objects or string its recommend to do it using .equals()

grim ice
#

doesnt matter for null

#

i assume

glossy venture
#

Yeah it doesnt

lost matrix
#

Collections should be used sparely. There is an object called Optional<T> if you want to wrap your nulls. Actually really useful.

quiet ice
#

^

grim ice
#

i want performance

sterile token
#

Smile how it was call the option that let you check if player exists or not?

#

Wasnt Predicate?

grim ice
#

is optional good for tahat

sterile token
#

I cannot rember hence

quiet ice
#

If you need performance, use null

grim ice
#

btw whats the fastest collection for reading and writing

lost matrix
#

Predicate<T> is just a function that takes T and delivers a boolean

quiet ice
sterile token
quiet ice
#

Lists have good random access times too as they are based on arrays

sterile token
quiet ice
#

However as soon as you work with primitives, type erasure is going to kill performance

lost matrix
sterile token
quiet ice
#

(it is subtle, but still noticable on the gc and the likes if used often enough)

quiet ice
lost matrix
#

But if we are speaking about, contains, add, remove, remove while iterating etc. then there are a lot of different options.

sterile token
#

Because there is a big discussion with that

lost matrix
quiet ice
#

They are likely going to be the exactly same thing

rotund pond
# lost matrix Collections should be used sparely. There is an object called Optional<T> if you...

Some guys said that Optionals shouldn't be used.
Here what they said (I use Google translate because there's things I can't translate properly, sorry if it's a bad translation...):
Not forbidden but heavy for what it is. In java we always say not to use nulls because if you mismanage your code it leads to too many npe problems. But the use an optional, so create an object that has a strong reference to another object just to replace a != null with an isPresent (or all the alternatives), well it's not even folichons to make the code more readable

quiet ice
#

for (var object : iterable)
is equal to

var iterator = iterable.iterator();
while (iterator.hasNext()) {
   var object = iterator.next();
}
lost matrix
#

Wait

#

Would have to double check on that

rotund pond
sterile token
quiet ice
#

foreach has a slight overhead

rotund pond
# lost matrix Who said that?

A french developer, tbh I don't wanna give a name because I don't want him to get harass for some reason, I just wanna understand things

sterile token
quiet ice
#

I do not think so

sterile token
#

I cannot remember who mentioned was doing a http client

#

😡

quiet ice
#

Why would you even do one?

sterile token
quaint mantle
#

Temporary objects are really optimized by gc

lost matrix
quaint mantle
#

It is better to create a new optional every time rather than keeping it as field or reference idk

rotund pond
#

What do you mean by "volatile scopes" ?

lost matrix
#

But optionals are not just null checkers. They have a really rich API of dealing with empty content. Thats the main strength.
Let me find an example of a plugin i wrote last week.

quiet ice
#

My personal opinions about null:

  • In environments where developers know how to use null checking tools and nullabillity annotations NPEs are a non-issue
  • The same can be said about Optional (as you can add annotations to generics params - even if tools such as eclipse will have an heart attack due to it)
  • Null can be ambiguous from time to time (no value, or null value?), Optional usually is not
rotund pond
#

Just someone told me I shouldn't and I didn't really understand why, because it's really useful in APIs

lost matrix
#

This saves me like 15 lines of code.

sterile token
#

That has made me the day

lost matrix
#

And optionals that contain no value point at a single object anyways.
There is an uber Optional that is used to basically remove the whole overhead if
the element is null.

lost matrix
#

And read the message above that ^^

lost matrix
#

Hm but this is one thing i have not benchmarked so far. I should do that rn.

rotund pond
#

Ty for these informations @lost matrix

#

Very useful, as always

midnight shore
#

Hi, how can i make an armorstand look at a specific player?

sterile token
#

This would teleport the armor stand to player

#

You can take it as an example

#

Prob you should set the armor stand location to player location

midnight shore
#

i don't want to teleport it to the player i want to have an armor stand head pose to make it look like if it is looking at a player

sterile token
#

Oh

midnight shore
#

but ty btw

sterile token
#

You want an armor stand looking forward to player?

#

Like an npc?

midnight shore
#

yes

#

i have this now, but that's broken

#

i think i'm wrong with something mathematically

sterile token
#

Oh

grim ice
#
private void lookAtPlayer(ArmorStand armorstand, Player player) {
Location armorstandLocation = armorstand.getLocation(); 
Vector playerVec = player.getLocation().toVector();
Vector armorstandVec = armorstandLocation.toVector();
Vector facingVector = playerVec.subtract(armorstandVec).normalize();

armorstandLocation.setDirection(facingVector);
armorstand.teleport(armorstandLocation);
}```
Credits to Choco#9999
next stratus
#

Hey, does anyone have some experience with the worldedit api and knows how to do relative location stuff? I've been told iterating the region "isn't fast enough" by someone although I thought 18ms to iterate a region is pretty good

leaden sigil
#

Hello, so i want to make cancel multiple events, when they happen, and i have this long piece of code:

    @EventHandler(priority = EventPriority.HIGHEST) public void on(PlayerInteractEvent event) { event.setCancelled(true); }
    @EventHandler(priority = EventPriority.HIGHEST) public void on(BlockBreakEvent event) { event.setCancelled(true); }
    @EventHandler(priority = EventPriority.HIGHEST) public void on(BlockPlaceEvent event) { event.setCancelled(true); }

Is there any better approach, instead of typing all of that?

midnight shore
grim ice
#

and

#
private static EulerAngle convertVectorToEulerAngle(Vector vec) {
     
        double x = vec.getX();
        double y = vec.getY();
        double z = vec.getZ();
     
        double xz = Math.sqrt(x*x + z*z);
     
        double eulX;
        if(x < 0) {
            if(y == 0) {
                eulX = Math.PI*0.5;
            } else {
                eulX = Math.atan(xz/y)+Math.PI;
            }
        } else {
            eulX = Math.atan(y/xz)+Math.PI*0.5;
        }```
sacred mountain
#

maths

#

pro

grim ice
#

then pass in facingVextor

sacred mountain
#

i cant math

grim ice
#

then setHeadPose

#

nah this isntm y math

#

Credits to @Quzzar

#

in spigot forums

lusty cipher
#

is there some way to detect when a end crystal is placed?

eternal night
#

I mean, either entity spawn event

#

or interact

lusty cipher
#

hmm entity spawn does seem likely

eternal night
#

Well both should trigger

#

Actually, EntityPlaceEvent is the one

#

lol

red sedge
#

is there a way to prevent dupe uuids?

eternal night
#

what are dupe uuids o.O ?

red sedge
#

i have a feeling UUID.randomUUID could generate smth duped

eternal night
#

That is rather unlikely

red sedge
#

but still possible

eternal night
#

"For example, the number of random version-4 UUIDs which need to be generated in order to have a 50% probability of at least one collision is 2.71 quintillion"

waxen plinth
#

That is so insanely unlikely

#

So you don't gotta worry about it

eternal night
#

you'd probably die from a lightning strike while coding spigot first

sacred mountain
#

lol

#

my mac mini was fried

#

when a lightning bolt hit my house

#

sockets burst out the wall

eternal night
#

and somehow still no uuid collision

sacred mountain
#

yes

red sedge
#

yeah but it is POSSIBLE

eternal night
#

bruh

#

no

#

it effectively isn't

#

especially in your closed system

red sedge
#

yeah but like

#

it would ruin everything if it does

eternal night
#

so would a meteor striking the earth

red sedge
#

i mean a meteor almost did

#

so probably

eternal night
#

probably more likely that that happens than a uuid 4 collision in your closed system

#

are you hiding your server in a meteor safe data centre ?

#

if not, start with that risk

red sedge
#

i am