#help-development
1 messages · Page 1339 of 1
I'm missing out on a lot of context I'm sure, but what's wrong with this?
public double parseDouble(String input, double defaultValue) {
try {
return Double.parseDoublue(input);
} catch (NumberFormatException e) {
return defaultValue;
}
}
yeah, this is what apache commons does
Other than the glaringly obvious typo
hey i found the regex recommended by the javadocs
final String Digits = "(\\p{Digit}+)";
final String HexDigits = "(\\p{XDigit}+)";
// an exponent is 'e' or 'E' followed by an optionally
// signed decimal integer.
final String Exp = "[eE][+-]?"+Digits;
final String fpRegex =
("[\\x00-\\x20]*"+ // Optional leading "whitespace"
"[+-]?(" + // Optional sign character
"NaN|" + // "NaN" string
"Infinity|" + // "Infinity" string
// A decimal floating-point string representing a finite positive
// number without a leading sign has at most five basic pieces:
// Digits . Digits ExponentPart FloatTypeSuffix
//
// Since this method allows integer-only strings as input
// in addition to strings of floating-point literals, the
// two sub-patterns below are simplifications of the grammar
// productions from section 3.10.2 of
// The Java Language Specification.
// Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
"((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
// . Digits ExponentPart_opt FloatTypeSuffix_opt
"(\\.("+Digits+")("+Exp+")?)|"+
// Hexadecimal strings
"((" +
// 0[xX] HexDigits ._opt BinaryExponent FloatTypeSuffix_opt
"(0[xX]" + HexDigits + "(\\.)?)|" +
// 0[xX] HexDigits_opt . HexDigits BinaryExponent FloatTypeSuffix_opt
"(0[xX]" + HexDigits + "?(\\.)" + HexDigits + ")" +
")[pP][+-]?" + Digits + "))" +
"[fFdD]?))" +
"[\\x00-\\x20]*");// Optional trailing "whitespace"
if (Pattern.matches(fpRegex, myString))
Double.valueOf(myString); // Will not throw NumberFormatException
else {
// Perform suitable alternative action
}
it's only like 50 lines which is primarily comments
the slight off-chance that my default value is the same as a user input by pure coincedence
but my NaN idea is basically that but with defaultValue == NaN
iirc the context is an eco transaction
i think guavas is even longer 💀
Does negative currency make any sense in that case?
no, but i early return in transaction methods if n is negative anyway
so yeah uh after taking this into account, you maybe do want to do primitive double and check for NaN/infinity instead
so negatives are handled later on
fuck ur so right
because unless you or someone else validates the input, the player could enter the string NaN which is going to give you a NaN
which, again, if you do like receiver.deposit() on it and deposit just does balance += amount, it'll nuke the player's balance
i think vault probably guards against nans and infinities
or well i don't know if vault is in a position to guard anything, it's just a service registry
i made the naive decision to write the eco implementation myself and at this point im in too deep to turn back
sunk cost fallacy
Just make your economy communist
iirc its up to the implementation
i looked at Essentials once i dont remember much
but im pretty sure Vault is all interfaces
anyhow yeah, try catch and if it throws, return nan
then explicitly check Double.isFinite
what if i add the finite check to the parser lowk
this will nicely represent "not a number" without boxing, and will also guard against someone trying to /pay me infinity
but since you will then be dealing with nan's, you have to take very good care to always check that it is finite
doing the finite check outside of the parse and if its false i kill the player
so if you're planning to expose this to "outside callers", like other classes, maybe dependencies, other plugin modules, i'd still go with null in place of nan
perhaps
thats been mo jank for years
yeah its like relatively common actually
aight glad, since i'm currently messing with join & quit stuff, so i wouldnt have been surprised
ye plugin themselves provide values rather than the economy plugin (all eco does is safeguard n < 0)
so its per-plugin to make sure they dont nuke the balance
the good part is im in charge of all the plugins that will use it (since its for My server)
the bad part is Im in charge
writing your own eco backend isn't a bad thing
i've had to do the same because all the plugins out there seem to either be terrible, bloated, feature creepy dumpster fires like TheNewEconomy (recommended by towny) or otherwise nice and simple, but don't work with towny
so i ended up writing one that specifically doesn't fuck shit over when used by towny, and is just a plain and simple uuid -> double store
does Towny not hook Vault?
it does, but it has had trouble with uuid's ever since they were introduced
oof
and since it needs to register non-player accounts for towns, shit gets whack and the uuid resolution differs from backend to backend
many backends like essentials eco do weird evil uuid version checks that prepend npc_ to accounts or something, and that makes it not work with towny
i do like mine bc it has a pseudo-bank system where players have their on-hand/wallet balances, but can also store and access balances in an infinite amount of "bank" accounts
i just have no way of making more than one bank rn... so its just one Central bank
im like the federal reserve fr
User
- Wallet
Bank
- AccountHolder
-
- Owner (User reference)
-
- Collection<Account>
eventually ill think of a way to manage multiple banks but
maybe just like
BankRegistry
-
- Collection<Bank>
its a fun learning experience for sure
ive never touched SQL even with a 39.5 foot pole until now
never had a system that benefitted enough from having a storable database to constitute learning SQL
had to spend yesterday evening fixing my queries bc my initial database structure didnt work properly to let me use UPSERT in SQLite
and initially i had 3 separate queries (UPDATE on SELECT else INSERT)
you will have fun with this
remember CRUD
Celect
inseRt
Update
Delete
I thought it was
Chatgpt
gRok
claUde
Deepseek
yo how do you detect if the damager is anchor block explosion?
EntityDamageByBlockEvent#getDamager returns null cuz block alr gone
but it still calls the event
would probably need to chain some logic with the BlockExplodeEvent
Ah
this does not make sense but.. BlockExplodeEvent is called AFTER EntityDamageByBlockEvent??
i don't know if there is any sensible implied order for them
yeah, it will prevent the blocks from exploding if cancelled
it doesn't cancel the explosion itself
well, not really
suppose for example that you want to prevent some blocks from exploding
but still want it to damage mobs
perhaps you have an indestructible custom block that you don't want to be explodable
blockList#clear?
cancelling the event shouldn't make the explosion not deal damage to nearby entities
blockList is a mutable list
sure
so yes, its stupid
not really
Entitydamagebyblock event is not inherently tied to blocks exploding. There is other blocks that can damage. The reason blockexplode event comes after is because otherwise you would not be able to cancel the damage to entities as blockexplode event does not have entity list.
@topaz cape
what is the commonly used way to align multiiline-text properly, since apparently tabs aren't a thing, and spaces just don't work at all, i assume due to different character lengths
there's a MapFont class or something that you can use to calculate the rendered widths of text in the minecraft default font
using this and spaces and bold you can manually align things
there's a magic trick
making a block of text bold makes it 1 pixel wider
so you can make your spaces bold to get pixel-perfect adjustments
this for instance.
when i move the "<name>" from the "enter" line one to the right, it does not seem to work either
oh the spaces
different characters have different widths, and you have to adjust the width of some of your spaces to account for it
a cleaner way of doing this is to use a custom font with spaces of widths 1, 2, and 3 pixels in addition to the default 4 of the regular space
but messing with bold also works, it's just more clunky
well, it's fairly simple to set up, but it does mean that people without the pack will be seeing random squares in place of some spaces
yea i know how to do custom fonts, but custom rp's itself are smt i always avoid, since people do not like those, for a reason
myeah that is fair
welp i guess ima see about that custom formatting. thanks for the help
spaces it is then, but it will be fucked if anyone has unicode font enabled or uses a custom font, since then the character widths will be different
ugh
yk what, i'm just going to use comic sans
or just use no spaces at all the same mojang does.
dots can get you sorta close
that's what worldguard has been using for its /wg flags list for like 20 years
it's not pixel perfect, but each one is like 2 pixels i think, so you'll be 1 pixel off at worst
meh that should be enough, kinda same as the existing "help" command
Make a custom monospaced font :p
unicode has a monospaced block and it does render ingame, but it looks kind of weird
I'm facing a weird issue where getPersistentDataContainer() highlighted in red (Cannot resolve symbol) in IntelliJ IDEA. However, my pom.xml seems correct and I'm targeting Spigot 1.20.1.
zero width spacing or something
Does it compile fine? intellij is weird sometimes
Make sure Intellij is up to date and that you have a modern JDK set for the project
Does it compile fine? intellij is weird sometimes
crazy
Oh, sorry, I was just trying to insert a picture.
The program won't compile because of this error and I've already tried clearing the cache.
do you maybe a have a bukkit 1.8 as a transient dependency from worlguard or something
No, I don't think there's anything like that, but I have an api vault in my pom.
that could do it, vault is ancient and does depend on bukkit
print your dependency tree
if you use intellij, you can see it in the maven sidebar; expand "dependencies" and look for bukkit/spigot
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@thorn isle Indeed, as soon as I removed the vault dependency from the pom, everything worked.
@echo basalt Sorry if I offended you, I just wanted to send a pic.
you can exclude it
shove
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
within the vault dependency tag
thank you
anyone knows why I can't "Go to declaration" (like being transferred to where the method/variable/class resides) in IntelliJ 2026.1 with the middle mouse button?
worked in IJ 2024
but it doesn't support gradle 9.4 so had to transfer
My case about some stupid gradle plugin requiring gradle 999.99 for no discernable reason in point
It's in the settings somewhere, but good luck finding it
My personal recommendation is to give up and just run gradle through the command line instead of the ide
26.1 is fucking horrible
Or even better, switch away from gradle altogether
I can run every maven build under the sky from IJ 2019.1
Since I maintain an intellij plugin and target everything from 19.1 to 26.1, I frequently see and use each version, its mych more apparent to me how it has evolved (and I have about 100gb of gradle garbage and IJ platform shit in my build cache, but thats besides the point)
But switching the versions to runIde and test the plugin on each is like watching a timelapse of Rome turning into ruins
Every time it gets worse and worse
The buttons get bigger and bigger, the ui gets rounder and rounder, all the tool tips and in-ui button texts disappear and get replaced by big fat icons that I have to guess what they do
More and more ai buttons and "start free trial" shit appears
yeah fuckin hate that
will just keep the 2024.2 version Ig
I imported the settings, and it's fixed a little bit
but still terrible navigation
I don't think it'd be easy to configurate that
why java doesnt support compact source files outside main class?
it would be so useful to have as an utils alternative
i feel like a broken record
currently i use lombok's
@UtilityClass
public class UsernameValidator {
}
for this
but it would be quite nice to drop class level too
what's the issue again?
Costs an extra AI token or two
true
my condolences
is there an exploit when player can close inventory without sending a packet (or not close it and send a packet) and this way duplicate items?
ive heard of it and im using invenotryCloseEvent to remove the inventory from a set
to dupe items? unless it's a poorly coded plugin and the server has no anticheat, no
They can use invutils to run commands while a menu is open
Delaying the close packet on top means they get to open a menu before closing another
For example, if you have a gui that saves when closed and renders its items when open it'd result in a dupe
because you can take your item, reopen the menu and get it again before the old version saves
Speed check doesn't account for anything like ice, speed effect etc
uuuh
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Does Component#translatable not distinguish which plugin is running?
??
That's just a translatable component it has nothing to do with plugins really
They're a vanilla thing
so no it doesn't care what plugins are running
lang.item-bought-successfullyI have this key in 2 plugins and one message is being overwritten
I thought that two different plugins could use the same key
I mean yeah if you have two plugins trying to define the same key that's not going to work
ok thanks
One more thing: if a world unloads, are all chunks at the time of unloading called in the ChunkUnloadEvent?
Try it and see
My plugin is behaving strangely, I imagine that's not
And what about the EntityRemoveFromWorldEvent? Do you have any idea if the EntityRemoveFromWorldEvent is called when the entity is in a world that is unloaded?
Try it and see
?whereami
[15:56:06] [Netty Epoll IO #1/ERROR]: Thread Netty Epoll IO #1 failed main thread check: Cannot perform command async
java.lang.Throwable
at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:9) ~[aspaper-1.21.11.jar:1.21.11-17059-496f794]
I see org.spigotmc
You're not running Spigot so it doesn't matter
it makes sense
Block block = world.getBlockAt(cx + dx, cy - 1, cz + dz);
Material type = block.getType();
I'm doing this in EntityRemoveFromWorldEvent and I'm getting this warning: Cannot update ticket level while unloading chunks or updating entity manager
What can I do?
So I'm screwed lol
Nah
thats pretty cool https://github.com/pingcap/tidb
looks like cockroachdb but mysql instead of the postgres wire protocol
raft
nice
and written in go
looks very impressive, though i don't really need something like this
Despite the fact this is not spigot, reading the trace, its about a command being called async. What excactly are you doing in your onDisable?
i don't see any plugin classes in the stack trace, and it looks like it's just a command packet being received and processed normally
does it happen every time? if it was just an one-off thing, maybe someone sent a command right as the server was about to shut down, and that isn't handled correctly by the server internals?
it does seem to try to pass it to the BlockingEventLoop which i think should schedule it to run on the MT, but it's a common pattern for schedulers to short circuit on shutdown
Does RIGHT_CLICK_AIR in PlayerInteractEvent not work anymore? (1.21.11)
nothing from i know
From what I saw, it only happened that one time
Are you holding an item?
no, when not holding
Then no the client doesn't send the interact packet
It's been this way for a long time
you need either a block at the crosshair or an item in your hand for an interact packet to be sent
the client doesn't expect anything to happen if it has nothing to interact with, so it just doesn't send an interact packet
Or just constantly have an interaction entity infront of the player
yes a block or an entity at the crosshair to be more specific
I mean yeah any entity will work
however i'd recommend against doing it with the interaction entity as that will take priority over targeting actual blocks at the crosshair
that's also true
so you'll have to move it around as the player looks and moves around, which then in turn is latency sensitive
someone has suggested adding a fully transparent texture for an item and then filling all hotbar slots with that item, but i think that will make the player's hand disappear
so the best approach is i think just switch your input button to left click for whatever you're trying to do
ah okay
tested, and ye, doesn't send
easiest to check would probably be making a large hitbox ride the player at all times and just reproducing the interactions with the api
not sure about mining blocks
will just use items then
it is fine if you just put it far enough that it is in entity interaction range but not in block interaction range
it's different?
the two
by default block interaction range is 4.5 and entity interaction range is 3
those values are increased by 2 in creative mode, but I doubt anyone cares about creative
still not ideal as this will make the targeted block outline/highlight not appear on the client
unfortunately that is backwards in regard to what you need
you could increase it with an attribute and then manually check the range on entity interact packets, and drop any that exceed the normal range, but i suspect that might cause issues with anticheats; it's worth a shot however
nowadays you can make it so the rendered item is the hand
can't remember if it was a component or a resource pack thing on the item model definition
i know you could do that with core shaders, but i guess they added some special model that just renders the actual player hand?
is it possible to get 1 tick of redstone? normal repeater's smallest interval is 2 ticks which is = 1 redstone tick apparently
so for example play a noteblock 2 times in 2 ticks
Is the EntitiesLoadEvent called on a tick after the associated chunk has been loaded? And what about ChunkUnloadEvent? Are the entities unloaded on the same tick that the chunk is unloaded?
not strictly related to repeaters, and i'm not sure but i'd guess, that blocks like noteblocks perform their behavior only when their redstone power goes from zero to nonzero
Block block = world.getBlockAt(cx + dx, cy - 1, cz + dz);
Material type = block.getType();
I'm doing this in EntityRemoveFromWorldEvent and I'm getting this warning: Cannot update ticket level while unloading chunks or updating entity manager
so it'd take 2 ticks either way, one tick to power it, another tick to depower it
undefined; the two are not coupled anymore
wdym coupled
they are not the same and have no well defined relation
and yes, it is ass, and it makes everything more difficult
entities could load several ticks after the chunk is loaded
not sure how unloading works
Yeah, I need to know about unloading
and why?
either way your error comes from the chunk being unloaded, or being in the process of being unloaded, at the time the code runs
because that's how it works, ask mojang
hi hd luna
they separated, i.e. decoupled, i.e. made it not coupled anymore, between entity and chunk loading
entities and chunks are stored in completely separate files
And can entities load after the chunk unloads?
i don't know
it is. some components like noteblocks dont operate on redstone ticks. With some specific timings (maybe 2 out of sync observer clocks, which produce one tick pulses) it is possible, atleast in theory. Try googling or searching on yt, someone most likely already has done something like this
Well, I was thinking of using ChunkUnloadEvent and iterating through all the entities. I need to get world blocks when the entity is unloaded. But I don't know if the entities are guaranteed to be unloaded on the same tick as the corresponding chunk is unloaded
hi :)
I don't know if this is a problem
oh
then yea this is a problem
can i print current tick to console on event handler
?
i think you might be able to deal with it through nms, i suspect this is bukkit being dumb
bukkit only considers the highest, entity ticking chunk ticket level to be "loaded"
But then I wouldn't have that error I told you about
If the entity is unloaded before the chunk is unloaded, then I shouldn't get that error about getting a world block if the chunk is still loaded
You really shouldn't have gotten yourself banned from the Paper discord
yeah but then you have no entity to call that getBlock logic on
They heavily change how chunk loading works
i'm fairly sure the chunk is still loaded at the border ticket level, meaning the block data is still there
this is a impossible task
not to mention the events you're using are Paper specific
so you should be able to get the chunk with nms and read the block with nms
Impossible to be nice and follow the rules?
i got banned for trying to help people with 1.8
two thirds or more of the people here are paper users who either dislike the community or have been banned from it
Yeah I know a lot of you have been
You get banned for being good; you don't get banned if you're bad
i'm fairly sure he also got banned for asking for help with 1.8
guys i need help with 1.0 beta how do i add plugins
no
It was because I said "lol" in response to a message and people thought I was mocking them. Something like that
either way, try nms
And then they muted me for a month. I spoke to the admin and they told me that next time it's a ban, and I told them to ban me
And so I got banned
I'm not aware of another way in spigot, but maybe you could try the Bukkit Scheduler and reapeatingly schedule a sync repeating task every tick? Whats the xy for powering the noteblock every tick? I assumed it was only a general redstone question at first, but since you're asking about doing it with a plugin, what's your plan?
just noteblock songs
What I find strange is that getting the block is possible, but getting the block type isn't
xy problem is probably not the case
getting a block does nothing
yea i see now
only when you try using them to read the state does it e.g. trigger a chunk load
If you're doing it through the plugin anyway, you could also go the route with Player/World#playSound
Then probably either the scheduler or some special redstone circuit, sadly my knowledge there isnt too great so i cant help you with that :/
yeah thanks anyway you helped
I don't know how I can obtain the block with the nms in a different way than Bukkit
cast the world to craftworld and get the handle and get the nms chunk and get the nms block
So what are you even doing with the block?
just getting the type
for what purpose?
https://imgur.com/a/LeEFdt7 To save in memory the number of blocks the minion has, in order to know the minion's efficiency. In this case, there are 3 grass blocks, so the efficiency is not 100%, consequently it will generate less stone
here's a thought
Do you not already know the efficiency on removal??
do that on chunk load
it's not like the blocks are going to change while the chunk is unloaded
https://imgur.com/a/kDFiT70 like this?
yeah that's worth a try
Good observation, lol
I can't do it in chunk load yea
i mean with chunk borders and pistons, adjacent chunks might change between the entity unloading and loading if it's on the chunk border, but i don't think it should be an issue
https://imgur.com/a/3TILeKB I need to retrieve the data from memory before loading the minion
I could do this with timestamps/time differences, but yeah, that's a big refactoring
But it seems to me that Bukkit does the same thing I'm doing
public Material getType() {
return this.world.getBlockState(this.position).getBukkitMaterial();
}
possibly
bukkit and nms chunk load levels aren't 1:1 however
so it's still worth a try
The difference is that Bukkit uses the world to obtain the state block, while I use the chunk
getChunk will load the chunk if it is unloaded
i'm guessing it is loaded, but not at the entity ticking level
which bukkit considers "unloaded"
either way, try it and see
if you get the error, then it is actually unloaded
I haven't had that error for a while now
if it doesn't happen consistently, what i'd do is just schedule the block get to happen a tick later if the chunk isn't loaded when the code runs
this would be bad if it does happen consistently, as loading the chunk would make it unload again and it'd loop indefinitely
but if it's a 1 in 100 thing, it's fine
But the chunk won't be loaded in principle for a tick later
Or are you telling it to load the chunk one tick later?
it won't, but the block get call will load it
it also tries loading it here, but the problem is the code is called from nms code that's already doing chunk loading/unloading status shit
and you can't load chunks under that code
loading the chunk a tick later under the scheduler will work as normal
https://imgur.com/a/ljuvw11 Perhaps this if statement will resolve the infinite loop you're talking about
I set this to true in EntitiesLoadEvent
With this if statement, I have a guarantee that the getBlock call will be made for a chunk that is not loaded
don't use bukkitrunnables for stateless behavior
those are meant for self-cancelling tasks and tasks with state
Actually, the chunk might have been loaded, but the entity hasn't been loaded yet, but I don't think that's a problem
just use a regular runnable and pass it to the scheduler
wdym
your bukkit runnable
yes but why
it's redundant and not as readable
Do you advise doing this instead?
Bukkit.getScheduler().runTask(BukkitMinionPlugin.INSTANCE, () -> {
if (!bukkitMinion.isLoadedChunk()) {
bukkitMinion.getMinionState().onMinionUnload(cx, cy, cz, radius, world);
}
});
yes
you are using this yet?
they have a dupe
If you drop an item and restart the server, your item will be on the ground and in your inventory
SEVERE: FlatLaf: Using JProgressBar.setIndeterminate(false) not on AWT thread may throw NPE in FlatProgressBarUI.paint(). Use SwingUtilities.invokeLater().
java.lang.IllegalStateException
at com.formdev.flatlaf.ui.FlatProgressBarUI.lambda$installListeners$0(FlatProgressBarUI.java:127)
at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:343)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:335)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:268)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:310)
at java.desktop/java.awt.Component.firePropertyChange(Component.java:8690)
at java.desktop/javax.swing.JComponent.firePropertyChange(JComponent.java:4598)
at java.desktop/javax.swing.JProgressBar.setIndeterminate(JProgressBar.java:916)
at org.spigotmc.gui.panels.general.GeneralPanel.lambda$buildButtonActionPerformed$1(GeneralPanel.java:197)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:884)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:862)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:531)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1794)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1781)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
am i the only one getting this error
it happens right at finish
judging by the one line in the stack trace that seems to be vaguely related to spigot, i assume you're talking about buildtools?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
is there a way not to send teams to client until they see a player of that team without manually sending packets?
it looks like when a player joins they instantly get told of all teams and their members
not only that, but the entire scoreboard, with tags and scores and all
this is sort of "doing it manually with packets"-adjacent, but you could maintain a per-player scoreboard with player::setScoreboard, and assign only nearby people to teams based on the real scoreboard
Ah yes
Forgot to mention
Something with the laf theme
Leaf theme?
im gonna assume maybe the icon to use the theme is a leaf lol
I thought we had a sun and a moon
See, that's what I thought
yeah i think he meant LAF
sleeping mannequin disappears when player is >19 blocks away ignoring tracking range, why? hard coded client side?
is it possible to modify for how long the action bar message stays visible after showing it
or is that kind of hardcoded
@vagrant stratus

hardcoded i think
but you can extend by just sending it multiple times and sending empty to clear or shorten it
yeah but it will disappear abruptly and not fade
(i think the actionbar fades, cant remember)
yes but its possible to calculate when it should fade and send the last one some time before that
Yes laf
is it possible to make mannequin walk normally without packets or teleporting
can goals be added to them?
You could create a fake player instead of a mannequin if u are using a plugin
This still involves packets
My personal recommendation is libsdisguises
Oh yeah
Ppl are too horny 😔
there is any good library for config handling becuase i don't like the fuct that as right now all my config is messed up when i push a new update
are you the guy to whom i explained how to config.set and save for like half an hour a few days back
Does anyone need plugin development ... xD
maybe... hahaah
there's jshepherd
How can I protect my plugin against leakers? I've already tested ProGuard and Skidfuscator but apparently it's not that useful
I just wouldn't bother. Anyone with enough time and dedication will deobfuscate it
Or they'll copy/paste your obfuscated code. It's not like it doesn't work just because it's obfuscated
Your code isn't high-value enough to need to be obfuscated
I'm about to open a paid plugin store and with my own licensing, you know, I just want to protect it as best I can, isn't there any alternative to make it as difficult as possible?
The plugin will be leaked regardless of what you do
You're just making it a fun challenge to crack
The best protection against leakers are updates
- obfuscating won't stop people from sharing the jar. it just makes it more fun to read the code
the best protection is to not run code on the client but stream it from a license server and apply at runtime
but i dont recommend it, just make good content, good updates, and dont worry about cracks
I mean even that isn't too hard to bypass
- now you run in to the classic problem of the plugin being better and more reliable if you pirate it
Actively making the experience worse for paying users is not the way to go
piracy doesnt need active prevention as the ceo of steam said "piracy is almost always a convenience problem"
make your store easy to use and everyone who is willing to pay will pay, everyone who isn't willing to pay just wont use your software even if there's not a pirate
^
https://www.youtube.com/watch?v=EQweFurRz4g give it a watch :)
WATCH A SLIGHTLY LESS CRAPPIER VERSION OF THIS ON ODYSEE: https://odysee.com/@postscriptreal:e/Gabe-Newell-on-Piracy-(Full-Version-HQ):2
This is the un-abridged, web-exclusive version of ABC Good Game's interview with Gabe Newell, which contains the full version of Gabe's take on Anti-piracy.
Despite what the title and YouTube says, this video ...
how can i check if the player have played the server before? i used to use PLAY_ONE_MINUTE but it isn't working properly now...
declaration: package: org.bukkit, interface: OfflinePlayer
and there is a way to reset this value?
delete the player data
is there any decent gui client like dbeaver which doesnt have clunky java ui
specifically searching something for redis
vkcommander
Datagrip probably does, free for non commercial
public CompletableFuture<Response> sendAsync(Request request) {
return CompletableFuture.supplyAsync(() -> {
try {
return send(request);
} catch (IOException exc) {
throw new CompletionException(exc);
}
}, threadExecutor);
}``` does this look correct for passing an exception to the CompletableFuture?
which is then used like ```java
sendAsync(args).whenComplete((response, throwable) -> {
if (throwable != null) {
/* handle err */
return;
}
/* do stuff */
});```
Im not sure i would throw a CompletionException.
Probably a RuntimeException, since the CF will wrap it in a CompletionException on default.
i tried using exceptionally and it had an issue with return types
it will unwrap (wont be rewrapped) CE so its fine
i havent used CFs much tho so i probably just had the wrong method used before it
Exceptionally does not pass through the result, so it will be a CF<Void> with exceptionally
would i need to like return null and then in a .thenAccept check if null?
god I hate CF's handling of CompletionException it's absolute ass
in some cases it wraps exceptions in it, in other cases it doesn't, but it never unwraps them
There are like 10 methods that let you handle exceptions in some way.
my alternative idea is sendAsync takes a Request + Consumer<Response> and Consumer<Throwable> lol
so you always end up having to run a stupid conditional unwrap method somewhere to get the actual exception you want
Dont mix functional forwarding with CompletableFutures. Your approach is fine.
exceptionally is more so a recovery function, the signature is CompletableFuture<T> exceptionally(Function<Throwable, T>)
oh wait it doesnt?
edit: well im psure it wont rewrap CE at least, unwrap was a bad choice of word
so yes it does pass the result downstream
i would ditch the CF if i did 2 callback consumers instead :P
something like java public void send(Request request, Consumer<Response> onSuccess, Consumer<Throwable> onThrow) { threadExecutor.execute(() -> { try { onSuccess.accept(send(request)); } catch (IOException ioe) { onThrow.accept(ioe); } }); }
i like it
though, if its always an IOException u're catching, why not Consumer<IOException> ^^
idk ¯_(ツ)_/¯
i could change the type ig
this function looks rather pointless
why not just use Java's HttpClient
because im on java 8 😔
my condolences
I've been working on a custom inventory GUI system and ran into what I think is a gap in the InventoryClickEvent API.
When MOVE_TO_OTHER_INVENTORY fires (shift-click), the event tells you the source slot but not the destination. The destination is computed at the NMS level before the event fires, so plugins have no reasonable way to access it without diving into NMS — which kind of defeats the point of having a Bukkit API.
This makes it really difficult to write a slot-based inventory library that correctly handles shift-clicks without either blanket-cancelling everything or reimplementing item routing logic that ultimately doesn't match what NMS actually does.
Would it make sense to expose the destination slots on the event? Something like event.getDestinationSlots(). Since the information already exists at that point, it feels like a natural addition.
Has anyone else run into this, or is blanket-cancelling really the accepted approach?
what people do is just duplicate the internal logic with the API
and yes, people have ran into this before but it is niche enough of a problem that nobody has bothered to fix the API around it
alr
alr
alr
alr
alr
I did make an nms based slot thing but even then I often find myself emulating slots because everyone and their mom wants to have display items that represent "empty slots"
alr
i hate InventoryClickEvent i hate it
did you know
Does anyone know how to use ClientboundSetEntityMotionPacket ?
you give it an id and a vector @autumn zinc
I'm trying to use it, but without results
one min i'll send code
show code
((CraftPlayer) player).getHandle().connection.send(new ClientboundSetEntityMotionPacket(id, new Vec3(x, y, z)));
this is exactly how i'd send it
Display.ItemDisplay entity = new Display.ItemDisplay(
EntityType.ITEM_DISPLAY, ((CraftWorld) player.getWorld()).getHandle());
entity.setItemStack(CraftItemStack.asNMSCopy(new ItemStack(Material.STONE_SWORD)));
Location location = player.getLocation();
entity.setPos(location.getX(), location.getY(), location.getZ());
ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;
connection.send(new ClientboundAddEntityPacket(entity));
connection.send(new ClientboundSetEntityDataPacket(
entity.getId(), entity.getEntityData().getNonDefaultValues()));
Bukkit.getScheduler().runTaskLater(
plugin, () -> connection.send(new ClientboundSetEntityMotionPacket(
entity.getId(), new Vec3(0, 1, 0))), 20L);
The entity spawns successfully, but without velocity in a second
i also tried with default zombie
ok
Villager entity = new Villager(
EntityType.VILLAGER, ((CraftWorld) player.getWorld()).getHandle());
//entity.setItemStack(CraftItemStack.asNMSCopy(new ItemStack(Material.STONE_SWORD)));
Location location = player.getLocation();
entity.setPos(location.getX(), location.getY(), location.getZ());
ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;
connection.send(new ClientboundAddEntityPacket(entity));
connection.send(new ClientboundSetEntityDataPacket(
entity.getId(), entity.getEntityData().getNonDefaultValues()));
Bukkit.getScheduler().runTaskLater(
plugin, () -> connection.send(new ClientboundSetEntityMotionPacket(
entity.getId(), new Vec3(0, 1, 0))), 20L);
same thing
do you mean i should use protocollib?
yes, it is necessary
I mean, the api can technically do that too
mm, how?
Entity#setVisibleByDefault
Player#showEntity
interesting
so this doesn't add it to the world?
or no
it just hides it
pretty cool
my guess is you need to send the packet in small chunks over a period of time
i know, but it is very important to implement my system using packets
without creating a real entity or something else
yes
interesing suggestion, i'll try
Bukkit.getScheduler().runTaskTimer(
plugin, () -> connection.send(new ClientboundSetEntityMotionPacket(
entity.getId(), new Vec3(0, 0.2, 0))), 20L, 3L);
Like this? if yes it doesn't work ...
it doesn't work either
i tried to intercept set motion packet when a default zombie was moving, and i got this data
[15:20:25] [Server thread/INFO]: X: -372 Y: -627 Z: -329
[15:20:25] [Server thread/INFO]: X: -364 Y: -627 Z: -339
[15:20:25] [Server thread/INFO]: X: -357 Y: -627 Z: -347
[15:20:25] [Server thread/INFO]: X: -356 Y: -627 Z: -348
[15:20:26] [Server thread/INFO]: X: -355 Y: -627 Z: -350
[15:20:26] [Server thread/INFO]: X: -192 Y: -627 Z: -192
[15:20:26] [Server thread/INFO]: X: -105 Y: -627 Z: -104
[15:20:26] [Server thread/INFO]: X: -105 Y: -627 Z: -104
String stringBuilder = "X: " +
packet.getXa() +
" Y: " +
packet.getYa() +
" Z: " +
packet.getZa();
Bukkit.getScheduler().runTask(plugin,
() -> Bukkit.getLogger().log(Level.INFO, stringBuilder));
``` used this code
but i know that these values are already converted
try new ClientboundMoveEntityPacket.Pos(
there are no sub classes in ClientboundMoveEntityPacket
oh
it's 26.1
yes
not sure how it's on lower
there are i'm sorry
i tried it, but the entity doesn't move smoothly, but abruptly
one second, let me try
how is it going?
just got the server going
let me see
it doesn't spawn at all @autumn zinc
might be something related to 26.1 tho
i try it on 1.20.1
can you?
i can't rn
do you thing it is because of vesion?
are you sure that your way of creating the entity is okay?
yes
server entity is required in newer versions
give me some more time to check
ah nvm
i got it
i had to move the position above server entity
holy 26.1
they don't move indeed
might be something else as well
server entity seems to hold the vector data
set motion packet constructor
public ClientboundSetEntityMotionPacket(Entity var0) {
this(var0.getId(), var0.getDeltaMovement());
}
public ClientboundSetEntityMotionPacket(int var0, Vec3 var1) {
this.id = var0;
double var2 = 3.9;
double var4 = Mth.clamp(var1.x, -3.9, 3.9);
double var6 = Mth.clamp(var1.y, -3.9, 3.9);
double var8 = Mth.clamp(var1.z, -3.9, 3.9);
this.xa = (int)(var4 * (double)8000.0F);
this.ya = (int)(var6 * (double)8000.0F);
this.za = (int)(var8 * (double)8000.0F);
}
maybe it will help you? 🙂
it's not related to the move packet
?
the packet itself is a vector and entity id
we are trying to move the entity using the move or motion packet?
those are just logic for transfering
yes
but the constructor does work to prepare it to send it to the player/players
hmm
movement is really complicated for some reason
i think there's multiple packets you need to send first
why wouldn't a move packet not move an entity
@autumn zinc really sorry, i don't think i have enough time to debug this
if (this.entity.needsSync || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) {
Vec3 vec31 = this.entity.getDeltaMovement();
double d0 = vec31.distanceToSqr(this.lastSentMovement);
if (d0 > 1.0E-7 || d0 > (double)0.0F && vec31.lengthSqr() == (double)0.0F) {
this.lastSentMovement = vec31;
Entity entity2 = this.entity;
if (entity2 instanceof AbstractHurtingProjectile) {
AbstractHurtingProjectile abstracthurtingprojectile = (AbstractHurtingProjectile)entity2;
this.synchronizer.sendToTrackingPlayers(new ClientboundBundlePacket(List.of(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), new ClientboundProjectilePowerPacket(abstracthurtingprojectile.getId(), abstracthurtingprojectile.accelerationPower))));
} else {
this.synchronizer.sendToTrackingPlayers(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
}
}
}```
i found this
but it doesn't tell me much
When i use move packet it works, but motion - no
thx so much, i'll check it
all this does it checks if it's higher than a value and if it's a projectile it sends 2 packets, otherwise just one
in this code sends only motion packet to move the entity, without move packet, i thought these two packets must be used together
let's try seeing which packets get sent during movement
it has to be more complex than just this packet
I understood, that smooth movement can be achieved without motion packet - you just have to send move.pos packet every tick
like calculate offsets using this code
short x = (short) (entity.getX() * 4096D - previous.getX() * 4096D);
short y = (short) (entity.getY() * 4096D - previous.getY() * 4096D);
short z = (short) (entity.getZ() * 4096D - previous.getZ() * 4096D);
new ClientboundMoveEntityPacket.Pos(entity.getId(), x, y, z, false);
previous it is a last location of the entity
well if you want to move an entity 5 blocks along X+ in 1 sec (20 ticks), you have to calculate offset per tick:
double distance = 5; // 5 blocks
double time = 20; // 1sec
double offsetPerTick = distance / time;
and then every tick send pos packet with adding an offset per tick
delta time for the win
but i wonder why this packet doesn't work
it should do pretty much the same thing
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
so add entity takes a motion
doesn't work
entity set motion doesn't work
i can't pick anything during packet sniffing related to this
i assume the pos is when the villager tries to move while on the ground
and it's also not every tick
last i checked the protocol, entities do send pos/posrot every tick, regardless of whether they actually changed position or not
not sure when they send motion packets, i think that might be up to the entity property data sync whatever the fuck logic
hmm
let me try one thing
send a motion packet and then a pos
it still doesn't feel as fast to be per tick in my testing
i am actually stubborn
i wanna figure out what mojang did exactly
my guess is they use the set entity motion to smooth out in between position changes
that's handled through regular interpolation
motion is for clientside predictions for the next tick
what were you trying to do?
trying to help iwust above
he went with position update and delta time
i hoped there was a way to cut that packet
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
i lowkey got that shit on tho https://github.com/winnpixie/http4j
i wanted to move entities smoothly, and i achieved this buut it works perfect only with living entities such as zombies or villagers, when i try to do it with item displays their movement is still jerky
the funny part is originally i started the project as just the Server portion, and on a newer Java version (like 17 i think), but eventually downgraded to java 8 after i started building the Client code, since it wouldve been redundant to have mine + the built-in client
i should split them really but u never know when ur gonna need a HTTP Server on java 8..
however, not having access to features like record does negatively impact my health
local site testing (before i learned about jwebserver lol)
how would it have been redundant?
cool :d
and there have been a few times ive embedded the server code into other programs for callbacks with api tokens like Spotify
redundant in the sense that i wouldnt necessarily need it
id just use the built-in http client over my own
wanted to write client, wouldnt make sense if i stayed on newer java that already had a client framework
so you downgraded for the sole purpose of writing a client? and you wrote a client because you decided to write for java 8?
kinda yeah
i do still have some other projects on 8 that could benefit from having a nicer api instead of rawdogging HttpURLConnection so it wasnt a complete waste
and thus have switched to my client framework, instead of rawdogged HUC
i could split the projects, me no wanna
regardless of the java version though... i need to learn how to properly read the full channel rather than relying on hoping everything fits in my initial buffer
so some server functionality is half-baked bc i dont bother to read past N(bufsize) bytes (reading content body in a request)
neat
a non-issue when i was on java.io, but NIO has ever so slight differences bc of the Buffers that i lost some correctness when i initially moved over
actually
i have an idea now
i think i can just allocate a second (larger) buffer, copy the remaining from the first, and then read from the channel again
dealing with variable-length input when u have to use fixed-length apis sux idk how C devs do ts every day
literally the one thing keeping me away from learning nio sockets
the buffer is so weird to use
netty is non blocking and it has a nice byte buffer to work with
(old io)blocking sockets too
it's my own fault really, that i didn't think to redesign more when i decided to switch to nio. this is the consequence of my actions
well, you did good tho
i have to get to learn nio sockets as well
even if i don't like working with them as much
probably once i figure them out i'll like them
its a nice api honestly
jag dog och skule hemta mina saker och blev banad i 30 dagar för grov stöld??
its not vastly different from using regular .io at the end of the day (at least for me), and being used to nettys bytebuf will probably give u an edge
men får man inte hemta sina saker utan att bli banad??
Du är nog i fel discord :p
i mean the jdk http client will give you the raw response as a List<ByteBuffer> (or, well, you pass a Flow.Subscriber<List<ByteBuffer>>), you can do the same really
or if you want to keep it in a contiguous buffer you'd need to realloc and copy
im talking for the server portion rn
sure
the client is still using .io actually lol
but it's all the same
regardless of whether it's the client or the server, you have a SocketChannel, and you need to read data into a ByteBuffer, or a collection of ByteBuffers
yes
i'm just saying that's what the jdk http client chooses to do
not a strategy only to be employed in such setting
i think i can get away with 2 buffers if i give ample leeway for the http head
i will still enforce a max size for the content body (i think this boils down to arrays in java not? being able to exceed 2^31 - 9 in length)
i wonder how the header and body are placed from a client
so header here\r\nbody here?
the split between head and body is when u have 2 consecutive newlines
HEAD
Key: Value
Body```
now do chunked encoding!
what's chunked encoding?
it's still one request!
yeah but its split up :(
:)
thats above of my pay-grade
doesn't sound impossible tho
instead of passing the content-length header, the body is split up in chunks that are length-prefixed (plus crlf)
oh
HTTP 1.1 feature iirc right
you got this winpixie
in the case where you don't or can't know the full body length ahead of time
and then HTTP 2.0 builds on that with multiple requests in one socket i believe
so you choose to stream it instead
i dont even have properly reading one Full request 💔
my saving grace if the client detects i dont support chunking i think i can avoid it
i will need to stop reporting as HTTP/1.1 though, pretty sure
maybe 0.9 or 1.0
clients are pretty smart at adapting their function to the server
sadly, i am not smart at adapting to the client
wait, does this work for anything that's not application/json?
chunking can apply to anything i believe
u can reconstruct any content type so long as u have the data u need
i assume application/json is just a header for the processor
nicee
i might make a http client
Content-Type just tells the client/server... the type of the content being sent
ye, i kinda figured it as i said
tbh, the http protocol is not as complicated as i thought
i mean sure there's chunking and such
but with enough tinkering you can get it to work
just wait until u deal with HTTP/2 and HTTP/3
lol
jk those r probably "easy", im just dumb lol
nah, you just need to get into hyper focus and add those features
just spend like a day reading the RFC lowkey
im not sure what HTTP/3 looks like since its not on TCP anymore
it uses QUIC (UDP)
oh udp
requests might look relatively the same, but chunking i imagine is a must-have bc of the lossy nature of UDP
or well not lossy, but... limited single transmission size
(but also a little lossy)
its makes for a fun afternoon project :3
i still have no SSL support tho 😿
that's for securing http no?
yes
you can try it tbh
my server can only serve HTTP rn, not HTTPS (unless u cheat and hide it behind a secured proxy) (cough cough cloudflare) (or on-site nginx reverse proxy cough cough)
well, did you look into the implementation?
nah
my server implementation is mostly based on reading RFCs addressed for HTTP and observations from what my own browser sends
not so much how others chose to impmement
spring boot has a nice client impl
waow
i should try and add a function (similar to newer javas HttpClient) that can apply a content mutator for u to use when building the request
rn i have a method in the Response class thats "good enough" that looks like java <T> T getBodyAs(Function<byte[], T> mutator)
pretty cool
javas client has BodyHandlers that u use when sending the request i think
<T> HttpResponse<T> send(HttpRequest request, HttpResponse.BodyHandler<T> handler)```
how can i get the itemstack when throwing an trident?
im using ProjectileLaunchEvent with getShooter().inventory.itemInMainHand but that doesn't seem to work
probably because the trident is already in the air when the event is called and no longer an item
ngl i didnt try adding a debug message
but maybe someone knows from the top of their head
?jd-s
cast projectile to Trident i believe @robust helm
getItem on the Trident
thanks that should work :)
oh im so big brained as hell
what if I send way too many headers to fit in your initial buffer
SocketChannel channel = getChannel();
ByteBuffer initialBuffer = ByteBuffer.allocate(8192); // 8KB buffer for header
channel.read(initialBuffer);
initialBuffer.flip();
// do processing with head buffer
doStuff(initialBuffer);
// read content body
int contentLength = getContentLength();
int remaining = contentLength - initialBuffer.remaining();
ByteBuffer contentBuffer = ByteBuffer.allocate(contentLength);
contentBuffer.put(initialBuffer);
while (remaining > 0) {
remaining -= channel.read(contentBuffer);
}```
i Blow up
is the project you're making an http client
because otherwise I don't understand why you're spending time with this lol
this is for http server
I see
heaven forbid i want to toy around D:
i like reinventing the wheel
even if there are significantly more squares
I just thought it'd have some relation to minecraft since well, this is spigot in the end
I do it often as well, when I want to learn
(even if there are much better frameworks for such goals)
if ur sending a header over 8KB i implore u to reevaluate ur life choices
thatss so many bytes
(cookies can easily become an issue)
there is a way to tell the client they sent a header or content body too large to be processed so i could just do that
i think im calculating my remaining bytes wrong actually
and i think it does have to do with the buffer potentially filling up without completing
so contentBuffer might accidentally fill up with data from headers
ok so ive added a safeguard against that for now
i will no longer blow up and leak memory into the content buffer, but i also just wont process the content body LOL
ill need to rethink how i read headers, or just tell the client "hey, this is 2 large 4 me"
ill need to rewrite my readLine function though to let me know when i lose the buffer midway through a line read
inuendo for cumming btw
<dependency>
<groupId>me.libraryaddict.disguises</groupId>
<artifactId>libsdisguises</artifactId>
<version>11.0.0</version>
<scope>provided</scope>
</dependency>
just switched pcs
loading up an old project
anyone know why this might be really angry
and red
did you change the repo?
<repository>
<id>libraryaddict-public</id>
<name>libraryaddict repo</name>
<url>https://mvn.lib.co.nz/public</url>
</repository>
@mighty wind
<dependency>
<groupId>me.libraryaddict.disguises</groupId>
<artifactId>libsdisguises</artifactId>
<version>11.0.16</version>
<scope>provided</scope>
</dependency>
i use this version
but there might a newer one
will a newer version break like
1.21.8
nvm it works now i think
libraryaddict can't into maven so he keeps changing the artifact coordinates every 3 days
i just put my stuff on jitpack
but libsdisguise had to change the repo since it was hosted on md5's repository
and then on mythic's repository
and then changed the artifact id and org 5 times
and even then 80% of the time the deployed artifact doesn't match what you'll get from spigot/ci
there's a good chance he's changed some internals in a breaking way and just pushed it under the same version/snapshot without a corresponding spigot update, or vice versa
i've entirely given up trying to depend on the artifact from the repo, i just build the plugin myself and deploy it on the server and to my maven repo
does anybody know how, in a datapack, how to replace the lava in the nether with blue ice? I was able to replace all the lava pools, but not the lava generated ontop of basalt deltas.
Try asking in the world gen discord
saw the invite layout and thought it was another hot women camgirl egirl nude 18+ sexy spam
ngl i almost jumped to banning them lmfao
hey, does anyone knows why I can't compile my plugin.
I updated from 1.21.11 to 26.1.2 and now I can't compile it (maven)
First error was java 25 since I had j21 but now the error is just can't find any code
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
The error literally says can't find [piece of code]
i suspect something to do with Lombok but getters are working fine in the ide
Does your ide show an error at that line
nope
same version of the code can be compiled with 1.21.11 and java21
I was trying to update it for latest version but ....
Try not setting Java 8 as your Java target
You need to update Lombok too
Thanks, i'll take a look soon
?paste
Looking to paste something? Try a code block or one of the following websites:
- https://pastes.dev/
- https://sourceb.in/
- https://mclo.gs/ (best for server logs)
Still doesn't work, here is my pom
https://pastes.dev/jJntF3D4Y8
Still missing the annoation processor?
okay it is fixed thanks everyone
also anyone can explain why is that needed for newer versions
i feel like every new version there is going to be something new that will fuck up my compiling process
does gradle have the same issues?
which is the configuration library most used in plugins / public and private, because i'm starting to have the problem that it get all organised wrongly (i know i did a similar question in the past but today is the day i need the final answer)
If you think that's a pain the you really will not like Gradle
They break stuff all the time
Anyways yes that would have happened in Gradle too
The solution is to not use Lombok
What’s the first farm you build every new world?
I hate adding like 50 getters setters and things like that
ðŸ˜
I mean your IDE can auto generate them in one click :p
The solution REAL developers don't want you to know about: Make all your fields public! 🤫
haha, I'm so used to private fields
yeah maybe not that important in plugins but in other aspect is 100%
Bump (still looking for a solution / good library suggestion)
checkout packetevents
all i type is get or set and the autocompletion already shows it
Takes a split second to generate them, or you can use an actual dedicated menu for it to generate all of them at once for all your fields
If your on intelllij iirc default generate keybjnd is alt+insert and you can generate getters settings equals hash code override etc
it generates it
but not where i want it
oh nvm
it generates at cursor position
perfect
@remote swallow thx sir
this is the way

As you know, I came from SA-MP with player ids like the yellow text. So what I asking here, is there a api like Vault that assigns player ids and I get that from the api into my plugins I create?
SA-MP
?
San Andreas MultiPlayer
What do you mean player id
Who the fuck knew that, who are you addressing with "as you know"
Groups?
Are you sure the thing in the square brackets is an ID and not like... idk, a level system?
player ids like the yellow text
That yellow text looks like a level system, seeing as YOU are on 0, and someone with "OG++" is 201.
I forgot these ranks, I not trying to adv but I just thinking I could get a player id system like on my SA-MP server. If that is not possible, that is ok because my bots on the IRC server is programmed to accept player names or IDs
Why do you need an API for 10 lines of code?
That is possible but last I heard, the data don't transfer between plugins. Yes, there is this api like Vault that made this possible but I don't know what they did
i have literally never heard of this
Make ur own API then.
It's not like you're losing integration because, given how I have literally no idea of an API like this existing, its likely that not many plugins are hooking into whatever this API might be.
You might as well make the API urself.
I looking at my source code and found this: private boolean setupShop() { if(getServer().getPluginManager().getPlugin("MGN_ServerShop") == null) { return false; } this.shop = (com.mrnategeek.serverShop.Main) Bukkit.getPluginManager().getPlugin("MGN_ServerShop"); return true; }That is one way which I going to use. Don't mind me, my mind. Its been a min since I worked on this. Don't mind me, sorry
I'm not sure what you're trying to say
https://pastes.dev/w2LD9C2fP0 How can I guarantee that PlayerJoinEvent will be called if AsyncPlayerPreLogin is called? Perhaps this isn't possible, and I need to remove the map key from the cache if the player doesn't log in within x seconds (where x = timeout seconds)?
I imagine that if a plugin uses event#disallow, then the playerjoinevent will not be called
join event is not called if async pre login doesn't go through
so you already have that guarantee
join event is already after the login process when the player entity is being spawned and the player data broadcast to other players
if the login events are disallowed, then none of that can happen as there is no player to spawn
But what if a plugin executes event#disallow on AsyncPlayerPreLoginEvent? Will PlayerJoinEvent still be called?
if you disallow the player gets kicked
so they don't join the server
this kind of thing is easy to test though, you can just give it a try
If you disallow it won't go further
Player join event is happening at a later stage
hello I had a question
like I know all note block states and mushroom block state textures can be altered in texture pack , what else can I alter to get more textures that I can cutomize
I believe there are some note block states you can use
waterlogged double slabs are unobtainable in survival and can be safely replaced (but they will act as water source blocks)
the age:0 sapling states appear identical to the age:1 saplings and can be safely replaced, although it's more complicated as you want a protocol level filter that replaces natural age:0 saplings with age:1 saplings
the nice part about saplings is that they're not solid and so won't occlude any adjacent block faces
If I schedule an async task, and it's runnable is in the middle of running, and the server shuts down while the runnable is running, will the server wait for the runnable to complete?
kind of, but not in any proper or controlled way
after the server is otherwise completely shut down, it will wait an extra 10 seconds for bukkit async scheduler threads to complete
they will not be interrupted and bukkit does nothing to signal to them that the server is shutting down; you can't rely in InterruptedException and have to manually check on a loop whether to exit the thread
if the threads don't complete in that 10 extra seconds, they just get killed and the jvm terminates
this is one of my major pet peeves, making long-running and blocking async tasks much more annoying to write correctly, as bukkit doesn't use the first class language feature specifically intended to notify threads to clean up and terminate that's been in the language for like 20 years
Alright, thanks. I will just have to make something on top of it then.
my personal recommendation is either using your own executor/scheduler and terminating it in onDisable, as this will fire interrupts correctly
or manually propagate interrupts to your bukkit async task threads, but that's kind of ass
e.g. suppose you block on say a http request that'll time out in 60 seconds, normally you'd just do like client.send(whatever).join(), but this is "incorrect" as the thread will have no clue that the server is stopping if it does, and just continue blocking until it gets killed, with no chance to do cleanup and possibly leaving things in a corrupted state
in bukkit what you have to do instead is
long started = System.currentTimeMillis();
Response response = null;
while (System.currentTimeMillis() < (started + 60_000) && !Bukkit.isShuttingDown()) {
try { response = future.orTimeout(5_000, TimeUnit.MILLISECONDS).join(); }
catch (TimeoutException ex) { continue; }
}
which is as you can see SO much easier than just try catch interruptexception
i asked about this at paper once, and it still makes me mad
"we don't want to do interrupts because they're hard to get right and confuse plugin developers, and then you'd have to check for and catch interrupts everywhere in async task code"
YEAH that's kind of the point of the exception; if you do something that blocks the thread, it's your main (and sometimes only) mechanism to pull back
what, are we intended to try catch ignore it in async task code instead and ad-hoc it in 200 different ways with manual boilerplate?
Leaves with different distance values, tripwires in the active state
does this happen with Folia's AsyncScheduler too
I vaguely remember that one just cancelling tasks when terminated, don't remember if it awaits or not (though I imagine it should? How do you deal with classloaders closing before the task is finished otherwise)
i think im gonna need to make that registry
(i dont like the current way i load my central bank)
what would be a good way to manage them in database? im thinking a table that has bank names, and generated tables for each bank
CREATE TABLE IF NOT EXISTS banks (name VARCHAR(255) PRIMARY KEY)
CREATE TABLE IF NOT EXISTS TABLE bank_bankname (owner VARCHAR(36), account VARCHAR(255), balance BIGINT, UNIQUE(owner, account))```
is there a way to decompile a minecraft client class when working on a plugin? (ping on answer pls)
You’d have to add the client as a dependency
oh okay
Or just do it externally
blud did not ping on answer
Like you just want to look at client source code?
If so, https://mcsrc.dev
oh shit dis new?
Relatively. Fabric people
Wait that’s really nice
is there a way to switch between vineflower and cfr?
It even works on mobile for when I get those brain blasts in bed at 3am
bruh istg ur always on mobile
Real
no, but you can plop the client jar into slicer.run for that
Hey, when I switch to Java 25 Lombok is not working. I have the latest version.
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.44</version> <scope>provided</scope> </dependency>
On Java 21 works fine.
did you add it as an annotation processor?
maven doesn't scan the classpath for annotation processors for projects targeting JDK 23+ anymore
you can also press a button on this site to get minecraft with mappings loaded in there automatically https://minecraft.katana-project.org/
https://pastes.dev/5d8kHeL59a Do I have a guarantee that the value of serverId on line 97 will have the value initialized on line 78 (the value read from the redisExecutor thread) if I never redefine it anywhere else except on line 78?
yes
it is going to read static variable every time it is executed
so yeah, if you are not modifying it elsewhere, it is guaranteed
I added this and is still same
is not abstract and does not override abstract method
Whether it's static or not, it doesn't change anything

