#help-development
1 messages ยท Page 1739 of 1
CreeperDeathEvent
you have an event class, you are not registering it itn onEnable()
i did register already ๐
ok, so you need the actual class (you can paste that as well)
but in the main, you have to register it
?paste
that was empty
just fyi, Spigot has some good support
we have a Wiki section on the main website
here you can find nice info
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
which talks about how to setup event handling
sir, i know how to use it, but this specific zombie spawning is not working, can you please look upon my code and say if there is any mistake i did or not ๐
I have this now:
Yadel:
inventory:
lumberjack:
- null
...
ArrayList<ItemStack> content = (ArrayList<ItemStack>) this.c.getList(this.guild.getGuildName() + ".inventory" + "." + type);
``````[12:46:49 ERROR]: Could not pass event BlockBreakEvent to CimeyRolePlay v1.1.0
java.lang.NullPointerException: Cannot invoke "java.util.ArrayList.size()" because "content" is null
at de.cimeyclust.utils.guilds.GuildInventoryManager.loadInventory(GuildInventoryManager.java:59) ~[CimeyRolePlay-1.1.0.jar:?]```
you need to register the events
@noble lantern Why content is now null?
sir, i already registered on my main class ๐
getServer().getPluginManager().registerEvents(new CreeperDeathEvent(), this);
yeh
Add a null check for items
i have already registered dude
if null, continue and load next item
I did: java for (int i = 0; i < content.size(); i++) { ItemStack item = content.get(i); if (item != null) { items[i] = item; } else { items[i] = null; } }
any it not workign?
But content is null now
no
Yeah dont actually set a null value to a array of ItemStacks
ah, so do you know that it is hitting your event handler?
If its null just ignore it
thats why we made logger right? ๐
And possibly add a method to remove hte null value from your config
put in some log messages to see that it is hitting inside your event handler
So. When content is null I just should create an empty inventory?
thats what i was asking, how do i make logger message in my event class ๐
hmm ,it not working?
no
remove logger = plugin.loger();
I sent you the code to log a line
then?
No if a ItemStack is null completely ignore it
ItemStacks cannot be null, hence why you have that error
here sir
the handler, not the main class
dude that is handler class -.- not main
for both CreeperDeathEvent and CreeperBlow
bruh
public final class BossMobs extends JavaPlugin {
should be
public final class BossMobs extends JavaPlugin implements Listener {
bruh
๐
implement listener on the event classes then
tf
can u just see my paste
above?
no where?
He did its implementing Listener
this class
Wait so what even is the issue here?
I dont mean to intrude but i see you all have been working on this for a while
bro I, swear, ah the way you are talking, the peacefully you are talking, dont mind me but i think you are high.
he's not getting into the event
sorry if i sounded rude ^^
soz, i scrolled up and saw main not the event part, but i found it
not and not hgh, just a bit of wine ๐
i already pasted event class 4th time
i found it
i knew it
not to worry
i knew it
just you linked to the main nto the event
i grab people in their chat itself
why to implement bruhhhhhhhh????
listener is for events
and i dont do events on my main
oh my freaking goddd
Whats the issue your having with your code, is EntityDeathEvent not firing?
ye when creeper dies it should spawn zombie
its not working
ok well, you have yet to show me that you can throw a message to the logger in your event
idk why
did you put some debug before your if statement
so ,i'mt at a loss,
dude chill out
get some rest
and come back when u r fresh
I know you have sent it a few times now, but can you send your Main class again i dont wanna scroll up a lot
His if event should be firing tbf thats fine
?paste
also I presume EntityExplodeEvent would be called instead of death if a creeper explodes?
plus you need to import logger into your event code as a static
Yes that is true IIRC
bro, pls stop your logger thing
well maybe not
ArrayList<ItemStack> content = (ArrayList<ItemStack>) this.c.getList(this.guild.getGuildName() + ".inventory." + type);
ItemStack[] items = new ItemStack[content.size()];
for (int i = 0; i < content.size(); i++) {
ItemStack item = content.get(i);
if (item != null)
{
items[i] = item;
}
}
Inventory inventory = Bukkit.createInventory(new GuildInventory(), 54, type + "-Inventory von " + this.guild.getGuildName());
inventory.setContents(items);
return inventory;
@last ledge are you making the creeper explode or not
java.lang.NullPointerException: Cannot invoke "java.util.ArrayList.size()" because "content" is null```
I still have this error with the code.
You need to listen to EntityExplodeEvent
Even if ignore a null item completely
What Sam said ^ are the exploding or dying by player damage
You might need to listen to both events
thank you so much bruh
it worked
you need to listen to both if you want to catch all creeper deaths
Try using List's for this isntead of arrays ([]) it makes things so much more complicated
man u r saviour
you can import static frolic.bosmobs.logger;
oh my frekaing goddddddddddd
can u stop ur logger
pls
for god sake stop your loger
your config getList is returning null
sorry sir ๐
maybe you need to communicate what your issue is more clearly
i was just irritated with the word "logger"
back to work on mah dragon ball z plugin ping me if someone needs help
if it is not the basics of the event is not being reached then the next conclusion is that the event is wrong
but we have to go through the process
yes sir, so the event is now successful
and now when Creeper dies it spawns Zombie as intended
yes, because it wasn't the correct event to begin with
well sorry for the bottoms up analysis, should have just looked at the event
ah how do i edit my inventory from another class ?
but if I didn't explain how to paste code, no one else would understand
as my bad then
Can you explain on that some more? like what class are you trying to edit from? i assume after they kill the zombie?
i'm quite tired, it's 4am, just trying to help another dev out.
4am cali gang
yeh, don't know why i'm even back on this discord
other than folks complaining about my plugins
I worked one time:
[13:09:51 INFO]: [CCRP] is correct block
[13:09:51 ERROR]: Could not pass event BlockBreakEvent to CimeyRolePlay v1.1.0
java.lang.NullPointerException: Cannot invoke "java.util.ArrayList.size()" because "contents" is null
at de.cimeyclust.utils.guilds.GuildInventoryManager.loadInventory(GuildInventoryManager.java:60) ~[CimeyRolePlay-1.1.0.jar:?]
```But then I got the error again.
```java
ArrayList<ItemStack> contents = (ArrayList<ItemStack>) this.c.getList(this.guild.getGuildName() + ".inventory." + type);
ItemStack[] newContent = new ItemStack[]{};
for(int i = 0; i < contents.size(); i++)
{
if(contents.get(i) != null)
{
newContent[i] = contents.get(i);
}
}
Inventory inventory = Bukkit.createInventory(new GuildInventory(), 54, type + "-Inventory von " + this.guild.getGuildName());
inventory.setContents(newContent);
return inventory;
well good luck then
Thats why you never make plugins public insert thinking face
no this is for another set of instruction. I have made a inventory named GUI, in another class, so i dont want players to be able to close the inventory, so as there is no .setcancelled in Inventory close event, so i am looking to import my GUI inventory to another class so that i can reopen the inventory each time player tries to close it
so my question is
how do i import my inventory from another class
to reopen it
If you listen on the InventoryCloseEvent you can just cancel that event
You should add a InventoryHolder to the inventory you created and do a check if the inventoryholder is that inventory
that code is cancer
omg
o fudge, maybe i can just remove all my plugins from spigot
how to change target block of an entity
i mean where the entity is going
I have one single Public plugin and its just a JSON Gui creator like deluxe menus xD
u cant cancel Inventory close event unfortunately
Soon ill make this new plugin im working on public its gonna be badass
menus are a pain
menus are easy af
you 100% can im doing it in my plugin
(when using my menu framework)
e.setCanceled
so my question is how do i import my inventory from another class to my event class?
no they aren't, it's more complex that is thought
if u use a well built framework
Just make a GUI wrapper over the Inventory class bam ez
did you know you can have an menu (container) that is open by two persons?
yeah?
yes
yeh
so my question is how do i import my inventory from another class to my event class?
You just need to cancel InventoryCloseEvent fam
e.setCancelled
u cant dudeee
basically
u cant cancel inventory close event
Im doing it right now?
one tick later
open it again
and to check if the inventory is that inv
you can use a InventoryHolder
^
show?
impossible to cancel inventory close event
You can store the inventory using e.getInventory iirc
you now guys, i haven't looked at spigot code in 6 months
can u send me ur code snippet leme see what u have done
Look what Olzie sent i should of mentioned that part
https://javadocs.olziedev.com/spigot/1.17.1/org/bukkit/event/inventory/InventoryCloseEvent.html it extends inventoryevent
declaration: package: org.bukkit.event.inventory, class: InventoryCloseEvent
so you cant cancel it, it doesn't implement cancellable
public Inventory loadInventory(String type)
{
ArrayList<ItemStack> contents = (ArrayList<ItemStack>) this.c.getList(this.guild.getGuildName() + ".inventory." + type);
List<ItemStack> items = new ArrayList<ItemStack>();
for(ItemStack content : contents)
{
if(content != null)
{
items.add(content);
}
}
Inventory inventory = Bukkit.createInventory(new GuildInventory(), 54, type + "-Inventory von " + this.guild.getGuildName());
inventory.setContents((ItemStack[]) items.toArray());
return inventory;
}
```I will try this now @noble lantern
can u send me ur code snippet?
Ide have to find it in one of my old ass projects, just look what Olzie said
InventoryCloseEvent
e.getInventory
one tick later
open inventory to player
https://img.olziedev.com/465GB465r465i465E.png it doesn't implement cancellable
so u cannot cancel it
InventoryEvent also doesn't implement cancellable either
yee i had to of mixed it up with something else i was doing
so idk why how u did InventoryCloseEvent#setCancelled
ah
was u confused with clickEvent?
he can just do this and be just fine though
i think so
what does your event provde?
ah yep i did have it confused with that
wait, so event gives you the inventory you want or you want another inventory?
Meh fine for me im the only contributer on this project
InventoryCloseEvent gives the closed inventory
i'm confused
Not really, e = event not too hard to understand there and in most caes in this plugin e is used once
and Events is the only place one letter variables are used in this project
Exceptions are either ex or ignored on here
this is the one?
I know, but having one letter variables is very bad practice
you should at least use full letter variables which are short
like for example if you have InventoryMenuContainer, i would name it invMenu
I know but its not project ending to use them and ide have to run through over 2600 lines of code to change all of this in this project
What you are trying to get from the inventory
@last ledge
Well do it in the future
Open a PR request and change it for me ๐
๐
nah do it in the future for new projects
and @noble lantern https://img.olziedev.com/265226565265PPYSVjo.png
shit wrong person
@echo saddle
do something similar to that, on close wait a tick
open it up again
awww cmon i know you wanna code dive through 2k lines of code
Is that inventory lib public by chance?
2k lines is nothing tho
i mean it kinda is, kinda not
lmao
no documentation whatsoever
nah especially when this project is barely far from done
Public github link by chance or nah ive done things without docs before
yea i mean
there is way more
how to open one tick later inventory?
its not that hard
@EventHandler
public onInventoryClose(InventoryCloseEvent event) {
Inventory inv = event.getInventory();
// do your check for the inv here
Bukkit.getScheduler().runTaskLater(plugin, () -> event.getPlayer().openInventory(inv), 1);
}
BukkitRunnable's
i havent used it
but TBF you might not even need it for this idk
its not that its just a vegan teacher POV ๐
Bukkit.getScheduler().runTaskLater(plugin, () -> event.getPlayer().openInventory(inv));
plugin word is throwing error
because you need ur plugin instance
cmon man, its not rocket science
do you even know basic java?
I think I do?
I typically pass my instance through each constructor in classes that use any type of schedular
i aint gonna tell u
if you dont know
how to get your plugin instance...
yeah same i have a abstraction class for simple getters
and also extend my APIBase
If its in main then use this or if not use constructor like this public TestCommand(Main main) { this.main = main; }
Ok
fucking love abstract class's
or pass it through all the classes when needed
this is one of my main classes for one of my plugins
Works too
pretty sexc
I do something like this
@Override
public void run() {
menu.show(player, page);
}
}.runTaskLater(plugin, 1);```
use a scheduler
so much more cleaner
no suitable method found for runTaskLater(frolic.kingdomplugin.events.Closeinventory,()->event.[...](gui))
than u using an anonymous class
thats wrong
ur saying ur plugin is an event?
put your plugin instance, not the class its in
ye i did this
yah
thats wrong
its not in your main class
for example in your main class have a field
public static MAIN_CLASS_NAME INSTANCE;
wait can you extend main class and use multiple onEnables? shit just gave me a great idea
then in your enable, set INSTANCE = this
what
no
i jave already dont it leme showu
then in your disable set INSTANCE = null
?paste
yeah do that then and use ur getter
BossMobs.getInstance()
set ur instance to null in the disable please
looks like that unless thats your whole entire onEnable event for that plugin
i dont understand
i have a custom abstraction class named OlziePlugin
then that extends and implement other classes
and also extends JavaPlugin
ohhh i see now nvm
was about to say damn i can make my shit so much more organized cause my onEnable method is just shitloads of initializers
Ohh
Like... this shits nasty asf lmao
Kinda need to store those events and cancel them in onDisable but meh later time
i sent my wrong main class lamo
you color scheme is nasty
?paste
HEY your right
ouch thats
i was actually gonna tell you off but, your right
this is my main class
kinda ugly
yeh
i agree, ugly as fuck
man
u should use a custom event framework
automatically register events
like my command framework, holy fuck
that can load over 300 unique commands within seconds and literally execute one method for it
i use a custom color scheme
if (economy.equalsIgnoreCase("vault")) {
EconomyResponse withdrawResponse = econ.withdrawPlayer(player, world, amount);
if (withdrawResponse != null && withdrawResponse.transactionSuccess()) {
return true;
} else {
if (debug) {
logger.info("Warning! Vault could not withdraw from the buyer");
if (withdrawResponse == null) {
logger.info("Economy plugin response is null!");
} else {
logger.info(String.format("Economy plugin response type %s", withdrawResponse.type.toString()));
logger.info(String.format("Economy plugin response message %s", withdrawResponse.errorMessage));
}
}
return false;
}
} else if(economy.equalsIgnoreCase("tokenenchant")) {
double tokens = te.getTokens(player);
if (tokens >= amount) {
te.removeTokens(player, amount);
return true;
} else {
return false;
}
} else {
return false;
}
}
lol
well that sucks
I could probably do the same thing if i modify my command api to be like spigots HANDLER_LIST and just add each class into the list and then loop through each and execute
https://img.olziedev.com/Z337474373744dWEH.png this is my register for commands in my one of my plugins
meh effort
yeah also i did lazy caching too
Boi you talking how my color scheme is ugly and yours looks like almost all white xD
with Configuration.getString() lmao
its not bad, would change the background color
well
thats the default intellij color scheme
and tbh its ugly
i use material theme, premium
yeh
i cant even remember if my theme is default or not
i think i installed one a long time ago idk?
thats default
damn
i just use dark mode everything
for all of my ides https://img.olziedev.com/i794M794Kj794s794wg.png
i totally didnt just update my intellij from 2019 to 2021 a few hours ago
yeh, no, i like just in my code, you should see my sublime with my "synchonicity" theme
i just ignore it
its so annoying
might go look at intellij themes now
but the other did i was doing some NMS and reflection
and i needed to decompile a class i think it was
Sadly i needed to do it for discord RPC
CraftSkullMeta
and i did it
and oh boy intellij was hungry
IntelliJ ate 6gb of my ram
and 50% of my cpu
it was a memory leak or something lmao
my intellij is kinda always hungry with this project open
Was it just the one file?
here it is
yep
@noble lantern come dm
one file
had to of been a fatass file ngl
is that ur ah plugin
it wasnt
it was CraftSkullMeta
i mean intellij is just vibing at 1.7gb https://img.olziedev.com/O535533ZvCxs53i.png
thats fine
i gave it 10gb of ram to eat up if it needs to
uh, yeh.
Never looked into that class before so idk how large it is
Try doing Player class now :kek:
not even big
nah nah
do Material
hate material, i do like this color scheme i made tho
pls no
kinna reminded me of the colors on the cover of the Police: Synchronicity album
thus the name
just realised
why
are
these
static
๐ฉ
thats not a util class
yeh, gotta go play some skyfactory-one, and bug darkosto about bugs
but before I go...
!spacex
A Spacex Falcon 9 is scheduled to launch Crew-3 from KSC LC 39A in 10 days 18 hours 32 minutes.
you have a gta v server?
:I
why do u think i own a server
we have a rust server, but it's down atm on comfy
we are playing modpacks and the usual factorio stuff on our servers
someone ask for help i dont wanna work on this plugin rn
we might have valheim still running tho
"HoW do I ImpOrT SpiGoT ApI in My EClipsE"
pm me if you want the url
hOw mAkE jAr fIlE in InTeLlIj
god i have no idea how to use eclipse
my answer would just be google
what, dont you use netbeans?
your lucky i dont have custom emojis in here
:out:
oof, don't tell the orange dude that
im out
gta v ๐ฉ
depends on whether you use maven or gradle or intellij artifacts
im joking
but i want to use intellij artifacts
ngl i was kinda enjoying gradle for the short time i was using it
yeh, its not that hard then
Maven or Gradle is the way to go over intellij artifacts
soooooo much more complicated using the intellij artifacts
never
partyyyy
upper right, gear, dont' go into settings, but go into project structure
select Artifacts under Project Settings
try me, i wanna die
Click the + key
rust zergs be like
Select Jar
what jar
from modules with dependencies
ur in build configurastion
thats the wrong bit
man
just use maven
lowkey forgot how to even do intellij artifacts theyre kinda not good
why arent you just using maven or gradle fam
thank
im built different fam
its so much harder to shade/import in dependencies using the artifacts
just google it
you could setup your project using maven or gradle
^
yeah
its much more complex to etup
setup
nah
ju
its really not
Spigot forums has a super simple copy pasta for maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
$ sudo apt deny-all
and shading meands including jars in your plugin that you can access but doesn't conflict with other jars available in the java classpath
oh god for a sec i thought i was in papermc and i was gonna get roasted for a spigot link
i was like shit better delete that
what
But i love paper
i love paper cuts
i love the smell of paper
I love writing down notes on paper
where is that auto-kick bot, slacking off again.. . reee
jtx you been typing a while you okay?
why kick me
!8ball will you kick icky?
dyno is disabled
sheesh im almost at 2k messages in here
A Spacex Falcon 9 is scheduled to launch Crew-3 from KSC LC 39A in 10 days 18 hours 17 minutes.
well i guess the SpaceX bot still works
yes
okay just checkin in on yah
wym
there is a bot command to show last iportant quote by a member
oh idk
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
i just hop in here every few months and help people then ghost chat
maybe it's changed
used to be able to see how much you have been chatting too
?userinfo
dalton,sounds country-sexy
Hey guys wonder if we compare 2 worlds is laggy than compare 2 world's names?
?userinfo
?userinfo 486203444709949450
Member "486203444709949450" not found.
if world == world wont have any impact on performance tbf
You could compare UUIDs if youโre really concerned
^
as expected. tks
as think it maybe need to get each element of the world, and more stuff to compare. not like string only get name of the world
lol i guess i joined april fools like all the other folks who were on IRC
im teaching a local AI to learn how to write code as i give it comments
so far i made it type "c"
great job. :sad:
Only issue with comparing names is you might have 2 worlds with the same name but theyre different
You can compare World UUID if you are concerned like Coll said
hmm
That isn't a big issue, tho if comparing worlds arent lag then i might just use that instead, cleaner code.
hey, what plugin do people usually use for /warn? i'm trying to hook into it for something
advancedban
Essentials but good luck hooking into that
What are you trying to hook into it for?
gah discord lag
CodeCademy
I have essentials (and vault to access it) but it doesn't have /warn. Is it one of their other addons e.g essentials protect? @noble lantern
Tyrone, a developer with 15 years of experience programming in Scala and Node.js, tells us why Scala is categorically better than Node.js. Through personal anecdotes and incisive commentary, Tyrone forcefully argues that developers should always choose Scala over Node.js.
https://vimeo.com/216330850
IIRC EssentialsX base jar has the /warn commands, if it doesnt then its kinda random what people can use for /warn
Oh fuck you your gonna start a war over my NodeJS
nodejs is ballshit
yeah it doesn't have /warn :/ I guess people most likely use advancedban like icky mentioned, thanks guys :D
watch the video
Can i ask what your trying to hook into /warn for?
this man just called NodeJS the worse thing ever to happen in programming nah
Hiya, I'm having a problem: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
I'm using the Worldedit API , how can I fix this?
im literally getting triggered by this video ngl
virginia
How are you importing world edit API?
Maven
Set the scope as provided in your pom
Wdym?
I cant tell if this guy is joking or being serious in this video
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
Example
he's joking
this is one of the most funniest posts i've ever encountered as a dev...
console.log("its 5am how are you awake");
thnk u
this is not how you PR
ty it worked
please don't post memes in #help-development
my bad.
guys do i do it
why?
u unlucky
well shoot, 5am, i'm prone to be a bad influence
anyone know how use the HoverEvent in bungeecord with the show text action?
my faowkin luck iis shait senpaii uwu
dude, langwage
ok senpaiii UwU
When I use "spigot.yml", "bukkit.yml", "paper.yml" and "purpur.yml" in my plugin. It dont work
bruh no
thats wrong
its the plugin.yml
spigot.yml, bukkit.yml, paper.yml is for the server implementation
But I want to make it Spigot and Bungeecord support
Okay? so create a plugin.yml for bukkit, spigot, etc...
then create a bungee.yml for bungeecord
oh
and you have a main in both of those files which chooses what main classes is for what
When creating those types of plugins, i normally have a Spigot module, a BungeeCord module and a Core module
How can I unregister a vanilla event?
a vanilla event?
Iโm trying to make my own playerjoin event when a player joins the server but I added it and there is still the minecraftโ player joined the gameโ
Maybe not vanilla but just like default events
Ohh ok Iโll try it thanks
is there a way to spawn a floating leash? or not make the leash unleash from an entity?
Anyone know how to fix configurations.runtime call here for gradle 7.2 ?
from {
configurations.runtime
}
include("spigot-" + project.property("apiversion") + ".jar")
rename("spigot-" + project.property("apiversion") + ".jar", "server.jar")
into "testserver/"
}```
> Could not get unknown property 'runtime' for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.
hi, is allowed to host Spigot (with NMS and OBC) on private Maven Repository?
Hi, I am trying to trace/render the pathfinder "path" of an entity using blocks. I have a location the entity is trying to reach as i've set its pathfindergoal to that location, I was wondering how it's possible to draw a path from where the entity is to the path it's taking to get to its target..? (Version 1.17)
Is there any thread about custom events?
yea
ty
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
up to u
Is it better to have a big large fat plugin doing everything my server needs to, or is it better splitting it up to mutiple plugins?
so the core would, be the core of my server with individual tasks within a "module"?
This depends on multiple factors. I for my part just write one plugin that runs the whole server.
Either manage it with modules or just packages. If you have multiple plugins then you have to write
one common core library.
how would one make a "module"? Is it any different from a plugin?
He is speaking about maven modules. You can check out multi module setups online.
Hey quick question: I have created a custommob that follows the player who spawns it. To do this, I created the following command:
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
if(player.hasPermission("test.commands")) {
CustomMob mob = new CustomMob(player.getLocation(), player);
WorldServer world = ((CraftWorld) player.getWorld()).getHandle();
if(args.length == 1) {
int number = Integer.parseInt(args[0]);
for(int i = 0; i < number; i++){
world.addEntity(mob);
}
} else if(args.length == 0)
world.addEntity(mob);
}
}
return false;
}```
In the command, you can either specify no argument or an argument that must be a number. Depending on the size of the number, so many custommobs will be spawned. However, no matter what number I enter, only one custommob is spawned.
mob is spawned. Does anyone know how I can fix this?
Adding the same entity multiple times should error concerning its uuid should be the same ?
CommandBlock#setCommand(String command) seems to not be working, it's not actually setting the command. Any ideas?
are you updating the block state
Well I though I'd need to but I can't find how
oh ok ty
I am in a awkward situation. I made a Gui which has many options, and option to go to another GUI. This Gui will appear when player joins the server for the first time, to basically choose teams, they wanna join. Before choosing the team they cannot close the GUI, or if they try, they will be be kicked of the server. This GUI has information about teams, and another GUI has options to choose team. so when players click on "choose teams" option to go to team choosing GUI they get kicked, how do i fix it?
why doesnt ImmutableMap.of supports more parameters?
Well, you gotta stop somewhere
its 5 afaik
5 isnt that much
its more than 4
lemme use the builder than ๐
what he said
Hi I'm running into an issue while trying to build, got this plugin from a previous dev and I can't figure out how to fix this Im using Intelij, Gradle
error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider me.lucko.helper.plugin.ap.PluginProcessor not found
looks good
I am in a awkward situation. I made a Gui which has many options, and option to go to another GUI. This Gui will appear when player joins the server for the first time, to basically choose teams, they wanna join. Before choosing the team they cannot close the GUI, or if they try, they will be be kicked of the server. This GUI has information about teams, and another GUI has options to choose team. so when players click on "choose teams" option to go to team choosing GUI they get kicked, how do i fix it?
someone?
seems pointless though
ignore them when they click on "choose teams"
when you open the second GUI, the first is closing
so yoru InventoryCloseEvent is firing
Send ur build.gradle
@EventHandler
public void onClose(InventoryCloseEvent event){
Player player = (Player) event.getPlayer();
if(event.getView().getTitle().equalsIgnoreCase("Willkommen auf ยงbHydramc.de")) {
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', "ยง7Du wurdest rausgeworfen\n ยง7Grund | ยง7Wรคhle ein Reich aus!"));
}
//player.openInventory();
}
}
where do i add
Only kick them if they don;t have either of the inventories open
there is .hasinventoryopen?
its not even less lines
Am besten wartest du einfach 1 Tick (Scheduler) bevor du den Spieler kickst und fragst vorher nochmal ab ob player#getOpenInventory() null ist. Wenns nicht null ist kickst du nicht
From what I understood the dude before me used a plugin on Intelij it might be the cause of my issue ๐
instead of calling 10 times the same method
???
add both your inventories to a Set. Then when teh close event happens, check if that player has an open inventory and its in the set
It still gets called 10 times
if it is, don;t kick them
Also, why do you kick them, just open it again
its crashing my server
when i try to do it
You can wait 1 tick?
yes
but hsi issue is he wants to open a second inventory but he's not checking for the second inventory
he's just kicking them if the first closes
oh hmm
how do i check if second inventory is open?
player.hasinventoryopen exist?
cant you just put players is a set when they click on the choose team button and ignore that set in the inv close?
hey, i am working on plugin that providing better way of creating commands (i know that there is similar things but still) and i made a sample, ill be glad if u check it and give some suggestions/advice about how to make it better, https://paste.md-5.net/onifirusik.java
he only needs to add both his inventories to a Set, then on the close event, get the open inventory of the player and .contains on the Set.
if its not there then kick the player
Might be it, anyways it complain about a processor right?
Donโt make it annotation based
Imo
how do i add in set?
i made it just because standart event handling system is so, and i wanted to do it consistent
Thatโs a bad reason
Standard event system does that because itโs the best alternative
Set<Inventory> gui = new HashSet<>();
gui.add(inventory);```
yup
not just the class?
for your case, just normal data abstraction and polymorphism would work fine
you add the gui's you create
anyone know how use the HoverEvent in bungeecord with the show text action?
yes
Check out the plugin but does helper by lucko use annotation processing btw?
an example
this might be the dumbest thing ive heard
Justify
thanks
how do you exactly mean that? when i try to spawn several entitys the console does not give me an error
can you spawn an entity with an uuid defined?
private boolean isSelected = false;
@EventHandler
public void onClose(InventoryCloseEvent event) {
Player player = (Player) event.getPlayer();
// so here you check if the proper gui was closed right?
if (event.getView().getTitle().equalsIgnoreCase("Willkommen auf ยงbHydramc.de")) {
// check if player did not select the item
if (!isSelected) {
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', "ยง7Du wurdest rausgeworfen\n ยง7Grund | ยง7Wรคhle ein Reich aus!"));
}
}
}
//somewhere where you check if player clicked an item, add this
isChecked = true;
}```
will this work?
@eternal oxide
Hello, how can I make a username where I can hover over it?
idk if spigot does silently ignore it, but you should not be able to add multiple entities with the same uuid.
in general, you do not want to add the same instance of an entity multiple times
You mean like in chat?
where? in chat?
create the instance as often as you need it and add it after
Here when you hover
and uhh i guess that's chat
Yeah
no
i just find it strange that before i worked with normal mobs and it worked there. but it just doesn't work now that i'm using a custommob.
You probably have to cancel the chat event and send the message as a component manually where youโve added a hover event to all online players
i think you need to listen for the AsyncPlayerChatEvent and cancel it send a TextComponent with player.spigot() to all players that receive the chat
smh ๐
๐
how would you ever summon the same mob multiple times
?
I did it with a for loop
yea but world.spawn creates a new instace
you are trying to throw in the same instance of a mob
i got issues with mob uuids too
i have a quik question. I am trying to clear the inventory of an player when he picks up an item and everything gets delete except the item he is picking up. Should i do it with an runnable or is there anything i can do. Event: EntityPickupItemEvent because old one got deprecated
how can I link some object to a player?
I only know how to use HashMaps as something to link stuff
my question is
how to link BUT save the data even after server restarts/reloads or whatever
If the event is cancellable, just empty the inventory, then let teh event run as normal. It will pickup after you clear
i think you need a file?
save it in a json
or use a proper database ๐
proper design? 
Depends on what you are trying to link
thats what i am currently doing
anyways to save data every 5 minutes, should i make a runnable with saves it bla bla bla and nothing else?
trying to link an object constructed by a class which owns a name, location and other stuff
just like an another spawnpoint that a player can access through commands
save onDisable()
na. but just don't crasdh your server๐ง
?pdc
json can be handy
omg how useful can this be
thank you so much
what
when did this exist
you can update the file when ever something is change. So on every method call you want just make a method for it
why didnt no one tell me lmao
bcs pdc is advanced stuff ๐ณ ๐ณ ๐
i dont even understand half of that tutorial
especially that i haven't finished high school yet so i have no idea what some math stuff means when people use them
also the byte part
no idea what it does
bytes are mostly used in form of an array
okay this is too complicated for me
is there another way to do this?
example: have more than 1 value in a HashMap
i know this sounds dumb but that is just an example
what are you even trying to save?
What I would do is create a class containing all the info and put that class with something else. Such as, if I needed to store a players balance, kills, deaths and rank, I would just create a Class called โPlayerDataโ or something along those lines. This class would hold all that data and then I just put the players UUID with the PlayerData class into the HashMap.
Yea that would be good but what if i need to store more than 1 copy of that class per player?
Why would you need to do that
im making a waypoints plugin and i need to save multiple per player
depending on the max an admin would give per player to have
I already have the max integer command done
i just need some kind of dataCombiner to link all waypoints created by a player to them
unfortunatly java doesnt has structs
i already know how to save data through serializer input and output streams
oh
hmm
how do i make giants attack players
There is a plugin that makes a command when you are online?
Like every hour you are online it will make a command
In that case, why not just keep a Map<UUID, PlayerWaypointData>, fill it when the player joins and remove+save it when they leave
Yea but what if server shuts down?
their waypoint data will be wiped and when they come back nothing will be returned to fill it?
or am I wrong? I see you are using Map instead of HashMap
not sure what are the differences
does Map save even after server restart?
map is just a common interface, what implementation you use is up to you
but you may simple save the data for all online players when your plugin disables
perhaps just save onCreation of waypoints or something?
because if server crashes onDisable() won't be called
or that ยฏ_(ใ)_/ยฏ
1 last question though
dont wanna be annoying
how can I make some kind of function that returns how many waypoints a player has?
depends entirely on how you store them
To prevent lag from too many waypoints being saved at once, I would set up some type of queue system, only save a certain amount per 30 seconds or so
it is a waypoint system, idk how many you expect to be saved ๐
You know how players find any way to lag a server xD
any suggestions?
will add cooldown for creation
That works
I'd go for a Map<UUID, PlayerWaypointData> to map each player to their waypoint data
PlayerWaypointData can then just contain Map<String, Location> to map a waypoint name to a location
Map#size
public class WayPoint() {
String name;
Location loc;
UUID uuid;
// extra variables here for info
WayPoint(UUID uuid, String name, Location loc) {
this.uuid = uuid;
this.name = name;
this.Location = loc;
}
}
// now for how i can save the map
HashMap<UUID, WayPoint> wayPoints = new HashMap<>();
wayPoints.put(uuid, new WayPoint(uuid, name, location));
is that good?
this.loc = loc*
ye
but ignoring that
do u think that is a good way of storing it?
for file storing ill just use serializer i guess
onDisable and onCreation
That should work but that class only stores one location for one waypoint
ye
i can make multiple instances of that same class
with a command
so players can make more
that is just a blueprint
right?
The hash map can contain multiple of the same value but not the same key, youโll save one waypoint with their UUID and if you try to add another it would override their last one
ye
that is why i save on creation
and not onDisable
i want to make every chunk in a world exactly the same i had the idea of pasting a schematic in the chunkloading event with fawe but this would be very power consuming.
is there a better way?
can you check if an object in an instanceof a method's generic?
Full Code: https://paste.gg/p/anonymous/4cce517b96544d4386912b0e212ec481
Error at: skeleton.setMetadata("SkeletonKing", new FixedMetadataValue(plugin, "skeletonking"));
Error: incompatible types: jdk.javadoc.internal.tool.Main cannot be converted to org.bukkit.plugin.Plugin
Main Class if needed: https://paste.gg/p/anonymous/e7c086c2bbd44e11be5660b00ac984fc
Change to correct import
which one?
Main
Welcome back to: Reasons you should not name your plugin's class "Main"
this is why you shoudl never call your plugin instance Main
Ok there are a few issues...
First bad import
Second you create a Field called plugin of type Main, but you never initialise it
Third, your plugin seems to be called BossMobs so I assume your plugin Class is BossMobs, as that is imported too.
so line 25 change to BossMobs plugin;
then add a constructor so you can pass an instance of your plugin
Dependency Injection
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
player.spigot().sendMessage(new ComponentBuilder()
.append(ChatColor.translateAlternateColorCodes('&', " &8ยป &b&lRULES INFO &7[CLICK]"))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text
(ChatColor.translateAlternateColorCodes('&',
"&b&lRULES" + "\n"
+ " &8ยป &7Page 1, Section A" + "\n\n"
+ "&b&lTHIS INCLUDES" + "\n"
+ " &8ยป &7How to use /rules correctly" + "\n"
+ " &8ยป &7Hovering over text & Clicking on text in /rules" + "\n"
+ " &8ยป &7Pages and Sections" + "\n"
+ " &8ยป &7How to tell when someone is breaking a rule" + "\n"
+ " &8ยป &7What to do when someone is breaking a rule"))))```does anyone know why every line after a line that is bold is like 2 pixels off
i'll send a screenshot 1 sec
have you tried adding a reset to the end of each line (before the CR
what's CR
carriage return the \n
huh
&r is reset yes
Is there a way that when an armor stand collision with a block i send some action? For example:
I set the armor stand gravity to 0 and i want it go straight bit if it collision a block it explotes
player.setVelocity(new Vector(0, 2, 0));
error:
no suitable constructor found for Vector(int,int,int)
any ways to improve this code block?
private boolean isAuthorized(CommandSender sender, Permission permission) {
if (sender instanceof BlockCommandSender) return false;
if (sender instanceof Player) {
executor = (Player) sender;
if (!permission.has(executor)) {
PlayerUtils.message(executor, Lang.NO_PERMISSION.get());
return false;
}
} else isConsoleSender = true;
if (!(this instanceof ConsoleCommand) && isConsoleSender) {
PlayerUtils.message(sender, Lang.NO_CONSOLE.get());
return false;
}
return true;
}
wth? Yes, use the built in permissions
