#CivilisaCraft Plugin Development
1 messages Β· Page 1 of 1 (latest)
Hi
ππ»
I would suggest you use ?paste
?paste
shit doesnt work
I would sugget using paste md5 its better
first question
Do you have any other plugin in the sever?
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 ?
Ok !
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
Spyler
You can also make usage of javadocs
You have spigot javadocs which are amazing for seeing each class methods, method paramenters, etc
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)
Spyle compare the full inventory object
Spyle i dont want to sound rude but did you learnt java before?
I know the base of Java but it's my first use of Spigot API
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
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
can u remove the "final"
First off, have you registered the event in your main class?
Also are you supposed to be dragging something or do you just want to cancel any clicks
I want to stop possibility of pickup any item of gui
@EventHandler
public void onClick(InventoryClickEvent event) {
if (!event.getView().getTitle().equals(title)) return;
event.setCancelled(true);
}
But
I want to put command on certain item in my gui
I use InventoryDragEvent
william dont compare by name
William if you cancel click event you can still drag items
yest
lol u cant
I told you because i test myself
there is no way
I dont know maybe the version
what version are you on spyleurfr
1.19.2
Creation of a Simple GUI - Need Help and Infos (1.19.2 - No Paper)
β
Ok i go put a debug system out
what I sent
@EventHandler
public void onClick(InventoryClickEvent event) {
if (!event.getView().getTopInventory().equals(InventoryClass.getInventory())) return;
event.setCancelled(true);
}
oh ok
static... too
i dont like people using static
wow wow wow
Please use an amazing DI
it works
Wait please everyone
What i could put in i my code ? DevelopperWilliam's code or not ?
π«
@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
you
already had an inventory
in your class
you said you needed
the event to be cancelled
STATIC
there is the event canelled
Help im confused right now π«
Someone told "Yes do that" and all other "No dont do that !"
Well better idea
I never said use the static openInventory code
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
Look my code, there is my class and this didn't work
I picked up that code on official spigot website π
but ok i changed that
@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
Okay sorry π
or just get the clicked inventory instead of topinventory
what I did worked perfectly for me
this has nothing to do with it but why does he have final before the event?
Just to be sure, i put that to replace my actual code ?
I want to talk with you privately is it possible?
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 ?
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())
Something to tell you
When you have a single line on if
You can take out the brackets
Oh ? Thank for tips π
if (conditions) return;
yes i changed that thanks
No problem
But once I have time I will work on the Menu api
I havent find a good menΓΊ api so simple
Ok ! Send me a message when it's good π
Yes
Creation of a Simple GUI - Need Help and Infos (1.19.2 - No Paper) β SOLVED
I will send friend request
You are already my friend on discord x)
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)
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
I finished my Chat Channel system ! π Work from first time
Are u spanish? I mean do you talk spanish
No, French
π
si
they are similar
neither me
lmao i dont know why no one published the oAuth 2.1 authorization server
π‘
Why do u use that ? Im interessed (and curious)π
oAuth is a library for making autorizations for resources
I can send you an amazing video in watching about it
Explanation of what the OAuth 2.0 and OAuth 2.1 protocols are, including PKCE.
Patreon π https://www.patreon.com/raw_coding
Playlist: https://www.youtube.com/playlist?list=PLOeFnOV9YBa4yaz-uIi5T4ZW3QQGHJQXi
Shop π https://shop.raw-coding.dev
Twitch π₯ https://www.twitch.tv/raw_coding
Discord π¬ https://discord.gg/R9A8yq4
Gi...
10/10
Oh thank !
I mean its was the logest explanation video i have seen
π 100% Worked !
(I test with other account and when im not in the same channel i dont see the message π )
CivilisaCraft Plugin Development
Update : New prefix style ( @shadow whale what do u think of that)
Texture pack and Bytemap, I love the utilisation of bytemap to do that and all other custom texture (gui, badge, etcβ¦)
oh o