#help-development
1 messages · Page 1675 of 1
If thats a question: Spigot provides jdbc drivers for MySQL. Otherwise you need to shade the driver you want into your plugin.
ah okay thanks
haha yes it was a question. JDBC it is
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
https://www.spigotmc.org/wiki/mysql-database-integration-with-your-plugin/
Those are the two articles about mysql integration.
can anyone help? it says it's not used and it doesn't do anything
i have this in main class in onEnable:
MobileCraftingTable getMobileCraftingTable = new MobileCraftingTable();
and this in MobileCraftingTable class:
public void MobileCraftingTable() {
createMobileCraftingTable();
}```
This is not how you declare a constructor. A constructor has no return type. Remove the void
ok
hey got problem with palceholderapi loading before my plugin
and it is softdepandancy
If you depend on it then it will load before your plugin
but it loads after
I am trying to make some blocks glowing and it is working. But this glow is not visible from far distance. Is there a way to make them visible from further?
my bad
I typed it wrong way
xd
Then check if your depend is correct in terms of case sensitivity
[PlaceholderAPI]
my situation is like this
I do use proper names
Ouch
what ?
All good. I just forgot how it is to write public plugins and support a bunch of other garbage.
I mean it is hard
this is one cutomer having problem
some how
Whats your plugins name? This info is missing.
Hm. Did you try to replicate this?
well didn't try with all plugins they have
but it work papi on my test server get's loaded before my plugin
can someone help? im getting this error:
https://paste.md-5.net/upeyewoyis.pl
from these lines:
mobileCraftingTableRecipe.shape("WW", "WW", ""); and
oakPlanksRecipe.shape("L", "", "");
i tried adding spaces to the empty ones but then it said the crafting must be rectangular
Then its to the client to send proper steps to reproduce the problem.
OS, Spigot version/Fork, plugin list etc
i'll try adding spaces so it's 3 letters each row
mobileCraftingTableRecipe.shape("WW", "WW", "") -> mobileCraftingTableRecipe.shape("WW", "WW")
oakPlanksRecipe.shape("L", "", "") -> oakPlanksRecipe.shape("L")
alright thanks
How can I cast a class that extends the nms zombie entity to a spigot interface mob so that other plugins can deal with it easier
Spigot is the API layer. CraftBukkit implements this layer. CraftBukkit encapsulates the NMS handle.
So Zombie -> nms EntityZombie
Zombie zombie = ...;
CraftZombie craftZombie = (CraftZombie) zombie;
EntityZombie nmsZombie = craftZombie.getHandle();
That is not what I was asking
I need the other way around, from nms zombie to spigot abstraction
Ah i see. Most nms classes have getBukkitXYZ implemented. So
final EntityZombie nmsZombie = ...;
final Zombie zombie = (Zombie) nmsZombie.getBukkitEntity();
But you can always create an instance of the CraftBukkit wrapper.
final EntityZombie nmsZombie = ...;
final Zombie zombie = new CraftZombie(nmsZombie.getMinecraftServer().server, nmsZombie);
But the first method is recommended. @halcyon mica
I see
How do yall name your utils calls like TestUtils or just Test
found the problem
depends on what they are
What would the class if it was a logger
wtf is that dependancy
xd
and loadbefore
that is braking everything
that is some plugin
which was braking my dependancy
this plugin was braking my plugin softdepandacy not loading proparly
question: can you not use static in a class that implements Listener or did i do something wrong
Where are, you using it?
go to the bottom
https://paste.md-5.net/sonapehuqu.java
You can use static in a class that implements listener. You can even make the eventhandler methods static. But you shouldnt.
it also says i can't use the field variable cause it's a non static context or whatever
-_- im stupid
😊
still says that
a static method requires static Fields
No. Wtf
- He has a return value so he needs a non void return type
- He is trying to return a local variable from a static method. Which is not possible.,
will this cancel the runnable when cancel is true?
ok i fixed it
No.
ah
Didnt lookt at it closely so i just said both. Also on phone, forgive me @7smile7
Return does not cancel a runnable.
it all worked thanks a lot
now my servers self destruct !
ah lemme just cancel the bukkittask with process id pid
Hmm. Pls dont.
yoo my code works for once les gooo baby
Les gooo
?paste
new BukkitRunnable() {
@Override
public void run() {
if (condition) {
this.cancel();
}
}
}.runTaskTimer(plugin, 10);
oh actually a runnable instead of cancelling
i had this nw
https://paste.md-5.net/ezasihilub.cs
Oof.
😳
Separation of concerns just went behind the shed and killed himself
mobs killed from an explosion from World.createExplosion don't drop anything
how do i fix this
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
oh i was using the java.lang runnable
Are you sure? Because dropped items are also entities and therefore get killed by explosions.
hush
wouldn't the loot drop after the explosion?
Dropped items just get deleted in an explosion, no loot.
If youre talking about a blown up chest the items will drop
if i use a normal explosion like tnt, the loot still drops
Make sure its not 2 explosions
this better?
new BukkitRunnable() {
@Override
public void run() {
if (cancel) this.cancel();
player.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, player.getLocation(), 3, 0, 0.5, 0, 0L, 5L);
}
}.runTaskTimerAsynchronously(plugin, 1L, 5L);
Not really but its fine. If it runs it runs.
why not really?
If its 2 explosions and the first one kills the mob then the second one kills the items no matter how little time there is between them
oh
Its alright
also, how do you increase explosion damage without increasing range
You cant.
Hey quick question: I'm trying to connect my plugin to a database and I'm following this tutorial: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
It says in one part that you should call the following method in your onEnable() method of the Main class and the returned data source should be cached in a private DataSource dataSource field. :
private DataSource initMySQLDataSource() throws SQLException {
MysqlDataSource dataSource = new MysqlConnectionPoolDataSource();
File file = new File("my File Path");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
dataSource.setServerName(yamlConfiguration.getString("host"));
dataSource.setPortNumber(yamlConfiguration.getInt("port"));
dataSource.setDatabaseName(yamlConfiguration.getString("database"));
dataSource.setUser(yamlConfiguration.getString("user"));
dataSource.setPassword(yamlConfiguration.getString("password"));
testDataSource(dataSource);
return dataSource;```
However, I cannot call this method in my OnEnable method. My guess now would be that it doesn't work because my methods are private. That's why I'm confused, because in the tutorial private methods were also used. can anyone help me there?
Then I wanted to ask what exactly is meant by caching the returned DataSource in a `private DataSource dataSource` field. Does it mean that I should store it in a variable?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
"quick"
thumbnail fooled me. thought pigs have tails now
In your onEnable you should call this method once and cache the result in a variable
this.dataSource = dbProviderInstance.initMySQLDataSource();
And then distribute this variable to points where its needed.
private makes this method ONLY accessible withing the own class.
@burnt current
pog
?
hey there y'all, just wanted to see if theres a way to have this listener only apply to a specific inventory?
public void onInventoryClick(InventoryClickEvent event) {
//if statement to only apply while the inventory is open?
event.setCancelled(true);
return;
}```
Agree to disagree sir
Make a Set<Inventory> and check if it contains the inventory for example.
when you open the inventory, create a new class with the player name and inventory. then the class can check if the inventory is the right one
so i have this thing on PlayerInteractEvent:
if (e.getItem().getItemMeta().getPersistentDataContainer().has(key, PersistentDataType.STRING)) {
but then if i don't have anything in hand it sends an error to console, how do i fix this
each class handles its own inventory
📤 Cheers
thats what i use
Hover over getItem() and you will see (if you have javadocs) it is @nullable
wait i might have misunderstood the question
wat dat mean
that means it can return null and no item
alright, what do i do to fix it
if its does return null and you try to chain .getItemMeta() there is no item for that to happen on
how 2 fix
if (e.getItem() != null && e.getItem()...
Hasn’t he blocked you 2Hex?
if at any stage you can have a null value always test it
Yeah well I can’t help much since I am apparently "stealing" his code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
This is why javadocs are so important
🥴
im actually suprised 2hex is not banned yet
:/
he's being hating on me and only me for days
my cutie isnt banned yet?
hello i'm asking for how to get all blocks from from location and remove it
example:
get all blocks from x:1 to x:7 and remove it
is there any way to do it
pfft
loop over the locations and setType to AIR
I don't mind those willing to learn. I can't stand those who are too lazy
2hex go bully someone else will you
player.getWorld().getBlockAt(x,y,z).setType(Material.AIR);
}```
like that?
yes
is string.concat actually something?
no he is not
hes trying to help you
so shut up and stop whining, do research yourself
please
for the love of god
if there IS a god
bruh
thanks
wasnt gonna go that far
¯_(ツ)_/¯
some people are just ignorant and dont want help, oh well
i want help, not bullying
2hex
please, i do not want your "help"
this is how i learn
ok
now please, stop talking to me
thank god
im allowing you to talk
ok thanks master
you may talk :p
@lean gull Are you using maven to build?
idk
do you have a pom.xml?
where would that be
idk
in your project
root
bruh
external libraries or?
learn
no
Same level as your src folder
oh then no i don't have one
yes
nOtEpAD
notepad is great
yeah
i click build > build artifacts > projectname.jar > build
I was asking as with maven its really easy to add javadocs (if they IDE) doesn't do it for you
did u forgor
he didnt want ur heblp
:(
💀
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
playerinteractevent
@lean gull
dont want ur help
oh
oh sorry
¯_(ツ)_/¯
im just trying to actually help
and hes denying it
its very toxic
i want help from non toxic people thanks
@quaint mantle what do u think about this toxic person
no, elgar's pog
hes like a bad hypixel player
how many have u found so far
thinking that everyone is hacking
about 1 or 2
lol
nah, I'm in teh good books now. you are on your own 😄
you do realise he just tagged a helper and your spammin
dm them then
how do i be elgar :(
you are unsmart
dear comrade
no you are the unsmart
ok
Guys can we just drop this
yes
that too
👀
its a request
Block him if he annoys you
...
But don’t harass him
i forgor that was a thing
u were told to drop it
we were told to drop it*
Nope. Democracy is not allowed
ill drop ur nan down a hill
just agree with mr helper :(
uh can u dont
:this:
for(String s : mainClass.getConfig().getStringList("discordmessage")) {
player.sendMessage(s);
}
how come when for example
I have in the config
- &6&lTest1
- &1&lTest2
it doesnt send to the player in color?
idk config things
it changed to ChatColor.translateAlternateColorCodes('&', s); @grim ice
i just made my own thing for that
i call it mcMsgFrom(String str)
and it returns a string
with HEX
and/or
chatoclur
still no color
if (cmd.getName().equals("discord")) {
if (player.hasPermission("slashtools.discord")) {
for(String s : mainClass.getConfig().getStringList("discordmessage")) {
ChatColor.translateAlternateColorCodes('&', s);
player.sendMessage(s);
}
} else {
if (!player.hasPermission("slashtools.discord")) {
for(String s : mainClass.getConfig().getStringList("nopermissionmessage")) {
ChatColor.translateAlternateColorCodes('&', s);
player.sendMessage(s);
}
}
}
}
You never stored s
I love watching the drama, it gives me life.
Text containing the ChatColor.COLOR_CODE color code character.```
I just wanna fix this
strings are immutable
player.sendMessage(ChatColor.translateAlternateColorCodes('&', s));
this is for something else,
Illegal modifier for parameter mainClass; only final is permitted
private Main mainClass = Main.getInstance();
wait nvm
fixed it
XD
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Good di isn’t just passing your main class everywhere
Your main class shouldn’t go anywhere for that fact
why not?
Breaks dip
Your main is your highest order class therefore it shouldn’t be passed anywhere
Shutup bonzi buddy
he forgor 💀
okey
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter;
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle;
import net.minecraft.server.v1_8_R3.PlayerConnection;
it's not working for me | it says it's not in my library
because its not
please help
please help
Literally he is trying to help you and you're not giving any additional info
They have told you twice the answer
You have to add the server jar to your classpath to import nms
I'm from Poland and I don't understand some of your words
before u ask how to do that
so understand me
Google your question before asking it:
https://www.google.com/
Imagine being a discord helper
Imagine being an info stealer
?
no
ok
bump #881143044685045810
lmao 404
Say hello to every plugin on spigot
wait why did u need that link anyway
I dunno why that message was deleted
i'm tryign to link to a database
But gradle can use maven dependencies
nice
cool 👍
sick
cool
alright so next question. in the build.gradle file wehre does it go
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.26'```
^
And please look up gradle guides, this is a very simple and googleable thing
i said cornflakes
the best build system
🧢
Objectively true
There’s only so much maven can offer
lmao this dude added a thumbsup to his own message
lol
Thank you but i would like my dependency manager to not fail every second java LTS version
Gradle has never failed me except when I messed up
Idk how you achieve such hatred from gradle
gradle breaking every minor update 
But generally gradle likes people (:
An artist I found on reddit
lmao
same
their art is great
bad joke
did you pay for it?
bruh
Yeah I commissioned it
insults you lol bro chill its just a prank
there is no joke
LOL
you're just being a dickhead
why are you so mean
2hex stop
fr
Yeah guys fr
it wasnt
It was just straight out mean
.-.
why the hell would you tag someone on a spigot development chat just to tell them their pfp is shit
?kick @grim ice mature.
i list my creditcard in this chat
Oh. I found something that i might use a bit more often in the next time XD
Done. That felt good.
I LOVE THIS
lol
incredible
can i ask what a shaded sql driver is... probs not
Shaded means it's included in the server jar
shaded = compiled & included
Very very true lol
So you don't need to add any dependencies to use mysql or sqlite with spigot
The sql driver is just containing some useful classes for managing sql related stuff
Tho on the flip side I don’t blame em, you kinda need to pass your plugin instance on several occasions
Assuming you’re not mocking it
No
ok easy enough. well in order to use that with the api what class do i need
It’s the violation of abstraction hierarchy
It was just you continuing to be an asshole
DriverManager
Passing main class everywhere doesent make dependency injection good is what I’m saying
It makes it very tightly coupled
hey there yall, this is throwing an error at me; what can I replace null with?
Inventory inv = Bukkit.createInventory(player, 9, "testInv");
Set<Inventory> codedInventory = null;
codedInventory.add(inv);```
new HashSet<>()
Assume you want to reuse a component, in that case you’d have to pass your plugin instance to it because the constructor might require it
So ye
Of course you can't call a method on something you initialized as null
Yeah that was always pretty annoying
yeah i knew that much, I just put it there as something to replace
how do u .add to null
It's probably bad practice but I wrote abstraction layers that get the plugin
So you don't need to pass it around at all
It's either that or a static getter
doesnt JavaPlugin.getPlugin exist for a reason
Yeah well I have a plethora of bad designed plugins so no shame
That's a static getter lol
pretty sure it just accesses a map
Nope
Yeah
So it has the plugin as a field
why is that better than having it all in a map?
how is that sus
can you not. you're about to be kicked again
Anyways static singletons for your plugin instance is imo weak because we have to violate the design pattern and rely on Bukkit that the plugin instance is the only one to exist.
2hex what if you stopped talking in all caps about things completely unrelated to development or this conversation in this channel
?ban @grim ice trolling
Done. That felt good.
Thank god
bro
Anyways

What design pattern are you talking about?
Good job conclure
Singleton
Ah, right
so apparently the nbt on one of my items is so big it now bans ppl who get killed by it
I get really lazy with singletons
Yeah same sometimes lol
Generally I either do a static getter and don't really try hard to enforce single instantiation
Or I make a manager that reflectively instantiates all the classes that should be instantiated
I mean most cases it doesn’t matter a jack shit
It doesn't
I've never really used HashSet before, any advice? So far, it doesn't seem to be working for what I'm trying to do.
public void onInventoryClick(InventoryClickEvent event) {
HumanEntity player = event.getWhoClicked();
Inventory inv = Bukkit.createInventory(player, 9, "testInv");
Set<Inventory> codedInventory = new HashSet<Inventory>();
codedInventory.add(inv);
if(codedInventory.contains(event.getInventory())) {
event.setCancelled(true);
return;
}
return;
}```
A HashSet is an unordered collection which cannot contain duplicates
What are you trying to do here?
You can make a class that implements plugin. A little aids to fill out but it’s the best option
You create an inventory
Then check it to the set
Then check if the set contains the event inventory
Which will never be true
if inventory is open, and it matches one that the system has made, dont let players take stuff from it
this specific case wont ever be true
but im going to add more inventories later from another class
Maybe sub interface that default implements all Plugin methods btw and then mock that interface
im more or less just checking if the system opened the inventory, and if they did, dont let the player touch it
So you create the inventory elsewhere and open it for the player
And you're trying to check if the inventory they have open is the one you created previously?
yes
You need to store that inventory somewhere else then
Creating a new inventory doesn't make sense
Maybe try something with the invetorys name? Is that possible?
Add the invetory you create to a list and check if the inventory the player is trying to click in is in that list?
You can but you shouldn’t need any of the methods from there
Then cancel the click event if the set contains the inventory
I really just use it for events/scheduler
Alr yeah
So I should be making the Set in the same class that I'm making the actual inventory in?
And make sure to remove the inventory when it's closed to you don't leak memory
Was thinking in case you have 10 mocks of Plugin
Yes, probably
Is set faster than a list or would a list work aswell?
Aite
lists work but
A set is faster for contains
Well
ArrayList is faster in terms of iteration
You should consider the differences between list and set
And probably index insertion
A list is ordered, can contain duplicates, and can be indexed
But contains and remove are slow
list is better if you know where its going to be, yeah?
So if you have a set you cant open the same inv twice
They take more time the longer the list is
Set is unordered, cannot contain duplicates, and cannot be indexed
contains and remove are fast, they take the same amount of time no matter how large the set is (on average)
Thing is a Set alone does not inherently grant faster speed or for that part optimization, it’s just a mere interface, it’s the implementation that really matters x)
so wait, i should be making the inventory, adding it to the set, running the whole process of making sure they cant click in it, and then once its closed remove it from the set?
HashSet
Will keep that in mind, thanks
But all of the set implementations I'm aware of have fast contains and remove
HashSet, TreeSet, LinkedHashSet
O(1), O(logn), O(1)
I mean eh you won’t be using a crazy amount
I think thats all ye
Indeed
in your opinion is intellij or eclipes easier to use i just want something simple
Intellij
Unless the plugin is for a large server the speed usually doesnt matter much
Its java its crappy in speed anyway. A couple milliseconds wont mattet
Java is not crappy in speed
i use eclipse because its the first one i found lol
And a couple of milliseconds absolutely matters
Both are great, if you’re beginner both will do, the problem comes when people are judging something before even trying it out, like Eclipse fan boys. You should always give new stuff a chance.
Hi, I'm trying to remove invisibility effect from my custom potion but idk why it doesn't remove it. Is clearCustomEffects() still working on potion meta on spigot 1.17.1 ?
You get 50ms per tick if you want to stay at 20tps
The server will use probably about 25 of those on its own
Every plugin you add will take up some more of that budget
A few ms can be the difference between 20tps and 16tps
Are you making sure to do ItemStack#setItemMeta after modifying the ItemMeta?
yup.
Welp, gonna go bury myself in the dust now. Have a good day
And beware that lagspikes may not be included in the 25 ms used by the server
Yeah vanilla can take more than 25 depending on what's going on on the server
Yatopia was made to fix this!
but no, the paper team wanted to merge yatopia into paper
nah, they only merged tuinity
Ah right
That happened yesterday I think
But given that yatopia is mostly based on these patches it might as well be the case
I'm glad it got merged, there are way too many forks
True and true
any ideas ? I've tried removeCustomEffect(PotionEffectType type) but still nothing.
removePotionEffect?
how to check for section in specified section in config file?
it doesn't exist
Elaborate, like a sub section?
yes
You can do getConfigurationSection("section1.section2")
Or getConfigurationSection("section1").getConfigurationSection("section2")
or isConfigurationSection iirc
How should I make my set carry between classes? Can I define it as public static, or import it?
ill try
You shouldn't
It belongs to that class, try to keep it so nothing else is messing with it
Encapsulate it and provide mutators and accessors from the class that contains the set, then pass that class instance rather
If absolutley necessary then make public methods that mutate the set in ways you know won't mess it up
if it is a constant-type thing you can define it as a public static final
It's not constant
(+ use ImmutableSet for best practise)
Set::of Set::copyOf (:
so i should be defining the set in the class that doesnt include the inventory, so how do i have the inventory shift between classes?
What do you mean with shift?
One class is making an inventory, adding it to a set, then opening that inventory.
The other class is listening for clicks in that inventory to prevent them, but it's currently having issues discerning the opened inventory from any inventory.
The set is supposed to act as a sort of "filter" to prevent it from cancelling clicks in any inventory that isn't within the set, but it can't tell what is in the set because the set is defined in a separate class.
I'd just dependency inject the set instance through the classes's constructor, but that won't be that conventional if you'd ask other people
The danger there is that debugging can be more complicated since you wont see at a glance where you are modifying the set
I've just realized something; since I'm only going to be making one inventory at a time for what I'm doing, can't I just have it restrict based on the name of the inventory?
You could
Not a bad idea to learn how to do this sort of thing though
It will help you down the road
Definitely will, I'll bookmark the JavaDoc for it and go back to it soon enough. Thanks for your guys' help!
ok thank you
How would I get the name of an inventory? .getTitle() doesn't work for some reason.
edit: figured it out.
Hi
hellon't
i was wondering if is warmful to update a value of a db every second?
warmful?
i mean harmful xd
ah
Well, it depends on how the db is set up, but if it is done properly, no
And probably many other plugins
For example if the DB is on the other side of the world you might see issues
:v
i have a class that extends of the mysql connection
and that class is called by creating an object in class main
It's okay?
Finally got it working, thanks yall!
What value?
There are a few cases I could see you needing this for, but it's probably better to not do this
There's a few ways to avoid it
If you're updating a timer or something, you should be using timestamps instead
If you're updating a volatile value, you should be at least using a transaction, but ideally using a local cache
Does the Grindstone emit the EnchantItemEvent?
why would it do that
If it’s from a database do it async
And use a ConcurrentHashMap or a SingleThreadedExecutorService to mutate it
I don't know if it does, but you can probably check by having the server say something when one of those events happens.
Then just log in, use a grindstone, and see if it says smth.
Alright, but first I'm going to reread the events list.
Do you have an example?
i don’t think there is one
I know too little to give you a concrete example
you will have to use the inventoryClickEvent
There "is", but it is a pain to search through.
Me seeing MachoPiggies typing for a long time 
pls
There's not an event but a packet is sent
I don't remember what it's called either though 
🥲
Wait is there even an event emitted by the Grindstone?
Presumably ye
huh
Sounds right 
Could you help me with detecting when it is used? I'd presume I need to use InventoryAction, but it doesn't seem to have anything regarding an item being altered.
how can i cancel click inventory event when i do this: if (e.getView().getTitle().equalsIgnoreCase("randominventory") { e.setCancelled(true) } it will cancel click in players inventory
you're already cancelling it?
he wants to know the name i presume
or how to cancel specific inventory click
use a custom inventory holder https://www.spigotmc.org/wiki/creating-a-gui-inventory/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
this doesn't help with the holders
"implementing inventory holder breaches the api"
it does ye
I personally use
if (evt.getInventory().getType() == InventoryType.GRINDSTONE) {
GrindstoneInventory gi = (GrindstoneInventory) evt.getInventory();
World world = evt.getViewers().get(0).getWorld();
if (evt.getSlot() == 2) {
removeOutputEnchants(gi, world);
} else {
Bukkit.getScheduler().scheduleSyncDelayedTask(Storage.plugin, () -> {
removeOutputEnchants(gi, world);
}, 0);
}
}
but of course that may or may not apply to you
but most likely gonna be fine
Well, I'll be able to modify if needed. Thank you!
Why does .disconnect require BaseComponent? can I use hover event there?
bungee btw
I dont think hover is supported there, but I am not too sure
it isnt
it would be cool if it would be supported
Most of the main menu doesn't support complex components
Yeah it's really weird imo that BaseComponent got these methods, should be a derivative
Not per se a protocol issue, you'd really have to blame mojang for only implementing stuff half-way
but then I dont see any reason for requiring base component instead of just string
if it can only have formating
Components are arguably better in an object oriented perspective
kinda why paper chose to use them over strings, also cause minecraft itself has a similar system
legacy chat stuff (i. e. strings) are deprecated for about a decade now. I would consider it futureproofing
any one has some symple method
to convert numbers to roman numbers
so I don't need to write one
😂 feel lazy
ok so i am being an idiot but if plugins contains a list of the "plugins"
how do i get each of their data
getConfigurationSection
Thats a list
thats a List of ConfigurationSection that has a List of ConfigurationSection?
why is it a list
I have https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/src/main/java/de/geolykt/enchantments_plus/util/Utilities.java#L178, but it only supports the numbers 1 - 10. Never needed anything above that anyways
remove the - on id and version and it becomes a map
it doesn't have to be this format
ok
i just need a list of strings that point to teh id & version
like this?
yep
oke
remove the - on the keys too? they're useless
@NotNull
public static ConfigurationSection[] getConfigurationSections(@NotNull ConfigurationSection section) {
return section.getKeys(false).stream()
.filter(section::isConfigurationSection)
.map(section::getConfigurationSection)
.toArray(ConfigurationSection[]::new);
}

Won't work because its in a list from a configuration section...
Need to do List<ConfigurationSection> sections = config.get("plugins"); sections.forEach(configSection -> {//code here});
true
!!!!
That wouldn't work either read above
You're getting a config section and not a list
!!!!!!!!!!!!!!!!!!!!!!!!!
Well, you can always use Arrays::toList to convert the array into a list
this channel is killing me
🤦 your method gets a configuration section from a configuration section. Not a list of configurations sections
I guess the real question should be, how is he generating the yaml
by hand 😎
it returns a array, so it is more than one in most cases
because 👏 why 👏 is it a list
Ask him xD
it literally doesnt matter how it is formatted xD
I provided code that would work with how he showed us
Again, if you don't want an array, use Arrays.asList
it does
to me i mean
map vs list
then remove the dashes and get that sexy stream
@NotNull
public static ConfigurationSection[] getConfigurationSections(@NotNull ConfigurationSection section) {
return section.getKeys(false).stream()
.filter(section::isConfigurationSection)
.map(section::getConfigurationSection)
.toArray(ConfigurationSection[]::new);
}
🤦 section.getKeys(false).stream() Gets config sections that are set not config sections that are in a list. Hopefully that clears it up
Give me a min to finish my game. Ill dumb it down further
he is removing the dashes
this will return the configuration sections inside of plugins
example: plugins.2323232.id will be id
and this is for a MAP
a:
b:
id: 5
pass a, get the configuration section of b
yeah it works thanks imajin
Jesus yappery
Is there a way to check if a player is colliding with another player
If he removed the dashes then yes it would work but thats not what I was answering. I was answering him leaving it as a list of configuration sections... Jesus imaginedev

🤦
Final message i'm sending on this subject 😉 This is what I was responding to and your method would not work here.
It dont matter
its all working now
what is the way to trigger the restart script via the api?
Collection<ItemStack> bDrops = block.getDrops(p.getItemInHand());
Bukkit.broadcastMessage("drops "+ bDrops);```
any one can tell me how to get drops
well there you go
well a pickaxe has no drops
I am confused
Ohhhh
wait i misunderstood
I am getting blocks around the one in the middle
they are getting broken and they drop stuff on floor
but I can't grab there drops
surely you should get the drops before you break the block?
cause if it is broken, surely it will return the drops of the air block in its place
well works like charm
thanks
my bad didn't think that way
but it is apsolutly logical
xd
thanks
🍻
lol no problem
well I can't clear drops
so should I just set it AIR
I am adding those blocks to inventory
yep
BlockBreakEvent.getDrops().clear()
well those blocks are not broken by player
and event is not called
on block.breakNaturally(e.getPlayer().getItemInHand());
you need to call it manually and manually remove block
BlockBreakEvent bbe = new BlockBreakEvent(Block, Player);
Bukkit.getPluginManager().callEvent(bbe);
```Or something like this.
hey I wanted to ask how to display a particle for a certain amount of time.
How I am spawning one rn:
location.getWorld().spawnParticle(particle, location, 1);
Is there already a given method for that by spigot or do you have to put an timer arround it - with which method could u delete the particle at all again?
u cant
maybe a scheduled task?
just run the task for a while
then stop?
how do i loop trough every amor stand in a specific world ?
yea just thought if there could be a predefined method for that, how do I remove a particle from a certain location?
for (ArmorStand e : world.getEntitiesByClass(ArmorStand.class)) {
}
think it is imposible to do anything with event
found this post
same problem
so I am calling brakeNaturally on block because I want to keep partical and sound
but I can't clear drops
because I am putting them direcly to inventory
yep
removeDrops
breakBlock
playSound
spawnParticle
anybody knows that?
this drop is not regular drop
block.breakNaturally(e.getPlayer().getItemInHand());
custom block break?
Anyone know the what the class is that you can modify the main menu with mixins?
setAir
playSound
spawnParticle
giveItems
@wary harness
yep
Is there a way to remove lore from a preview in the Grindstone? After I remove the chestplate from the Grindstone, the lore disappears, but I'd like to remove it from the preview as well.
probably best solution
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/PrepareItemCraftEvent.html#getInventory()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/Inventory.html#getType()
declaration: package: org.bukkit.event.inventory, class: PrepareItemCraftEvent
declaration: package: org.bukkit.inventory, interface: Inventory
Ah, I forgot the Prepare events existed, thank you!
whats the best, and easiest way to use read/write from/to multiple yaml files
What is the api-version for 1.17.1?
1.17
ah
I want to be able to get the player who ever placed down a chest
declaration: package: org.bukkit.event.block, class: BlockPlaceEvent
detect a chest when its placed then use the pdc to store who placed it on the chest pdc
?pdc
ok thanks
How would i lock the chest and only have the player who placed it down be able to access it and no one else can
so my image is in the resources folder and i have this ```java
ResourceLocation background = new ResourceLocation("resources/background.png");
is it in the resources folder of your project? or you actually created a resources folder in your final jar?
yes the resources folder in my project
then it will not be in resources in your jar
The contents of resources is copied to the root of your final jar
so I should make a folder?
no
where would it be then?
what are you trying to do with the png?
just drawing it
if your pom is setup correctly it would have been copied to the root of yoru jar
gradle
same difference
so I should just put background.png?
I'm getting the error java: incompatible types: org.bukkit.Material cannot be converted to boolean, how can I fix this?
Because I did that before and it still didn't find it
write your code so you are not testing a Material as a boolean
ok
open yoru jar with 7zip and see whats in it
it ain't a jar
all plugins/mods compile down to jars
where the file is in your project will not be the same when its compiled
it all depends on how you have your grade/maven setup
having yoru ide see it will be different to yoru final jar
i would use a BlockInteractEvent and if it's not the player that placed it just cancel the event
ok
so what am I suppose to do
if I put the image in the same package it still can't find it
only files you specify will be copied to your jar. its not just the location
in src folders only class files are copied
in resources, it depends on your setup
Could you give me an example? I am quite new to developing plugins
Well first off you would need to store the player who placed the chest inside of the chest's pdc
?pdc
this is dumb
so how do I check if my setup is correct
ok
I can;t tell you that with gradle, I use maven
aw
ParticleProblem
to get a 1.12 map working in 1.16, do i have to incrementally bump the mc version and open it?
With gradle it seems By default any files you add to src/main/resources will be included in the jar.
so then I should be able to find it then
yes, they will be copied to the root of your jar
so just using the resources name should find then
Sheesh
hello! im kinda new to spigot coding and i have one problem projectile.setVelocity(); what do i put in the ()?
Vector I believe
projectile.setVelocity(new Vector(x,y,z));
From the sounds of it they are moved to the new WorldInfo object
got a bit problematic situation
BetterFarming plugin is returning false/positive cancel event
I guess not, looking at it
ok but how does the x,y,z increase the velocity?
some time returns iscanceled false when block is not broken
so then why isn't it not working
Hello hi i'm asking for how to add effect practlice into hash map
public HashMap<String, List<Effect>> effects = new HashMap<String, List<Effect>>();
now i want to add Heart Effect how do i can do that?
Effect effect = Effect.HEART; ?
effect.add(effects);
not work for me
In RegionAccessor
and I am checking if event is cancled and it is anoying when u get false positive because of other plugin event
vector
to increase it you just need to do this: projectile.setVelocity( projectile.getVelocity().multiply(2)); them the velocirty is 2 times faster
ok thanks!
Have you checked they are actually exported to yoru jar?
no
Might be an idea to look
yea it is
are you just trying to access it (InputStream) to use it?
no
This sir, ```java
ScaledResolution sr = new ScaledResolution(mc);
ResourceLocation background = new ResourceLocation("background.png");
mc.getTextureManager().bindTexture(background);
Gui.drawModalRectWithCustomSizedTexture(0, 0, 0.0F, 0.0F, sr.getScaledWidth(), sr.getScaledHeight(), sr.getScaledWidth(), sr.getScaledHeight());
being nms?
nooo
the only reference to ResourceLocation I find is in nms
thhhhaaaaatttt looks kinda like Forge code tbh
That would make sense
ScaledResolution also doesn't appear to exist in Spigot?
this is all rendering code too
which I don't think Spigot supports
Do you have a ModId?
ModId?
if its Forge
pure mixin
your mod has an id
ok, lets start again. You are using ScaledResolution and ResourceLocation. These are nms/Forge classes
so what is your project?
on the client? so its a forge mod?
On the client
Could be Sponge if he's using mixin
I feel like i'm trying to wring blood from a stone
@proud basin What are you using? Forge, Spigot, Sponge, etc.?
Tell us something and stop hiding shit. We can't advise unless we know what you are using
Just trying to find what you are using so I know what classes you are using and from where has been a painful ordeal.
See I already asked that and you were evasive.
using forge you will have a mod id
all resources should be accessed using that id new ResourceLocation("modid", "image.png");
forge gradle
4th post down
yes
I don't have a mod id
It ain't forge
you just said it was...?
you just said it was
.
gradle is just the build method
that is literally the same-
thats forge being built using gradle
[[mods]]
modId="examplemod"
version="1.0.0.0"```
nope
again it's pure mixin
Good luck with that
how come
Still needs a modid https://github.com/Mouse0w0/forge-mixin-example
still didn't fix it
why are you asking about a mod question in a spigot server anyways
This link shows you how to setup your mixin. The first link I gave you tells you exactly how to setup your assets
why not datasian
because its a spigot server not a forge server?
my mixin is set up properly
If you did everything properly it would be working
so just ask in a forge server (if they have one)
did you create your assets folder?
and inside that a folder with the name of your modid?
src/main/resources/assets/modid/image.png
yea
and you put your png inside teh folder with yoru modid ?
yea
not as folder called modid a folder with the name YOU set your modId to


