#help-development

1 messages · Page 1959 of 1

young knoll
#

I’ve put entities in items before

maiden thicket
#

future is async

young knoll
#

Idk if I still have the code

tardy delta
#

ye thats why i ask

maiden thicket
#

no it wont u have to execute in the whencomplete

#

unfortunately

young knoll
#

WhenComplete runs when the future is complete

mortal hare
#

it will get executed instantly

maiden thicket
#

yeah it'll get executed but wont get what h want

grim ice
maiden thicket
#

probably

tardy delta
#

ah so i would need to put it in the whenComplete

maiden thicket
#

i recommend it yeah

young knoll
#

Just use get()

maiden thicket
#

it will execute but probably will now load what u want it to

young knoll
#

🤡

maiden thicket
#

cant it

mortal hare
#

how do you guys store ExecutorService thread pools

#

you need to shutdown somehow

grim ice
#

isnt .join() better, conclude once told me about it and it worked fine

maiden thicket
#

i dont

#

ez

mortal hare
#

and encapsulate them

young knoll
#

get just blocks until completion

#

Essentially making the future pointless

mortal hare
#

i fail to encapsulate them due to shutdown

maiden thicket
#

just block the whole thread w an infinite while loop

#

ezpz

tardy delta
mortal hare
#

yea

tardy delta
#

lagging the server so no

mortal hare
#

until the task is complete

grim ice
#

so what even is the point of a completable future when u use .join() bruh

#

tf

tardy delta
#

block the thread to wait for the result

#

idk useful in async events

young knoll
#

?paste

undone axleBOT
tardy delta
#

i should learn more about threads smh

young knoll
#

Be warned it’s old and kinda messy

quiet ice
#

This is why I prefer Flows over Futures

young knoll
#

And also spigot mapped

quiet ice
#

Don't use futures, they are utterly pointless

tardy delta
#

what is a Flow?

quiet ice
#

java.util.concurrent.Flow, J9+ exclusive

young knoll
#

Go with the flowwww

tardy delta
#

wha does it do

#

concurrency is a bitch

quiet ice
#

It works with a publisher-subscriber model, so it won't force you to constantly poll whether it has completed yet

#

Concurrency is life

#

Don't talk anything bad about my java.util.concurrent package

grim ice
#

i assume getNBTData(Entity en) is

net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) en).getHandle();

 NBTTagCompound nbtTagCompound = new NBTTagCompound();
en.save(nbtTagCompound);
return nbtTagCompound;``` @young knoll
#

first time working with nms ive found this in google

#

i do know that this will only work in 1.16

#

but is possibly how you did it

quiet ice
#

it's at least something

young knoll
#

Full class

grim ice
#

alr tysm

stuck flax
#

how do you remove 1 itemstack from the player, for example if im holding 2 diamonds i only want to remove 1, not 2

autumn talon
young knoll
#

setAmount works

grim ice
#

they should make a decreaseAmount(int) method tbh

#

or do they

hasty prawn
#

They do it's called setAmount with a lower number

tardy delta
#

lol

modern rock
#

do you know any mods / plugins for stone drop for version 1.18?

lost matrix
modern rock
#

what I mean is that every amount of stone that is excavated, the raw materials are dropped out

lost matrix
young knoll
#

Or a datapack

modern rock
#

thanks

supple elk
#

anyone know what might cause this?

#

is super vague

#

trying to maven install

#

think the pom could be the issue?

#

If I remove properties

#

I get this

lost matrix
#

what does the stack tace say?

#

Try cleaning first. Into terminal:
mvn clean install

supple elk
#

tried cleaning already

#

but will do again

#

only issue it has is lombok...

#

🤔

hasty prawn
#

Problem solved then, don't use Lombok peepoGiggles

lost matrix
# supple elk

So it compiles now? If not show the rest of the log

supple elk
#

🤦

supple elk
#

that is all it says >_>

#

o

#

I'm trying to install

#

should i be doing compile?

vocal cloud
#

You can click up the stack on the left to see more

lost matrix
#

I only know how to get the trace when using the terminal. Could you please do that?

supple elk
#

ah I see

lost matrix
#

There you go.

supple elk
#

Source option and target option?

#

actually

#

think i found it

lost matrix
#

maven compiler plugin

supple elk
#

yeah works now

lost matrix
supple elk
lost matrix
#

Or this

#

Java 8 😄

supple elk
#

hmm

#

I want to be using 8

#

*17

#

not 8

lost matrix
#

Also 8 shouldnt work

supple elk
lost matrix
#

its 1.7 1.8 9 10 11

worldly ingot
#

8 is 1.8

supple elk
#

or will it not work on the server?

worldly ingot
#

Either they added support for that naming scheme or it defaulted back to 5 lol

lost matrix
#

Maybe the compiler plugin has a dumdum filter for that

placid fog
#

i'm a total noob at this how would i implement faster crop growth rate?

spiral light
#

you want to make crops grow faster ?

deft forum
#

if i say continue; in a for loop it will go for the next run right?

visual tide
#

it will abort the current run and skip to the next run

deft forum
#

thx thats what i meant

visual tide
#

is there an equivalent to BlockReed.canPlace in the api?

midnight shore
#

Guys how can I return some items in the crafting grid when the craft is done? Like when you craft cakes with milk it gives you an empty bucket

brave sparrow
#

CraftItemEvent

midnight shore
#

Yeah but how can I set the grid

spiral light
#

getInventory.setItem

midnight shore
#

And that inventory will be the grid right?

placid fog
spiral light
#

all crops or just in a range ? with api or without api ?=

placid fog
#

all crops lmao what's api

spiral light
midnight shore
#

Okay

#

Ty

spiral light
placid fog
#

like api as using another separate plugin is that what you mean

spiral light
#

NMS would be code from minecraft itself which changes mostly every update

midnight shore
#

Application programming interfaces

spiral light
young knoll
visual tide
spiral light
#

just use the gamerule and set the randomTickSpeed higher

#

using api and affect all blocks would need you to check every world, every chunk, every block and thats rly bad ....

brave sparrow
#

If you set the randomTickSpeed higher that’s going to impact anything using it, not just crops

tardy delta
#

^^

placid fog
#

yes i was about to say

#

i want to make all crops to grow slower but then change its growth speed when a player does something

tardy delta
#

maybe changing something in the TickEvent?

young knoll
#

There is no tick event

#

I would basically make my own RandomTick system

tardy delta
#

oh i thought i saw it

brave sparrow
#

Here’s what you could do (not necessarily the optimized solution):
On any chunk load, check all the blocks in that chunk for a crop. Cache these crops in a map or something similar.
On any block break/place/physics/etc if a crop gets planted add it to the cache, if it gets removed remove it from the cache
On chunk unload remove all the crops in that chunk from the cache

young knoll
#

^ That also works

brave sparrow
#

Then you tick those crops at the rate you want and that will be their growth

mortal hare
#

so I asked a question a while ago, and i found an answer

#

In a single-core CPU, we may get concurrency but NOT parallelism.

#

so I was right

brave sparrow
#

Yeah

#

I think we said that before lol

tardy delta
#

should i make a separate method to check on the db if an user exists or should i just try to load them and check if its != null?

mortal hare
#

i would load all data at once async tbh

#

that way you don't need to use async tasks

tardy delta
#

i mean im loading the user when they log in

mortal hare
#

to access the db without blocking the main thread

#

oh

#

you meant loading all the data of player

#

at auth

mortal hare
#

i would still load it

brave sparrow
#

Both valid strategies

#

Gonna depend on your use case

mortal hare
#

because there's bigger chance that the connecting player would log on

tardy delta
#

i think best thing is to load it so i could store it in a variable and wolk with it if its nonnull

brave sparrow
#

If that’s what you’re trying to do then do that

#

But if you’re ONLY trying to see if they exist, you can just check if it’s in the database

#

Highly dependent on what you’re actually trying to do

mortal hare
#

Each thread is created in Java 8 will consume about 1MB as default on OS 64 bit

#

oh no

#

my precious 1mb of ram

tardy delta
#

when the player joins, i want to check if they have played before (and not in terms of: they have joined the server before, but they actually chose a kingdom to play in (im making a kingdom server)) and when true, im loading their data or otherwise im creating a new user on the database

muted sand
#

what's the database key in bukkit.yml? Can all plugins use it?
and how do i save / fetch bans from a database, removing the need of the banned-players file?

tardy delta
#

no no im not saving their data when they havent chosen a kingdom to play with (im making a kingdom server)

mortal hare
#

i would just lazily load all the data of the player to the memory

waxen barn
#

Hi there, I need to get nms class named "NetworkManager" (spigot mapings), how can I get it?

mortal hare
#

because as i said there's bigger chance that the player played on the server before

tardy delta
lost matrix
mortal hare
#

load and unload

#

if he quits

tardy delta
#

or just an completablefuture?

brave sparrow
tardy delta
#

embedded h2 db 😌

lost matrix
mortal hare
#

i have an arduino

#

how much RAM does arduino have

brave sparrow
#

@tardy delta load the data on the AsyncPlayerPreLoginEvent

tardy delta
lost matrix
brave sparrow
#

No need for a completablefuture

#

Because that event happens async already

#

Make the database call in there

tardy delta
#

hmm people told me to not do that because there is no getPlayer() method and the uuid might be fake

#

users might have a ban too

brave sparrow
#

That’s not how it works

#

Lmao

mortal hare
#

why

#

i think he's right

brave sparrow
#

AsyncPlayerPreLogin happens after Mojang authentication

#

So the UUID won’t be fake

mortal hare
#

what if the server is cracked

lost matrix
brave sparrow
mortal hare
#

🤔

brave sparrow
#

@tardy delta you just unload their data after x ticks if they never actually complete the join

mortal hare
#

i haven used that event before

#

so i cant tell really

lost matrix
brave sparrow
#

^

tardy delta
#

hmm could give it a try

vague swallow
#

umm... Can someone explain this to me please:

I mean... maybe I am stupid but

brave sparrow
#

That’s the event you’re supposed to use for loading data off the main thread on player connect

tardy delta
#

but loading data sync feels like a pain

brave sparrow
#

It’s not a pain

mortal hare
#

is there any fancy way to do file deletion async

brave sparrow
mortal hare
#

im using Files.delete() rn

#

but its synced

#

and i need to fire up

#

threadpool

lost matrix
mortal hare
#

or FJP

kind hatch
brave sparrow
#

Bukkit.getScheduler().runTaskAsynchronously()

tardy delta
mortal hare
tardy delta
#

thats what it says

brave sparrow
vague swallow
#

it returns an int

lost matrix
#

Ok so im not tripping. You can pass Integer as an int parameter.

brave sparrow
tardy delta
#

hmh not

brave sparrow
#

But if the Integer is null you get an exception

lost matrix
#

throws an npe iirc

brave sparrow
tardy delta
#

the method also says getForceLevel, not really something that would return a boolean

mortal hare
tardy delta
#

?di

undone axleBOT
tardy delta
#

singleton brr

vague swallow
tardy delta
#

it returns an int so

mortal hare
#

waaait

#

i have an idea

tardy delta
#

you cant use it in an if statement unless you do like < or > or something

mortal hare
#

you're a genius

#

i literally have plugin instance

tardy delta
#

🥲

mortal hare
#

lol

#

dum dum

vague swallow
#

but

#

that's the problem

#

it says that it requires a boolean

#

but

tardy delta
#

@tender shard you said something why not to load players in the asyncprelogin event right?

#

lmao

#

learn java

#

isnt it that difficult

kind hatch
#

Is there a way to use hex color codes with TextComponents while the text input can be configurable? To clarify, would it be possible to take a message like this "&7Hi there, #03A9F4Nothixal" and have it automatically converted to the proper colors?

I currently have a method that does this for chat messages, but when I want to add something like a link or hover text, it doesn't return the right color. I'm trying to avoid hard coding messages whenever possible.

vague swallow
tardy delta
#

it expects a boolean

brave sparrow
# vague swallow

It’s returning an int, you need to apply an operator to that int to make it a boolean expression

tardy delta
#

^^

vague swallow
#

oh lmao

#

sorry

#

I found out what I did wrong

#

thanks for the help

lost matrix
tardy delta
#

C++ moment lol

mortal hare
#

Map<Player, List<Pair<Integer, Pair<ItemStack, ObjectDataFile<List<ItemStack>>>>>>

#

generic moment 🥴

lost matrix
#

If you see nested collections then it is 100% time for new classes

mortal hare
#

it is

solid lion
tardy delta
#

are the log messages printed?

solid lion
#

yes it is logging out every block broken but it drops nothing

#

not hitting any else statements

spare patio
#

because the statement in your if is true?

tardy delta
#

cat uwu

solid lion
#

yes

spare patio
#

I don't think the code you've sent is causing the issue

solid lion
#

unless my config file is formatted wrong

spare patio
#

still no

#

do you get any errors?

solid lion
#

no errors, i do have another issue though where when i run the command to toggle the plugin on or off. it doesnt toggle off

tardy delta
#

what does define 'if the user has played before'? the usercache.json?

solid lion
#

always says "Autosmelt toggled "on"

#

so im assuming theres an issue with my getters and setters

spare patio
#

hold on

#

oh actually no, at least for spigot 1.8

tardy delta
#

hmm its a boolean flag that becomes true when the 'readExtraData' method id called

midnight shore
#

Is it possible to add a value to an Enum with code?

tardy delta
#

1.8 💀

spare patio
#

well

#
public boolean hasPlayedBefore() {
    return getData() != null;
}
mortal hare
#

is it possible to get generic type class at compile time

#

like

#
List<Integer>.class // not legal
#

probs not

eternal night
#

I mean, java erases generic types

spare patio
mortal hare
#

because this is not cpp templates

sullen marlin
#

yes, kind of

ivory sleet
#

dovidas non reifiable types iirc

sullen marlin
#

if you make a class you can get its type

#

see: gson typetoken

ivory sleet
#

^

sullen marlin
#

but not of a standard variable / field

ivory sleet
#

you create an anonymous "subtype" that at compile time enforces the type by passing it to the supertype type parameter in its declaration

tardy delta
# spare patio well

only becomes true when this method inside craftplayer is called, it has a boolean field in 1.17.1

sullen marlin
#

TypeToken<List<String>> list = new TypeToken<List<String>>() {};

#

spigot includes by default

mortal hare
#

how does it get it tho

ivory sleet
#

^ due to the {} its an anonymous subclass of TypeToken

#

and as you know

spare patio
quaint mantle
#

how do i exclude an array to not be deserialized in gson?

ivory sleet
#

class ListString implements List<String> would require to know the type even at runtime dovidas

eternal night
#

transivite

sullen marlin
#

make it transient

#

private transient String[] potato;

quaint mantle
sullen marlin
#

hmmm

mortal hare
quaint mantle
#

so i can deserialize it with a type adaptor i found

sullen marlin
#

handy

ivory sleet
#

idk what exact call the type token does

quaint mantle
#

@Expose(deserialize = false)
public ArrayList<ItemStack> menuitems;

#

i have this

ivory sleet
#

but by deriving a class with generic type parameters and then pass the types would result in non erasure

#

so then with reflection you're basically able to pick the type up

mortal hare
#

yea

quaint mantle
#

but it is still deseralizing

#

and therefore giving an error

mortal hare
#

i saw this this.getClass().getTypeParameters() on stackoverflow long before

#

and it stated the same

ivory sleet
#

myea

#

its a known trick, sadly a bit verbose

quaint mantle
#

since gson can't serialize item stacks

mortal hare
#

that whenever subclass defined a type for a generic, you can get its subclass types

lavish hemlock
mortal hare
#

the problem is

#

im extending a generic class

lavish hemlock
#

(Note: that one uses constant pool hacks)

mortal hare
#

and i cant use this in super constructor

ivory sleet
#

I mean there are some ugly tricks to bypass that

mortal hare
#

the only way to solve this probs is to wrap around the object

tardy delta
#

call it without 'this'?

mortal hare
#

that wouldnt work

#

its the same

lavish hemlock
tardy delta
#

meh

ivory sleet
#

you could declare a Consumer<? super SuperType> in the super constructor, very ugly but works

spare patio
#

enums are constants

ivory sleet
#

(presupposing you in fact have control of the super class)

spare patio
#

if you wanna dynamically add values, don't use enums

mortal hare
#

use EnumSet if you want to group enums

spare patio
#

"Is it possible to add a value to an Enum with code?"

#

original question

mortal hare
#

i think i'll just wrap around the object

#

its seems most suitable solution

ivory sleet
#

Whitz no

midnight shore
ivory sleet
#

the entire purpose of enums are that all of its instances are in principle known at compile time

mortal hare
#

he literally answered it

quaint mantle
mortal hare
#

to another person

ivory sleet
#

oh

#

im a potato

spare patio
#

happens

mortal hare
#

im not sure though

ivory sleet
mortal hare
#

are you deserializing objects with gson?

quaint mantle
quaint mantle
#

for deserailization

sullen marlin
#

just use yaml like a normal person

quaint mantle
spare patio
#

I'm not a normal person

#

I like json more

ivory sleet
#

I mean valid json is valid yaml essentially

quaint mantle
#

since i started java like 2 weeks ago and i suck

quaint mantle
#

yml is slower

mortal hare
#

correct

quaint mantle
#

especially if the file is giant

mortal hare
#

well the file size is bigger though

ivory sleet
#

depends

blazing scarab
#

if yoy have giant json files you are doing something wrong

quaint mantle
#

i am making a menu plugin

ivory sleet
#

yes

quaint mantle
#

and menus require items

#

and itemstacks + itemmetas are big strings

#

so the json will be huge if you have like 11 items

tardy delta
#

serialized items and an iventory can contains max 52 stacks or something so there is a limit at your file size uwu

ivory sleet
tardy delta
#

serializing itemstacks looks ugly too, tried it in base64 was even worser

#

lol

mortal hare
#

*feels like a god, when he serializes items in nbt*

quaint mantle
#

u use commands to make menus

tardy delta
#

itemstacks in databases is also pain

midnight shore
#

Is it possible to make an entity glow only for specific players?

ivory sleet
#

well its primarily good at representing a set of data values in a key pair format

blazing scarab
tardy delta
#

idk

mortal hare
#

i wonder if storing itemstack data as BLOB type in db would perform better

#

🤔

spare patio
#

binary, obviously

quaint mantle
blazing scarab
#

like, you have any alternatives? Break down everything into tables? No, thanks

mortal hare
#

base64

#

varchars

sacred mountain
#

i have an EntityDamageByENtityEvent and it detects when a fireblal explosion happens, and then sets the damage to all nearby entities in a certain radius. this is what i want it to do:

Fireball Explodes
Set damage, add damage to a variable/map
Set damage to all nearby entities, for each entity that is damaged also add damage to the same variable/map

After that, it will send a message to the player like "Your fireball hit 3 entities for 22 damage" but it sends it multiple times, because the event is being called and then its also going through the nearby entities at the same time

#

im trash at explaining

blazing scarab
mortal hare
#

i don't really know why

blazing scarab
#

Base64 is just encoded bytes but fat

mortal hare
#

yes

#

i agree

blazing scarab
#

idk maybe more readable

spare patio
#

EntityExplodeEvent?

blazing scarab
#

But idgaf i store UUID's as BINARY(16)

sacred mountain
mortal hare
#

i have only one great scenario where using base64 would be amazing

#

in web

sacred mountain
#

of the entities

#

around it

quaint mantle
#

yes i am stupid

#

tell me please

mortal hare
#

you can send binary data via address bar

stray crescent
#

Anybody know how to make a NPC into a shop that works with essentials and vault?

ivory sleet
#

well did you use gson?

mortal hare
#

on the web

spare patio
quaint mantle
ivory sleet
#

in that case you might have to implement a TypeAdapter or JsonSerializer/Deserializer (iirc the name)

mortal hare
#

without loading the picture itself, like HTML does

spare patio
#

just check for entities around and damage them

ivory sleet
#

sounds somewhat dumb

stray crescent
#

@ivory sleet dms bro

naive bolt
#

'PlayerDropItemEvent(org.bukkit.entity.Player, org.bukkit.entity.Item)' in 'org.bukkit.event.player.PlayerDropItemEvent' cannot be applied to '()'

#

why?

ivory sleet
#

Yes but I can't call rn Grenade, talking w/ some others, please respect that

spare patio
tardy delta
spare patio
#

you have to provide some arguments

#

wait why do you want to intialize that

dusk flicker
#

static

spare patio
#

ah it's not the constructor

sullen marlin
#

you want new PluginEvents()

#

you register your listener not the event

naive bolt
#

thanks

spare patio
#

I was right

quaint mantle
sacred mountain
quaint mantle
#

it runs everytime the server enables

#

so

#

i presume this is what is causing the error

#

since loadmenus worked without this

tardy delta
#

no need for static

spare patio
sacred mountain
#

good idea

solid lion
#

I think i found my issue, there is something wrong with my main command not actually toggling on and adding/setting the player to the Hashset

ivory sleet
#

veri pog

quaint mantle
#

i'm just gonna use org.json to deserialize

ivory sleet
#

or use the api 🧠

quaint mantle
sullen marlin
#

org.json is deprecated

young knoll
#

ItemStacks are ConfigurationSerilizable

sullen marlin
#

you can use gson to JsonObject for similar thing

ivory sleet
#

^

quaint mantle
#

gson does not work with deserializing item stacks, i need an alternate way to deserialize it

young knoll
#

It does if you make your own type adapter

ivory sleet
#

it does if you define an ItemMeta serializer

young knoll
quaint mantle
young knoll
#

You can save them directly to yml with spigots configuration API

quaint mantle
#

that might work

sullen marlin
#

json configuration api wen

quaint mantle
#

is there a snippet u can show me

#

no wae

sullen marlin
#

*for legal reasons this is a joke, json is not a config language

quaint mantle
#

json!

#

D:

ivory sleet
#

oo md5 technically tho

quaint mantle
#

mongo support when

ivory sleet
#

an impl for it like JsonConfiguration would be nice

quaint mantle
#

mongo storage api wen

sullen marlin
young knoll
#

What about toml

blazing scarab
#

mongo is for noobs

quaint mantle
#

morphia integration when

sullen marlin
quaint mantle
#

Love you md_5

#

frick it im gonna use yml

#

i dont care if its slow at this point

young knoll
#

What about .png configs

quaint mantle
#

omg true

sullen marlin
#

genius

quaint mantle
#

Lmaoo

ivory sleet
quaint mantle
#

.avi configs very memory friendly

#

.dat configs when?

blazing scarab
#

Spigot config api is still bad

sullen marlin
#

whats wrong with it

#

srs question

worldly ingot
young knoll
#

It’s bad

#

Duh

worldly ingot
#

Does it support jpg you reckon?

quaint mantle
#

.rar configs'

blazing scarab
#

ConfigurationSerializable

quaint mantle
#

.exe configs

young knoll
#

Discord based configs

quaint mantle
#

omg

#

skype based configs

sullen marlin
quaint mantle
#

no shot

sullen marlin
#

though I mean gui configs are already super popular

worldly ingot
#

unfortunately

quaint mantle
young knoll
#

I mean

#

Users are special

quaint mantle
young knoll
#

And text files are hard

sullen marlin
#

no

#

you cant love choco and me

quaint mantle
#

hm true

#

I choose md_5!

young knoll
#

I mean who has more spigot commits

#

Exactly

quaint mantle
#

👀

#

.jar config

#

.iml

#

.dll

grim ice
#

can i do rust with intellij

quaint mantle
#

this is why mum doesn't fucking love you

#

vine boom

#

❤️

#

ok i will stop joking in help dev

worldly ingot
quaint mantle
#

just more commits you know

young knoll
#

You have a girlfriend choco, you don’t need purples love

#

MD however is single 4 life

worldly ingot
#

I also have 3 dogs

#

:((

quaint mantle
#

I have 10

#

i have 2 guinea pigs and one cat

young knoll
#

Be careful that doesn’t change to 0 guinea pigs and a slightly fat cat

quaint mantle
#

Amber, Pixie, Binkie, Neo, Halo, Nova, Connie, Raffie, Obi, Ozzy

#

👀

quaint mantle
ivory sleet
quaint mantle
#

they are fatter than base64 bytes

young knoll
#

Wow you just submitted yours now

#

Smh

ivory sleet
#

yeah

#

well I havent thought about it much, but one day must be a first right

young knoll
#

I kept saying “Wow this could be a PR”

#

And then never did it :p

sullen marlin
#

do you not have suburbs in sweden

#

weird

sacred mountain
#

@spare patio tysm

#

working now

quaint mantle
#

what the

#

very poggers

sacred mountain
#

yesss

#

indeed poggers

#

throwable tnt next :)

spare patio
#

np

ivory sleet
#

I guess Vasastan would be it, might have forgotten that but you got the street I live on, so hopefully enough 😅

sullen marlin
#

ye it appears in google maps so good enough

quaint mantle
#

how do i serialize my arraylist to yml

sullen marlin
#

getConfig().set("test", list)

young knoll
#

Assuming the list contents are serializable ^

quaint mantle
#

/load it

sullen marlin
#

.get("test")

#

or getStringList or similar if you have one of those

quaint mantle
#

this is why md_5 is cool

#

wow i spent 13 fricking hours on making a json when i could have just done that the whole time

#

p a i n

quaint mantle
young knoll
#

List.toArray

sullen marlin
#

lists are better than arrays..... but list has a toArray method

quaint mantle
young knoll
#

Meh

#

Optimization!!!11

quaint mantle
#

no i mean the data it gets, how would i put it IN to that array

young knoll
#

Cast it

quaint mantle
#

since arrays are wiped after the server gets shut down

young knoll
#

get(“path”) returns an object you can cast

sullen marlin
#

(cast to List)

young knoll
#

(Isn’t there also a get method that takes a class)

sullen marlin
#

oh yeah

quaint mantle
#

wanna date md_5?

sullen marlin
#

I think there actually is

#

I never use it

young knoll
#

Lol

sullen marlin
#

getList(String, Class) or something

sullen marlin
tardy delta
#

grill hmm

young knoll
#

George Forman?

tardy delta
#

very hot

quaint mantle
#

only for you 😉

tardy delta
#

barbecue onlyfans special for yo

#

i scared everyone now i guess

quaint mantle
#

getConfig().get("Menus"); ok so if i put this in onenable the arraylist menuitems would automatically get filled with the data in the yml?

sullen marlin
#

menuitems = getConfig().get("Menus");

quaint mantle
tardy delta
#

getStringList() would be better i guess

young knoll
#

If it’s a string list

tardy delta
#

whats the difference between getList() which returns a List<?> and get() after casting it to a list?

#

you could use both

sullen marlin
#

nothing

quaint mantle
#

config.set("Menus", menu.menuitems);

#

this does not work

young knoll
#

?noteorking

#

?notworking

undone axleBOT
#

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

dusk flicker
#

we need to change that command

quaint mantle
dusk flicker
#

"does not working"

#

english is hard

muted sand
#

the bot command does not work

#

anyways
what's the database key in bukkit.yml? Can all plugins use it?
and how do i save / fetch bans from a database, removing the need of the banned-players file?

quaint mantle
#

sorry

dusk flicker
#

USE A PASTE

muted sand
#

etf

quaint mantle
#

i will i forgot

sullen marlin
dusk flicker
#

i'll put 5 bucks on 1.8

muted sand
#

oh appears I am slow in the head
what about the second part!

quaint mantle
muted sand
dusk flicker
#

the second part is just using a database, up to you how you implement it

sullen marlin
#

AsyncPlayerPreLoginEvent -> Check database -> deny login if banned

quaint mantle
#

config.set("Menus", menu.menuitems); this is the line

#

bruh

worldly ingot
#

(and do that with a blocking task - the event is async)

quaint mantle
#

i am stupid

sullen marlin
#

menu is probably null

#

or config

muted sand
quaint mantle
#

i am using the wrong array

#

sorry

muted sand
dusk flicker
#

just dont use the file

sullen marlin
muted sand
worldly ingot
#

Yeah don't use the scheduler if you're accessing the database in the AsyncPlayerPreLoginEvent

dusk flicker
#

hey Choco while you are here can you fix the notworking command for the grammar mistake?

worldly ingot
#

notworking command?

dusk flicker
#

?notworking

undone axleBOT
#

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

worldly ingot
#

oh lol

dusk flicker
#

the first quoted part, is a mess lol

worldly ingot
#

"does not work" I presume?

young knoll
#

That was intended

dusk flicker
#

yeah

sullen marlin
#

I think its meant to be bad english?

young knoll
#

^

muted sand
worldly ingot
#

Yeah pretty much

dusk flicker
#

I figured it meant to be Does not work, rather than working

muted sand
#

"it no work"

worldly ingot
#

Well, depends on what you're doing I suppose, haappi

young knoll
#

Nah conclure did it on purpose

#

Or imagine

#

Whoever it was

worldly ingot
#

If you want to prevent a player from logging in, that requires a block. If you're logging chat or something, you can do that async even in the async chat event without issue

#

Just an unnecessary schedule is all

muted sand
#

ah okay

#

yea that helps a lot! thank you!!

full mauve
worldly ingot
#

Most interfaces in Bukkit aren't legal for implementation unless otherwise stated

full mauve
#

Ah

worldly ingot
#

What purpose would you have to introduce a new implementation?

waxen plinth
worldly ingot
#

Doubtful

#

Binary change afaik

waxen plinth
#

Damn

full mauve
#

I want to add custom recipes using ItemStacks and i want to have a less strict way to match the items which ExactChoice doesn't do

worldly ingot
#

You can make use of a prepare craft event

full mauve
#

And using the Inventory update event (can't remember the exact name) is kinda buggy

#

For Geyser users

full mauve
#

Hm okay

waxen barn
#

there is harcoded switch for the spigot classes

full mauve
#

It's converted to an NMS class?

waxen barn
full mauve
#

What does that mean?

neon minnow
#

is this bad

waxen barn
# full mauve Ah okay
default RecipeItemStack toNMS(RecipeChoice bukkit, boolean requireNotEmpty) {
        RecipeItemStack stack;
        if (bukkit == null) {
            stack = RecipeItemStack.a;
        } else if (bukkit instanceof MaterialChoice) {
            stack = new RecipeItemStack(((MaterialChoice)bukkit).getChoices().stream().map((mat) -> {
                return new StackProvider(CraftItemStack.asNMSCopy(new ItemStack(mat)));
            }));
        } else {
            if (!(bukkit instanceof ExactChoice)) {
                throw new IllegalArgumentException("Unknown recipe stack instance " + bukkit);
            }
            //some code
    }
full mauve
#

Ah okay

#

Just subclass ExactChoice then, got it :)

waxen barn
full mauve
#

Ah rip

lost matrix
young knoll
#

MD has been asked about that

#

Something to do with how to handle them being attached to a plugin

worldly ingot
#

Yeah, it's considered leaky

lost matrix
#

unregistering those recipes could be tricky because you dont know the context of the implementation

full mauve
#

Is there no library that implements a simple interface to do this then?

waxen barn
#

Btw, Is there any way how to get LoginResult params forwarded by bungeecord without using protocol lib to listen to the handshake packet and parsing the host header myself?

#

I know, that I can also get the nms player connection and get it from the connection, but I need to get it already at the login state

quaint mantle
#

when this runs on onenable, it doesnt put the yml data in the array

#

MenuStorageUtil.menus = (ArrayList<Menu>) config.get("Menus");

sterile token
#

?paste

undone axleBOT
sterile token
#

So let me ask again if i have understand, you have a runnable right?

quaint mantle
#

what is a runnable? sorry i am new to spigot stuff lol

sterile token
#

Sorry sorry i missunderstand onenable with runnable. My bad

sterile token
#

Are you havign any inssue on console?

quaint mantle
#

look at onenable

#

no

sterile token
#

Ok, so you are just getting an empty array list?

quaint mantle
#

yes

sterile token
#

How you are saving menus?

quaint mantle
#

by using the config.yml

#

config.set("Menus", MenuStorageUtil.menus);

#

(you can see this in the paste)

sterile token
#

Allright

#

Wait, you shouldnt be saving on on enable

#

Like, you should update values (config ones) when important changes are done.

quaint mantle
#

it saves when i use commands

sterile token
#

Ahh allright

#

Please send full paste with main class, menu storage util

quaint mantle
sterile token
#

Allright

quaint mantle
sterile token
#

Wait how looks your config can i see and screenshot?

quaint mantle
#

ok

#

wait i need to restart server

sterile token
#

Allright and please check if content its save to the file

quaint mantle
#

item-lore-visible: true
item-name-visible: true
Menus:
menuitems:

  • ==: org.bukkit.inventory.ItemStack
    type: REDSTONE_BLOCK
    meta:
    ==: ItemMeta
    meta-type: UNSPECIFIC
    display-name: red
    lore:
    • coolred
      name: poo
      size: 54
#

all contents

lost matrix
lost matrix
# quaint mantle ok

This way your findMenu, deleteMenu and updateMenu methods become each a single line

quaint mantle
neat maple
#

I have a strange problem. When I use Allatori-8.0-Demo to obfuscate my plugin to level 1, the event 'AsyncPlayerChatEvent' does not work for me. Does anyone have an idea what this could be?

lost matrix
quaint mantle
#

ok

left swift
#

is it possible to detect player collision with an entity?

sullen marlin
lost matrix
neat maple
worldly ingot
#

The @EventHandler annotation. Keep it. Allatori likely removes it

quaint mantle
#

public static Map<String, Menu> menus;

#

like this?

lost matrix
#

Make it private final and non static

quaint mantle
#

ok

neat maple
worldly ingot
#

Not sure. Never felt compelled to use an obfuscator

#

I open source everything

quaint mantle
#

how do i put it in config yml then?

worldly ingot
#

And you should too fingerguns

lost matrix
# quaint mantle ok

If you want to have per player maps. But i dont know your data structuring so public static might work. Strongly recommend against that.

neat maple
#

When I decompile the encrypted date, it looks like the whole method is removed

quaint mantle
worldly ingot
#

I had a premium resource that was also open sourced 🙂

#

(keyword: had. I really, really dislike maintaining premium resources so I'm done with them now)

quaint mantle
#

well i open source my free stuff

#

like when i modded fnf

#

i would open source that

#

but there is no point charging 40 bucks for a massive plugin when people can compile it themselves imo

#

anyways this is a help channel so i will stop talking

dawn hazel
#

i dont rlly like doing premium resources

quaint mantle
#

bruh

#

now my data folder wont create

dawn hazel
#

if im honest it makes me feel like im obligated to keep it updated

dawn hazel
quaint mantle
dawn hazel
#

are you using the java.io file creation stuff to do this?

#

also code pls

quaint mantle
#

@SuppressWarnings("unchecked")
@Override
public void onEnable() {
getLogger().info("Enabling MagnificentMenus LITE by Magnumsrt!");
config.addDefault("item-lore-visible", true);
config.addDefault("item-name-visible", true);
config.set("Menus", MenuStorageUtil.menus);
MenuStorageUtil.menus = (List<Menu>) config.get("Menus");
plugin = this;
config.options().copyDefaults(true);
}

dawn hazel
#

why are you supressing the warnings

quaint mantle
#

because i get an unchecked warning

#

on the cast

dawn hazel
#

also you dont have a savedefault for the config

#

is this using custom config or normal bukkit config

quaint mantle
#

normal bukkit

dusk flicker
#

i like to say if you need a suppress warning you might be doing it wrong

dawn hazel
#

your going to want to do config.savedefaultconfig

dawn hazel
#

if you have to supress the warnings then yeah something is probably incorrect

dusk flicker
#

I remember Eclipse use to suggest the first thing to fix anything was suppress warnings lol

#

~2015 eclipse or earlier lmao

vocal cloud
#

Can't have errors if you try catch @supress them all

dusk flicker
#

smart

dawn hazel
#

btw anyone who needs to make an updatechecker but doesnt want to spend an hour on very simple code

#

heres a reference

#

enjoy an hour of your life saved

sullen marlin
#

You dont close the stream

#

😦

vocal cloud
#

Kek

dusk flicker
#

bad refrence

#

/j

dawn hazel
#

if (@dawn hazel.equals(idiot)) {
return isidiot = true
}

#

it returned true

dusk flicker
#

ALSO WHY THE FUCK DID YOU CAPITALIZE THE START OF THE METHOD

#

?conventions

undone axleBOT
dusk flicker
#

fix. it.

vocal cloud
#

Anyone remember the guy trying to make everything one line. This reminded me of that guy

dawn hazel
#

its something i do lol

dusk flicker
#

then unlearn it

dawn hazel
#

it looks off if i dont put capitalization

dusk flicker
dawn hazel
#

it just makes everyones life harder

dusk flicker
#

we're talking java conventions here, not preference

#

wow I cant spell

#

lol

dawn hazel
#

the grammar mishap doesnt affect my plugin so idc

vocal cloud
#

Learn how to do it right because otherwise people are going to spend more time complaining about your convention breaking than helping you

dusk flicker
#

^ this tbh

dawn hazel
#

pissing off good developers with my terrible code is a trait of mine

vocal cloud
#

It's not terrible code. It's the wrong convention

dawn hazel
quaint mantle
#

pissing of good developers by being a bad developer is a trait of Mine

dusk flicker
#

its cause you aint following java conventions

vocal cloud
dawn hazel
dusk flicker
#

too bad

vocal cloud
#

Absolutely. You're also not forced to be right on a test

dusk flicker
#

that aint oracle

#

?conventions

undone axleBOT
dawn hazel
vocal cloud
#

And you'll stay that way forever with that attitude

dawn hazel
#

plus all this code is getting revamped anyways

#

so it will probably be corrected

#

if im not lazy that is

vocal cloud
#

Also that javat articles whole point is that it's a convention not a rule because it will compile with wrong convention. It still recommends using them

wet breach
dawn hazel
#

i know

#

im fixing that rn

#

well

#

after i fix my bad grammar

quaint mantle
#

how would i use the config to get a list<class>

#

get better grammer

dawn hazel
quaint mantle
#

i saw someone say that in bedwars once

dawn hazel
#

no i cannot change UpdateChecker btw

vocal cloud
dusk flicker
#

why would you change UpdateChecker?

#

thats a constructor

dawn hazel
#

cause i remember seeing someone mistake a constructor for a method

dusk flicker
#

that person is just stupid

wet breach
vocal cloud
dusk flicker
#

also have u still not closed the connection or am I blind?

dawn hazel
#

theres like a million other incorrectly named methods in the plugin

wet breach
quaint mantle
dawn hazel
#

but im not even gonna bother fixing those cause this plugin is getting entirely revamped

dusk flicker
#

yeah thats the best frostalf

dawn hazel
dusk flicker
#

it's one fucking line

dawn hazel
#

cause of grammar.exe not found

dawn hazel
quaint mantle
#

grammar.dll was not found

wet breach
#

lol

quaint mantle
#

ignoring extension, booting up skygamez

dusk flicker
#

also why use Plugin

#

rather than JavaPlugin

quaint mantle
#

he doesn't like coffee?

#

ok i will stop meming

dusk flicker
#

damn I need to update intellij

dawn hazel
#

spooky

dusk flicker
#

apireader and new ver also dont need to be global vars but that aint the biggest thing

dawn hazel
#

time for another episode of roast my code

junior remnant
#

Hey, someone can help me with scoreboard teams? Up to 1.12.2 the prefix in tab list colours the nick of the player, but in 1.13+ the name its in white 😦

quaint mantle
#

why does my yml array look like this?

#

Menus:

  • !!me.magnumsrt.MagnificentMenus.Menu
    menuitems:
    • ==: org.bukkit.inventory.ItemStack
      type: REDSTONE_BLOCK
      meta:
      ==: ItemMeta
      meta-type: UNSPECIFIC
      display-name: red
      lore:
      • coolred
        name: placeholder
        size: 54
dawn hazel
#

Cause your exporting an array to the config

#

That’s what item meta looks like

dawn hazel
quaint mantle
dawn hazel
#

Your going to have to first get the array

#

Then for the config part

#

You’ll have to take the array data

#

And put stuff in your yml file that is specific to each part of the array you want

#

Also I don’t recommend using yml for data storage

#

Use json

quaint mantle
#

never worked

dawn hazel
#

Specifically the file creation part

young knoll
#

Use gson

quaint mantle
young knoll
#

It does if you make an adapter

quaint mantle
young knoll
#

Check the forums

#

Maybe someone already made one

lost matrix
#

Its just a matter of ItemStack -> String and String -> ItemStack
Can be done by either (de)serializing them Map<String, Object> provided by Spigot

quaint mantle
#

thanks

lost matrix
#

or with an BukkitObjectOutputStream which produces a byte[] that is base64 encoded afterwards

left plover
#

Is there any easy way to take two chat colors , and a string, and turn it into a gradient?

#

Ive done it before, but I lost that code

olive lance
#

Definitely is a way

#

Guy answered with a bit of code you can use

left plover
#

Thanks

olive lance
#

It’s javascript tho

#

So u know make it work n all that

#

It also only gets 1 value for the middle but you can see how he converts the hex to rgb values and then u can just loop through each color

quaint mantle
muted sand
#

How do I stop logging in console and direct it to something like a discord webhook instead?
Is it even possible to disable logging chat?

neon minnow
#

How can i get all players around a location in radius of 5 and if they are there send them a message saying you are close

worldly ingot
#

World#getNearbyEntities()

#

Takes a Location and an x, y, and z radius

#

(and an optional Predicate so you can check if the entity is an instance of Player)

sterile token
#

I was trying to do the same he was asking. And no one give an amazing answer

quaint mantle
#

@lost matrix sorry for the ping but i am trying to load the itemstack and other data from the same file, how would i go about this?

#

with your adaptor

quaint mantle
stray crescent
#

What do I write in the commands.yml to make a custom /discord command?

I already tried this:

  discord:
    - "say https://discord.gg/spigotmc"

It prints in chat "[player] https://discord.gg/spigotmc"

I just want it to print alone the link, not to mention, the link is not even clickable??

languid laurel
#

Use tellraw

stray crescent
#

thanks!

#

ur a god

#

does colorcodes work?

#

like

#

rellraw &aBLABLA

languid laurel
stray crescent
#

thanks

#

in luckperms, the permission for /discord would simply just be "discord" right?

summer scroll
stray crescent
#

I'm 27 and mature enough to talk retirement

solid lion
#

If i have a custom item for a player and i want that item to damage nearby entities what would i use for that? i know how to get the radius around a player but not sure how to do it for an item that was placed

summer scroll