#CivilisaCraft Plugin Development

1 messages Β· Page 1 of 1 (latest)

abstract terrace
#

To quietly up this message πŸ˜‰

shadow whale
#

Hi

abstract terrace
#

πŸ‘‹πŸ»

shadow whale
#

I would suggest you use ?paste

#

?paste

#

shit doesnt work

#

I would sugget using paste md5 its better

abstract terrace
shadow whale
#

first question

abstract terrace
#

Nop

shadow whale
abstract terrace
#

Nop

#

Ok i try this but what do you understand with that ?

#

Oh ?

#

item.setitem ?

#

oh no, inventory.setitem

#

but

#

i didn't use that

#

Yes

#

Ok, in my case i do that in createGuiItem function ?

#

But

#

problem

#

look screen, no paramater for slot

#

1.19.2

#

oh is that the int i

#

okayyy

#

thank a lot i try this and i informed you if i found a solution for trigger

#

Yep

shadow whale
#

Spyler

#

You can also make usage of javadocs

#

You have spigot javadocs which are amazing for seeing each class methods, method paramenters, etc

abstract terrace
#

I didn't have getClickedInvenoty into the InvetoryDraggingEvent

#

Yep i do that

#

but

#

nothing work x)

#

I didn't use paper

#

nop is a diamond sword x)

abstract terrace
#

Sorry, i take it and i can put it in my inventory

#

do not what ?

shadow whale
#

Spyle compare the full inventory object

#

Spyle i dont want to sound rude but did you learnt java before?

abstract terrace
shadow whale
#

Oh ok

#

yes the first usage of the api are a bit hard then you just understand that is more reading about tje javadocs or online

#

My recommendation is not to look for the menu name, just compare the full menu objects

#

i dont like spoofing code but as you are new i will have to

#
if (!event.getView().getTopInventory().equals(inventory)) return;
// do stuff here
event.setCancelled(true);
#

Ah yeah true

#

I mean inv or inventory is the same

#

He just need to replace it with his inventory var

#

if you ask what does return keyword its just stop the code execution so if you more lines of code under the return they wont be executed

abstract terrace
#

I try that

#

thank a lot Verano !

#
    @EventHandler
    public void onInventoryClick(final InventoryDragEvent e) {
        if (!e.getView().getTopInventory().equals(inv)) {
            return;
        }
        e.setCancelled(true);
    }
#

Didn't work 😦

#

Oops i put it in wrong event handler

#

i fix the function but didnt work :/

#

But you see in my Main my listener was declared

shadow whale
abstract terrace
#

'k

#

Nop i can pickup item from gui x)

faint ruin
#

First off, have you registered the event in your main class?

abstract terrace
#

Yes

faint ruin
#

Also are you supposed to be dragging something or do you just want to cancel any clicks

abstract terrace
#

I want to stop possibility of pickup any item of gui

shadow whale
#

I know i just seen it weird there

#

haha

faint ruin
#
    @EventHandler
    public void onClick(InventoryClickEvent event) {
        if (!event.getView().getTitle().equals(title)) return;
        
        event.setCancelled(true);
    }
abstract terrace
#

But

shadow whale
#

dont use title

#

comparing by name is not the best way

abstract terrace
faint ruin
#

yes

#

you could do

shadow whale
#

william dont compare by name

faint ruin
#

But why do you use

#

drag event

#

if your not supposed to be moving anything

abstract terrace
#

For dragging ?

#

x)

faint ruin
#

just use click event

#

I asked if you were supposed to be dragging items

#

you said no

shadow whale
#

William if you cancel click event you can still drag items

abstract terrace
#

yest

faint ruin
#

lol u cant

shadow whale
#

I told you because i test myself

faint ruin
#

there is no way

shadow whale
#

I dont know maybe the version

faint ruin
#

what version are you on spyleurfr

abstract terrace
#

1.19.2

faint ruin
#

give me 1 secon

#

d

#

i will check

abstract terrace
#

Creation of a Simple GUI - Need Help and Infos (1.19.2 - No Paper)

#

βœ…

#

Ok i go put a debug system out

faint ruin
#

what I sent

#
@EventHandler
    public void onClick(InventoryClickEvent event) {
        if (!event.getView().getTopInventory().equals(InventoryClass.getInventory())) return;
        event.setCancelled(true);
    }
abstract terrace
#

oh ok

faint ruin
#

just tested now

#

this works

#

cant drag the item

#

cancelled on click

abstract terrace
#

Wait

#

What i supposed to put on InventoryClass ?

faint ruin
#

I just made this real quick

#

i

#

siad

shadow whale
#

static... too

faint ruin
#

i made the project and thing

#

real quick

shadow whale
#

i dont like people using static

faint ruin
#

oh my days

#

are you guys mentally insane

#

or what

abstract terrace
#

wow wow wow

faint ruin
#

I made the project

#

in 2 min

#

to show him

shadow whale
#

Please use an amazing DI

faint ruin
#

it works

abstract terrace
#

Wait please everyone

faint ruin
#

the point is the fucking

#

event

#

you moron

#

@abstract terrace

abstract terrace
#

What i could put in i my code ? DevelopperWilliam's code or not ?

faint ruin
#

the InventoryClickEvent

#

works

abstract terrace
#

🫠

faint ruin
#
@EventHandler
    public void onClick(InventoryClickEvent event) {
        if (!event.getView().getTopInventory().equals(InventoryClass.getInventory())) return;
        event.setCancelled(true);
    }
#

@abstract terrace

#

this works

#

this cancelles the click

#

and drag

abstract terrace
faint ruin
#

you

#

already had an inventory

#

in your class

#

you said you needed

#

the event to be cancelled

faint ruin
#

there is the event canelled

abstract terrace
#

Help im confused right now 🫠

#

Someone told "Yes do that" and all other "No dont do that !"

shadow whale
#

Well better idea

faint ruin
#

I made it to check if the event would be cancelled

#

which it does

#

and that was your problem

#

when I look up in the chat u already had an inventory

#

you just needed the drag and click to be cancelled

#

so just use the @EventHandler code above

#

and it will cancel both click and drag

#

on the inventory item

abstract terrace
#

I picked up that code on official spigot website πŸ˜…

#

but ok i changed that

faint ruin
#
@EventHandler
    public void onClick(InventoryClickEvent event) {
        if (!event.getView().getTopInventory().equals(inventory)) return;
        event.setCancelled(true);
    }
#

This cancels the click and drag

#

use this

#

@abstract terrace

abstract terrace
#

Okay sorry πŸ˜…

faint ruin
#

or just get the clicked inventory instead of topinventory

abstract terrace
#

My Jetbrain crashed 🀑

#

WOW Thanks for writing that i try

faint ruin
#

what I did worked perfectly for me

#

this has nothing to do with it but why does he have final before the event?

abstract terrace
#

Just to be sure, i put that to replace my actual code ?

faint ruin
#

thats what I thought.. but why then haha

#

just more code for nothin

shadow whale
abstract terrace
#

Yes !

#

But im confused a lot of code was sended here which i take or not take ?

#

Ok, i put your code in my class but implement it no replace my code

#

that right ?

abstract terrace
#

I have found the problem !

#

But not the solution

#

I made this in my Gui class

#
    @EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        if (!(e.getClickedInventory().equals(inv))) {
            System.out.println("TEST DEBUG !");
            System.out.println(inv);
            System.out.println(e.getClickedInventory());
            return;
        }

        e.setCancelled(true);

        final ItemStack clickedItem = e.getCurrentItem();

        if (clickedItem == null || clickedItem.getType().isAir()) {
            return;
        }

        final Player p = (Player) e.getWhoClicked();
        p.sendMessage("You clicked at slot " + e.getRawSlot());
    }
#

And in my console :

#

The solution (work !) :

#

    @EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        if (!(e.getClickedInventory().getType().name().equalsIgnoreCase(inv.getType().name()))) {
            return;
        }

        e.setCancelled(true);

        final ItemStack clickedItem = e.getCurrentItem();

        if (clickedItem == null || clickedItem.getType().isAir()) {
            return;
        }

        final Player p = (Player) e.getWhoClicked();
        p.sendMessage("You clicked at slot " + e.getRawSlot());
    }
#

I change
!(e.getClickedInventory().equals(inv))
to
!(e.getClickedInventory().getType().name().equalsIgnoreCase(inv.getType().name())

shadow whale
#

Something to tell you

#

When you have a single line on if

#

You can take out the brackets

abstract terrace
#

Oh ? Thank for tips πŸ˜‰

shadow whale
#

if (conditions) return;

abstract terrace
#

yes i changed that thanks

shadow whale
#

Haha its not necessary but in y case I preferir

#

Sorry im on cellphone

abstract terrace
#

No problem

shadow whale
#

But once I have time I will work on the Menu api

#

I havent find a good menΓΊ api so simple

abstract terrace
#

Ok ! Send me a message when it's good πŸ˜‰

shadow whale
#

Yes

abstract terrace
#

Creation of a Simple GUI - Need Help and Infos (1.19.2 - No Paper) βœ… SOLVED

shadow whale
#

I will send friend request

abstract terrace
#

You are already my friend on discord x)

shadow whale
#

Oh yes

#

Sorry

#

I forget haha I have really bad memory

abstract terrace
#

No problem all is good πŸ˜‚

#

βœ… SOLVED - Creation of a Simple GUI - Need Help and Infos (1.19.2 - No Paper)

#

Update :

Change :
if (!(e.getClickedInventory().equals(inv))) return;

To:
if (!(e.getView().getTitle().equalsIgnoreCase("Gestion de village"))) return;

Because if i put :
!(e.getClickedInventory().getType().name().equalsIgnoreCase(inv.getType().name())
I can't take item from chest x)

abstract terrace
#

It's work πŸ€·πŸ»β€β™‚οΈ

#

Like ?

#

There are no reason for player to do that because in english Gestion de village want to say "Village Management" but how do you think i can do another ?

#

Oh ok thank for tips !

#

Yep it's perfectly work !

#

Thanks

#

Now i go to work on chat channel

abstract terrace
#

I finished my Chat Channel system ! πŸŽ‰ Work from first time

shadow whale
abstract terrace
#

No, French

shadow whale
#

Oh that why

#

I read gestion de village and i looks mainly spanish

abstract terrace
#

πŸ˜‚

shadow whale
#

si

#

they are similar

#

neither me

#

lmao i dont know why no one published the oAuth 2.1 authorization server

#

😑

abstract terrace
shadow whale
#

oAuth is a library for making autorizations for resources

#

I can send you an amazing video in watching about it

#
#

10/10

abstract terrace
#

Oh thank !

shadow whale
#

I mean its was the logest explanation video i have seen

abstract terrace
#

πŸŽ‰ 100% Worked !
(I test with other account and when im not in the same channel i dont see the message 🌟 )

abstract terrace
#

CivilisaCraft Plugin Development

abstract terrace
#

Update : New prefix style ( @shadow whale what do u think of that)

shadow whale
#

What did you use to make them=

#

They looks pretty good

abstract terrace
#

Texture pack and Bytemap, I love the utilisation of bytemap to do that and all other custom texture (gui, badge, etc…)

shadow whale
#

oh o