#help-development

1 messages ยท Page 220 of 1

river oracle
#

what is this

tardy delta
#

worst code ive seen in months

river oracle
#

?basics

undone axleBOT
river oracle
#

learn java before using spigot api atleast the basics

hybrid spoke
flint coyote
winged anvil
#

?paste

undone axleBOT
tardy delta
river oracle
tardy delta
#

oh lmao

winged anvil
#

lmfao

flint coyote
#

I said "not inactive". I know you are active. That's why I said it can't be the worst

kind hatch
tardy delta
#

mongodb is really fucking with me

#

invalid bson name 'id' when inserting and its valid when retrieving ๐Ÿค”

winged anvil
#

I don't think I've setup maven to shade correctly because I have a small plugin and its coming out to be 293KB. Heres the important bits of my pom. https://paste.md-5.net/koleninoje.xml . I'm just doing a package build, I read a clean package build would do it, tried it, didn't change the size.

river oracle
#

your shading gson

#

there is no reason to do that

#

its provided through spigot

winged anvil
#

oh shi

river oracle
#

just mark it as provided and your good

winged anvil
#

bet

#

ty

river oracle
#

fellow vscode user ๐Ÿ‘‹๐Ÿฝ

winged anvil
#

see

#

i just quit

river oracle
#

๐Ÿ˜ญ

winged anvil
#

yeah...

#

i tried to create a maven archetype and that didnt go well

#

it had been like a week and i just wanted to code

river oracle
#

lmao you see I just have a copy and paste pom :P I barely even use my own archetype

winged anvil
#

see i didnt wanna do that. I thought I could setup something that would like allow me to input the things i wanted and generate a pom

humble tulip
#

Yes but can you copy paste thermometer

#

The line*

hazy parrot
#

you can google about static block too

fervent prawn
#

toReturn.setContents(InspectRequest.victim.getInventory().getContents());

river oracle
#

why help him ๐Ÿ˜ญ please lord just atleast help him learn java

winged anvil
#

lmfao

#

honestly, just let him. he'll learn through a project

river oracle
#

does mysql have a visual client or something like mongo compass I want to beable to visualize my data

river oracle
winged anvil
#

aye look

humble tulip
#

Print inv_size

winged anvil
#

he'll come around

river oracle
winged anvil
#

my first project became 10k lines long cause i didnt know what a map was

hazy parrot
river oracle
#

idk wtf either of those are

#

but probably

remote swallow
#

my first plugin was so jank at the start

hazy parrot
#

yap, you can google its probably what you want

tardy delta
#

mysql workbench

#

bruh mongodb ive tried every field and nothing gets accepted

humble tulip
#

Yes or console

tardy delta
#

im starting to regret not using sql

river oracle
#

I don't understand why you are putting more doccuments inside of your base doccument it seems kinda uneeded

tardy delta
#

idk lol

river oracle
#

also may be your cause of error

remote swallow
#

whats your favourite debugging method, System.out, logger or bukkit.broadcastMessage

tardy delta
#

dont you just have a root documennt where you put other documentns in?

river oracle
#

logger is just too much of a pain to type out its needlesly long same with broadcastMessage when I could just type sysout and its there

tardy delta
#

Debug.log best

remote swallow
#

wonder if i should add a debug method to my lib

river oracle
tardy delta
#

same error

#

dunno what the dif is between Document and BasicDBObject anyways

winged anvil
#

son ur code has bigger issues

winged anvil
tardy delta
#

it isnt pojo mapped lol

river oracle
#

don't have to use pojos nvm

winged anvil
#

i see

tardy delta
river oracle
# tardy delta

the link I sent talks about mongo docs what your doing isn't very complex either you should be able to apply from that

tardy delta
#

whats the point of that new object id vs a id field or smth?

winged anvil
#

think its like THE document id

river oracle
#

thats just creating an empty _id for the doccument

#

iirc it'll gen a random ID if you do that

#

in your case _id would be a players UUID

tardy delta
#

im now wondering when to use _id and id

river oracle
#

afaik _id is the doccuments id

dim bronze
#

the actual id mongo uses is _id

river oracle
#

^

dim bronze
#

'id' is 'your' id

#

if you can guarentee itll be unique use _id

river oracle
#

in the case of player UUID ^ this will be okay

dim bronze
#

haven't used the java monogo drive but your usage of updateOne looks wrong

river oracle
#

you'll never have an overlap

#

mogno docs and mongodb > sql any day :P

winged anvil
#

oh shiiii

dim bronze
#

they have different uses

winged anvil
#

i just watched a video that said to never use mongodb lmao

tardy delta
#

sql doesnt have that weird errors unless you dunno how to write statements lol

river oracle
#

it has its uses

winged anvil
#

actually

#

can i put that here?

#

fuck it

#

he is web-dev though so, different

river oracle
#

web-devs ๐Ÿ’€

tardy delta
#

smth like this maybe

dim bronze
#

rather than adding to the document directly, add an update like they do in the docs

#

weird syntax just to upsert but it probably makes more sense for single updates

tardy delta
#

that looks horrible

olive valve
#

Hello! I am trying to clean up my code a bit. And in my onEnable() it looks terrible with the command registering. Because I have alot of commands for my smp server. So I was wondering a good way of cleaning it up.
Here is an image of just over half of the commands:

#

Thanks!

dim bronze
#

only way I can think of is to use reflection

trim creek
#

is it possible to get a player from its string name?
(example: Player p = (Player) stringPlayer;)

dim bronze
#

or just have a set of all the command instances and loop over them

trim creek
#

:O

dim bronze
#

is that undeprecated now?

remote swallow
hazy parrot
#

Get offline player from name is deprecated afaik

olive valve
tardy delta
#

what about users.updateOne(Filters.eq("_id", user.getUniqueId()), document, new UpdateOptions().upsert(true));

dim bronze
#

does that work if the document doesn't already exist?

trim creek
dim bronze
#

you'd think so if it allowed upserts

tardy delta
#

lets see

dim bronze
fickle juniper
#

Does anyone have experience with Spring Boot, Spring JPA and Liquibase? If so send me a DM, would really appreciate it if someone could point my in the right direction. I basically want to automatically generate migrations and be able to apply those to my DB just like in Entity Framework (.NET). Thanks in advance! ๐Ÿ™‚

dim bronze
#

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

olive valve
tardy delta
#

ok not working

dim bronze
dim bronze
tardy delta
#

im hosting on that atlas stuff or smth and it says there is nothing inside :/

olive valve
dim bronze
#

but also you would need a collection anyway to be writing these documents to

tardy delta
#

im setting up the stuff

dim bronze
#

that collection is never made though

#

you need to create it first

peak depot
#

how can I hide those names

dim bronze
tardy delta
#

doesnt ::getCollection ensures it gets created tho?

dim bronze
#

not sure if theres a spigot event for it

dim bronze
tardy delta
#

it doesnt return null anyways so it should

dim bronze
#

yes it does

peak depot
dim bronze
#

however you don't have a database

tardy delta
#

there are however ::createCollection methods

dim bronze
#

collection get created when you try to insert

#

but the database doesn't

tardy delta
#

smh doesnt a database gets created automatically too

#

its not null so

dim bronze
#

the docs don't mention it

#

ahhh i can't embed links

#

I really should verify but I hate my forums name

#

its like 6 years old

tardy delta
#

lmfao

dim bronze
#

doesn't mention it

#

but I guess if its not null shrug

tardy delta
#

lets try database.listCollections().forEach((Consumer<? super Document>) doc -> System.out.println(doc.toJson()));

dim bronze
#

but you have no collections

#

atlas is showing you that

#

you definitely need to be using Updates though

#

follow that exactly

tardy delta
#

doesnt print anything

dim bronze
#

but you have no collections
atlas is showing you that

tardy delta
#

and how can i use Updates for tthat tho :/

dim bronze
#

rather than give the document an id when you intialise it, I think mongo may do it on the line when the upsert is done

#

so create the document for the home as normal

tardy delta
#

after calling create database::listCollections outputs this

dim bronze
#

of course

#

that doesn't matter

tardy delta
#

ok calling createCollection twice gives an error too :/

dim bronze
#

I wonder why you_think_about_that

#

hang on, I'll spoodfeed and try to explain

quaint mantle
#

I think I'm a stupid you're right the shadow file was already in plugins file Lmao

tardy delta
#

ok inserting into atlas doesnt work

dim bronze
#

you'll have to give me a second gradle is updating

#

I don't have great internet

tardy delta
#

gradle ๐Ÿ’€

dim bronze
#

java ๐Ÿ’€

eternal night
#

skulls ๐Ÿ’€

dim bronze
#

opinions ๐Ÿ’€

tardy delta
#

skills ๐Ÿ’€

#

anyways this is for loading

dim bronze
#

is there no nice deserialise method?

#

if you use a pojo

tardy delta
#

pojos require awful stuff

#

like having non final fields and setters ๐Ÿ’€

#

why cant it just use reflections

dim bronze
#

another java l and kotlin w

#

so after I just upgrade gradle, why then does intellij also need to download ahhhh

quaint mantle
#

Did anyone help me in world gurd plugin

tardy delta
#

no they didnt

dim bronze
#

all this effort because I can't be bothered to manually install jdk18

tardy delta
#

๐Ÿค”

dim bronze
#

arch jumps straight to jdk19 the second it becomes available

tardy delta
#

and i have no idea what im doing

#

imagine using arch tho, cant be me

dim bronze
#

you'd better not be using windows

tardy delta
#

college lmao

dim bronze
#

probably why none of the code works tbh

tardy delta
#

my only teacher that uses linux is teacher computer systems

dim bronze
#

dual boot

#

gaming on linux is atrocious

tardy delta
#

ye i might but im wondering if i can share programs over both oses

dim bronze
#

what do you mean by share

tardy delta
#

dont want to install everything twice

dim bronze
#

thats inevitable

#

what would you be installing twice though

tardy delta
#

some jetbrains stuff, minecraft, spotify, discord and those things

dim bronze
#

none of them are massive though

tardy delta
#

dont have that much installed on my pc actually

dim bronze
#

when you think about it, most of the big stuff you could only keep on one

#

depending on what you code, its plausible to only have intellij on one and not on the other

#

then all games go on windows

tardy delta
#

hmm

#

im thinking what classes would require a windows os

#

maybe for programming if that stupid bluej doesnt worrk on linux, probably does

#

ugh need excel too

dim bronze
#

yeah libre suite is not where its at

tardy delta
#

well ye still dont know how to solve this

dim bronze
#

yeah just getting things set up I'll figure it out now

#

bored anyway

#

what's the roouser password by default?

#

haven't used mongo in a while

#

is it just account pass?

tardy delta
#

to login into atlas or what

dim bronze
#

dw making a new user

zealous scroll
#

how do i include nms packets in buildtools when building my jars

tardy delta
#

just 'id' doesnt work too

#

error at the ::updateOne

tardy delta
#

im wondering if i need a new Document for the homes and in there each home as a separate document too?

quaint mantle
chrome beacon
#

Works great for storing simple things

dim bronze
#

@tardy delta im dumb and was using updateOne not replaceOne

#

it works fine the way you've done it?

#

just dont give the user an id

#
val users = client.getDatabase("plugin").getCollection("users")

// Setup
val user = User(
    uuid = UUID.randomUUID(),
    homes = mutableListOf(
        Home("home", "world", 0.0, 20.0, 0.0),
        Home("farm", "world", 20.0, 20.0, 10.0),
        Home("portal", "world", 20.0, 20.0, 20.0),
    )
)

val userDocument = Document()
user.homes.forEach { home ->
    userDocument.put(home.name, Document().apply {
        put("world", home.world)
        put("x", home.x)
        put("y", home.y)
        put("z", home.z)
    })
}

val filter = Filters.eq("_id", user.uuid)
users.replaceOne(filter, userDocument, ReplaceOptions().upsert(true))
tardy delta
#

hmm

#

kotlin

dim bronze
#

eh you can read it

tardy delta
#

glad

dim bronze
#

I tried to make it as readable as possible without using java

tardy delta
#

so with not giving the user an id you mean not doing this

dim bronze
#

yes make a document with no parameters

#

the uuid is given when it fails the filter

tardy delta
#

then append it later?

sterile token
dim bronze
#

does not matter

dim bronze
#

thats how upsert replaces work

sterile token
#

Wait no no, mongo add "_id" to every document

#

So i was wrong to what ive said

dim bronze
#

wouldn't matter anyway, mongo doesn't have a schema

#

you can query any object to have any field, mongo just wont return it if it doesn't have the field

sterile token
dim bronze
#

if it exists or doesn't exist, it doesn't matter

sterile token
#

No, if mongo doesnt find the query field, will yell with the Bson field exception

#

I have tested that you wont make me change OOP - in case you are expecting that

dim bronze
#

thats not how mongo works

#

that defeats the whole purpose of mongo to begin with

#

it does not have a schema so you can rely on certain fields existing

#

so when you query a field, it cannot just fail if it doesn't exist

#

that's to be expected

sterile token
#

I dont care how works or not, the point is said. When you query with field not contained on documents, will shall with Bson field exception

#

So stop it please and ?tryandsee

dim bronze
#

I just did

#

it works fine

sterile token
#

Driver from and version

#

I will test with yours

dim bronze
#

that does not matter

#

this is mongo

#

what are you not getting

#

thats not how mongo works

#
fun main() {
    val settings = MongoClientSettings
        .builder()
        .uuidRepresentation(UuidRepresentation.STANDARD)
        .applyConnectionString(ConnectionString(CONNECTION_STRING))
        .build()

    (LoggerFactory.getILoggerFactory() as LoggerContext).getLogger("org.mongodb.driver").level = Level.OFF
    MongoClients.create(settings).use { client ->

        val users = client.getDatabase("plugin").getCollection("users")

        users.find(Filters.eq("noexist", true)).forEach {
            println(it)
        }
        users.find(Filters.eq("_id", UUID.fromString("255fd3ba-dbe6-4edb-80c6-4a828fa258e2"))).forEach {
            println(it)
        }
    }
}
#
Document{{_id=255fd3ba-dbe6-4edb-80c6-4a828fa258e2, home=Document{{world=world, x=0.0, y=0.0, z=0.0}}}}

Process finished with exit code 0
#

that is the full output

#

no errors

#

latest mongodb sync driver

sterile token
#

And tell what happens!

dim bronze
#

I did

sterile token
#

๐Ÿคก

dim bronze
#

users.find(Filters.eq("noexist", true))

#

thats what that does

#

???

sterile token
#

It will shall you with the exception

dim bronze
#

that line is in the code i just sent

#

here, I'll write it in java so you can understand

sterile token
#

yeah kotlin is cance really shity syntax

ivory sleet
#

wow

#

na

dim bronze
#

?paste

undone axleBOT
tardy delta
dim bronze
#

I'm just using it as im setting the document id with a uuid

#

and you get an error saying you haven't specified the uuid representation type

#

and that fixed it

tardy delta
#

ah

dim bronze
#

how have you done it?

dim bronze
#

heres your java code

#

the full output:

Document{{_id=255fd3ba-dbe6-4edb-80c6-4a828fa258e2, home=Document{{world=world, x=0.0, y=0.0, z=0.0}}}}

#

thats the full collection

#

like I said

#

mongo has no schema so it cant complain if you query a non existing field, because the field doesn't have to exist on all documents

#

if it threw an error if a field didn't exist, how would mongo possibly work?

tardy delta
#

lemme test

dim bronze
#

not all documents have to have the same fields

#

therefore, you wouldn't be able to query a field if it didn't exist on all types

#

your logic doesn't make sense

tardy delta
#

its the first time im using it smh

dim bronze
#

I'm talking to VERANO123

#

not complaining about you ๐Ÿ™‚

#

I started a test project a while back because I wanted to mess around with mongo and graphql because i hadn't used either but never actually wrote anything

#

so I haven't either

#

I just understand how it works

tardy delta
#

yes another error message

dim bronze
#

show code

tardy delta
dim bronze
#

does the user definitely have a home?

tardy delta
#

lets print the json

dim bronze
#

you need to use replaceOne

#

not updateOne

tardy delta
#

but dont i have to store the users uuid too to later search on it

dim bronze
#

its hard to explain

#

the first argument of the method

#

Filters.eq...

#

checks if there is a document that matches it

#

because there isn't, it creates the document you've given it

#

and gives it what you checked against

tardy delta
#

ahh

dim bronze
#

so by passing the filter, you are already giving the uuid

#

if it doesn't exist

tardy delta
#

because of upsert?

dim bronze
#

yes

#

exactly

#

if you passed it normally, you'd be trying to change the id to the same thing

#

which I don't think would be wrong?

#

but i don't know maybe id is immutable

tardy delta
#

i believe so

dim bronze
#

you'd hope so

tardy delta
#

but now if the user doesnt have homes ig the document is empty

#

lets just create one

dim bronze
#

which is why im suggesting you store all the homes in an array

#

you'd just have an empty array

#

which is fine, you can store an empty array

tardy delta
#

is there really a point to do a db operation then

dim bronze
#

how do you plan on loading this data? you'd have to loop through all the fields in the database

#

what happens when there's more than just homes stored in there

#

you'd have to have some way to distinguish

tardy delta
#

smh home name is test

dim bronze
#

you are using replaceOne now yes?

tardy delta
#

ah fuck

dim bronze
#

ahah that's what happened to me when I first tried

tardy delta
#

i guess so actually

smoky widget
#

u cant use completablefuture when you start connection with mongo ?

dim bronze
#

oh?

tardy delta
#

you can?

#

just wait till its finished initializing, that would make sense

#

wait do i need replaceOne nw?

dim bronze
#

yes, you are replacing not updating

#

if you were updating, it would leave old homes

#

unless you specifically removed them

#

or used an array

tardy delta
#

after creating a home, the saving seems to work

dim bronze
#

2 options

tardy delta
#

loading is meh

dim bronze
#
  1. which i don't recommend, check if they have a home first and then update
  2. store in a array
tardy delta
#

array ig

dim bronze
#

and its more clear what each document is

#

map each home to a document, and then put the list in homes

#

you'd have to store the home name in the document now

tardy delta
#

im just saving a list of homes now, wondering how it retrieves them

dim bronze
#

there's a getList method

tardy delta
#

and homes is a List<Document>?

dim bronze
#

yup

tardy delta
#

smth like this?

dim bronze
#

looks much better to me

#

although I would use java streams

#

but it works

tardy delta
#

only wrong parameter type ;-;

dim bronze
#

oh yes

#

you'd need a parent document

tardy delta
#

can i also just save the players uuid in there?

dim bronze
#

yes that's where you'd want it

#
Document userDocument = new Document()
userDocument.put("homes", homes)
#

and you'd upsert userDocument

#

then any future information thats not homes related gets stored in the user document

dry forum
#

if i have a config like "yes: true" for example then i added the plugin to my server it works fine using saveDefaultConfig(); and saveConfig() but if i update the config file in intellij and add "no: true" for example then delete the old jar and add the new 1 "no: true" doesnt get added, i cant really have people delete their config everytime the plugin updates so how can i fix this

dim bronze
#

FileConfiguration#addDefault

ivory sleet
#

isnt the config cached tho in your plugin data folder?

#

so yes you probably wanna try to default as creppy pointed out

dim bronze
#

and then copyDefaults as an option

tardy delta
elfin atlas
#

Is there a way to check if a pressure plate is pressed?

#

If yes how?

ivory sleet
#

iirc PlayerInteractEvent

remote swallow
#

yeah

elfin atlas
#

Yeah but after you pressed it I want to see if it is still pressed

remote swallow
#

Action.PYHSICAL

elfin atlas
#

Not when it just started currently like 5 seconds after also

tardy delta
#

ok this seems to be null: List<Document> homes = document.getList("homes", Document.class);

elfin atlas
#

Is there a way to check it with like the blockState or smth?

dim bronze
#

there is no homes field

tardy delta
#

because i fucked up earlier i

#

g

dim bronze
#

it should have been replaced on the last save call though

tardy delta
#

well i can now enter and quit the game without errors

ivory sleet
#

BlockData

tardy delta
#

thanks you for your time lol

#

copilot gave me this for deleting a home lol users.findOneAndUpdate(Filters.eq("owner", home.owner()), new Document("$unset", new Document("homes." + home.name(), "")));

dim bronze
#

that uuid is triggering me a bit

#

whats your uuid representation set to?

#

minecraft usually uses type 4 which is what mongo calls standard

#

that just looks wrong lmao

tardy delta
#

well BinData(3 says uuid type 3 iirc

#

i dont have explicitly set the uuid representation tho

dim bronze
#

weird how I had to

#

I mean it's still correct, just looks wrong to me because I've always seen type 4

tardy delta
#

i tried setting it once and BinData was replaced by UUID(<string format uuid>)

viscid ember
#

Has anyone here made a combo system before? like
R = Right click
L = Left Click
R + R + L = Spell #1
R + L + L = Spell #2
Etc

im trying to make one but struggling

summer agate
#

What are you struggling woth?

viscid ember
#

i have 2 functions outside of the event

    boolean readyCombo = false;
    String comboList[] = new String[0];```

the rest of the code look like this

```java
   @EventHandler
    public void onRightClick(PlayerInteractEvent event) {
        Player player = event.getPlayer();

        if (event.getItem() == null) {
            return;
        }
        if (!(event.getItem().getItemMeta().equals(ItemManagerTestingItems.testStaff.getItemMeta()))) {
            return;
        }
        if (!(event.getAction().equals(RIGHT_CLICK_AIR))) {
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText( ChatColor.BLUE +"Pew"));
            player.sendMessage(String.valueOf(readyCombo));
            readyCombo = false;
        }

        if (readyCombo == true && event.getAction().equals(RIGHT_CLICK_AIR)) {
            player.sendMessage(String.valueOf(comboList[0]));

        }

        if (event.getAction().equals(RIGHT_CLICK_AIR)) {
            readyCombo = true;
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText( ChatColor.BLUE +"You have Started a combo! _ + _ + _"));
            player.sendMessage(String.valueOf(readyCombo));
            comboList[0] = "R";
        }
    }
}```
#

the ready combo part works fine for now

#

but whenever i rightclick after getting the combo ready i get a error thrown at me (let me get the error)

summer agate
#

Be aware, your current combo list is the same for all players, so if a starts it and b finishes it then that will fire the combo

desert loom
#

you can't add any elements to that array

#

array indexes start at 0

dim bronze
#

?learnjava moment

undone axleBOT
viscid ember
#

i was doing some bs before to try and get it working

green prism
#

Could this work?

        PlayerProfile playerProfile = null;
        PlayerTextures textures = playerProfile.getTextures();
        try {
            textures.setSkin(new URL("https://textures.minecraft.net/texture/"+val));
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
        playerProfile.setTextures(textures);

        
        final ItemStack head = XMaterial.PLAYER_HEAD.parseItem();
        SkullMeta meta = (SkullMeta) head.getItemMeta();
        meta.setOwnerProfile(playerProfile);
        head.setItemMeta(meta);  ```
dim bronze
#

well you've just tried to call getTextures on a null object

#

so that'll be an NPE

green prism
#

ik but... I don't know how to get that value

dim bronze
#

from doing this in the past, I seem to remember a lot of encoding to base64

viscid ember
viscid ember
#

my question right now is how can i store both the readyCombo and ComboList without it reseting every time i call "Right Click Event"

#

would i need to implement some sort of database

summer agate
#

My idea would be a hashmap with a key of the player uuid and a PlayerCombo object. The playercombo would contain a list of recent actions you could check and add to

#

and storing the hashmap as a final field

viscid ember
#

what i was planning to do is the string array is temporary just for testing purposes i will replace that with a int array

golden turret
#

Math experts, please help me with this:

viscid ember
#

sinch im only listening for right and left click (0 = Left & 1 = Right) i could have something like and store that in the hashmap retrieve it and at the end of the combo i could clear the hashmap

summer agate
#

You want it per player right?

viscid ember
#

yes thats correct

#

so ill need to also make sure the UUID of the player matches with the one in the hashmap correct?

summer agate
#

Then have a hashmap item per player which contains a class that contains the list, the class could have a shouldFireCombo method

#

And just clear the list inside the class if the combo expires/fails

viscid ember
#

another thing which i couldnt find out is how could i implement a timer to expire the combo

#

so e.g after 3 seconds they would need to ready the combo again

#

since i cant just sleep(3) XD

summer agate
#

if a combo were 10 actions, would you want the combo to expire 3s after the first action or 3 after the latest?

remote swallow
undone axleBOT
summer agate
#

I disagree, would be better to keep track of the latest use timestamp, and if cur time when using is greater than last use + 3s then clear. No need to schedule for that

remote swallow
#

oh true

viscid ember
#

i had a look at scheduling but its not what i exactly need

summer agate
#

after the first or after the latest action?

viscid ember
#

first action

#

where it prompts "Combo Ready _ + _ + _"

summer agate
#

What if a combo were 10 actions though? Theoretically

viscid ember
#

im going to limit it to 3

#

because lets be real no one is going to sit there and memorize a 10 combo spell

#

10 actions would mean

_ + _ + _ +_ +_ +_ +_ +_ +_ +_

summer agate
#

Perhabs, but having the possibility could be interesting, besides, if you write the code well it could be expanded without rewriting

viscid ember
#

i want to definitely do that where by i can easily change the combo system to have 2 abilities

#

3 abilities etc

#

background information is im building a MMO rpg with different classes

#

and different tiers of weapons

#

T1 will have like 1 spell

#

while T3 has 3 spells

summer agate
#

Have a list skills which have a list of required actions you loop through on each tool use and see if it matches the spell

#

Sounds like an interesting idea

#

Probably been done before but what hasn't

viscid ember
#

yk wynncraft

#

?

#

basically copying what wynncraft combo system is

summer agate
#

yep

#

Well as long as you make it your own

viscid ember
#

i could just make it easy and do each right click cycles through a spell list and they choose like that but thats not fun

#

like this?

#

honestly i never understand anything they "teach"

#

i just look at docs

#

its so much better

shadow night
#

yep

winged anvil
#

because they dont teach concepts

shadow night
#

reading is a lot faster than watching and listening to somebody speaking with 1 word a minute

winged anvil
#

they "teach" what to type

golden turret
#

Why is that happening?

viscid ember
#

why is what happening?

#

why is it overlapping?

dry forum
golden turret
#

idk how to say

#

just see the images

remote swallow
dim bronze
dry forum
dim bronze
# golden turret Why is that happening?

don't even understand the logic behind your use of the trig functions maybe some sort of drawing would help me out. But for a start you are looping through degrees when javas trig functions use radians

quaint mantle
#

Hey guys, What is the packet? As I know Spawning Block, Or everything can send to player but I can't understand how they work

green prism
#

lmao

golden turret
#

no

green prism
#

Wow, that's cool, good job

dim bronze
golden turret
dim bronze
#

a packet is just information regarding an action that the player is taking

#

you can find a description of all the packets the server and client send on https://wiki.vg/

dim bronze
# golden turret

what are you actually trying to achieve, and what's your logic behind your rotation algorithm

dim bronze
#

yes, I see the code, but I don't know what it is you actually want it to be doing

golden turret
dim bronze
#

you keep sending different images, I'm not too sure what you are trying to convey. Are you trying to get a cross pattern around the chest?

quaint mantle
dim bronze
golden turret
golden turret
dim bronze
#

right, okay

quaint mantle
dim bronze
#

my brain is awful at interpreting anything in space, especially when you move 3d into 2d with an image. So that second image is hard for me to process. Let me look through the code

quaint mantle
golden turret
#

yes

quaint mantle
#

Oh

green prism
#

Guys, a quick question, I have created an InventoryBuilder which, to allow commands/events to be triggered after clicking on an item, uses predefined Enums. Once an item is clicked, it checks if the same has an enum of value X then performs Y and so on (Relating it to the one in the list created by the InventoryBuilder (quick forEach) ).
Would you have any better ideas?

#

(Maybe lighter ideas)

hasty prawn
golden turret
dim bronze
#

for a start its using the wrong angle unit

golden turret
#

I changed to radians and nothing happened

hasty prawn
#

I think you're setting the wrong coordinates

#

or well

#

Hm wait

golden turret
green prism
golden turret
#

it should be centered with the white thing

hasty prawn
#

For one rotateXY and rotateYX are the same thing so idk why you have both

green prism
#

hmh

golden turret
hasty prawn
#

Ik but I'm saying you should just remove rotateXY

summer agate
green prism
#

Maybe this is the only solution

if(elementArray.getSlot(Clicked).getEnum() == TAKE_A_POTATO) {
}...```
golden turret
summer agate
#

maybe 0.6 or 0.7 y

dim bronze
#

if we treat along the chest as the x axis, and up as the y, then we're rotating around the z axis right?

#

oh wait

#

that wouldn't work

hasty prawn
#

@golden turret I assume this is what you want?

vocal cloud
#

Dear god the particles scareDog

hasty prawn
#

Lmao

eternal night
#

weaker clients for sure will love that xD

glossy venture
#

rip client

hasty prawn
#

Hey man it's not my idea KEKW

glossy venture
#

does mc use opengl instancing to render particles

#

does mc even use modern opengl

hasty prawn
#

fuck the clients

glossy venture
#

run it

hasty prawn
#

LMAO alr

lofty pebble
#

I've got a rather specific question on a nuance of the spigotapi, specifically OfflinePlayer::getLastPlayed(). Javadoc says it's the "last time the player was witnessed on this server", but doesn't state exactly when it's updated. Is it updated before or after the PlayerJoinEvent for the player in question?

hasty prawn
#

what the shit

#

It's definitely laggy lol

glossy venture
#

damn looks kinda cool tho

hasty prawn
#

It looks like a halo

#

Wait lemme disable the rotating and see what it does

wary topaz
sterile token
#

I have 64gb that wont happen

#

๐Ÿคฃ

hasty prawn
#

kinda cool

#

If it didn't flicker it'd be fine

fossil lily
hasty prawn
#

Idk if there's too many people that use Kotlin for Spigot dev here tbh

fossil lily
#

:(

hasty prawn
#

My only guess with that is something is wrong with your dependencies/building the JAR

#

Or the server doesn't have whatever that is

dense shoal
#

Hi, I'm doing something with PlayerTeleportEvent right now in an event handler. If I have event where event is an instance of PlayerTeleportEvent and I call event.getPlayer().getLocation() does that return the equivalent of event.getFrom()?

eternal oxide
#

yes

dense shoal
#

Ugh that's frustrating

fossil lily
#

I think im going to use Groovy with Kotlin because kotlin gradle is weird

dense shoal
fossil lily
#

yea ik its a shading problem

wary topaz
#

thanks

flint coyote
#

Is there a way to create a local variable inside
list.stream().map()?

#
sGames.stream().map(sGame ->
                            new Game(
                                    sGame.getGame().getId(),
                                    sGame.getGame().getQueue(),
                                    sGame.getGame().getWinteam(),
                                    sGame.getGame().getDuration(),
                                    sGame.getGame().getStart().getTime()
                            )
)

Basically I would like to create a variable that does the ".getGame()" part and then use that in the constructor

hasty prawn
#
stream.map(sGame -> {
  Object game = sGame.getGame();
  return new Game(game.getId(), etc);
});
flint coyote
#

ohh that's smart

#

thanks!

hasty prawn
#

Dont use Object use whatever getGame returns obviously but yeah

flint coyote
#

Ofc :) Thanks a lot!

tribal rivet
#

If i want to learn java for making plugins where and what is the easiest way to learn it?

#

np if it costs money

dusk flicker
#

?learnjava

undone axleBOT
flint coyote
#

Do you wanna learn java or do you know basic java and wanna get into developing plugins?

tribal rivet
dusk flicker
#

I would recommend if you only know if statements / variables; you start at the ?learnjava above and get a decent understanding of basic Java

tribal rivet
#

yep ty

dusk flicker
#

then move onto plugin dev

flint coyote
dry forum
#

if i have a config like "yes: true" for example then i added the plugin to my server it works fine using
saveDefaultConfig();
and
saveConfig()
but if i update the config file in intellij and add "no: true" for example then delete the old jar and add the new 1 "no: true" doesnt get added, i cant really have people delete their config everytime the plugin updates so how can i fix this

sterile token
#

Hi, im having problems with my wand and region system, for a fkn reason while im using the wand its allows me to break the block, etc, while that shouldnt be allow

dry forum
#

no thats not the problem its the default config when i modify it/update it and add the new version the modifications dont get added

sterile token
#

that why i use my own file handler instead of shity getConfig() from JavaPlugin

#

๐Ÿ˜‚

flint coyote
#

Yeah I doubt that it's possible. Unless you write functionality to check for differences yourself and add them

dry forum
#

thats rly dumb ๐Ÿ˜’

flint coyote
sterile token
flint coyote
#

Alright

sterile token
#

I have divided the logic into 2 classes, WandListener and RegionListener

smoky widget
#

Cannot invoke "fr.fokpi.hcproxylogin.HCProxyLogin.getDataLink()" because "instance" is null
Why do I have this error when I have always called my main class this way?

flint coyote
flint coyote
smoky widget
flint coyote
sterile token
flint coyote
#

So basically you wanna protect using the interact event and then those other events apply for the protected regions, right?

sterile token
#

I mean

#

I need these

flint coyote
#

Do the other events cancel as expected? Is it only the BlockBreakEvent that fails?

sterile token
#
  1. Inside a region, block everything allowed (breaking, placing, interacting, dropping, etc)
  2. When you use the wand item allow you to select 2 pos
smoky widget
sterile token
#

But i also have issues while im op

sterile token
#

Sorry

smoky widget
#

but it's not about velocity

#

its just why my main class not work

flint coyote
#

I'm afraid I don't know bungeecord either :x

sterile token
#

And then we try gelping him

smoky widget
#

but okay i understand

#

i will ask in other discord

sterile token
#

Fabsi its really weird what happening

flint coyote
sterile token
#

IM really exausted

#

One 1m please

#

Dont leave i will test smth

#

Because i made so much changes lmao

flint coyote
#

Sure, take your time

sterile token
#

thanks mate im really exausted of this shit

#

I have been with this shit since 2 pm and its 6 pm

flint coyote
#

Programming takes its time

sterile token
#

No defintly nothing is getting blocked

#

So it should be smth wrong with the wand checks

#

๐Ÿ˜ก

#

@flint coyote

#

Sorry for ping haha im really strssed

#

I have a test sever tho

flint coyote
#

Did you try debugging any of it so far? Like checking where the events fail?

#

lets take the block place event. You have 4 returns.

#

So first you should check which one fails you (and returns something else than what you expect)

sterile token
#

fabsi

#

Let me write the logic

#

Mainly i need is while claiming and not claiming, with the wand block everything allow (placing, breaking, dropping, etc)

flint coyote
#

yeah I get that. While you are claiming you aren't supposed to do anything else

#

But you should still test each guard clause

sterile token
#

You should only be able to do actions, only if you are op or a member of a region - only must be done if you are not claiming

#

I hate logic

flint coyote
#

basically you wanna change

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onPlace(BlockPlaceEvent event) {
        Player player = event.getPlayer();
        if (!this.wand.getSelections().containsKey(player.getUniqueId())) return;
        Profile profile = this.profiles.getProfile(player.getUniqueId());
        if (profile == null) return;
        if (profile.isBuild()) return;
        Region region = this.regions.getRegion(player.getUniqueId());
        if (region != null && region.getCuboid().contains(event.getBlock().getLocation())) return;
        event.setCancelled(true);
    }

to

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onPlace(BlockPlaceEvent event) {
        Player player = event.getPlayer();
        if (!this.wand.getSelections().containsKey(player.getUniqueId())) { System.out.println("test1"); return; }
        Profile profile = this.profiles.getProfile(player.getUniqueId());
        if (profile == null) { System.out.println("test2"); return; }
        if (profile.isBuild()) { System.out.println("test3"); return; }
        Region region = this.regions.getRegion(player.getUniqueId());
        if (region != null && region.getCuboid().contains(event.getBlock().getLocation())) { System.out.println("test4"); return; }
        event.setCancelled(true);
    }

And then see which one returns

#

After that you can further investigate what's wrong

sterile token
#

that would take more time

#

if can get gelp to re write its better

flint coyote
#

Just add those 4 changes and re-test

#

You know exactly what you want to achieve. So test what wasn't working (by placing a block) and then you know which guard clause is behaving odd

#

After that you can look for issues inside your methods

#

So basically you narrow down the issue and then you search for details

sterile token
#

I fixed

#

I think

#

Atleast now i can claim now without breaking

#

But now i have cuboid issues

#

๐Ÿ˜ก

quaint mantle
#

Is there a way to Override the /msg command ?

earnest copper
#

to listen to command execution

sterile token
#

plugin-name:msg

#

/nsg is not from spigot tho ๐Ÿค”

remote swallow
#

/msg is default iirc

sterile token
#

I testing it and not

#

default from spigot is /tell

#

idk which version u are using

dry forum
#

does anyone know of a way to update the config.yml when its updated with newer versions? i cant see how addDefault is the best option since that could take hours and seems extremely unncessesary

eternal oxide
#

include a config version so you can read teh current config and the default and you'll know what needs updating

dry forum
#

if tried instance.getResource("config.yml") but it doesnt return a file

eternal oxide
#

it returns a stream

dry forum
#

would that be the way to update the config?

eternal oxide
#

So long as you actually have a config.yml in your jar

#

take a look at teh spigot config

dry forum
#

wdym

eternal oxide
#

it auto updates

#

?stash

undone axleBOT
dry forum
#

it doesnt auto update when i do it

#

its a resource in my project but it doesnt update with the newer version

#

i use saveDefaultConfig();

eternal oxide
#

that will only save teh config from teh jar to file, if it doesn;t already exist

dry forum
#

is there another method to use?

dry forum
#

i dont see anything that auto updates it though

eternal oxide
#

that code I linked performs an update

#

it gets the current config from file, then loads the defaults from the jar and saves

sterile token
#

Its more simplier than coding everytime the code for creating, updating, etc yaml files

dry forum
#

if its available sure

dry forum
eternal oxide
#

you have to write teh code in your plugin to update

#

I liked you to code which shows you how to do it

sterile token
#

Jeffa

https://paste.md-5.net/eponaroraz.java


// Construtor: FileHandler(plugin, name, parent)
// Plugin param: your plugin instance
// Name param: your file name with the extension
// Parent param: when set to true, will create/load the file from the same file from your resource folder

// Example
FileHandler config = new FileHandler(plugin, "config.yml", true);

config.reload() // Reloading the file
config.save() // For saving the file
dry forum
#

and that updates the config when theres new stuff?

sterile token
buoyant violet
#

hi guys can someone explain to me how to implement an algorithm in a java plugin?

buoyant violet
#

so i created a dice that randomize a number to 0 to 100

#

and i need to implement it in a minecraft plugin

dry forum
# sterile token eXPLain more tHAT

if i have my config version 1 as "value: true" for example then i make a new version of my plugin and update the config to add "2ndvalue: false" for example, does it update the config to add the new values

buoyant violet
#

and i want to do if a player does /roll does that algorithm

#

and then gets the number

dim bronze
buoyant violet
#

@sterile token help me please :D

#

can you see my code?

#

so you can help me more

sterile token
sterile token
#

?jd-s

undone axleBOT
sterile token
#

For the one who sent the message

stone light
#

that was the wrong thing lmao

hazy parrot
buoyant violet
#

so i did an algorithm with flowgorithm then i coded in java, then i am creating a minecraft plugin, so i need to put this algorithm in this minecraft plugin when a player does /roll then he can get the random number

buoyant violet
buoyant violet
sterile token
#

Ok

remote swallow
#

ThreadLocalRandom.nextInt iirc

buoyant violet
#

i am just starting

sterile token
#

So i will send you some useful info

buoyant violet
#

i am just learning by tutorials

dry forum
dim bronze
#

you need to save the config afterwards

buoyant violet
#

btw can i create the config at the end?

dry forum
#

ah

dim bronze
#

also, from the code you've sent already, I have the feeling you aren't using maven?

sterile token
#
buoyant violet
#

ty

#

@sterile token ty

eternal oxide
#

saveConfig not saveDefaultConfig, using that code

dim bronze
#

saveDefaultConfig() hasn't worked for me with maven

sterile token
#

Your welcome

dim bronze
#

like, at all

sterile token
#

It will make you forget your headaches

dim bronze
#

you 'handler' class doesn't do what he wants

sterile token
#

LMAO

sterile token
#

I dont even udnerstand

buoyant violet
#

btw can you help me create the randomizer number?

eternal oxide
buoyant violet
#

its written in the spigot files that you send me?

dry forum
#
        getConfig().setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("config.yml"), Charsets.UTF_8)));
        saveConfig();``` this still doesnt update the config no errors
eternal oxide
#

That code looks fine

dry forum
#

my jar has extra config options vs the 1 that it is currently on the server

dim bronze
dry forum
#
        getConfig().setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("config.yml"), Charsets.UTF_8)));
        saveConfig();``` the only code involving config file in my plugin and file is

resources:
config.yml
data.yml

eternal oxide
#

that code is fine. So long as you are actually calling it

dry forum
#

its in onenable

buoyant violet
sterile token
#

YOu are wrong

#

He is doing/tring what does my FileHandler

#

๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก๐Ÿคก

eternal oxide
sterile token
#

Lmao i gived my FileHandler and explain how to use it

dry forum
#

oh

#

wait

#

why does it make the new stuff at the top of the config

#

and not where it is in the jar

eternal oxide
#

because it's not ordered

dry forum
#

is there a way to order it

sterile token
#

๐Ÿค”

dim bronze
#

not as far as I know since it's handled for you

dry forum
#

also it doesnt copy comment

#

๐Ÿ˜’

sterile token
#

yeah

#

he does that

#

he copy paste

#

old texts

eternal oxide
#

only by doing it programmatically . So not easy

dry forum
#

is there a way to make it copy comments?

sterile token
dim bronze
#

Make your own yaml parser ahah

sterile token
#

give a try it

dry forum
dim bronze
#

exactly

eternal oxide
#

comments are preserved, but not sure about for default. They should be

dim bronze
#

the saveResource call should copy comments, but the addDefaults won't since all it sees is what's parsed by YamlConfiguration

sterile token
eternal oxide
#

well they are preserved in teh current Spigot. I think it was added in 1.18.2?

dim bronze
#

oh really?

#

yamlconfiguration keeps track of comments?

eternal oxide
#

yes

dim bronze
#

oh yeah

dry forum
dim bronze
#

getComments

#

mad

sterile token
#

its bruh

#

just try it

#

it will load your config.yml from resource folder with the content

dim bronze
#

not sure if you don't understand your own code, or if you don't understand what Jerelfa is wanting, but your code does not do what he wants

eternal oxide
#

What we posted does

sterile token
#

what he wants

#

I dont understad

#

He is just trying to load afile with content from resource folder

#

Which is that what does mine

#

๐Ÿค”

eternal oxide
#

He wants that when he uploads a newer jar to his server it automatically adds any new config entries to the existing config

dim bronze
# dry forum too much work

to preserve the comments, you'd have to loop through the comments on the default config resource and then set them for the server's config

#

don't think theres a way around order

dry forum
#

rip

eternal oxide
#

config is by insertion order

dim bronze
#

you could probably change that through reflection? but that would be a mess

sterile token
#

๐Ÿ˜‚

eternal oxide
#

no

dim bronze
#

that will override their current config

river oracle
#

Your dumb verano

dry forum
#

๐Ÿ˜•

dim bronze
sterile token
dim bronze
#

force save the resource with saveResource(path, true), and then loop through each key and check if its set in the config in memory. If it is, overwrite it?

#

sounds like theres room for potential errors though

hazy parrot
dry forum
#

hmm maybe ill try smthn like that

grand flint
#

What event runs when the player moves their camera, like their mouse

river oracle
#

Player move event

grand flint
#

Thank you

stone light
#

The constructor ItemStack(int, int) is undefined
I get this error on this line of code
ItemStack currentitem = new ItemStack(id, quant);
Any idea how I can fix this?

river oracle
#

What the fuck version are you using that you think item id is viable

grand flint
#

How can I detect if the player is looking at a certain coordinate, for example how can I check if the player is looking at 0, 0 from all the wya 2000, 3000?

stone light
river oracle
#

A little that tutorial is ancient as hell

#

Please learn Java first anyways

dim bronze
river oracle
#

?basics

undone axleBOT
dim bronze
#

or you could ray cast yourself

grand flint
stone light
#

alright thanks

dim bronze
grand flint
dim bronze
#

yes, of course

#

but it depends on how accurate you want to be

#
    // Paper start
    @Override
    public boolean hasLineOfSight(Location loc) {
        if (this.getHandle().level != ((CraftWorld) loc.getWorld()).getHandle()) return false;
        Vec3 vec3d = new Vec3(this.getHandle().getX(), this.getHandle().getEyeY(), this.getHandle().getZ());
        Vec3 vec3d1 = new Vec3(loc.getX(), loc.getY(), loc.getZ());
        if (vec3d1.distanceToSqr(vec3d) > 128D * 128D) return false; //Return early if the distance is greater than 128 blocks

        return this.getHandle().level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this.getHandle())).getType() == HitResult.Type.MISS;
    }
#

that is the actual implementation

grand flint
#

Oh thank you very much

regal spire
#

Hi guys, me and my friend Tobias want to start a Craft Attack project and have only one problem and that is we need a plugin that removes all end_Portal_frame

dim bronze
#

so it only works if it's closer than 128 blocks

grand flint
#

So I need to raycast it?

dim bronze
#

i don't think you understand how hard it is to look at a specific block 2000 blocks away ahha

grand flint
#

Well basically I am trying to make a waypoint mod but as a plugin or datapack

#

Thank you ๐Ÿ‘

#

Would it be possible to make like a gui text that points towards a coordinate with an arrow symbol?

dim bronze
# dry forum hmm maybe ill try smthn like that
val configFile = File(plugin.dataFolder, "config.yml")
val oldConfig = YamlConfiguration.loadConfiguration(configFile)
saveResource("config.yml", true)
val config = YamlConfiguration.loadConfiguration(configFile)
for (key in config.getKeys(true)) {
    if (oldConfig.isSet(key)) config.set(key, oldConfig.get(key))
}

// This part is only needed if you want to preserve old config that is now not used
for (key in oldConfig.getKeys(true)) {
    if (!config.isSet(key)) config.set(key, oldConfig.get(key))
}

config.save(configFile)

excuse the kotlin, but this works

#

I tried to write it in a way that its easy to read for java folk

#

essentially, we are overwriting the old config with the new one, and whilst the old one is still in memory, we update the overwritten config with the old values

#

downside to this approach is that the formatting that whoever the configurator used will not be saved

#

but comments and order will

hazy parrot
#

imo just leave user to add new configuration entries by himself and rely on defaults from your resources folder

dim bronze
#

I mean that's what I would do

#

but if you really need this then there you go

elfin atlas
#

Is there a way to check if a pressure plate is pressed outside of the PlayerInteractEvent (so just checking the current state)

sullen wharf
#

kotlin physically and mentally hurts me

echo basalt
#

kotlin got more keywords than a janitor got keys

orchid gazelle
eternal night
#

probably touch grass to fix that or something ?

orchid gazelle
#

Helo Lynx ur here too?

eternal night
#

yea lol

#

gotta keep taps on the upstream people

remote swallow
#

quick ban him

orchid gazelle
#

XD im just here so I can help some people when im bored

eternal night
#

spigot is fun banter xD

dim bronze
#

(sorta)

golden turret
#

i want the code please

hasty prawn
#

Uh it uses my Particle lib lol

golden turret
#

code

#

link

golden turret
#

yes

#

nothing lol

#

but

#

what is the logic

hasty prawn
#

It's basically the exact same thing you're doing.

golden turret
#

๐Ÿค”

#

but mine dont work

hasty prawn
#

Look at the ParticleRotate class on the github

golden turret
#

alright

#

the client said he dont need the animation anymore

#

so I wont care anymore too

hasty prawn
#

What even was the animation

#

Rotated around it?

golden turret
#

I wanted literally the same animation you did

hasty prawn
#

Ah

solemn meteor
#

i remember this being the same error i got on my pc since i didnt have --remapped in my buildtools args

#

but this one is in github

dim bronze
#

you'd have to clone and build spigot buildtools first as a setup

rigid lynx
#

Any library recommendations for inventory GUI's for 1.19.2 spigot?

dim bronze
#

can't remember if its possible with github actions

#

but if im not mistaken you can have it cache the m2 repo

sterile token
# rigid lynx Any library recommendations for inventory GUI's for 1.19.2 spigot?

Try coding it and the impl the same as this one

MenuPlugin plugin = (MenuPlugin) getSever().getPluginManager().getPlugin("MenuPlugin");
if (plugin == null) return;
A a = plugin.getA();

B b = a.newC().a("&6Users").b(3).c(27, new C(itemstack, ClickType.RIGHT, (d) -> d.getA().sendMessage("Stop")).e();

a.getA().a("users", b);

b.f(event.getPlayer());
#

๐Ÿ˜‚

dim bronze
dim bronze
#

although it is quite large and most of it you won't use so it make be better to look around for a specific library for guis

rigid lynx
#

Yeah that's one thing I'm concerned when it comes to helper

dim bronze
#

just putting it forward as a possibility, definitely not the best

ivory sleet
#

I avoid 3rd party libs also as most of them do not encapsulate any sort of guarantee against bugs like issues

#

fe no unit tests

#

poor code architecture

untold patio
#

Hello guys c;

dim bronze
ivory sleet
#

you have interfaces also

#

and IF

dim bronze
#

thought i put IF on there :P

#

but yeah, there's no shortage

ivory sleet
#

^

untold patio
#

Today I'm trying to create a plugin that allows users to set their own homes (a home is specific of an user), so the way I thought I could do it was; "Create a class of Players that contains an arraylist of Homes and then everytime they execute a command it should add the home to the home arraylist"

#

Is my idea correct?

dim bronze
# ivory sleet fe no unit tests

still haven't ever written tests for spigot, seemed like too much hassle for little benefit? Is there any easy way other than manually mocking classes?

untold patio
#

or is there an easier way to do it

dim bronze
#

i mean i don't even know how that would work

ivory sleet
#

but if u need to mock the entire lifetime then mock bukkit maybe

#

and for integration tests u do have mini's thing (dont remember the name)

dim bronze
untold patio
dim bronze
# ivory sleet mockito works, for most part

how does mokito actually mock the server though? What's needed from the dev?

Only tests i've ever written were for challenges with clear goals, so never used mockito myself though I've seen it used before

ivory sleet
#

no it doesnt

#

but everything doesnt need an entire server lifetime mock

#

lets say ur persistence layer

vocal cloud
#

I love how the tutorials on the threads are so bad too

dim bronze
#

i didn't have time or the mental capacity to explain

untold patio
#

This is my project so far

remote swallow