#help-development
1 messages · Page 876 of 1
DataWatcher is called EntityData in the mojang mappings
sry for the ping but thx to @tender shard and @icy beacon for all the help u gave to me <3
*SynchedEntityData
ah yes
SycholicEntityData
(resending this because i changed over to remappings <3)
val dataWatcher = (event.player as CraftPlayer).handle.entityData
dataWatcher.set(EntityDataAccessor(0, EntityDataSerializers.BYTE), 0x40.toByte())
val glowingByte = dataWatcher.packDirty()
if (glowingByte == null) {
dataWatcher.set(EntityDataAccessor(0, EntityDataSerializers.INT), 0)
val cancelByte = dataWatcher.packDirty()
val packet = ClientboundSetEntityDataPacket(event.player.entityId, cancelByte)
(event.player as CraftPlayer).handle.connection.send(packet)
return
}
val packet = ClientboundSetEntityDataPacket(event.player.entityId, glowingByte)
(event.player as CraftPlayer).handle.connection.send(packet)
I cannot figure out why this packet gets sent globally instead of to just one player? If someone could help I'd be greatly appreciative!
can you show the whole class or at least method?
hey can anyone help me
pls
im trying to export a spigot plugin as jar file
but when i drop the plugin on my spigot server
it is not showing any plugin
i have used the same code in eclipse ide and intellijide when i export from there it works as fine
you're editing the datawatcher itself
Hmm seems like cancelling void damage seems to cause a weird infinite loop
So why don't you just export from Eclipse or Intellij then
if that works
i like to use vscode
Setup a proper build tool like maven or gradle
because i always code html and css on here
and let that handle the building
https://paste.md-5.net/vuzilonuri.cs 🤔 why is this causing me to get stuck in a teleport loop and basically not be able to move
im not using any maven im using no build toos
Yeah that will just cause problems in vscode
It's much easier for you to use maven
why if i put the value String balance = String.valueOf(VaultHook.getBalance(p)); in the scoreboard everytime the scoreboard update it send getBalance() detected! Map: {}
if i delete the line System.out.println("getBalance() detected! Map: " + this.balances); Here:
System.out.println("getBalance() detected! Map: " + this.balances);
return this.balances.getOrDefault(playerName, 0);
}```
it will make the server lag for the spam or it's only a fake spam then nothing will appen to the server status?
Right, sorry!
@EventHandler
fun onSneak(event: PlayerToggleSneakEvent) {
if (event.isSneaking) {
event.player.sendMessage("You are sneaking!")
val dataWatcher = (event.player as CraftPlayer).handle.entityData
dataWatcher.set(EntityDataAccessor(0, EntityDataSerializers.BYTE), 0x40.toByte())
val glowingByte = dataWatcher.packDirty()
if (glowingByte == null) {
dataWatcher.set(EntityDataAccessor(0, EntityDataSerializers.INT), 0)
val cancelByte = dataWatcher.packDirty()
val packet = ClientboundSetEntityDataPacket(event.player.entityId, cancelByte)
(event.player as CraftPlayer).handle.connection.send(packet)
return
}
val packet = ClientboundSetEntityDataPacket(event.player.entityId, glowingByte)
(event.player as CraftPlayer).handle.connection.send(packet)
}
}
I know it uses Paper event handlers but I thought asking about packet problems made more sense here, I hope that's okay!
VSCode is literal hell if you don't use maven
gradle support is meh but I highly reccomend maven with VSC
I hope I don't have to do movement checks 
the problem is that you're making changes on the player's datawatcher, you need to deep copy it
heh
yeah I've got no clue
It could be a slimeworldmanager thing
It could be a teleport thing
olivio it is asking me to choose an archetrype which one should i choose
Oh? How would I be able to do that with a datawatcher?
let me see
make a copy of the list from pack dirty
and of the items inside
then find the one for sneaking in that list and modify it to your needs
slime paper?
purpur but ye
if something unexpected happens to client and there's absolutely no clue, try listening on packets which is being sent to client, you may find whats wrong
so change val glowingByte = dataWatcher.packDirty() to val glowingByte = dataWatcher.packDirty()?.toMutableList() to make it a deep copy instead of a reference?
I used it for setSpectatorTarget bug for my plugin (conflicting with ac)
@river oracle can u tell me to add extern jar like spigot api in vs code dependecies
i cant find the place to add it
I only use Maven sorry
Can't help unless you switch
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
but it doesn't modify the values within, remember those are still from the entity data
I'd need to do that first and then dataWatcher.set(EntityDataAccessor(0, EntityDataSerializers.BYTE), 0x40.toByte())?
Like this? :
val dataWatcher = (event.player as CraftPlayer).handle.entityData.packDirty()?.toMutableList() as SynchedEntityData
dataWatcher.set(EntityDataAccessor(0, EntityDataSerializers.BYTE), 0x40.toByte())
val glowingByte = dataWatcher.packDirty()
if (glowingByte == null) {
dataWatcher.set(EntityDataAccessor(0, EntityDataSerializers.INT), 0)
val cancelByte = dataWatcher.packDirty()
val packet = ClientboundSetEntityDataPacket(event.player.entityId, cancelByte)
(event.player as CraftPlayer).handle.connection.send(packet)
return
}
val packet = ClientboundSetEntityDataPacket(event.player.entityId, glowingByte)
(event.player as CraftPlayer).handle.connection.send(packet)
i fixed the indentation, dont know why i made note of it afterwards
@river oracle it is giving more prblms
Why ping them
i have add the repositers and dependency but now when i do extends JavaPlugin it is not import the org.bukkit thing and also when i created a new class inside a package it is not doing package etc.etc;
can u help me?
sounds like you don't have all the right plugins or something
make sure you have the Java plugin extension pack
it's still not a deep copy
I'd like to test my plugin in a high latency / ping environment. Is there a way I an artificially add latency between my client and the spigot server?
on linux you could do so via tc. idk if windows has a similar utility to artificially add delay to network interfaces
you're telling me someone thought of it? 😮
Am on Linux. Thanks for this, I'll check the command syntax for that command.
nice 
but how would you make a deep copy?
thank you IntelliJ
for this beautiful information
"plugin" is null
because you never assign any value to it
You often need a reference to your main instance (the instance of your class that extends JavaPlugin) in some of your other classes. There’s two basic concepts for this. Choose whichever you like more. Method #1: Static Getter First way is to create a static method called getInstance() or similar in your main class. You...
btw your "plugin" field should not be public
where my error told ? org.bukkit.event.EventException is 'Plugin' ? and i used public static SetStaticIpforeveryplayer plugin;
public static SetStaticIpforeveryplayer getPlugin(){
return plugin;
} and SetStaticIpforeveryplayer plugin = SetStaticIpforeveryplayer.getPlugin();
please for the love of god, use a codeblock
do something like this:
public final class SetStaticIpforeveryplayer extends JavaPlugin {
private SetStaticIpforeveryplayer plugin;
public static SetStaticIpforeveryplayer getPlugin() {
return plugin;
}
@Override
public void onEnable() {
plugin = this;
getServer().getPluginManager().registerEvents(new MyCodes(), this);
saveDefaultConfig();
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
Assign the constant sooner
wdym
oh right
fixed!
also, try to not get the value on every player join:
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
SetStaticIpforeveryplayer plugin = SetStaticIpforeveryplayer.getPlugin();
String database = plugin.getConfig().getString("connection");
String root = plugin.getConfig().getString("username");
String password = plugin.getConfig().getString("password");
String registermessage = plugin.getConfig().getString("registermessage");
String errormessage = plugin.getConfig().getString("errormessage");
String welcomemessage = plugin.getConfig().getString("welcomemessage");
Player player = (Player) event.getPlayer();
UUID uuid = player.getUniqueId();
String stringuuid = uuid.toString();
String name = player.getName();
String Ip = player.getAddress().getAddress().toString();
}
might be a little bad performance-wise and bad practice
also I genuinely have no idea if that is sql injection safe
It's not safe
thanks but i know my problem on the past " sql"
storing passwords in config files? WILDDDDDD
no
this isn't save any password
this is oldest version of plugin and this plugin isn't public and is just test plugin not more
unhashed, i might add
is there any specific way to determine what type of loot event is being called or any mcguivered way folk have come up with?
Would like to know if the loot being generated is like spawner dungeons, mineshafts, strongholds etc.
check the namespacedkey of the loottable
LootGenerateEvent -> getLootTable() -> getKey()
I always have the java docs open we gucci. Missed the LootTables Enum. Cheers Mfnalex. Makes this so much easier
np
RIP I just spent 5 minutes debugging why the flags for my command are not working, wihtout any errors... until I realized I missed this line
default args in kotlin are dangerous!
people keep complaining about it but it saved me so much work ¯_(ツ)_/¯
I respect it. I just personally prefer java
And in my defence, default args did just kick ur ass lol
yeah but it's my fault for using them lol
I could have also made that parameter required, it's my fault kek
Was ur fault for using Kotlin
AYOOO
Jk
But yeah where is loottables even called from?
God damn that sucks. Would of been god tier to have a way to get the enum based on the namespaced key lol
public static LootTables getByKey(NamespacedKey key) {
for(LootTables table : LootTables.values()) { ...
well you'll just need a method like this ^
then return null if it's not there, because it might be a custom loottable, or from a datapack, or whatever
Yeah its the for loop that does me an ick
Might make a manager or cache or something and map em all out.
Cause yknow. Even the term "key" implies mapping would be big n clever
I know its actual purpose dgmr
But like, if this is gonna call every time an event procs , imagine a 100 person server with loads of folk fishing etc
cant see a for loop without mapping going well for tps
Why do you need the enum
Working on a project where a user could define additional loot for specific loot cases based on the LootTables enum
why do baboons like bananas
To give a lot of flexibility to what the user can change
so, uh, datapacks but not with a datapack?
aren't datapacks json?
from what i understand that stuff is fairly easy to change with data packs lol
Mhm. I dont wanna say too much but . points at mythiccraft
The key , unless im misreading, is not commonly available to the end user unless you decompile.
It is a lot nicer for user experience to go "to see valid loot events you can effect, check out LootTables in the javadocs"
I mean
You can easily see the keys with /loot
Or by looking at the vanilla datapack
Or you could just make a /listkeys command
or by looking at the mc wiki
^
Is there a decent wiki page of it?
i like the idea of directing people to the wiki ngl
I meant a wiki page with the keys
nw
Seems like a border line "why cant we just have the loottables type as a method in the LootTable class" moment lol
Like im not crazy for thinking thats a reasonable idea right?
hmm?
Well my thought process is time saving. All the end user is gonna get is the namespaced key. And then there is no way to get the type of LootTable it is from the LootTable u get from the LootGenerateEvent.
Seems like an odd thing to have to rubber band and glue together
wdym type
Like "I just wanna know what type of loot ive generated fml" sorta moment lol
Like the constant?
The enum aye.
Like its as reasonable (in my head at least) as wanting to know the material type of a block or item etc
registry ❤️
I have a problem. With this code some mobs spawn, others don't, and I don't understand the reason for this
proof that the id is passed correctly
yes, these ids exist and the mobs are configured
I noticed that a mob with a certain id was spawning, so I put the id to the same mob that doesn't spawn. But it doesn't spawn anyway
i solved it, np
@brazen badge use primitives btw
float != Float
But I think the compiler might optimize it alrdy idk
i'm making a custom kb:
public static void KB (LivingEntity attacker, LivingEntity victim, double force) {
force/=10;
Vector direction = new Vector(victim.getLocation().getX() - attacker.getLocation().getX(), 0.5, victim.getLocation().getZ() - attacker.getLocation().getZ()).normalize().multiply(force);
victim.setVelocity(direction);}
and sometime there is some kind of bug:
sometime the kb is sending straight up and extremely high
nothing to do, but where does $none cames from?
its a border in the world 
its not a circle its a square
nah, half the height
yeee
Has anybody ever developed a plugin using clojure?
The automatic loading of test framework implementation dependencies has been deprecated. This is scheduled to be removed in Gradle 9.0. Declare the desired test framework directly on the test suite or explicitly declare the test framework implementation dependencies on the test's runtime classpath. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
BUILD SUCCESSFUL in 1s
I'm using this:
dependencies {
testImplementation(kotlin("test"))
}
// ...
tasks.test {
useJUnitPlatform()
}
I supposed I have to add JUnit manually but which version am I even using right now? lol
well guess doesnt matter, I just added their exampe for JUnit Jupiter and that fixed it
Can i somehow disable defualt drop for ores with event?
BlockDropItemEvent or BlockBreakEvent
We need your event handler code @sharp heart
that's the method that is called in my event @sterile axle
Show your entire event handler please
ty very much
Explain the issue you're getting again?
So my event is called twice only when the player doesn't have any item that is gaved at the end of the event
Exemple :
I have my inventory cleared
I'm making a left click
It gaved my 1 fence
And if my inventory doesn't contained this fence, it will recall again this event
So this event is called twice only when the item gaved weren't in my inventory before
That's why I think it's a spigot problem
im not surprised
Maybe it's a packet problem
doubt
im not convinced it's a spigot problem but im not sure what the problem is, so let's wait to see if anyone else has any ideas
how can I share img ?
?verify
you need to verify your account
there should be a channel in your left sidebar
go there and do it; i can't see it anymore since im already verified but it's pretty easy
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
? are from red and ! is from mds custom coded bot for verifying iirc
In a perfect world they would all be /
Just update redbot
yea i now im dumb
i searching on spigot docs and i cant find anything idk what im doing wrong
You need to pass a Block and a Player
Material wont do
OH my god thanks
do i question why your firing ur own block break event though
i dont understand (my english bad)
looking at that your calling new BlockBreakEvent, why
so when i break the block the player is given like idk diamond or something
i just learning and im watching some tutorials about java and plugin tutorials (my last java learning ends like year ago and i forgotten everything (not really but yea)
I have a Kotlin class ClaimListener which extends Spigot's Listener Interface.
I have a Main written in Java, where i register this listener: Bukkit.getPluginManager().registerEvents(new ClaimListener(), this);.
Now when running the plugin, i get the following error in the console:
"[... ERROR]: [...] Failed to register events for class de.floskater99.mapmenu.listeners.ClaimListener because kotlin/jvm/functions/Function1 does not exist."
I'm using maven and i've added the Kotlin 1.9.22 dependency / plugin in it. (maybe wrongly? i can send the file if needed)
Does anyone know how to fix this?
Did you also shade the kotlin dependency?
shade the std lib
Nope, I don't think so, how do i do that?
maven. ChatGPT told me to use the maven-shade-plugin and put <include>org.jetbrains.kotlin:kotlin-stdlib</include> and <include>org.jetbrains.kotlin:kotlin-stdlib-common</include> etc. in the <includes>.
seems to do the trick
do you support anything lower than 1.16.5?
nah i'm doing 1.20.4 only
libraries:
- "org.jetbrains.kotlin:kotlin-stdlib:1.9.22"
plugin.yml ^
then you don't have to shade it. Because shading it will make your .jar like 5mb bigger
However, if you do wanna shade it instead: https://blog.jeff-media.com/common-maven-questions/
People just getting started with maven always ask me the same 3 questions, so here’s a a short FAQ! How to change the output directory? Read this. How to shade dependencies and what it means Sometimes you are using certain libraries (for example, my CustomBlockData class, or similar stuff) that is not already present at...
Does any1 has expierences with JDA?
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
you'll also need to add stdlib as dependency to your pom.xml if you wanna shade it if you haven't already
probably every third person here
why dont you just ask here
okay
Where can i find the plugin.yml?
im adding JDA to my spigot plugin
do you only have a paper-plugin.yml?
nope, not even that
huh
im tryna create easy mc command /message which sends message to some discord channel with some id
i have a spigot.yml
you must have a plugin.yml file in your main/src/resources
is that it?
i added JDA to library
ah ok lemme check
and to maven
np
NoClassDefFoundError?
YES
People just getting started with maven always ask me the same 3 questions, so here’s a a short FAQ! How to change the output directory? Read this. How to shade dependencies and what it means Sometimes you are using certain libraries (for example, my CustomBlockData class, or similar stuff) that is not already present at...
second headline "how to shade ..."
alternatively, do the same as we told Flo, and use plugin.yml libraries feature
to include jda inside your jar
when i added some other API etc it didnt need to
to tell maven what to do
because the other API is a plugin already running on the server
spigot probably shaded that as a lot of developers use it
JDA is not
JDA is not already running on the server
you have to bring it on your own
oh okay
soo i have to add the maven shade plugin?
yup
when i export the plugin i dont have .jar file, why
If your plugin is 1.16.5+ only you can also use plugin.yml library feature
how?
its in target/
ohh mb
@paper rain but use jda instead of stdlib
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>```
i just have to add this to plugins in maven?
You can also change the directory https://blog.jeff-media.com/how-to-make-maven-automatically-put-your-plugins-jar-into-your-test-servers-plugins-folder/
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
Yes
maven?
With package?
yeah
?paste your pom
youre setting JDA to "provided"
either remove the <scope> part in JDA, or set it to <scope>compile</scope>
thats not alr?
JDA isn't provided by anything
You're the one that needs to provide it by shading it
so i hae to remove
<scope>provided</scope>
Yes
and somethingh else?
No
so im gonna try it xd
<scope>provided means "Yo, JDA is already provided by something else (e.g. the server)", but since it isn't, it doesnt work.
For spigot-api using scope provided is fine, because the server already includes it
np :3
public class Drop implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event){
if(event.getBlock().getType() == Material.COAL_ORE) {
event.getBlock().getDrops().clear();
}
}
}
what im doing wrong, the coal drops normally :I
great! however your .jar is probably 10 mb now haha
Block#getDrops() is not the list that provides the actual drops
use BlockDropItemEvent
yes i see
:p beat me to it. It just gives you a copy of a list of drops
alternatrively you can use setDrops to false or sth I guess
ohhh i dont know that mb
yep
not even that. it gives a list of "default drops" for this block type
ok i will try it
if the block would be a chest, the Block#getDrops list would just contain a chest, not its contents. Or if it's wheat it contains the wheat but no seeds
if you only support 1.16.5+, you can also use the plugin.yml library feature to stop having to shade it, so your .jar isnt 10mb
do someone know why, directly with the entity (item), the remove method doesn't work (the entity isn't removed), but with getEntity and with this remove method, it works ?
to do that, set the scope back to provided, and add this to plugin.yml
libraries:
- "net.dv8tion:JDA:5.0.0-beta.20"
@paper rain
3rd line doesn't work, but 4th yes
okayy
that sounds easy
i hope
can someone reply me pls ?
thanks
dude it's only been like 1 minute
mbb bro
How are you storing the item entities
sry, I thought nobody saw
yes
.-.
check if item.isValid() returns true
How
It's ItemDisplay, not Item
maybe you have a "dead" reference to the item. Check if isValid() is true. If it's false, it makes sense that you can only remove it by getting it again through Bukkit.getEntity(UUID)
and?
becaise Olivo seams to be shocked
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#isValid() if this is true, then remove() should work
declaration: package: org.bukkit.entity, interface: Entity
Dead reference
then you're keeping a dead reference, probably the chunk got unlaoded or something similar
NICE
yes probably
you should generally avoid storing entities directly, and just use a List<UUID> or whatever
why ?
well to avoid issues like the one you're currently facing
also keeping references of dead objects causes memory leaks
right now you keep a reference to the "dead" entity so it can't get garbage collected
if you'd store the UUID instead, you wouldnt have this problem
The problem is that I summon my entites at loading and the chunk isn't loaded, so they are "dead"
should I load the chunk before ?
that wouldnt help, the entity gets invalid as soon as the chunk unloads again
why don't you just store UUIDs instead of entities
I could, but in my case It will change nothing
entities are displayed but aren't "linked" with my object
It will fix your issue
my remove issue yes
Spawn them in the entitiesLoadEvent instead
this event exist wtf
You can also use setPersistent false to automatially remove them when the chunk unloads
I want them to be keeped alive
am I blind or does Permission not have a proper equals method
It does not
Well children is a Map so != wouldn't have worked anyways
kotlin
Shenanigans
stupid permission not having equals and hashcode sucks
infix goes brrr
I can even compare minecraft versions with > and < huehue
What is the rustySpigotThreshold
thats why kotlin is good
i like it
and no ;
that is a pain in the ass
Who doesn’t have that auto filled by the ide
yeah fuck those rusty spigots
at least its just a txt file so in theory stupid admins could just edit that file
Lol
like how they "add folia support" to arbitrary plugins
Kek
what is that about
I mean does 1.20.2 have EntityKnockbackEvent? I didn’t think so
imagine complaining that you can't recreate 1.8 knockback in modern versions but the actual issue is that your "modern version" is just outdated too lmao
Looks like the first click removes two items from the barrel
Which is interesting
Does an item appearing in your hand fire an interact event?
I think it makes your arm swing, but idk about the event
A bandaid solution is to just ignore events from the same player within a short time
I thought to this but the delay between both is 50ms, and for players who need to click faster to pickup items (see my video), this isn't a good idea
Looks almost instant to me
50ms is one tick, can't be faster anyway, can it?
I guess 50ms is basically instant
No
Unless maybe some /tick shenanigans
maybe
I guess the other option is to use Interaction Entities and the events related to them
Might avoid the double event fire
yes, instead of PlayerInteractEvent, it's probably a good idea
I’ll have a look at the interact event tomorrow to see if I can find why it fires twice
Thanks you, can u ping me If u have news about this ?
But for me, it's 100% a bug from Paper or Spigot
you mean, the server ?
Yes
would also be helpful to print out all the things from the interact event (hand, action, clicked entity, ...), I'm pretty sure the event itself doesnt fire exactly the same
there's probably at least one difference in both events
I've already did this
it's the same
with all the methods?
yes
I always do new LinkageError().printStackTrace() kek
dumpStack is a static method
actually you can skip the curr- yeah
I like Minecraft
why on earth LinkageError of all throwables you could choose?
I spend more time patching bugs than coding
its my best friend
that is a very moot reason
yes
Is it just left click on block -> add item to inventory
I think its because I‘ve seen allatori do it like that
No idea why they chose that - maybe it also uses a different throwable everytime, haven’t checked
That exists? For a few tests in CB i use new Throw().print xd
apparently it only does new Exception().printstacktrace()
Hey if it works it works
StackTrace for debug CB is the best... NMS calls are a little... Stranges xd
how so?
Things like my last PR where WindCharge call explode call discard on hit block and not in hit entity but in vanilla this entity is discarted then that track help me found where is called the discard
which class function returns jsut the class name and nothing more like the pull import? getName(), getCanonicalName(), getSimpleName() ... ?
that's a cool way to use it
javadocs point out to be getSimpleName
altho if it's an array object it'll have [] to signify it
okay
SimpleName
thank you
yes
where i can storage player data (i know in json but howw), so for example he breaks stone and get like point or something idk something simple
You have a ton of options
Yaml, json, a database, pdc
Yaml is probably the easiest since spigot has a simple api for it
oh yea yaml i forgot
i was thinking that was only for config
but how i can pass info to it? exact player
have spigot docs for it? like pass etc
and yea 1 file sound good then few file
it would be for me messy ngl
is there a way to modify the values of a potion effect when it is added to a player?
EntityPotionEffectEvent has no setter or way to edit the effect it seems?
Could just cancel it and then apply an effect manually
will using livingEntity#addPotionEffect just call the event again
Yes
how can i add this without calling the event
thanks :)
BEGIN transaction
IF EXISTS (SELECT * FROM "basics-homes" WHERE "uuid" = ? AND "name" = ?)
BEGIN
UPDATE "basics-homes" SET "x" = ?, "y" = ?, "z" = ?
END
ELSE
BEGIN
INSERT INTO "basics-homes" ("uuid", "name", "x", "y", "z") VALUES(?, ?, ?, ?, ?)
END
commit transaction
I have this SQL query how would I properly substitute given the condition statements?
I'd suggest using something like jetbrains exposed for kotlin/sql, but depending on how deep you are with jdbc, it might require you to restructure a ton of your app, or virtually nothing :D
reason I didn't want to use jetbrains exposed is because I'm not a huge fan of ORM's plus you get locked into doing simple queries even if there is something complex that needs to be done
guh I might look into exposed again, but last time I looked it really just didn't look ideal for basics 
I guess, I don't like orms in general for java, but I've had a neat experience with exposed when I first (and last) used it
is there an easy way to get the affected item when moving items one inventory to another using hotbar buttons? getCursor and getCurrentItem both seems to return itemstacks that are not related
solved by getting the item directly from their inventory using the hotbar button
there should be an easier way to do this tho
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html getHotbarButton
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
yeah, this is what I used
ItemStack item = event.getHotbarButton() != -1 ? event.getWhoClicked().getInventory().getItem(event.getHotbarButton()) : event.getCursor();
here is the exact method for future references
what I meant by an easier method was that, maybe make event.getCursor return the item that is being moved or maybe make a new method
I was thinking like load up the world from /backup/ncidosncisndicsoi and unloading the current world
I think you can have a different item on the cursor when you press the keys though
ah yeah
I guess so
even a method like getHotbarItem() would be appreciated, would that be possible?
can you not just do PlayerInventory#getItemInMainHand
that'd be basically the same thing
I'm trying to remove banner patterns and dye color from shield, this is my attempt https://paste.md-5.net/arohupiyan.cpp and I couldn't find anywhere to do that, can someone help please?
does it send the message?
Yes, the message is sent.
i guess getPatterns() just returns a copy, use setPatterns(...) with an empty list
I'm thinking to create another shield but copy like the enchantments and stuff.
Not sure if get patterns is a copy
The patterns got removed but the color is not.
So the pink banners are the banners that I'm trying to clear, the white shield is after I tried to remove it using this code https://paste.md-5.net/arohupiyan.cpp
Well you set it to white, so that's why it's white?
Yes I think so, but there is no default dyecolor is it?
Use the /data command to compare the banner you have with the banner you want
Before I put color and patterns to the shield, the value come up as WHITE so I use that.
I think what you're really after is a banner with no meta?
Blockstatemeta.setBlockState(null)?
just get a new itemmeta
Hmm
I've tried to set the blockstate with this
public static Banner getDefaultBanner() {
ItemStack stack = new ItemStack(Material.SHIELD);
if (stack.getItemMeta() instanceof BlockStateMeta blockMeta &&
blockMeta.getBlockState() instanceof Banner banner) {
return banner;
}
throw new RuntimeException("Failed to retrieve default banner data!");
}
But same results happening.
ItemMeta newMeta = Bukkit.getItemFactory().getItemMeta(Material.WHITE_BANNER);
this should give a new item meta for an empty banner
then set the banner's meta to that
Yeah I think that's the workaround, I'll do that thank you.
i could swear that Material#createItemMeta() was a thing
confused, are you after a plain shield or a white shield
Converting colored shield with banner patterns to plain shield.
looking at the code this may not be possible for whatever reason
I think it would need a null blockstate which isn't allowed
I throw blockstate from new shield item and the result still the same.
I think you have to replace the whole itemmeta
but you should also open a bug report
what about setting it to an air blockstate maybe
will error due to invalid blockstate for material
oh
I think this is a bug due to the special casing of shield. setBlockState should probably be nullable to allow it
Yeah so, creating a new item meta works perfectly, a little bit mess but it's okay xd.
Thanks for the help guys!
item meta is always messy anyway 🥲
I dont think so
its not about the players hand item after all
you can press any hotbar button
how to correctly add a flag to a region ? Packet mismatches keep coming up - https://paste.md-5.net/movalarazu.cs
what flag object is needed to add existing flags
region#setFlag()?
You don’t understand, I know how to add a flag, but what object is needed for the flag itself? I tried using - Flag<?>, Flags - for now
what use object for ValueOf flag type
Flag<Input Type>
what objects are included in the input
StateFlag("name", false) and make sure to register it
Or Flags.PVP
I need a flag type that exists in worldGuard, is it really possible to use String and not enum to add a flag?
For some reason it causes this - 'setFlag(T, V)' in 'com.sk89q.worldguard.protection.regions.ProtectedRegion' cannot be applied to '(com.sk89q.worldguard.protection.protection.flags.Flags, com.sk89q.worldguard.protection.flags.StateFlag.State)'.
does Entity#setPersistent() determine if an entity despawns or not
Yup
ty
Code?
flags.forEach(region::setFlag);
https://paste.md-5.net/ceqezuyuce.cs - just say what the map i need for add to region
Map<Flag<?>,?> should be like that
lol
no not working - 'setFlag(T, V)' in 'com.sk89q.worldguard.protection.regions.ProtectedRegion' cannot be applied to '(com.sk89q.worldguard.protection.flags.Flag<capture<?>>, capture<?>)'
i gess i need generic
i find Map<Flag<?>, Object>
Now the problem is how to create the correct objects from the string (flags from the config).
is there any way to disable a plugin from sending messages to a player? for example, a plugin with no config and no normal options for disabling messages?
ok thanks 🙂
should be ClientboundSystemChatPacket
ah k
(in mojang maps)
ty 🙂
how can i execute a command from a player even when that player is not online?
What are you trying to achieve with this ?
dont worry i worked it out now.
🙂
ty
ik this may be stupid but, is it possible to do an optional parameter to a void method? (kinda not used to java)
yeah
public void printName() {
printName("default value");
}
public void printName(String name) {
System.out.println("My name is " + name);
}
oh ok, so I can just create same method but with different parameters... cool cool
Depending on which types of parameters I give it, it will look for the suited method, thats nice
ty for the help, both of you
Hello
Im having an issue using FAWE
I want to create a world and paste an schematic
The problem isnt the code, it works
The problem is, it lags the server when pasting
so i tried with Async Tasks, it still lags the server
Sync tasks, also lags
So what can i do to prevent this lag?
(i tried creating the worlds and pasting the schem on enable but that doesnt work for me)
you can't. Pasting multiple blocks will lag
does anybody know how I can listen to redis streams when using jedis? Do i need a runnable looking for new packets every tick or can i have something like an event listener?
Why would you want to do that?
i want to listen to redis streams?
i dont know how to properly listen to them as a bukkitrunnable doesnt feel like the right way
i heard pub sub is fire and forget therefore not secure when a network error occurs
im trying to send data across servers
to get data in sync
is it possible to merge a pull request on github into another branch, but still letting github know that the pull request was merged? Right now it just still says "Open" because obviously it's not merged into master
there is sadly no code provided to listen to this like an event
at least i cannot find it
they only explain xread
😭
is there a documentation on spigot resource api? couldnt find one
?jd-s
i want to get the latest version of a resource id
kind of old and idk if that can even help u
srry thats the only thing i knew about the topic
👍
thanks
I was just implementing a login system for my android app and realized I'm stuck. I use argon to hash my passwords and everytime I generate a password, I generate a new salt. This means that if the user registers with a password and then tries authenticating with the same password, they'll fail, because the salts don't match. What should I do? Should I maybe base my salt on the email hash code?
I'd just let a bcrypt library handle password hashing
I am using a library indeed
That’s just part of the problem with salts. They have to be deterministic in order to be reliable.
The function signature for hashing is hash(mode, password, salt, workfactor, memcost)
What approach would you recommend then? Maybe, again, basing the salt on the email, or even just on the password itself?
Probably a combination of both at least to get started.
I think that my understanding of the concept is just a bit convoluted.. I imagined that the approach would be as follows: the user puts in their credentials, I hash the password and then send the email & hash to my API. In the API, I simply compare the hash stored in the database with the requested hash, so just a string comparison. Am I doing something wrong? Because for some reason it feels weird now that I say it all out loud lol
You’d do a comparison with hashFunction(password + salt)
You cannot use the password as part of the salt
How would you be able to recreate it
Well, if I have password abc, the salt would be the hashcode of abc
That's what I mean
So do I also send the salt to the api?

couldnt you then unsalt that
Perhaps.. I'm so confused rn lol
I thought I understood the topic and now I'm getting more confused by the minute
You have to be able to recreate the salt without having the password
why would your client application be the one to hash and salt the password
Why not?
Genuine question
beacuse your client application would then know the salt and hash function you use ?
Oh shit
like, you are already encrypted via SSL
you send the password to the server. The server grabs the password, combines it with the salt for the user you store in the db, does the hashing and then compares
does anyone knovvv this
I mean, are you targetting the correct branch ?
On paper this is starting to make sense to me... Thanks, I'll try implementing this rn
salt exists because you want to prevent people from guessing the password if they get your DB
Another question leaking out of your answer right here - since I plan to make my server opensource, how would I hide my means of hashing? Or should I even
well I have manually merged it into another branch on purpose. does github maybe recognize the original PR to be merged when I later merge the other branch into main?
Yep I know why salt is, but I was getting confused on recreating it lol
if your original PR targets master and you just manually merge then no
Now it is starting to make sense
the PR should obviously stay open
the changes did not make it into the branch the PR targetted
yeah that's why I'm asking whether I can tell github that I want to it to target another branch, without asking the PR author to PR again
don't think so
I mean, if they have the "let admins edit" thing enabled you might be able to ?
Yea
the save button was an edit button prior ^ @tender shard
aah yeah that's exactly what I was looking for I guess. thanks!
woah 2ss in the wild
Not related to Spigot so keep it to yourself
I mean.. yes? Very odd question though
sup elgar
this is help-dev
i was wondering how you could stream audio to note blocks
Could be worse xD
is it possible
no
there is ofc noteblock api but that's like midi on crack
there is only resource packs, or reusing existing sounds like noteblocks
thats what im asking
how do you turn audio stream into noteblocks
never did audio stuff so am confused
NoteBlockAPI can read "midi" files (nbs)
@carmine mica I need a favor
👀
I need more real estate below my good habits post
As I'm doing an edit and it'll likely go over the message limit for the reserved message too
(This edit's present on the spigot version)
Yikes
Conclube could also help :)
At this point maybe consider a gist
I already have it as a forum thread and on git
A discord message feels more personal
Hm I wonder what nitro's message limit is
I'm thinking 4000
I think it’s double the normal
Yeah that's not enough
The message I'm going to edit + reserve hits 8k
need one more and that needs deleting at least 3 messages
just make a blog /shrug
Tumblr post
or use a webhook embed builder and get coll to send the link
iirc they dont get as hard of a char limit
What takes more time,
Statement statement = connection.createStatement();
or
stateement.execute(a);
the 2nd does the 1st and then runs
if you need more control do the 1st
Nah because im making some java code to migrate an SQlite database to mysql, and its 20 gb in size so theres lots of sql executions im gonna need to do
ah then they're the same
huh
you need the first to do the second
lol
you need a Statement if you want to run execute on a Statement
prepared statement be like
also batching 🙏
what tf could cause this erorr I'm so confused lol
e: file:///home/miles/IdeaProjects/basics/modules/basics-home/src/main/kotlin/com/github/spigotbasics/modules/basicshome/data/BasicHomeDao.kt:5:1 Inherited platform declarations clash: The following declarations have the same JVM signature (references$default(Lcom/github/spigotbasics/libraries/org/jetbrains/exposed/sql/Column;Lcom/github/spigotbasics/libraries/org/jetbrains/exposed/sql/Column;Lcom/github/spigotbasics/libraries/org/jetbrains/exposed/sql/ReferenceOption;Lcom/github/spigotbasics/libraries/org/jetbrains/exposed/sql/ReferenceOption;Ljava/lang/String;ILjava/lang/Object;)Lcom/github/spigotbasics/libraries/org/jetbrains/exposed/sql/Column;):
e
unable to find any github issues on the repository of exposed
method signature clash !!!
hi i dont remember how i can rename jar in maven (not source just jar name)
BasicHomeDao:5
generated code?
like wat object BasicHomeDao : Table() {
quite literally the same as their example 🥲
is the example even valid?
maybe because I didn't override the primary key, but it's not forcing me to do it?
I don't really want primary keys
I want to beable to have multiple entries with the same uuid
found an open issue from 2 years ago, but its not the same issue, though it makes me think relocation could be the issue
how do you break a block naturally just like vanilla? I tried block.breakNaturally() but it doesn't spawn particles if the block wouldn't drop for the tool the player is using and doesn't get rid of durability of the tool the player used to break the block and it also doesn't seem to take into account the fortune enchantment
well uh, does it work without relocating?
you need to do that all yourself
no clue @tender shard how to not relocate xD
ig I can test on my own repo
rip, is there a method to do all that using nms that you know of?
core/build.gradle.kts -> shadow task -> relocate(...) part
okay
i think I'm relocating all the stuff in a for loop or sth
yeah I'ma just add an exception for everything under org.jetbrains.exposed
hermmm well
e: file:///home/miles/IdeaProjects/basics/modules/basics-home/src/main/kotlin/com/github/spigotbasics/modules/basicshome/data/BasicHomeDao.kt:3:34 Unresolved reference: Column
e: file:///home/miles/IdeaProjects/basics/modules/basics-home/src/main/kotlin/com/github/spigotbasics/modules/basicshome/data/BasicHomeDao.kt:4:34 Unresolved reference: Table
that's not good either
how are you building?
@tender shard now it won't detect the imports xD
did you clean and then change the imports to non-relocated ones?
this should work
archiveClassifier = "shaded"
for (path in listOf(
"net.kyori",
"io.papermc.lib",
"org.intellij",
"org.jetbrains",
"com.tcoded.folialib"
)) {
if (path in listOf("org.jetbrains.exposed")) {
continue;
}
relocate(path, "$SHADED.$path")
}```
yeah, but it won't detect them on classpath now
no, that still calls relocate
just comment out org.jetbrains
try {
Statement litestatement = liteconnect.createStatement();
Statement mystatement = mysqlconnect.createStatement();
String sql = "SELECT * FROM co_art_map";
ResultSet result = litestatement.executeQuery(sql);
while(result.next()) {
mystatement.execute("INSERT INTO co_art_map VALUES("+result.getInt("id")+", '"+result.getString("art")+"'");
}
}catch(SQLException e) {
System.out.println("Error when doing co art migration");
e.printStackTrace();
}
}```
Hi issue, what if the table im trying to migrate is like 15 GB in size? I dont have that much ram in my PC to store a 15 gb sized ResultSet
migrating sqlite -> mysql
do we have any jetbrains dependencies?
kotlin comes with jetbrains annotations
just comment out org.jetbrains, doesnt really matter where they are or if at all
gradle does not care about intellij caches
?
everything with gradle should be good to go though
./gradlew build
or for a clean build ./gradlew clean build
@tender shard just took a while to refresh ig
it was intellij
dude wild
e: file:///home/miles/IdeaProjects/basics/modules/basics-home/src/main/kotlin/com/github/spigotbasics/modules/basicshome/data/BasicHomeDao.kt:5:23 Unresolved reference: Table
lol invalidating caches fixed it
@slender elbow it was our relocations
gonna have to figure that out
:trollface:
somone how rename jar name in build process? <finalName> not work
Is it possible to remove the default particle trail that spawns when an spectral arrow is flying?
in maven?
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
yes thenks
i just need rename jar file in build process
create a version system
like "plugin-1.0.0" without affecting the main class
not "put plugin automatically into derictory"
and yet I don’t understand why the build system doesn’t support tags like Jar.fileName or just FileName, in the end the name remains the same, it should have been easier
when you know which tag works, then yes, but no matter how many tags I tried, it didn’t work
it is literally mentioned in the blog post I sent you
Should timing attacks worry me if I hash passwords
in fact, tags like finalName should work, but they don’t
finalName works just fine
?paste your pom
@upper hazel paste your pom
yeah well you haven't read my blog post at all
that's why it doesnt work
do it like my blog post explains and it will work
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
Are you talking about creating a profile in maven?
it doesnt matter whether you choose option 1 or option 2
both will work
you are currently using option 3 (the wrong one) plus a few useless <properties>
I've tried to put that tag in every possible place....
When I read about this topic nowhere it was mentioned about outputDirectory tag I don't understand the specifics of this bukkit api
what does this have to do with bukkit?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<finalName>WhatEver</finalName> <!-------------------------------------- here -->
</configuration>
</plugin>
your current way is the one described in "3. The wrong way (don't do this)" so I am pretty sure you didnt read the blog post at all
!
you mean you don't have the maven-jar-plugin in your pom?
I have 1.12.2 version if anything. Maybe?
https://paste.md-5.net/uzukucakiy.xml
ehh i was can just add this tags?
^
no not work
?paste your pom
how do you compile?
build-> artifact
wrong
eh?
why so???
because you're using maven. that's what the pom.xml file is for
pom.xml = maven file
so you have to use maven
otherwise your pom.xml is useless
i know but build -> build artifact not use maven lol?
i dont know what build artifact does, but it definitely doesn't do the correct thing
wha?
here is
just do what I said. Maven tab -> double click on package
why in name exists "original" original-FudziEconmy-bukkit-1.0.0-beta
because you're using the maven-shade-plugin
i can clear this in build?
yes. but why are you using the maven-shade-plugin in the first place?
you don't have anything that needs to be shaded
I don’t know maven well, I can only create dependencies, but I build through the display for the first time
you can remove the whole <plugin> part for maven-shade-plugin
i was use only "build option" in top left
oh thenks
hmm?
oh you probably wanted to hijack one of my messages. but I think you got one from Conclube?
Nah
I need you to delete those 3 messages after my reserved one
so I can edit the one after
ok, deleted
you have 5 messages above that one too, you can use those by shifting stuff up

wait what? I can edit messages that old, for example my messages just after that
@ivory sleet Is it fine if I delete the good habits message and repaste the "new" one that includes an explanation on all SOLID topics?
it doesn't let me paste it
what is the difference between build in the upper left corner and build through the maven plugin display
maven = uses your pom.xml
the other one = doesnt
then dipandancy shold not work
but this worked like standard maven
Seems like smaller messages did the trick
discord does not like anything over ~3.5k characters
they only work because of Project Settings -> Libraries
oh
There we go
wat
