#development
1 messages · Page 2 of 1
the problem is that paper users are not dumb. we need the spigot users because they're the dumb people that pay for our trash plugins /s
feather uses server internals from Spigot, can you send your build.gradle?
understandable, I shall switch to spigot.
1s
uh to start with, this is not gonna work
sourceCompatibility = '1.17'
targetCompatibility = '1.17'
thanks discord
yes, use 1.19 wtf 
rofl
waiting for em to send the actual answer xD
try changing this
compileOnly 'ca.tweetzy:feather:3.1.0'
to
compileOnly('ca.tweetzy:feather:3.1.0') {
exclude('org.spigotmc')
}
why so
oh wait yes
don't
uhm
answer that
still gives the same error
RIP
ye
Versions after 9 dont have a dot, is just 10, 11, etc.
just use https://docs.gradle.org/current/userguide/toolchains.html instead
What event is called when Water and Lava come together to make obsidian/cobblestone?
1.8.9
It's not an event I think, you could check it with a blockupdate probally
declaration: package: org.bukkit.event.block, class: BlockFromToEvent
its in the docs for 1.8.8 so id assume its there
Does that work on 1.8.8? I heard that the BlockFormEvent is broken on 1.8.8
🤔
d;1.8.8 BlockFromToEvennt
public class BlockFromToEvent
extends BlockEvent
implements Cancellable```
BlockFromToEvent has 1 extensions, 1 implementations, 1 all implementations, 7 methods, and 3 fields.
Represents events with a source block and a destination block, currently only applies to liquid (lava and water) and teleporting dragon eggs.
If a Block From To event is cancelled, the block will not move (the liquid will not flow).
try it and see
Making a plugin with kotlin and using kotlin reflect for something. The correct versions of kotlin and kotlin reflect are given in the libraries section of plugin.yml. Getting this error when my plugin tries to use kotlin reflect
org.bukkit.plugin.InvalidPluginException: java.lang.LinkageError: loader constraint violation: when resolving method 'java.util.Collection kotlin.reflect.full.KClasses.getDeclaredMemberProperties(kotlin.reflect.KClass)' the class loader 'cordify-1.0.jar' @9ea769b of the current class, com/jackchapman/cordify/utils/Messages, and the class loader java.net.URLClassLoader @4e38616a for the method's defining class, kotlin/reflect/full/KClasses, have different Class objects for the type kotlin/reflect/KClass used in the signature (com.jackchapman.cordify.utils.Messages is in unnamed module of loader 'cordify-1.0.jar' @9ea769b, parent loader java.net.URLClassLoader @5ba3f27a; kotlin.reflect.full.KClasses is in unnamed module of loader java.net.URLClassLoader @4e38616a, parent loader java.net.URLClassLoader @5ba3f27a)
The server logs show the correct version of kotlin and kotlin-reflect are being downloaded by spigot
libraries:
- org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}
- org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}```
Why do you use jdk8 with jdk16 or whatever
No other kotlin stdlib afaik
I haven't checked in a while, maybe I'm wrong
I think also using kotlin-stdlib might be okay, but I don't think that is the issue here
are you additionally shading something?
I didn't think you need to if you used the libraries attribute in the plugin.yml
shading is a bit safer, libraries feature is a bit iffy still afaik
Yeah, I just never liked shading kotlin because it makes the JARs huge even for small plugins
I guess if that's the only option then that's what I'll have to go with
This approach has worked in the past with kotlin-reflect though, so not sure what's changed
Oh wow, restarting the server and it seems to work fine
That's odd?
That probably should have been one of the first things I tried. I don't like that fact that I know it's a possibility though
yo anyone devs looking to make a server to co own i have a few custom gamemode ideas and wanna make a server but i need a dev to make it
im service muted for sum resone
tho developing for a server usually includes getting paid real money, co owning a server isnt really payment or really that valuable
whats like a normal rate for a dev to get paid is it like hourly or by the project
depends on the dev, most do it by the project afaik, so like per plugin.
gotcha
game modes etc will usually cost 100+ $ usually
tho ive never done that so im not entirely sure.
medium size stuff is around 50 - 100 range
alright thank you
what about like a server setup with the main core being custom
i personally would not take a request like that
how come?
all custom coded plugins?
around 1k probably
prison has a lot of stuff in it that needs to be done
but if you are fine with using external stuff when available
cost should drop a lot
alright cause u usally want a fewq custom fetures
if i were you, i would set up the server as much as you can
then buy the features one by one
rather than pay someone to do all
hmm
not really, is a spin off of prison servers?
its preferable for developers as well usually
more simple
since its quite common to get the "hey can you add this too" as a major feature
do you know anythin g abt dev
yea
ok i have a qustion
is it possible to do a plugin for prision where its like ur own cell like an island for skyblock but its a prision sell and u can upgrade the size and stuff and all the blocks will change
for like an upgrade
yeah quite possible
it definitely is possible
if you want it properly done with instancing though, you would need an experienced dev
alright
otherwise player count scaling is a gonna be an issue over 100+ people
if done very badly it might take less than 100 players :)))
do you think a good game mode would be kinda like prision but the mines are like a sand and insted of a pick axe its a shovel that you upgrade
anything can be a game mode
but you need to think about it way more than just
"yeah you just want a cell with sand in it"
ok what do i look for
what about like a free lancer?
i would go with someone familiar with mc landscape personally
Fiverr 💀
post a request here and get quotas from developers
its too easy to get scammed
definitely a lot easier to get scammed over discord than fiverr so be careful
wow really
that's why you usually want to ask for portofolio and maybe even look them up and see maybe reviews, or posts about them
this
what abt like a 100$- 200$ game mode
unless its a small one
you can decide with them this, but you don't want to give full pay at the start, and NEVER use F&F (family and friends) payment methods. Even if other methods take a cut, at least you have a way to get your money back if they scam you
yes, business payment is king
should i alway use paypal

why not crypto
bcz you can't get it back
no way to charge back
when its gone, its gone forever
or do anything
also make sure to discuss source code etc
as in if you will receive full source code once done and if the plugin is exclusive to you
oh yea shouldthey give me the sorcecode too?
yes normally
but i have seen people get scammed with that in the past
where their plugin gets released to public after
or gets sold to others
coming back to this, what's the process usually? Haven't had the chance of working on large gamemodes that have needed it. How much actually has to be done by a developer these days, I imagine theres tools that just monitor resources and scale automatically? I know about kubernetes and docker but don't really know how they play in
so just go to a very trusted dev
kubernetes is okay, but you kinda want a custom solution usually honestly
a basic script can do wonders
have yall heard condor services?
no idea honestly
big service groups are hit and miss
some are great some are just meh at best
worst case you get scammed
yea
i think for you, i would go with a singular dev and maybe someone to configure your stuff
if you are willing to go that way I would recommend senior studios
then you can comission the same dev again in the future as well
havent commissioned them yet but from what I have seen they are good
im in there discord yea
but also yeah
If you want to make a small server or so a single dev should be enough
just make sure its one you can trust
not like a dev team one person can do it prolly?
our network got burned plenty in the past from service groups, i am semi biased against them i feel like
the advantage is usually
is that if you commission the same guy
if it is small
so i should hire someone to dev and to config u say?
i mean like hire them for the project
the problem is that you have to manage them and make sure they do the work
you can also hire a team of devs
yes ^
one by one
ok
what we do currently is to hire people per mode
and they maintain the gamemode as needed
add features / bugfixes etc
but for your case where you want to make a prison server of sorts
a dev and one guy to configure the rest
is enough i feel like
if you can configure plugins yourself
even better
I'd rather spend the time configuring it myself
so that you can know how does it work
one thin g that annoys me is crates
if you want a honest opinion
and how it is configured
i never know what to put in crates
i would make the server to the best of my ability
then hire a dev to fill the gaps as you need it
why even do crates
crates are great for income
well im working on a skyblock server rn
^^^^^
what are sum fetures yall would like to see in a prision server or skyblock that isnt already a thing or else something changed
feel like #minecraft is probably better
alright
this channel usually has programming questions
alright thanks everyone
whats the best way to take a player number input, sign or chat
Get them to build a 7-segment display with redstone lamps and light up the number
Conversation API exists too
It's conversation between plugin and player.... I don't know why it's named "conversation" lol
to this day ive never actually seen anything use the conversation api
Me neither
It's like java.util.Scanner, never seen anyone actually use it, but it's full of neat methods
👀 Competitive Coding
CoC
CodeChef
😩
I love CoC
I want a coke
Big black coke
I'm sure you do
Is it possible to store objects on item using PersistentDataContainer?
yes
json
Ah yes
Any help as to this weird issue im getting?
I give a player full colored leather armor and its fine
they die and then I set it again to that color, its fine for 0.1 seconds but then it changes to red/dark blue for some reason
i tried clearing their armor as well and then setting it but it doesnt fix it
public void setArmor(Player p) {
p.getInventory().setHelmet(dyeArmor(new ItemStack(Material.LEATHER_HELMET), playerTeam.get(p.getUniqueId()).getColor()));
p.getInventory().setChestplate(dyeArmor(new ItemStack(Material.LEATHER_CHESTPLATE), playerTeam.get(p.getUniqueId()).getColor()));
p.getInventory().setLeggings(dyeArmor(new ItemStack(Material.LEATHER_LEGGINGS), playerTeam.get(p.getUniqueId()).getColor()));
p.getInventory().setBoots(dyeArmor(new ItemStack(Material.LEATHER_BOOTS), playerTeam.get(p.getUniqueId()).getColor()));
}
public void clearArmor(Player p) {
p.getInventory().setHelmet(new ItemStack(Material.AIR));
p.getInventory().setChestplate(new ItemStack(Material.AIR));
p.getInventory().setLeggings(new ItemStack(Material.AIR));
p.getInventory().setBoots(new ItemStack(Material.AIR));
}```
the methods im using
i also tried clearing the armor and then running a delayed task to set the new armor
still doesnt work
I printed out the getColor and its correct every time btw
i use scanner :'(
i use scanner for a scanner
I like my BufferedReaders
BufferedReaders my bae
what people use?
Readers
@Override
public void onEnable() {
// Plugin startup logic
getServer().getPluginManager().registerEvents(this, this);
getServer().getPluginManager().registerEvents(new JoinLeaveMessages(), this);
getServer().getPluginManager().registerEvents(new WelcomeMessage(), this);
}```
'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(net.d1axowy.drainstealcore.Misc.WelcomeMessage, net.d1axowy.drainstealcore.DrainStealCore)'
why?
do your listener classes implement Listener?
Ohh yea right I forgot 'bout that one, thanks!
error/exception in console: https://pastebin.com/TsA5Ss8p
code:
public class WelcomeMessage implements Listener {
@EventHandler
public void welcomeMessage(PlayerLoginEvent e){
Player p = e.getPlayer();
String wm = "&e&lWelcome %luckperms_prefix% %player_name% &e<o &b&lDRAIN&f&lPVP &8&l- &e&lA great &b&lLifeSteal&f&lSMP &e&lserver";
wm = PlaceholderAPI.setPlaceholders(p, wm);
p.sendMessage(Utils.color(wm));
}
}
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.2</version>
<scope>provided</scope>
</dependency>
</dependencies>```
could anyone help?
Is PAPI on the server?
yea
/plugins output:
Plugins (4): DrainStealCore, CraftserveAgent, PlugmanX (Plugman), PlaceholderAPI
try restarting the server instead of reloading or using plugman if you haven't already.
alright wait
so uhh still nothing though no exception
it doesnt return the msg i wanted
try sending the message to console, see if its being sent there at least
i should use getLogger to send it to console?
sure
aight wait
it says this
[20:28:30] [Server thread/INFO]: ?e?lWelcome %luckperms_prefix% %player_name% ?e?lto ?b?lDRAIN?f?lPVP ?8?l- ?e?lA great ?b?lLifeSteal?f?lSMP ?e?lserver
when are you sending this? after parsing the placeholders or after?
wm = PlaceholderAPI.setPlaceholders(p, wm);
p.sendMessage(Utils.color(wm));
Bukkit.getLogger().info(Utils.color(wm));
}```
How can you get the directional value of a block?
declaration: package: org.bukkit.block, enum: BlockFace
What would be the best way to make a bossbar count down in a specific time of seconds (like from full to empty in 15seconds)?
I have tried some ways but nothing to hard. (i currently have a runnable for every 2ticks for 15seconds long but now it still needs to change the progress of the bar )
https://i.imgur.com/w39gZ76.png
How would i get the blockface from a block without using a different block for reference?
How do I set an armorstand into noclip mode in 1.19 NMS
Noclip mode?
probably marker setting
Gday Lads!
I recently faced some big issues with my Plugin Code, and i hope that anyone here can help me.
The Idea is, that if a Player Clicks a Specific Item in the Inventory (Command Block in this Case), the Current inv closes and a new one opens up.
Any Help?
Here's the Code:
https://srcb.in/u9sVDhswz3
I have a string, like for example "<StarL0st> Hello" and I need to split the part thats the username and the actuall message, how can I do so?
you can split at first >?
var split = "<StarL0st> Hello".split(">", 2);``` or something like that
kotlin moment
Whenever I move armor stands, I want them to go through the blocks
Rather than be stopped by them
I know you can do it with the 1.16 one but the 1.19 one doesn’t work the same
Why can't you just open a new inventory without closing the last one?
?mf
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOON™️
Also this^
a
can we get this pinned?
[00:25:03 ERROR]: Could not pass event PlayerJoinEvent to Simpleplugin v1.0.0 java.lang.LinkageError: loader constraint violation: loader 'simpleplugin-1.0.0.jar' @5b0ffae wants to load class org.geysermc.floodgate.util.DeviceOs. A different class with the same name was previously loaded by 'Geyser-Spigot (3).jar' @4dc5ff2c. (org.geysermc.floodgate.util.DeviceOs is in unnamed module of loader 'Geyser-Spigot (3).jar' @4dc5ff2c, parent loader java.net.URLClassLoader @5c29bfd) at com.plugin.simpleplugin.util.ToolBoxChecker.hasToolbox(ToolBoxChecker.java:14) ~[simpleplugin-1.0.0.jar:?] at com.plugin.simpleplugin.Simpleplugin.onPlayerjoin(Simpleplugin.java:111) ~[simpleplugin-1.0.0.jar:?]
guy i got an error
how to fix that
help please
You imported from geyser not spigot.
I wrote a method for it a while ago in one of my plugins, hold on
private void hideBossBarAfter(BossBar bossBar, int timeInSecs) {
if (timeInSecs == 0) {
player.hideBossBar(bossBar);
return;
}
double timeDecrease = (double) 1 / timeInSecs;
plugin.getServer().getScheduler().runTaskTimer(plugin, task -> {
if (bossBar.progress() <= 0.0) {
task.cancel();
player.hideBossBar(bossBar);
return;
}
bossBar.progress((float) Math.max(0.0, bossBar.progress() - timeDecrease));
}, 0, 20L);
}
Then you'd just make your bossbar with the adventure API, and pass it to the method
I am gonna try it later, ty
Doesn’t work either, tested it already
how to fix that
read it
how can i use 1.19 nms?
i import the spigot one its still error
oh and if i use 1.16.5 nms will it work on 1.19
No
run build tools for 1.19, or use the paper-user-dev gradle plugin (or whatever the spigot equivalent is if u use maven)
thanks!
How can I eval a String? I tried using the JavaScript and Nashorn engines, but they were removed since Java 15
eval a string representing what?
I mean there is no universal way to evaluate every expression, as that fully depends on the format of the expression
I don't need an "universal way", I just need something that can eval this %krownedlevels_level% >= 20
string.split(">="), trim, parse both integers, do a >= b
so basically there's no engine that can do that?
as I said, there is no universal way to evaluate expressions
If you have basic conditions like that one, is easy to make your own system
I tried using the graal.js engine, but it bloats my jar and makes it MBs bigger
graaljs can only evaluate js
that's good enough, idk why you're under the impression I need to be able to eval all languages known to man
well, you didn't specify that you need a javascript evaluator
I said I tried JavaScript and Nashorn which both eval JS, so I thought you got it
conditional expressions can look different than js, so god knows what you really want
omg
what I got from that, is that you tried javascript engines and you didn't like them so you were looking for different types of evaluators. Anyways, there's plenty of javascript engines out there like: Nashorn, Rihno, QuickJS, etc
pretty sure there's a wiki page with a long list of them
My issue is that JavaScript and Nashorn don't work, their script engine objects return null, so i looked the issue up and apparently they removed them in Java 15
If your plugin is for 1.17+ you can use the library thing to download them at runtime
But again, for some simple conditions, is just easier to make your own system imo
it's configurable tho, who knows what conditions the admins will want to use
They will use what conditions you allow them to, wdym
that's why you need to know what you want
By simple I mean != == > >= < =<
I'll negate you
I am making a portal that will only teleport those who meet 2 conditions: a JS condition and an item condition
Gday Lads!
I recently faced some big issues with my Plugin Code, and i hope that anyone here can help me.
The Idea is, that if a Player Clicks a Specific Item in the Inventory (Command Block in this Case), the current inv disappears and a the new one opens up.
Any Help?
Here's the Code:
https://srcb.in/KRh35LwcpH
How does one check if a hit is a critical hit, or a normal one with spigot?
Probably check their downward velocity
I've been spending a lot of the day trying to reverse engineer EssentialsX's build project setup. Yes, I've failed to try and build it from scratch several times. I basically want the same setup they've got for their projects, the code-style checks, junit and the multi-project building and compiling with a runServer.
Is there any helpful guides or simpler (than Essentials) code to look at to help build a system like theirs?
in your damage event just check player#isOnGround() tbh
i don't believe it has to be jumping to be critical
Was that recently changed?
I know in 1.12, the player must be like falling/not on ground, cant be on like a ladder or in water and cant be sprinting/on a mount
i might be delusional
unless it was changed since 1.12, which easily could have happened in which case im just dumb, I'm going to go with delusional xD

What about attack cooldowns and stuff
Yeah I think it's if your damage is below like 80% or smth
I'm pretty sure you can look at the logic in Spigot and just copy it
It should totally be exposed
I'm looking at a thread from a few years ago
let me see if I can dive into the source to make sure its still accurate
@SuppressWarnings("deprecation")
public boolean isCritical(Player player) {
return player.getAttackCooldown() > 0.9F && player.getFallDistance() > 0.0F
&& !player.isOnGround() && !player.isInWater() && player.getActivePotionEffects().stream()
.noneMatch(p -> p.getType().equals(PotionEffectType.BLINDNESS))
&& player.getVehicle() == null && !player.isSprinting();
}
that should do you just fine.
No, it's a custom method I built off of the requirements
np
Does anyone know the 1.19 NMS name for noclip? I know it’s just .noclip for 1.16 but things have changed
Uhm, so rn, I was going to check for every single thing I get from the config and report and error in case it doesn't find it, the thing is, is there no other way of doing this? Seems like DRY to be doing this like 15 different times...
Sir you can use code blocks
🥲
Hello, in Bungeecord API, does PreLoginEvent.getConnection().getUniqueId() returns the player's UUID? Is it the same as PostLoginEvent.getPlayer().getUniqueId()?
Examples of attributes which are not available include their UUID.
you sure that works?
fair enough
Either way I just assume config verification are a bunch of checks and there is nothing we can do
Ok, can I obtain their UUID from LoginEvent or PostLoginEvent?
I want to perform database action based on the player UUID
But it's still LoginEvent.getConnection() not getPlayer()
yes but the uuid should be populated by then
Ok let me have a try
Also
I should perform the database action asynchronously from the async LoginEvent right?
Should I start a new asynchronous task per LoginEvent or have a single thread for all LoginEvents
yeah, you should, and you should use the scheduler; on the event itself you "register an intent"
(https://javadoc.io/static/net.md-5/bungeecord-api/1.16-R0.4/net/md_5/bungee/api/event/AsyncEvent.html#registerIntent-net.md_5.bungee.api.plugin.Plugin-)
and "complete it" when your async action is done
https://javadoc.io/static/net.md-5/bungeecord-api/1.16-R0.4/net/md_5/bungee/api/event/AsyncEvent.html#completeIntent-net.md_5.bungee.api.plugin.Plugin-
See how LuckPerms does it (it also loads stuff from a database), it registers an intent before firing its async task and completes it when it's done doing it
https://github.com/LuckPerms/LuckPerms/blob/ad08b158f7d0d6a19c5da6b10f43d1765aec652f/bungee/src/main/java/me/lucko/luckperms/bungee/listeners/BungeeConnectionListener.java#L77-L110
the idea behind the intent stuff is "oh i'll be doing some work async, let the event continue to other listeners but don't continue the login process until i'm done"
Cool let me see
Looks like LuckPerms uses JDBC instead of JPA
yeah I mean how it does the query specifically isn't exactly relevant
What I was trying to point out was more of the usage of the intent
Is it possible for two players to login simultaneously, and should I access the database for the two players in the same JDBC Connection (assuming no connection pool), or separate?
Is creating a Connection expensive such that I should perform database action for multiple players in the same Connection?
eeh you should definitely use a connection pool library, it'll take care of all the nasty lifecycling, hikaricp is the go-to solution for jdbc, you can configure stuff like max pool size, max lifetime and whatevs, manually trying to take care of this stuff is hell
I am not familiar with jpa's ecosystem but surely there has got to be solutions as well 😅
Is it possible for two players to login simultaneously
possible? yeah, how likely that is depends on the size of the network
Ok thanks!
if i add this
String parsedColors = ChatColor.translateAlternateColorCodes('&', parsedPlaceholders);```
the plugin wont enable for some reason if i remove it itll enable why?
look at your logs
If you need it, then buy it, noone is gonna give it to you, also you would only end up with malware that way
well, thanks
Or use a free alternative
Can we get a yeet?
Don't ask for plugin leaks, purchase the plugin or use an alternative.
anyone got a api for making custom enites i hate nms, for 1.19 btw
So i have my saved kit-items in my config, but how can i put the items back in the player's inventory? Its prob very simple but i can't find the answer..
inv:
inv:
- ==: org.bukkit.inventory.ItemStack
type: DIAMOND_SWORD
- ==: org.bukkit.inventory.ItemStack
type: BOW
- ==: org.bukkit.inventory.ItemStack
type: ARROW
amount: 64
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- null
- ==: org.bukkit.inventory.ItemStack
type: LEATHER_BOOTS
- ==: org.bukkit.inventory.ItemStack
type: GOLD_LEGGINGS
- ==: org.bukkit.inventory.ItemStack
type: DIAMOND_CHESTPLATE
- ==: org.bukkit.inventory.ItemStack
type: CHAINMAIL_HELMET
- null
armor:
- ==: org.bukkit.inventory.ItemStack
type: LEATHER_BOOTS
- ==: org.bukkit.inventory.ItemStack
type: GOLD_LEGGINGS
- ==: org.bukkit.inventory.ItemStack
type: DIAMOND_CHESTPLATE
- ==: org.bukkit.inventory.ItemStack
type: CHAINMAIL_HELMET
I'd personally recommend you use the base64 serializer instead. It lets you serialize an entire inventory to a base64 string and then it also gives you a method to deserialize. Its much more compact and nicer. https://gist.github.com/graywolf336/8153678 but anyways if you want to continue with the YamlSerializer, you just get the item list, get the player's inventory using Player#getInventory, and then and then use a simple for loop that goes from 0 until list size, and use the PlayerInventory#setItem method to add set the item
d;spigot PlayerInventory#setItem
void setItem(int index, @Nullable ItemStack item)```
Stores the ItemStack at the given index of the inventory.
index - The index where to put the ItemStack
item - The ItemStack to set
Not the BukkitObjectOutputStream 
if you can do it better then please share. ok. thank you. and bye nerd
just a simple regex question, but based in java. how would i make it so you it doesnt match the ending : next to the }
d;paper ItemStack#serializeAsBytes
@NotNull
public @org.jetbrains.annotations.NotNull byte[] serializeAsBytes()```
Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will use the built in data converter instead of bukkits dangerous serialization system.
bytes representing this item in NBT.
cool
regex101
that's an online regex checker site
is it?
close ur tabs
Haha imagine having many tabs always
How do i make so when players leave the server their inventory gets cleared
package knockbackffa.knockbackffa;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
public class LeaveEvent implements Listener {
public void onPlayerQuit(PlayerQuitEvent e) {
Player player = e.getPlayer();
}
}```
no
Did not work.
I also registerd.
What about clearing their inventory when they join instead?
But they also get stuff when they join
wiat
i can clear it
and then give them stuff
im dumb
thanks
lemme try thaty
👍
You might have to update the inventory afterwards?
Wdym
player.updateInventory(); to force update the inventory after changing it
Should it update before
or after
they join
Like
Should it update before the player.getinventor
or after?
@inner jolt
after
No problem 👍
how can I make a regex to only match the first colon in a string
or I want to make a regex for separating this string:
" (Rank) StarL0stGaming: Hello"
the rank would be a string
the name another
and the message another
how would I do so?
string.split(" ");
Or you could match each part depending on like if there are always parentheses around the rank and a colon + space before the message
hello, let's say that I can't use Thread.currentThread().getContextClassLoader().getResource(".."); and as a parameter I get the main class of a plugin
since the plugin is supposed to work on spigot and bungeecord I decided to have the following structure:
me/oreoezi/plugin:
- spigot
- bungeecord
- universal
Therefore my main class is in me/oreoezi/plugin/spigot, which makes it impossible for me to just list the files of the directory using
URL url = main.getResource("resources/" + path);
File dir = new File(url.toURI());
dir.list();
main is a Class<?> and path is a string, this code would work if main was part of me/oreoezi/plugin but wouldn't work if the main class is in a subpackage
this is the structure of my code https://media.discordapp.net/attachments/898308178058559550/1003616988121276426/Screenshot_at_2022-08-01_13-48-50.png
so now the question remains; how would I write a function that when given the main class and "folder/" as a parameter it will return a string array with the names of all the files inside of that folder in the resources directory
I don't see how this is related to the package of the class at all
that's what I thought too
but for some reason it makes all the difference in the world
I doubt that
private String[] listResourceDirectory(String path) {
URL url = main.getResource("resources/" + path);
if (url == null)
return new String[0];
try {
File dir = new File(url.toURI());
return dir.list();
} catch (URISyntaxException e) {
e.printStackTrace();
return null;
}
}
I tested this and it worked on my other plugin, the only difference in setup is the package structure
another thing worth mentioning is the function for copying a file from my resource directory still works despite listing the directory doesn't
private boolean writeFile(String path, String local_path) throws IOException {
Path dest = Paths.get(folder + path);
if (new File(folder + path).exists()) return false;
Files.copy(main.getClassLoader().getResourceAsStream(local_path), dest, StandardCopyOption.REPLACE_EXISTING);
return true;
}
- don't mix the old file api with the new file api everywhere
- the package structure has no effect on functionality unless you found a bug
- you can't represent an entry in your jar file using
Fileafaik
You actually can do the third
It is worth mentioning that if i did the same thing but used the class loader to get the resource i would get an url to it but it would give me an error saying URI is not hierarchical
When loading the file
I also tried "../resources/" + path and "/../resources/" + path but to no avail
not sure where that "resources" is even coming from
that is the folder in which i store the files
yes, this is point 3
in the jar file?
correct
well as I said, you can't create a File object from that URL, so you can't list the dir content
I again state that I could just fine on my other plugin
well if you know the solution, just do the same again
I don't
my only assumption was that it was due to the package
but,as you stated earlier, it wouldn't make much sense
without using files, how can I get the names of the files inside that folder
the content of a jar file aren't Files, you'll need to use something to open the jar file and go traverse its entries
is there not another way, I am just interested in knowing the names of those files
not reading them
as the writeFile method can already copy them outside of the jar
because it works on an InputStream, which means it reads the files
correct
but if the resource is in a jar file, that means reading an entry from the jar file
those files are also inside of the jar
if I try to use getResourceAsStream on a folder and it returns an InputStream can I use that inputstream to get the items inside of that folder?
I don't think so
why is lambda function async lol
?
when trigger a lambda function from an inventory event, the bukkit api responds with the fact that i cant trigger closeinventory(lambda function) from async
or i assume inventories are handled in an async way or sth?
too lazy to decompile the source code
show your code
help i cant make health higher then 20 ```java
public class battle_bot extends Zombie {
public battle_bot(Location loc, BotData data) {
super(EntityType.ZOMBIE, ((CraftWorld) loc.getWorld()).getHandle());
this.setHealth(data.health);
this.setPos(loc.getX(), loc.getY(), loc.getZ());
this.setCanPickUpLoot(false); // Can Pick up Loot
this.setAggressive(true); // Aggressive
this.setCustomNameVisible(true); // Custom Name Visible
}
@Override
public void registerGoals() {
this.goalSelector.addGoal(2, new AvoidEntityGoal<>(this, Skeleton.class, 6f, 1d, 1.2d));
this.goalSelector.addGoal(1, new NearestAttackableTargetGoal<battle_bot>(this, battle_bot.class, true));
this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1, true));
}
}```
setMaxHealth ?
oh i dumb thanks
is there a way I can play sounds in a bungeecord plugin?
SlimeWorldManager is a good option for arena regeneration in minigames right?
What about ores regeneration? I mean, if a minigame where players mine resources is made, how to randomize (efficiently) the ores when regenerating the arena too (with SlimeWorldManager). Would it be by using a specific material in the arena and then looping arena to replace that material with random ores or there is a better way?
Hello, is there a way i could listen to /papi reload and re-register expansions from my plugin?
why would you do that
exactly what Alonso said. Why?
because expansion i register disappears after placeholder api reload
what i thoo
that's because you're not overriding the persist method
persist true
override it, and make it return true
if someone know, ping me 
it good

you probably need to change the ores afterwards
all slime world manager does is to save and load from slime format
ik
yeah. their question was, what's the best way to generate these ores after loading the world using SWM
ah? depends though no?
if block locations are known simple randomization is good enough
but if not you probably need to implement some procedural generation logic using noise
How can I play videos doesn't matter what file format on a 2d game based on Java Swing?
Maybe I could export the video as a list of images and a .wav file?
I fixed the issue in case anyone else has it, and I learned a bit along the way.
- The package that your class is in does matter, if you want to use
getClass().getResource("text.txt")and your class is inme.dev.pluginyour text.txt file should be inresources/me/dev/plugin/ - You can prevent that by using
getClass().getClassLoader().getResource() - You cannot load directories as
java.io.Fileinside a jar - Unlike directories outside of a jar, using
getResourceAsStreamin order to get anInputStreamwon't actually get you a directory listing, as expected
private String[] listResourceDirectory(String path) throws URISyntaxException, IOException {
URL url = getClass().getClassLoader().getResource(path);
if (url == null)
return new String[0];
FileSystem fileSystem;
fileSystem = FileSystems.newFileSystem(url.toURI(), Collections.emptyMap());
Path resourcePath = fileSystem.getPath(path);
List<String> resourcesNames = Files.walk(resourcePath, 1)
.skip(1) //the dir itself?
.map(p -> {
String name = p.getFileName().toString();
if (name.endsWith("/"))
name = name.substring(0, name.length() - 1);
return name;
})
.sorted().collect(Collectors.toList());
fileSystem.close();
return resourcesNames.toArray(new String[resourcesNames.size()]);
}```
This code is a modified version of https://stackoverflow.com/a/49570879
This worked like a charm, although I'm gonna be honest, I don't know exactly what each line does, I might experiment with it if I have time.
sorry for late response, it was kinda late for me at that moment, but yeah I have tried string.split(""), but what I'm looking to do with the regex is that this same method returns the 3 string parts
I assume it is possible right?
I have used simply split(":") for splitting the rank and message
\((?<rank>\w+)\) (?<name>[\w.]{3,16}): (?<message>.+) maybe something like this?
https://regex101.com/r/DIECJ6/2
the \d is not need btw
now the parentesis in the ranks is not actually in the chat message
I just used it for the explanation
the rank is a font character with an image
should I just change it with the character?
good luck with that
because you most likely use unicoded symbols and I personally dont know how to make a regex accept that xD
pain
doesnt it accept the unicodes tho?
I mean this should work
if I put the unicodes
or am I wrong
idk how regex works with unicoded symbols
try this
well yes...
that is the max limit of splits
or whatever its called. so if you give it 2, it will split a maximum of once if it finds the char sequence you want to split at
so the resulting array will either have 1 or 2 elements
if its 3, it will split it a maximum of 3 times, so resulting array will have between 1 and 3 elements
could also possibly look into using zero-width spaces if you're concerned about it, then you can set explicit break points wherever you want
constructor SimpleCommand in class com.plugin.simpleplugin.commands.SimpleCommand cannot be applied to given types;
i got this error
anyone know?
I did not understand a shit of what you said lol
I'm extremely new to regexes
it works now
tysm
shouldnt be a problem for now
so there's a character in unicode called a zero-width space
as the name implies, it has no width, therefore it is essentially not rendered
but it can be used to put breakpoints in where you want to split stuff, like in this case
you could put one after the rank and after the name if you ever swap away from using a colon
someone? 
is this actually something people do
on one hand it seems very easy and convenient
but it also sounds extremely hacky and like you'd get yelled at for even trying to add it
spigot down for anyone else?
What do you need made?
I'm available
Gangs plugin with some extra features. I have a full write up. Lmk

Mind me dming you?
Would apreciate some feedback
https://github.com/Andre601/AdvancedServerList/pull/2
Sure go for it
you are calling new SimpleCommand() but put incorrect arguments inside the ()
post both class's to helpchat paste, the one where you are trying to use simplecommand and simplecommand's class
or just hover over where your trying ot instance it and look what it says it wants and then what it recieved
I put this inside () and working thanks you
not sure what u mean by that
oh that makes more sense
that was a mistake
i wanted to make it in kotlin but it wasnt converting
im gonna tryu it with maven
so far its working with maven
i just make a new project lol
fairly certain the kt plugin adds the java plugin to the build environment
Why is pdc not applying to my item? (1.17.1)
public static void setEnchant(ItemStack pickaxe, Enchant enchant, Integer value) {
ItemMeta itemMeta = pickaxe.getItemMeta();
itemMeta.getPersistentDataContainer().set(enchant.getNamespacedKey(), PersistentDataType.INTEGER, value);
pickaxe.setItemMeta(itemMeta);
}
how do you know it's not applying
Because
I print item enchant list in chat on my event
can you show that
ugh. what is the PickaxeUtils.getEnchants method?
that sure does look fine
public static Map<Enchant, Integer> getEnchants(PersistentDataContainer persistentDataContainer) {
return new HashMap<>(){{
put(Enchant.EFFICIENCY, persistentDataContainer.getOrDefault(Enchant.EFFICIENCY.getNamespacedKey(), PersistentDataType.INTEGER, 0));
put(Enchant.FORTUNE, persistentDataContainer.getOrDefault(Enchant.FORTUNE.getNamespacedKey(), PersistentDataType.INTEGER, 0));
put(Enchant.MULTI_MINE, persistentDataContainer.getOrDefault(Enchant.MULTI_MINE.getNamespacedKey(), PersistentDataType.INTEGER, 0));
}};
}
and how/where are you using setEnchant
in a command
public void enchant(Player sender, Enchant enchant, Integer value) {
ItemStack pickaxe = sender.getInventory().getItemInMainHand();
ItemMeta itemMeta = pickaxe.getItemMeta();
PickaxeUtils.setEnchant(pickaxe, enchant, value);
itemMeta.addItemFlags(ItemFlag.values());
itemMeta.setLore(PickaxeUtils.getPickaxeLore(pickaxe));
pickaxe.setItemMeta(itemMeta);
}
you are overriding the meta after calling setEnchant
make it take an ItemMeta instead of an ItemStack
Thank you!
so PlayerDeathEvent is just for handling death event it has nothing to do with actually killing player
when i call the event i also need to kill player i guess
what, it fires when a player dies
so if you kill a player that event will also fire
what if i call that event in a plugin
Bukkit.getPluginManager().callEvent
with this
would fire the event without killing the player obviously
yeah
events are there to notify plugins not the other way around
and if i kill the player myself then again another event will be fired
ye it will fire two times
yeah then something wrong with my logic i guess thanks anyway
if you have other plugins, they could be cancelling the event as well (not sure if you can cancel death event) but maybe worth looking into
i just need to make a custom event or just create a method to use like events
idk if i need to create a event for this because i will be calling it from the same plugin
not gonna use for any other plugin
that event
i mean it depends, do you need to use it more than once?
if yes its probably an okay idea to use a listener pattern internally
if only once though, i personally would just use a function call and be done with it when your custom "event" fires
actually i just made a custom event which i think it's the best approach here
that didn't took a minute really
can I install ecloud expansions using placeholderapi on my plugin, for exemple, can I install Player expansion using a method from my plugin
#placeholder-api probably a better place to ask
ok thanks
exactly
i'm using BoundingBox#raycast and it's detecting the player, which i don't want. any way to fix this?
looks like custom logging?
Thats just a debug when I run commands. Nothing to do with the command/plugin that I used.
This is the client causing this right? Its not a bug but just looks bad. (When you have a long string)
I cant use .equals on getEnchtntmentLevel
am i misssing something
i can do it on .gettype()
it's an int so it doesnt have .equals
oh so what should i do instead for it?
usually, you can hover over it and it will tell you what's going on.
==
==
that really didsnt work
oh?
well you need to actually do something with the result
its for an if statement though
so put it in the if
Store the inventory in a variable instead of calling it twice
d;spigot PlayerInventory#setItemInMainHand
void setItemInMainHand(@Nullable ItemStack item)```
Sets the item the player is holding in their main hand.
item - The item to put into the player's hand
Or that
oh wow
ty very much
no problem
so, for FireworkEffectMeta, spigot's api mentions:
Represents a meta that can store a single FireworkEffect. An example includes Material.FIREWORK_STAR.
where do I Find a full list of this? Or is it just firework star and firework?
just these two
Arrays.stream(Material.values()).filter(Material::isItem).map(ItemStack::new).filter(it -> it.getItemMeta() instanceof FireworkEffectMeta)
👍 don't need a list, was just curious. but thanks
In the method World#createExplosion(), whats the biggest power you can pass in
or is there no max?
Is there any doc about which mc version fits best with which java version? I can set sourceCompatibility
targetCompatibility from build.gradle.kts and IDK what should I set them to
did you figure this out? I've been having this issue with no stack trace on 1.19.1 and when I hover it just says java.lang.UnsupportedOperationException or whatever
well, I Know this:
- 1.18+ requires java 17+
- 1.17 requires java 16+
I also know spigot 1.8.8-1.12.2 only support java 8 I believe but paper 1.8.8-1.12.2 supports up to java 11 if I remember correctly. I Don't remember the rest
I believe I need all versions (1.8-1.18) but thanks 😄
always target the minimum you plan on supported
in your case, java 8 would be that
I plan publishing multijar
java 8 
Hey ho
hey is for horses
I want to make a Skyblock Plugin. What is the Smartest way to generate the World? using WorldEdit to load a Schmetica or can i Just Copy a World?
that goes deep o.o
if it's skyblock just start with a void world and use either the worldedit api or just paste in the islands yourself (in code) as they are needed
wym by paste the islands yourself
like instead of depending on worldedit place the blocks programmatically on your own
make your own worldedit to copy your island into each spot
so hardcode block by block?
can you load Schmeticas with my Plugin without depending on others
there might be a library out there for reading schematic files so that you dont need to depend on another plugin
but i've never looked into something like that so ymmv
just tried 1.8 with java 17 and it worked is it normal?
you tried the server or have you tried compiling a plugin? because compiling a plugin shouldn't be a problem but according to reports I've seen in here before, the server jar doesn't work with anything but java 8. at least the spigot one
Installed spigot 1.8 from get bukkit and opened it with java 17 temurin
btw dont use spigot, paper does have a 1.8.8 legacy build
yeah. but that wasn't their original question
this was
i was just adding something extra, didnt even see what they originally asked
when it comes to minecraft versions, its probably recommended to compile using a version of java that its minimum can me
so for 1.8,1.12,etc its java 8
1.16 is java 11, 1.17 is java 16 and 1.18 is java 17
Sooo
In my Main I have an Array that contains commands. Now I want to check on Chat event if the /.... is in the Array. How do I do that
if (event.getMessage().contains("/") && !Main.commands.contains(event.getMessage()))
{
event.setCancelled(true);
event.getPlayer().sendMessage(PREFIX + "§cCommand not found.");
}
``` why doesnt this work
cus a command is never sent through the chat event?
the event api isnt used for commands
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
turns out theres an event for when a command is sent, i wasnt aware of this.
oof
Well I don't know what the error was or what caused it exactly by I knew what portion of code caused it cause at the time I had just added it. So I modified the code and the error went away.
Hey,
So how can I get every row from my MySQL table and return all rows in a String Array?
I have a question, is it possible to modify the enchantment table options?
for example add diamond sword and netherite and possible enchantments are custom
I dont think you can. Altho you could use a Custom Interface
Wait
Maybe there is o.o
oh thanks!
yes i thinked use enchantment table interface, i read that could change first slot that is where puts item and seconds slot that is where puts the lapis lazuli but i stayed with doubt if i could change the enchantments as options
?mf
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOON™️
@lyric gyro ^
any good modern java decompiler that supports higher version of java apart from jd-gui?
Quiltflower is pretty up to date
I use a mix of recaf and luyten
do you think that simulating that new spyglass without holding the item is possible?
im trying to give a potion effect to a player when holding a item and taking away the potion effect from the player when they switch the item in hand to smth else
I have been trying to do this for a long time and its working when Im swapping it from a item but it doesnt work when im swapping it from nothing
?
Any idea how to do collision detection with a custom model data armorstand?
yikes
yeah lol
i guess i'll just require that the hitbox is configured manually with a boundingbox
because it's not like the server knows how big it is
yea, most likely
i think the resource pack format specifies it
"from": [-13.3, 0, -1.23],
"to": [29.3, 7.1, 3.03],
"rotation": {"angle": 0, "axis": "y", "origin": [-3.36, 0, -3.36]},
"faces": {
"north": {"uv": [0, 0, 16, 8], "texture": "#0"},
"east": {"uv": [0, 0, 4, 8], "texture": "#0"},
"south": {"uv": [0, 0, 16, 8], "texture": "#0"},
"west": {"uv": [0, 0, 4, 8], "texture": "#0"},
"up": {"uv": [0, 0, 16, 4], "texture": "#0"},
"down": {"uv": [0, 0, 16, 4], "texture": "#0"}
}
looks like it anyway
You have to shade toml in to your project
isnt that just for an element?
(for the guy that deleted his post here)
yup, it is
wdym element
yeah, have fun
lmao
https://i.ibb.co/HttZ6rB/Capture.png anyone knows how to get rid of these residual classes when I package with maven?
they come from a library, and that's how inner classes are saved
so it's normal for it to have 3 more copies of JsonArrayList?
thx man appreciate it
those aren't copies of that class but inner/anonymous/local classes
Would it be at all possible to listen for vault economy deposits from a specific plugin? (Specifically autosell) I'm fairly unknowledgeable about development
I have a quick question. How would I access the whitelist.json file from a server through a plugin? Like what would that files directory be?
new File(Bukkit.getWorldContainer(), "whitelist.json") maybe?
why not actually use the whitelist methods in the API?
OH frick. I didn't think that that was a thing 🥵
thanks!
does adventure's translatable components work on older versions than 1.12? (for items and blocks name) iirc thats when spigot added localized names
adventure doesn't translate components, it sends the translatable component to the client to render
how can I check for a item being hold and when the player switches the item in main hand to something else
Hey guys, im trying to acheive something where if you are in a chunk a timer or counter goes up, but when you leave it it does down what should i use for this?
runnable, check the players standing chunk id, if it matches, decrement otherwise increment
java.lang.NullPointerException: null```*this is the entire error*
```java
@EventHandler
public void onInventoryMove(InventoryMoveItemEvent event) {
final Location source = event.getSource().getLocation();
final Inventory destination = event.getDestination();
if (source == null || destination.getLocation() == null || destination.getType() != InventoryType.HOPPER) return;
final UUID sourceOwner = new LockManager(source.getBlock(), null).getLocker();
final UUID destinationOwner = new LockManager(destination.getLocation().getBlock(), null).getLocker();
if ((sourceOwner == null || destinationOwner != null) && (sourceOwner == null || destinationOwner.equals(sourceOwner))) return;
event.setCancelled(true);
}```
are you having like a lot of NPEs in your log? Also try with -XX:-OmitStackTraceInFastThrow
unrelated, but is
if (sourceOwner == null || (destinationOwner != null && destinationOwner.equals(sourceOwner))) return;```the same as
```java
if ((sourceOwner == null || destinationOwner != null) && (sourceOwner == null || destinationOwner.equals(sourceOwner))) return;```
NPE?
NullPointerException
not like a ton ton
java.lang.NullPointerException: null
[19:09:45 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:09:46 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:13:41 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:16:21 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:20:30 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:20:30 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null```
yeah try with that jvm flag then
does it just hide the errors?
the - after the : means the same as -XX:OmitStackTraceInFastThrow=false, and it's true by default. If it's set to true, stack traces will be omitted under certain circumstances
o
yes
alright ty
o also this worked
was able to find out what was breaking and fixed it
ty
nice
You can use a truth table to check stuff like this
https://trutabgen.com/ is a good online generator for truth tables
ohhh nice ive tried looking for one of those before tysm
Alright, I am lost.
This is the code that I have ```Java
Bukkit.reloadWhitelist();
//People that are whitelisted in the server file
Set<OfflinePlayer> alreadyWhiteListed = Bukkit.getWhitelistedPlayers();
Bukkit.getLogger().info("there are " + alreadyWhiteListed.size() + " players whitelisted");
And this is what it prints out:```
[INFO] .... there are 0 players whitelisted
While the whitelist.json file looks like this
[
{
"uuid": "fac0a13c-91eb-43f7-894b-0d4483232af6"
},
{
"uuid": "a2eb00e4-8183-4244-bfef-8626b6391d84"
},
{
"uuid": "306a4cc3-5e29-4dbe-9540-a26c48c514ee"
},
{
"uuid": "33b17c18-b436-48bb-97a4-4bb5548d273c"
},
{
"uuid": "846e593b-a91f-4d4e-ad60-3a271da879d7"
},
...
Why in the world does the getwhitelistedplayers method not work?
this if statement isnt working
whats wrong
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
if ((e.getEntity() instanceof Animals && e.getDamager() instanceof Player) ||
(e.getEntity() instanceof Monster && e.getDamager() instanceof Player) ||
(e.getEntity() instanceof Player && e.getDamager() instanceof Player)) {
Player damager = (Player) e.getDamager();
if (damager.getInventory().getItemInMainHand().getType().equals(Material.STICK)
&& (damager.getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.KNOCKBACK) == (50))) {
damager.getInventory().setItemInMainHand(null);
}
}
}
full code ^^^
i just realised that code is extremely slow
what about it isn't working? where does it stop? have you tried debugging stuff? aka printing to console
also that if statement, can be made a lot shorter
when i actually hit anything in game it doesnt set to null
just realised im gonna improve it
check if damager is player only once
alrighty
start putting in debug messages
and see what code it runs, and what code it doesn't
alright ill check
why cant i do getLogger() in this class?
its an event handler
why cant i do that
pass the logger in the constructor from your JavaPlugin class
Dependency Injection
Dependency Injection is a way of providing objects with the objects they need ("dependencies"). This is usually done with a constructor, but can also be done for individual methods
Read more here: https://en.m.wikipedia.org/wiki/Dependency_injection
Dependency Injection in Java:
https://paste.helpch.at/yijawupoju.java
Dependency Injection in Kotlin:
https://paste.helpch.at/esogakutod.kt
what makes you say that?
aside from the redundant instanceof checks (which arent really gonna be slow) it looks fine
using the bukkit logger is a bit of a bad practice, the best way is to either use your Plugin's logger with DI as blitz said, or make a logger for the specific class with Logger.getLogger / LoggerFactory.getLogger
for me slow = unoptimized
how do you know it's unoptimized
Hi, I have a doubt Is it possible to change the texture of a block with nbt data? e.g. change the texture to the enchantment table with title state when the item it is in hand or placed
i want to create a custom enchantment table texture but i don't know if it is possible to load the texture from the plugin and link it with the block
Yes, it means a class VaultClaims was searching for (com.mongodb.client.model.Filters) was not found during run-time.
NoClassDefFoundError means there’s a previous exception
Potentially from not shading and a different version of the class being loaded
Man doesnt know how to pass a logger via constructor and tries to implement logger in his class but knows that his code is slow and unoptimized, don't doubt him
on a bukkit runnable. Each minute
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17```
Does this mean it will be compatible with java 11? I can't remember which option is for that 😬
I need java 17 for paper 1.18.1 but the jar to be compiled with java 11
source would be the JDK used to compile, so it would restrict certain language features.
eg: 1.6 couldn't contain any lambda expressions.
Target would be the version of the generated class files, and should denote the lowest Java version the program will run on.
so I should just switch them?
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11```
Could not resolve: io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT I guess not 😐
I don't think it can go that way around
I think it can only up-compile source -> target
doubt it's a polyfill like javascript or somethin
uh, that sucks
fucking paper, they have to do things in the right way all the time! spigot 1.18.1 is just fine with java 11 
why do you need to target Java 11 anyways? You need Java 17 to run Paper 1.18.1
1.13 compatibility, is for chatchat and we need some api from paper as an alternative for what spigot offers
oh I thought we were only supporting versions with hex colors
nah, 1.13+
fc call
idk man
And only ~17% if we only supported Java versions made in the last 7 years
so.. is not possible to use paper 1.18.1 and java 11? 🥺
Oh no definitely not, they use Java 17 features in the code
Time for some reflections🪞 then
what are you going to do for spigot servers?
Reflect on your decision to support legacy debt 😌
is not mine, ok ??
I already have a check for paper & >= 1.16
Things I didn't say
spigot will just use something that works there 
final var prefix = material.isBlock() ? "block.minecraft." : "item.minecraft.";
return Component.translatable(prefix + material.getKey().getKey());```
so what do you get for being paper & >= 1.16
Material#getTranslationKey
but thinking about it, this might work anyways
I mean surely it's not worth using two systems that do the exact same thing
just use the one that works for all of em and call it a day until we bully fc into submission
Make a multi-version wrapping library 🙂
👀

Hi ppl
I want to start making plugins
Is there any tutorials for paper spigot 1.16.5
Placeholder API Dependency not working pls help
some code would be helpful to see what you've tried. How have you added the dependency, what are you trying to do with it etc.
Make sure you have a good understanding of java first. Haven't checked out tutorials in years, but when I've needed something on a particular topic, TheSourceCode on youtube tended to be good
It's all preference, some people learn better off purely text resources, some off youtube, some prefer to buy courses (although personally I'd stay away from them)
i would be careful with thesourcecode, they can be good on some topics but some of their tutorials have some really bad conventions
Like I said, haven't watched them in years, so I don't know what state they are in now
i would personally just set up the basics and jump into a basic plugin afterwards
@outer fulcrum how are you adding the dependency, maven/grade?
you will end up learning as you get stuck if you know how to google properly
yes
sending your config for that would be handy

you sure that works?

problem solved