#help-development

1 messages · Page 2042 of 1

tender shard
#

np!

quaint mantle
#

Can I check if a server is online, and how many players are in it in bukkit?

#

If so how

tardy delta
#

Bukkit.getOnlinePlayers().size()

#

if a server is offline your plugin wont run

quaint mantle
grim ice
quaint mantle
#

so my bot wont be online either

grim ice
#

oh ur checking for the server running

tardy delta
#

|| -> |

grim ice
#

i thought u meant another server

tender shard
#

lmao

tender shard
#

I can't wait for someone to ask again on how to save a map or list into a PDC lol

grim ice
#

xD

eternal night
#

if only there was a library that has cool pdc types for that

#

😭

grim ice
#

yeah man, i would wish to see that :(

quaint mantle
#

hello i want to get the tps with (double currentTPS : net.minecraft.server.v1_8_R3.MinecraftServer.getServer().recentTps) { but i get the follwing eror cannot find symbol

tender shard
#

isn't that a private field?

eternal night
#

also 1.8 lol

quaint mantle
#

public Double getServerTPS() { Double tps = null; for (double currentTPS : net.minecraft.server.v1_8_R3.MinecraftServer.getServer().recentTps) { tps = (Double) (Math.round(currentTPS * Math.pow(10, 2)) / Math.pow(10, 2)); break; } if (tps > 20) tps = (Double) 20.0; return tps; }

#

that my method

tender shard
#

check whether recentTps is a private or public field

#

in proper MC versions, the field is public

quaint mantle
#

public

tender shard
#

then show the full error

quaint mantle
#

java: cannot find symbol
symbol: variable recentTps
location: class net.minecraft.server.v1_8_R3.MinecraftServer

tender shard
#

hm no idea, I don't have such an old version installed so I can't test

eternal oxide
#

recentTps is not a method/field in Spigot

tender shard
#

well it is in in 1.17 and 1.18

eternal oxide
#

not in Spigot

#

oh nms

carmine pecan
#

Hi guys! Any way to check if an item is damageable in 1.8? Instance checking item meta to see if it implements damageable doesn't work on legacy versions

glossy venture
#

doesnt work on modern versions either

#

maybe theres a material flag

#

you can check for

tender shard
glossy venture
#

x instanceof Damageable always returns true

#

look

#

every item meta extends this

#

its ridiculous

tender shard
#

maybe try ```java
Material.DIRT.getMaxDurability()

#

if it returns anything above 0, it's damagable

carmine pecan
glossy venture
#

yeah its stupid

carmine pecan
glossy venture
#

oh yea youre using legacy

#

with damage values

tender shard
vocal cloud
#

People living in the dark ages

tender shard
#

I also don't get why they used 1561 for diamond and 2031 for netherite. why not just 1500 and 2000 lol

carmine pecan
#

Yeah, trying to achieve cross version support since a lot of users want it

tender shard
#

gold is 32, that makes sense, and iron is 250, that also makes sense. but 1561?

glossy venture
#

idk

tender shard
#

that also explains why the numbers 7,8,9 never appear in any durability

#

and they use 0 when the dice falls from the table

#

fun fact, if you roll 2 dice, the result 7 is the most common

glossy venture
#

yeah

#

most combinations

#
32 / 250    = 0.128 (ok decent)
250 / 1561  = 0.1601537475976937860345932094811 (tf)
1561 / 2031 = 0.76858690300344657804037419990153 (why)
quiet ice
#

It might have been the protocol id at that time

carmine pecan
#

Will ItemStack#getDurability() return the same value as Damageable#getDamage()?

quiet ice
#

Ah you mean that

#

2031 makes sense actually

tender shard
quiet ice
#

2031 is 0b11111101111 in binary. Why they didn't go with 2047 is a bit beyond me but eh good enough

#

Could be that there was some random bit mask that noone wanted to change but would otherwise break if an item had that much durability

grim ice
#

well u can change durability of an item

#

so probably not?

nimble void
#

Where I can find help about quests plugin?

quiet ice
#

github most likely

quaint mantle
#

How do I skip a line of code if it errors?

#

To prevent the code from not running

quiet ice
#
if (false) {
    System.exit(0);
}
tender shard
#

you normally shjouldn't let this situation occur in the first place

nimble void
hasty prawn
#

Alex don't you have a blog post about exception flow

quaint mantle
quaint mantle
#

cause its a bot, and it cant change nicknames.

quiet ice
#

Oh

quaint mantle
#

That the owner is.

hasty prawn
#

yessss that

quiet ice
#

Errors at runtime or compile time

nimble void
#

How can I get discord server of quests plugin?

hasty prawn
#

Is my guess

tender shard
eternal night
fallen sandal
#

is there any method exist to check if player is not found or not ever joined my server?

fallen sandal
#

ok

#

i was trying this method lol

grim ice
#
try {
  throw new NullPointerException();
} catch (NullPointerException e) {
   throw new NullPointerException(); 
}

wdym i shouldnt catch Runtime exceptions, it works perfectly fine

hasty prawn
glossy venture
manic delta
#

guys can someone help me using world edit api 💀

hasty prawn
#

?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!

granite owl
#

if i search for this char (from the ascii table) ```java
(char)0

#

(which would be desired, trying to null the argument seperator from my ini parser which defaults to ',')

#

so it never matches

quaint mantle
#

Is it possible to get a users display name from their unique id?

#

example: 193ff4d4-68cd-4f4b-8877-a31f41f88aa2

#

as a string

manic furnace
#

I built build-tools. Does anybody know where the jar with the nms stuff is placed, so I can add it to my maven-local repo?

quaint mantle
#

it doesnt seem to work for me

quaint mantle
#

for example:

manic furnace
#

Ok, but at first, where is it placed?

quaint mantle
#
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT-shaded'
#

if you dont know hwo to do it research it first

#

or better yet learn gradle

#

as thats a basic thing in gradle

#

thats me assuming you know how to code java however

#

and that your using gradle

manic furnace
#

I am using maven

quaint mantle
manic furnace
#

Yes, but my main question was, where it is placed in the folder

quaint mantle
#

you download it so you can get the jars name

#

so you can add it to the repository

manic furnace
#

i just want to know where it is placed after running build-tools

quaint mantle
manic furnace
#

but i don't know where the jar is placed when i run build-tools

vocal cloud
#

If you run build tools it will put the files into your local repo so you don't need to do anything.

#

Just add it as a dependency

vocal cloud
#

Yes.

quaint mantle
#

I had to manually add it to my local repo

#

lmao

manic furnace
rare hazel
#

Hi, trying to make an Entity/Zombie not despawn. Had a look here (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Zombie.html) but does not look like there is an "easy" way of doing it. setPersistent did not do the job, if my understanding of the word persistent means "continuing to exist or occur over a prolonged period". Do I need to create a event listener, did not find a EntityDespawnEvent tho...

quaint mantle
#

Also, @vocal cloud while your here, can I convert a string to a UUID?

#

Example: Turn this into the UUID: 193ff4d4-68cd-4f4b-8877-a31f41f88aa2

tardy delta
#

UUID.fromString

vocal cloud
#

Yeah but be careful about it

quaint mantle
vocal cloud
#

You can't instantiate UUID it has static methods only.

tardy delta
#

UUID id = UUID.fromString(someStr)

vocal cloud
#

Well you can but not the way you want

manic furnace
#

I downloaded the dependency and can't import all the nms-specific stuff

#

The nms package don't even exist in my case

quaint mantle
#

on discord

tardy delta
#

did you change spigot-api to spigot?

manic furnace
#

oh

#

thanks

quaint mantle
#

How would I get a list of everything in the getConfig?

#

Would i just do .get(".")

#

or smth

rare hazel
#

Zombie zombie = (Zombie) world.spawnEntity(location, EntityType.ZOMBIE); zombie.setAI(false); zombie.setCustomName("Zombie"); zombie.setCustomNameVisible(true); zombie.setPersistent(true); zombie.setInvulnerable(true); zombie.setRemoveWhenFarAway(false);

Will this zombie continue continue to exist? Looks like it works in game...

quaint mantle
#

They wont despawn with a custom name set usually

rare hazel
#

@quaint mantle the custom name thing was not enough. Tested it, and it just despawned

quaint mantle
#

hey guys how can i make if in my gui i click a item player teleports in other world?

ebon stratus
#

Hi guys! How can i modify a vanilla command tab completion? I tried using the TabCompleteEvent but it didnt work

tardy delta
#

so InventoryClickEvent

quaint mantle
#

okaaaaaaaaaaaaaaaaaaaaaaaaay

low temple
ebon stratus
#

Im making custom items

low temple
#

If so look into TabCompleter

ebon stratus
#

Not my command

ebon stratus
#

Vanilla command

low temple
#

Oh vanilla command

ebon stratus
#

I want to add smth to give command tab completion

#

My custom items

low temple
#

What did u try for the tab completer event?

#

All u said was it didn’t work

ebon stratus
#

First i tried system.out.println to see id it fires

#

And it disnt

#

Didnt*

low temple
#

Did u register the event class?

ebon stratus
#

Yes

low temple
#

Show code

ebon stratus
#

Im in school

#

I ll show when i get home

low temple
#

Ok

tardy delta
quaint mantle
#

thats it

#

i want to get GINVE

#

and if there is other codes

#

get them as well

tardy delta
#

loop over a config section

quaint mantle
#
for(String id: EmeraldsPlugin.disc.getConfig().getStringList("")){
            System.out.println(id);
            if(EmeraldsPlugin.disc.getConfig().getLong(id + ".time") + 300 <= unixTime){
                EmeraldsPlugin.disc.deleteVerify(id);
            }
        }
#

i dont see how

#

@tardy delta is this correct or

#

so how to i get a section?

tardy delta
#

what are you trying to do?

quaint mantle
#

with a for loop

tardy delta
#

that isnt an answer

#

you arent getting it for no reason

quaint mantle
#

im using the id to check the config if the time is past 5 minutes of it being generated

#

if so delete the ID from the config

#

im trying, to errors stating that its not a valid arraylist

tardy delta
#

lol there is only one section so what

#

is GINVE a person or something and are there multiples such things?

quaint mantle
#

its a 5 letter string used for verifying

tardy delta
#

if you want to get the time use config.getLong("GINVE.time")

quaint mantle
#

ill give another example ig

tardy delta
#

so there are multiple?

quaint mantle
#

get ALL of the ids

#

inside the config

#

so i can loop thru

#

to get the time for them

#

and delete em if expired

#

Okay but you JUST stated arraylist wouldnt work

tardy delta
#

you need a root section

quaint mantle
#

Okay. now all you have done is make ID not a valid variable.

#

:/

tardy delta
#

so like

data:
  GINVE:  
    user: '193ff4d4-68cd-4f4b-8877-a31f41f88aa2'
    time: 1648050883
  SOMETHING_ELSE:
    user: 'some uuid'
    time: 1234567890```
quaint mantle
tardy delta
#

then get the section "data"

glossy venture
tardy delta
#

not sure if you can iterate over the root section if you know what i mean

glossy venture
#

for all keys on the first level of the config file

glossy venture
#

so yes you can

quaint mantle
tardy delta
#

owh right

glossy venture
#

i couldnt remeber the type, so replace var with whatever it returns if you dont want var

quaint mantle
#

Thank god it works

glossy venture
#

yeah

tardy delta
#

i stopped using yaml and switched to database lol

glossy venture
#

YamlConfiguration -> FileConfiguration -> MemoryConfiguration -> MemorySection -> ConfigurationSection

#

yeah i recommend a proper database too

tardy delta
#

refactoring my command system atm kek

#

smth liek this

#

it kinda goes brr

#

but its already much shorter than string parsing in every command class

glossy venture
#

nice

quaint mantle
glossy venture
#

just anything that persitently stores data

tardy delta
#

have you ever wondered how facebook saves your data? well in databases

glossy venture
#

for example mySQL

#

yaml is technically also a database but its not very performant or expandable

#

or it can be used as a database

tardy delta
#

yaml is just a file with some formatting rules

glossy venture
#

it can be used to store data

#

therefor it can be counted as a database 'strategy'

tardy delta
#

ye but its not really used for keeping a lot of data

glossy venture
#

it could be, its just that noone does it

tardy delta
#

its completely in-memory right?

glossy venture
#

its saved to a file

#

just like mysql

#

mysql is also partially stored in memory

#

i assume at least

tardy delta
#

but yaml has a backing map

glossy venture
#

reading a file every time you want to access something is stupid

plain helm
tardy delta
#

imagine saving a whole playerbase in yaml

plain helm
#

It's quite easy

#

rather than learning sql

tardy delta
#

sql is more scalable in my opinion

plain helm
#

on join you just get the player's name and set it as path for it's UUID in a yml file

tardy delta
#

also you can easily use ORDER BY stuff to order the result instead of doing it yourself

plain helm
tardy delta
#

that doesnt make sense

#

names can changes, uuid is the same

plain helm
#

yep

tardy delta
#

why not just calling Player#getUniqueId?

plain helm
#

indeed it gets updated each time

#

well

tardy delta
#

so basically you're storing its last known name?

plain helm
#

yes

#

and gets updated whenever they join

#

i do that because in one of my plugin there is command /release <name>

#

that has to work offline too

#

i don't think that making the user type the whole UUID is a good thing so they can type the name and so my code can get the UUID from the yml file

ivory sleet
#

could use Bukkit::getOfflinePlayer

ancient plank
#

offline mode 🤮

ivory sleet
#

altho I'd suggest creating a name -> uuid cache

tardy delta
#

offline mode ew

ivory sleet
#

I think they meant for when the player is offline

#

and btw offline mode has its use-case

plain helm
tardy delta
#

lol

plain helm
#

idk how the offline player works as i tried using it many times and gave me errors

ivory sleet
#

sounds a lot like a you-problem, anyhow I'd advocate looking at javadocs

plain helm
#

yes it's my problem

primal island
#

I make a NMS patch for Spigot-Server. I compiled it with mvn clean install.
But didn't create remapped-mojang version of jar in maven local repository.
How can i create this jar.

chrome beacon
#

Yeah looks like it isn't installing it

#

You can always do that manually or specify it in the pom

#

There is a install file command you can use to add it to your maven repo

primal island
#

If a use --rev 1.18.2 --remapped

#

my patches are gone

primal island
#

Where is file?

ebon stratus
# low temple Ok

for some reason it only works in the console and with commands i made

low temple
#

Can you post code?

#

?paste

undone axleBOT
quaint mantle
#

is there a way to intergrate a mod into a plugin? AKA the plugin requires a mod to run

#

like as a dependancy

tardy delta
#

i've seen that with veinminer

low temple
#

Weird, does it work with any non-vanilla commands

#

Like have u tried a different plugin’s command?

ebon stratus
#

nope

#

let me see

#

yep

#

any non vanilla command

low temple
#

Try that, if it does work then it means spigot isn’t creating events for vanilla commands

ebon stratus
#

from every plugin

low temple
#

Yeah then there’s no way to do it from my knowledge

vagrant stratus
ebon stratus
chrome beacon
#

Why do you even need this

low temple
#

Might need to override the give command urself

low temple
ebon stratus
#

yeah, i'll see, thnx anyway

tardy delta
chrome beacon
#

Just make your own give command it will be much easier

low temple
quaint mantle
#

Does spigot supports java 18?

low temple
#

Can’t remember if it’s Java 17 or 18 tho

tardy delta
#

16 and 17 do

#

not sure about 18

low temple
#

I’ve only tried 17

ivory sleet
#

altho j18 is still considered unstable afaik

#

so you wont get any support for using j18

chrome beacon
#

It released yesterday so have some patience

vocal cloud
#

Just use 17. LTS

primal island
#

yeah LTS better

sharp bough
#

how could generate a custom world this is constact structure:

ebon stratus
#

I added a plugin dependency to pom.xml and every time I compile my plugin it also copies the packages and classes from that plugin in my plugin and adds a bytebuddy folder, how can i make it stop doing this?

quaint mantle
#

i forgot the setting but change the thing from >compile< to >provided<

ebon stratus
vocal cloud
#

?paste it

undone axleBOT
grim ice
#

scope compile to provided

ebon stratus
#

ok

quaint mantle
#

not for plugins

grim ice
#

what happens if the repo dies tho

ebon stratus
#

and for the bytebuddy folder?

quaint mantle
#

wtf is bytebuddy

grim ice
#

with compile that wouldnt happen?

ebon stratus
#

or wait no

quaint mantle
ebon stratus
#

it compiled with that plugin

#

nvm

grim ice
#

i find that better

ebon stratus
#

idk what that was

grim ice
#

since itll work no matter what

quaint mantle
ebon stratus
#

thnx

grim ice
#

u just assumed every dependency

#

is a plugin

vocal cloud
quaint mantle
grim ice
#

so every dependency is a plugin??

quaint mantle
tardy delta
#

👀

quaint mantle
#

ok so

#

adding a plugin as a dependency should mean its not shaded into the plugin

#

and if you shade other plugins like that you're dumb and annoying to server owners

#

like essentials doesnt shade vault

tardy delta
#

you only have to depend on the api?

desert marten
#

What do you mean my 50MB plugin annoys server owners?

#

smh

vocal cloud
#

Depend on api but don't need to add it to your jar

quaint mantle
#

^^

grim ice
#

you literally just assumed every dependency is a plugin

smoky oak
#

it mainly annoys developers tbh bc there's an upload limit on spigot -.-

grim ice
#

??

tardy delta
#

so basically the 'provide' scope in maven?

grim ice
#

a dependency doesnt mean its always a plugin

tardy delta
#

so you have access to the api code but dont compile it into your plugin

quaint mantle
#

im talking about plugin dependencies

#

like plugin APIs and libraries

#

What do you mean I'm not supposed to shade the spigot jar??

grim ice
#

and did he specify "plugins"

smoky oak
#

can you make a not plugin shaded dependency anyways?

#

*provided

quaint mantle
#

i did that for galaxylib

smoky oak
#

well those still get loaded

quaint mantle
#

like a bunch of utility classes

#

not a standalone plugin

smoky oak
#

huh interesting

#

imma not jump into that rabbit hole yet

#

my stuff works atm

quaint mantle
#
<dependency>
    <groupId>com.github.ImajinDevon</groupId>
    <artifactId>GalaxyLib</artifactId>
    <version>latest_commit</version>
    <scope>compile</scope> <!-- Shade the JAR -->
</dependency>
vocal cloud
quaint mantle
smoky oak
#

uuum

#

interesting wiki u got there

quaint mantle
#

yikes

#

scroll down

#

oh i deleted the wiki

smoky oak
#

nope

quaint mantle
#

i think its cause i originally deleted the repo and it also deleted the wiki repository

#

for some reason on github they're two seperate repositories for easier editing

smoky oak
#

eh anyways

#

can i somehow translate a book into a string?

#

and back?

glossy venture
#

you mean like all the data?

#

or get the contents as a string

smoky oak
#

yea

glossy venture
#

if you need all the data like get the nbt as string idk

grim ice
#

a library idea

glossy venture
#

and then parse it back or something

grim ice
#

thank you

smoky oak
#

i know i can try to stuff it into a data stream and serialize it as a base64 string but not how

quaint mantle
#
BookMeta meta = (BookMeta) book.getItemMeta();
StringBuilder builder = new StringBuilder();

for (String page : meta.getPages()) {
    builder.append(page).append('\n');
}

@smoky oak

grim ice
#

or not

#

sad

quaint mantle
#

probably the most simple way

glossy venture
#

nah thats the contents

#

pretty sure they want all info about the book

quaint mantle
#

oh

glossy venture
#

like nbt

#

but only book

grim ice
#

u wanna serialize the item?

quaint mantle
#

^ you can use json

smoky oak
#

wait wasnt there a library for that already

#

brb

glossy venture
#

just grab the nbt

grim ice
#

dont

#

use nms for that

quaint mantle
#

nbt suck booty

#

only because its hard to access

smoky oak
#

there was already a solution

#

?paste

undone axleBOT
grim ice
#

nbt should always be abstracted, its cringe

glossy venture
#

because the nms stuff is mapped to just net.minecraft

#

now

smoky oak
glossy venture
#

so no need for shitty relfection

glossy venture
quaint mantle
#

im sure i could write an easier method

#

one sec

glossy venture
#

jUsT grAB tHe nBT

glossy venture
#

its quite simple tho

quaint mantle
#

yeah still a lot of code for no reason

gritty urchin
#

what is the easiest way to differentiate between a cracked and premium player

smoky oak
#

premium server

gritty urchin
#

on a offline server

glossy venture
#

with GameProfile

vocal cloud
#

Don't allow cracked accounts by using authentication?

gritty urchin
#

I want to allow both

#

just to differentiate

tall dragon
#

there is no way

gritty urchin
#

does FastLogin have an API

tall dragon
#

you have to manually auth premium users

gritty urchin
#

or anything

vocal cloud
#

You either auth with mojang or you don't auth at all

grim ice
#

cant u check if their uuid exists

#

since cracked players dont have uuids

#

afaik

gritty urchin
#

ye but premium players

tall dragon
#

it is possible if your server uses a mixed mode auth plugin so everyone has an online uuid

gritty urchin
#

are not their actual uuids either

grim ice
#

???

#

wdym

tall dragon
gritty urchin
#

premium players on cracked servers are not their actual mojang uuid

#

just an offline uuid

smoky oak
#

from personal experience, premium players are treated as separate on the same server running in online and offline mode. This is probably because their online uuid stems from mojang's servers and their offline uuid from their name

tall dragon
#

as stated in the post

gritty urchin
#

yeah but what if I use a cracked account of an existing premium player name

grim ice
#

what

#

???

eternal night
#

wat

vocal cloud
#

Sigh. Just don't allow cracked accounts.

tall dragon
#

yea its a pain

grim ice
#

well its not really if ur starting out

#

if ur struggling to find players cracked ones arent that bad

vocal cloud
#

I mean you're pirating software I'd say that's pretty bad

tall dragon
#

why is there even an option in the default spigot jar to run a server offline?

#

is that purely for bungee?

vocal cloud
#

Let's say you and some friends hang out in a place with no internet and want to play together. Voila offline mode

tall dragon
#

how would that work without internet

#

pertty sure u still cannot play together if u have no internet

grim ice
#

you can

#

LAN

tall dragon
#

yea but that works with a local network?

#

where everyone has to be connected to the same network?

vocal cloud
#

It's also useful if you're playing on a version of MC where the new auth isn't

grim ice
#

No need for wifi

vocal cloud
#

If their auth servers go down you can still play with people

tall dragon
#

hm, i guess thats fair yea

grim ice
#

Well you need a router

#

but no internet connect is needed, only the router

vocal cloud
#

Like og Technic stuff needs to be played in offline mode

strong parcel
grim ice
#

bro

#

wtf

#

why r u try catching

strong parcel
#

Because not all entities are players.

chrome beacon
#

Don't use lore to detect things

grim ice
vocal cloud
#

😭

strong parcel
#

The problem is not with the lore, nor with the try catching. My issue with with the potion effect. It does not apply the potion effect even when the try block runs perfectly.

quaint mantle
#

ok no but you have issues wit hyour code

strong parcel
#

I didn't include it in the pasted code, but earlier I had the code send me a message whenever an exception was caught. I did not get the error message even though the potion effect was not applied, so I think it might be something with how I am applying it.

chrome beacon
#

Is your message sending

tall dragon
#

and does the poison message send

#

ah

strong parcel
#

The poison message sends.

#

But the mob being attacked does not get poison as far as I can tell.

quaint mantle
#

why are you try catching exception

chrome beacon
#

I think you might want to try and increase the time of the potion effect. I'd expect that to be in ticks

strong parcel
#

OH

#

Thanks XD

quaint mantle
#
if (!(e.getDamager() instanceof Player)) {
    return;
}

Player player = (Player) e.getDamager();
strong parcel
#

I forgot that it is in ticks instead of seconds like the in-game command

quaint mantle
#

and use persistent data containers

#

not lore

quaint mantle
#

?pdc

grim ice
#

if(!(e.getDamager() instanceof Player player)) return;

quaint mantle
#

ive forgot java

#

rust is so much better

#

i keep forgetting java syntax and having to google it

strong parcel
#

I keep not knowing java syntax in the first place

quaint mantle
#

thats the bad part of working with multiple langauges

grim ice
#

no need to cast and make a variable

strong parcel
quaint mantle
tall dragon
#

you probabaly also wanna check if the item even has an itemmeta & lore

grim ice
#

it always has a lore

#

it just can be empty

#

afaik

strong parcel
#

But that is the beauty of the try and catch

quaint mantle
tall dragon
#

why the heck does #hasLore exist then

strong parcel
#

If it is anything I don't want, it just doesn't happen

grim ice
#

Oh

quaint mantle
tall dragon
quaint mantle
grim ice
vocal cloud
#

Don't try catch something that you can avoid try catching

quaint mantle
grim ice
#

@strong parcel sir u confused catching with if statements

strong parcel
#

😛

grim ice
strong parcel
#

Anyway, what is a persistent data container?

tall dragon
#

a container

woeful crescent
#

It takes a lot of processing power to handle an error. Best to avoid it whenever possible.

tall dragon
#

for persistent data

#

:D

grim ice
strong parcel
#

Okay, I will

eternal night
#

Eek, not really an abstraction of NBT

#

you won't be able to use it to modify minecraft relevant tags

#

think of it as a fancy map that is persisted on entities/items/whatever provides it through server restarts

grim ice
eternal night
#

Well, yea i uses NBT but it shouldn't be seen as designed to be an NBT interface

grim ice
ivory sleet
#

point is, if minecrafts persistence data format or general implementation were to change PDC would most likely be completely unaffected by that change (in high terms)

vocal cloud
#

2Hex is just Alex's alt account at this point lol

eternal night
#

lul

grim ice
#

Lmao

#

I have many things saved up

#

even 7smile7's

#

useful stuff

#

Anyways I need a lib idea :(

strong parcel
#

An idea for a new library?

grim ice
#

preferably something related to serializing

#

yes

strong parcel
#

googles serializing

ivory sleet
#

just steal some lib features from other libs and make them better

grim ice
#

Eh

#

not my thing

lavish hemlock
#

e z

grim ice
#

I would want to make something original

vocal cloud
#

Pick something that makes people's toes curl. Like excessive reflection where it's not needed :D

ivory sleet
#

😒

ivory sleet
#

oo

#

on spigot?

vocal cloud
ivory sleet
#

interesting

#

I might start writing replies again

#

tho I dont have any good quotes to come with atm

#

I am a bit embarrassed about the seemingly almost but not really 5 star review, though amused at the same time :]

#

wowow

#

okay

#

so

#

very epic grandest of grand moments 🙂

#

lets see if my phone wants to help me login into spigot for ONCE

#

lmao

#

indeed

#

its peculiarly intriguing, ye

#

ultra spectacularly blazing performance

#

lol

#

yupp

#

to think a single plugin could be the solution

#

it did cost me some lines, but we gotta look at the bigger picture riteeee

crude loom
#

What is the default value of a sound effect's volume and pitch?
Asking for the command

player.playSound()
vocal cloud
#

I imagine it's in the source

crude loom
#

I need to enter a value though, do I just insert "1"?

quaint mantle
#

How would I save a Location in the config?

#

Doesnt seem like I actually can e.e

ivory sleet
#

just like

#

set("blahpath",locationObject)

quaint mantle
#

alr

ivory sleet
#

and then ofc hit save(File) as well

#

ye you rite

#

IO operation hence resource intensive hence bad :xxx /s

vocal cloud
#

Wait that's another idea for reflection. Object serialization hyperKEKW

lavish hemlock
#

Unsafe is better suited for serialization

ivory sleet
#

which is alr done by gson (so moshi also :))))altho it as maow just stated uses unsafe as well

lavish hemlock
#

My problem with Gson is that it only works with JSON :p

ivory sleet
#

ye

#

configurate is my bae sometimes

lavish hemlock
#

And my problem with Moshi is that kotlinx-serialization exists lmao

ivory sleet
#

lmao

#

ye

#

well

#

I dont use kotlin now so hehe that thing gets defenestrated the moment I see it

lavish hemlock
#

kotlinx-serialization is like... serde for the JVM

ivory sleet
#

ugh discord auto correct is uhm... interesting

golden turret
#

guys

lavish hemlock
#

I personally like TOML as a configuration format

ivory sleet
#

myeah toml or hocon

lavish hemlock
#

YAML and XML are icky and most other formats are not designed for configuration

ivory sleet
#

I mean I do see yaml being quite powerful since you have anchors and that shit

golden turret
#

if the map can be resized and the canvas uses bytes to cursor, pixels and etc, how am i supposed to draw pixels at 132, for example

ivory sleet
#

but yeah it kinda becomes nested as you go unfortunately

lavish hemlock
#

(unless you use StrictYAML, which disallows anchors since they're a symptom of poor structure)

ivory sleet
#

lmao ye

lavish hemlock
#

(also YAML anchors make the language susceptible to recursive expansion attacks)

ivory sleet
#

well to some extent they imo can add manageability and readability

#

altho conversely they're sort of (unrestricted) gotos which is bad

grim ice
#

eh its useless

lavish hemlock
#

oh btw have you ever coded in Batch, Conclure?

ivory sleet
#

hehe

#

my first language

lavish hemlock
#

same lol

#

Batch is awful I'm never working in it again

ivory sleet
#

truly is

lavish hemlock
#

as soon as you need to do anything more than if statements and jumps

ivory sleet
#

I used to fake hack people mostly

lavish hemlock
#

it like

#

just devolves... into long stretches of bad design decisions...

ivory sleet
#

lol deplorably unfortunate cause you'll get loaded with demonic spikes trying to slaughter you

lavish hemlock
ivory sleet
#

oo

#

damn thats dedication

lavish hemlock
#

text-based games that uhh... weren't very good

#

the most complicated feature was savefiles

ivory sleet
#

myes

lavish hemlock
#

which aren't that complicated tbh

vocal cloud
#

Gotta add pong to the spigot log

ivory sleet
#

ye

#

hopefully we get a message log soon

#

btw

lavish hemlock
#

I really like developing in Fabric

ivory sleet
#

same

#

altho I use mojmaps

lavish hemlock
#

it's super easy to launch a Minecraft client straight from IDEA

ivory sleet
#

meh

#

sure its easy but like

lavish hemlock
#

also mixins are ✨ great

ivory sleet
#

you get the status thing error due to offline modee

golden turret
lavish hemlock
#

literally single modImplementation dependency + program argument

ivory sleet
#

oo

#

let me look that up

#

cuz I asked a while back

#

and they said most work arounds would be hacky one way or another

grizzled pier
#

Hey, this might be a bit of an X-Y problem but does anyone know if default minecraft command tab completion is handled clientside on 1.16? I'm at my wit's end here trying to remove some entries from minecraft commands and chat tab completions, but no packets are sent between client and server so it seems like this is clientside.

The context for this is that I am using custom entries in the tablist to sort it properly, e.g. using GameProfiles with names like 001, 002, etc to order them, but this causes those numbers to be suggested rather than the actual usernames. I don't have this issue with plugin commands, only for minecraft commands like /teleport and chat.

keen basin
#

can some one help me (command Prompt closed automatically when i open it.)

lavish hemlock
ivory sleet
#

oh yeah btw Maow how do u structure classes into packages

#

cuz rn

#

no clue what to put where

#

I'

desert musk
#

how do I suppress the "Respawn point set" message on interacting with a bed (and how do I actually make it not set the spawnpoint)

lavish hemlock
ivory sleet
#

Ive seen some splitting it up into client and server

#

oh one is a set of constants

lavish hemlock
#

and uhh

ivory sleet
#

or actually 4

lavish hemlock
#

you probably want like a item, entity, util structure here...

ivory sleet
#

hmm yeah

grizzled pier
lavish hemlock
#

I personally use client for client-side only, but never server

ivory sleet
#

ah

lavish hemlock
#

in client you'd include your gui and render stuff

spare canyon
#

when i hide playerA from playerB using playerB.hidePlayer(playerA), will playerB see playerA in tab?

grizzled pier
#

nope

desert musk
grizzled pier
#

but they will see them in chat, unless you add custom logic to handle for that

spare canyon
ivory sleet
grizzled pier
spare canyon
#

thx man

golden turret
ivory sleet
#

zacken if you're interested I can invite you

#

(to a discord)

tardy delta
#

wait maths

golden turret
#

imagine having 129 blocks

tardy delta
#

/ Byte.MAX_VALUE?

#

🤔 🤔

#

idk what im saying lol

#

if the scale is like default, is the max cursor value 128?

golden turret
#

it will be always 128

tardy delta
#

pain lol

grim ice
#

im bored

#

give lib idea uwu

river oracle
#

A good inventory lib

tardy delta
#

wwrite an uwu pwluwgin

#

OwO

ivory sleet
#

make a lib to stream anime through minecraft :]

hasty prawn
#

And detect if they try to stream non-anime, and blow up their server if they do.

sage dragon
#

Is the Beacon laser actually clientside?

hasty prawn
#

Yes

sage dragon
#

Oof

hasty prawn
#

start.cat

#

cat.jar

sage dragon
#

Yes, please

round finch
#

sounds like a infectious cat

tardy delta
#

make a lib to blow up the server if theyre using 1.8

round finch
#

lib there delete server if they're not old enough

#

😆

hasty prawn
#

rip most the servers

#

I feel like most server owners are 13-14 year olds who stole their parents credit card for commissioning people

eternal night
#

lib that runs in outdated servers and automatically upgrades them

sage dragon
#

Which isn't exactly what I wanted, but it's going to be good enough

opaque marsh
#

Mapping problem with SpecialSource (using gradle and spigot 1.18.1)

round finch
tardy delta
#

lol how

#

lets remove the server jar while running

round finch
#

updates on restart?

ivory sleet
#

lib that shutdowns 1.8 servers :>

tardy delta
#

i already said that :)

ivory sleet
#

oo

#

very good

round finch
#

1.7.10 servers too?

ivory sleet
#

yes

tardy delta
#

everything under 1.12

ivory sleet
#

if under 1.8 the explosion should be a nuclear reaction at the very least

dreamy chasm
#

Advice on storing crafting recipes

tardy delta
#

Thread.sleep(Integer.MAX_SIZE) is funnier

tender shard
#

what do you think, does it make sense to already cache the keys from 0 to 100? or should I just ignore it and only get them when needed?

public final class NamespacedKeyUtils {

    private static final Map<String, NamespacedKey> KEY_KEYS = new HashMap<>();
    private static final Map<String, NamespacedKey> VALUE_KEYS = new HashMap<>();
    
    static {
        // Caching the first 100 keys. I think that's reasonable for most use cases
        IntStream.range(0,100).forEach(number -> {
            getValueKey(number);
            getKeyKey(number);
        });
    }

    public static NamespacedKey getKeyKey(final String name) {
        return KEY_KEYS.computeIfAbsent(name, String -> NamespacedKey.fromString("k:" + name));
    }
quaint mantle
#
fn main(){loop{}}
ivory sleet
tardy delta
#

mhm ye

tender shard
#

oki

round finch
#

🥴 streams and lambda

brain no work

tardy delta
#

they are fun

round finch
#

mah brain can't understand these patterns

#

right now

hasty prawn
#

Streams and Lambdas are great

round finch
#

reeeeeeee

#

why?

ivory sleet
#

streams are... interesting

tardy delta
#

my brain wasnt understanding concurrency either

ivory sleet
#

readability itsvollx

round finch
#

it looks so functional

ivory sleet
#

functional is great

#

or well

round finch
#

functional programming
oh gosh

ivory sleet
#

Stream::peek and Stream::forEach isn't purely functional

#

oo

#

there you mentioned something rather good

tardy delta
#

lol im more using forEach than an actual for loop

hasty prawn
#
Runnable runnable = () -> System.out.println("Hi");

Runnable ugly = new Runnable() {
  @Override
  public void run() {
    System.out.println("hi");
  }
};

I think there's a clear winner here

round finch
#

do data science use this?

ivory sleet
#

data science might

#

one part of data science is programming language paradigms

#

in which for instance functional programming is a topic

#

specifically lambda calculus and group as well as category theory

#

if you wanna look into the mathematics of it

round finch
#

i saw this much "->"

one of the more data science languges

#

less very on programming

ivory sleet
#

"->" is heavily embedded into programming

#

I mean anonymous classes with a single function, or well just a function generally

#

anyways -> is usually called a lambda, or arrow function but its just an anonymous pure function at most

tender shard
#

pretty basic and probably not even correct explanation but that's how I learnt to understand what lambdas etc actually are

round finch
#

🙃

opal juniper
#

how many bytes is a UUID

tall dragon
#

16 bytes iirc

tender shard
#

yes

#

it's basically 2 longs

smoky oak
#

how do consumers work again?

#

Consumer<T> consumer = (n) -> {}; or smth like that?

hasty prawn
#

yes

#

Where n is type T

tardy delta
#

t-> t.doSOmething()

smoky oak
#

can i access n in the {} ?

hasty prawn
#

yes

smoky oak
#

i mean as n

tardy delta
#

ye

smoky oak
#

ok

tender shard
hasty prawn
#

Would be pretty worthless if you couldn't

tender shard
#

yeah lol

#

I hate the fact that you can't use "__" as parameter name in java 9+ anymore

smoky oak
#

python user right here

hasty prawn
#

fr...

smoky oak
#

also

tender shard
#
    public static NamespacedKey getValueKey(final String name) {
        return VALUE_KEYS.computeIfAbsent(name, __ -> NamespacedKey.fromString("v:" + name));
    }
#

this works in java 8 but not 9

#

I've always used __ for unused parameters

smoky oak
#

wait why do you need to put it into a consumer anyways then?

tardy delta
#

oh i just gave them the first letter of the parameter name

tender shard
hasty prawn
#

I always just use o -> if it's unused usually

ivory sleet
#

Function actually :>

tender shard
#

oh yeah

#

my bad

#

a consumer would make no sense

ivory sleet
#

sorry for the nitpick, I just had to 😅

smoky oak
#

also seems fine for me?

hasty prawn
#

D:

ivory sleet
#

__ 😐

tender shard
#

try to compile that on java 9+

hasty prawn
#

that looks awful

smoky oak
#

watch me

ivory sleet
#

state -> {...} is enough tho 😄

smoky oak
#

worked

hasty prawn
#

It worked for me too ^

smoky oak
#

your argument is invalid @tender shard

ivory sleet
#

was there even an argument to begin with?

tardy delta
#

god ( )

hasty prawn
#

It was more alex being sad over his imagination than an argument

ivory sleet
#

I mean I believe $ has become gradually less legal

smoky oak
#

(god == null) is true

ivory sleet
#

unsure if that applies to _ as well

tender shard
#

weird, I've read a book that said it's not allowed in java 9+ but "might be allowed again on later versions"

hasty prawn
#

Oh

smoky oak
#

waitaminit

hasty prawn
#

I'm on 17 so maybe it got readded

smoky oak
#

DOUBLE underscore is fine

#

SINGLE is keyword

ivory sleet
#

ah

#

mind sharing code?

#

since, provided that you wrote the correct code that ought to work just fine

tender shard
#

The second possibility can look like this, adding two underscores
use - the use of an underscore for an identifier
has been banned since Java 9, but might be in later Java versions
to be reintroduced:

tall dragon
#

did it print anything?

tender shard
hasty prawn
#

Hm maybe

tall dragon
#

what

tender shard
#

getInventory() simply prints the toString() of the inventory

#

which likely consists of just the Class name and the hashcode

#

yes that's correct

tall dragon
#

yea

#

try printing try getInventory()#getContents()

smoky oak
#

can i somehow return values from a consumer? It's a unfortunate requirement of the library I'm using

hasty prawn
#

Use Function<> instead of Consumer<>

smoky oak
#

you do know what the word required means correct?

#

i cant not use a consumer

hasty prawn
#

lol sucks for you then

tall dragon
#

fork the library ig

smoky oak
#

he lp ful

tall dragon
#

change it :)

hasty prawn
#

You're the one who decided to get mouthy 🤷‍♂️

smoky oak
#

static abuse time

tall dragon
#

😒

tall dragon
smoky oak
#

got a better idea?

#

the consumer itself relies on a consumer

tall dragon
#

change ittt

tender shard
smoky oak
#

if i call a consumer does it still run before anything after that?

signal atlas
#

Guys can i use Main main = new Main(); instead of dependency injection ?

eternal night
#

no

smoky oak
#

yes

#

its just not good practice

eternal night
#

you may not instantiate your plugins main class on your own

smoky oak
#

oh wait

tender shard
#

JavaPlugin can only be instantiated once

eternal night
#

^^

tender shard
#

oh I wanted to reply to Moterius

muted sand
#

how do I see if a player crossed a specific line?
PlayerMoveEvent could, but wouldn't that be intensive as fuck when they're not even remotely near the line?

smoky oak
#

yea you cant do new Main() but you can store your main instance in a static variable

tender shard
#

I always quote the wrong people

signal atlas
#

oh i see thank you guys 🙂

tender shard
smoky oak
muted sand
smoky oak
#

very often thrown events can still work lag-free if the checks are simple

granite owl
#

is there a non deprecated method like getOfflinePlayer?

smoky oak
#

for example blockPhysicsEvent block.getType

muted sand
#

o, hm

tender shard
#

can't you just use locations?

tender shard
muted sand
#

oh, yea, that exists

smoky oak
granite owl
#

xD

tender shard
#

you can use it, it'll work fine

granite owl
#

so just suppress the warning?

tender shard
#

it's just deprecated because it can be inconsistent

#

e.g. if a player changed their name and havent joined your server yet, it will still need the old player name

granite owl
#

yea but i need it exactly for its inconsistent behavior xD

tender shard
#

ItemMeta#getLore, change the first line, then setLore again

granite owl
muted sand
tender shard
#

and second of all, this would require a player to be EXACTLY at this location

#

if their location differs by 0.0000001 blocks, it won't work

lean gull
#

how do i use something that is deprecated? i'm tryna do world gen but biomegrid is deprecated

muted sand
granite owl
#
public static void getUUIDByName(CommandSender sender, String str)
    {
        Object p = Bukkit.getPlayer(str);
        if (p == null) p = Bukkit.getOfflinePlayer("");
        
        if (p != null)
        {
            
        }
    }
```this okay to do then?
spring minnow
lean gull
tender shard
#

of course

lean gull
#

ok, ty

spring minnow
lean gull
#

i'm using an old tutorial

tender shard
#

yeah something never gets just deprecated without replacement

spring minnow
#

mfnalex can you help me with a code?

lean gull
#

there's BiomeProvider

tender shard
#

it says "get..." but it's a void?

granite owl
#

its not finished yet ofc

#

was more about the typecast

tender shard
#

what do you need the CommandSender for?

tardy delta
#

also Bukkit.getOfflinePlayer(""); wont return anything that you can use

tender shard
#

btw you can also get offline players by name without deprecated methods

#

by simply looping over them 😄

#

why don't you just do this

    public static UUID getUuidFromName(final String playerName) {
        return Bukkit.getOfflinePlayer(playerName).getUniqueId();
    }
granite owl
#

okay give me a few minutes to write it out

#
@SuppressWarnings("deprecation")
    public static UUID getUUIDByName(String str)
    {
        Player p = Bukkit.getPlayer(str);
        if (p == null) p = (Player) Bukkit.getOfflinePlayer(str);
        
        if (p != null)
        {
            return p.getUniqueId();
        }
        
        return null;
    }
tender shard
spring minnow
#

actually he could if it would

#

like

#

Player extends to offlinePlayer

#

but in this case

tender shard
#

well getOfflinePlayer returns an OfflinePlayer

spring minnow
#

p == null

#

sooo

tender shard
#
public static UUID getUuidFromName(final String playerName) {
        final Player player = Bukkit.getPlayer(playerName);
        return player != null ? player.getUniqueId() : Bukkit.getOfflinePlayer(playerName).getUniqueId();
    }
spring minnow
#

you cant

#

at this point

tender shard
spring minnow
#

you could just always use Bukkit.getOfflinePlayer

#

cuz

#

its same thing, both give uniqueId

#

public static UUID getUuidFromName(final String playerName) {
return Bukkit.getOfflinePlayer(playerName).getUniqueId();
}

#

would work the same way

#

btw how can i do the '''java thing to write code?

ivory sleet
#

```java
code

spring minnow
#

Thanks

#

how can i do this symbol? (i have italian keyboard)