#help-development
1 messages · Page 1185 of 1
wtff
i think it's because it goes out if it can't keep up?
like a getTicksToLive
i think this is it
just a different naming scheme
huh, neat
you know that just made me realize, someone went through the vanilla code just to find out how age affects fire for the wiki page
I recently learned about that being a thing
I mean, yeah, that is the case for the majority of the wiki lol
its just so oddly specific
super cool
I recently learned about url text fragments btw, it's a pretty nice feature
instead of linking to an anchor, you can link to a specific text fragment by defining a start and end, and it'll automatically jump there as well as highlight the text
chrome browsers have the copy link to selected text option in the context menu
Euh, wtf?
Exception: java.sql.SQLException: Column count doesn't match value count at row 1
Code:
public void createPlayerAchievement(Player p, EAchievements achievements) {
if (!achievementExists(p, achievements)) {
try (Connection connection = Database.getConnection()) {
String query = "INSERT INTO survival_" + p.getName() + "_achievements" +
"(achievement_id, " +
"achievement_name, " +
"achievement_type, " +
"achievement_total," +
"achievement_achieved) " +
" VALUES " +
"('" + achievements.getID() + "', " +
"'" + achievements.getName() + "', " +
"'" + achievements.getAchievementType().getName() + "', " +
"'" + achievements.getTotal() + "'" +
"'" + 0 + "')";
try (PreparedStatement insert = connection.prepareStatement(query)) {
insert.execute();
insert.close();
connection.close();
}
} catch (SQLException e) {
Logger.DATABASE.log("PlayerAchievementsData:createPlayerAchievement", e);
}
}
}
What is here wrong?
are you doing one table per player? :monkaW:
i think your table creates less or more columns that what your insert attempts to
Lmfao, found the problem, missed a ','...
yeah, that could be also
but there's a better way to do this
use the prepared statement and ?
and set positions
How?
Yeah, thats indeed cleaner.
No?
i think you can't have same table name with different column count
no as you can see the table name is sufficient
Oh, thank you for the tips!
Thank you!
@worldly ingot ur smort, why does loading that first chunk cause the server to suffer
Void world, keep spawn in memory false, fixed spawn location
How do I display particles in 1.21?
many objects have a spawnParticle method
Outside of particle names which have been aligned with NMS this system has been largely unchanged for years
Anyone know what might cause a recipe to not work until you've reloaded the plugin?
player.spawnParticle(Particle.FLAME,player.getLocation(),1);
Why am I getting the error Unable to resolve symbol 'Particle' with this code?
It works in 1.20.1, but in 1.21 I get this error.
?jd-s
Ensure your intellij is updated
Ensure you're on java 21
i am
it's not that
it's something else
like
i have other recipes which work on startup
but for some reason these leather ones dont
not talking to my friend
you spoke in the middle of me replying to somoene else
o
silly aeso
@ancient plank ADELE
solve my problem
idk why it's only an issue now
in 1.20 it wasnt
I'm in bed
😦
@ancient plank fix my life please!
if u still haven't fixed it by tmrw send info here and ill try to help when I wake up https://discord.com/channels/163366480535093248/843690931365609482
Pls fix my nuclear reactor
How do I display particles in a straight line between two points?
Raycast (or even easier cannot you specify the delta coordinates?)
math, probably
a little sine and cosine never hurt anybody
How does that relate to casting a straight line
why on earth would you need trig to get a vector between 2 points
if you know both points, substract one from the other, normalize and multiply by a value from 0.001 to 1
and add the vector to one of the location for one of the point
help me fix it, I don’t understand why they sound at all + there are also these errors, here’s the recordinghttps://drive.google.com/drive/folders/1m5nlADysv9jjDq08MDgF7T6jkuoJvAvM?usp=drive_link
im trying to restore blocks that have been changed to their original but double chests and stairs etc have problems such as not being a double chest anymore and just 2 seprate chests or stairs not being connected correctly can someone help me
Location center = player.getLocation();
World world = center.getWorld();
List<Block> affectedBlocks = new ArrayList<>();
int radius = 10;
for (int x = -radius; x <= radius; x++) {
for (int z = -radius; z <= radius; z++) {
double distanceSquared = x * x + z * z;
if (distanceSquared <= radius * radius) {
for (int y = -radius; y <= radius; y++) {
Location blockLocation = center.clone().add(x, y, z);
Block block = world.getBlockAt(blockLocation);
if (block.getType() == Material.AIR || block.getType() == Material.WATER) {
continue;
}
if (!originalBlocks.containsKey(block)) {
originalBlocks.put(block, block.getState());
}
Material newMaterial = new Random().nextBoolean() ? Material.BROWN_CONCRETE : Material.BROWN_WOOL;
block.setType(newMaterial);
affectedBlocks.add(block);
}
}
}
}
Bukkit.getScheduler().runTaskLater(this, () -> {
for (Block block : affectedBlocks) {
if (block != null && originalBlocks.containsKey(block)) {
BlockState originalState = originalBlocks.get(block);
if (originalState != null) {
originalState.update(true, false);
}
}
}
originalBlocks.clear();
}, 140L);
}```
declaration: package: org.bukkit.entity, interface: Player
can you upload files here?
if you verify
gotta be verified i think
where do i verify
!verify
Usage: !verify <forums username>
alr i think im verified now
alr here is the code that im using to both change the blocks and restore
but unfortunantly it won't work
pls help me
so anything here which is making the blocks not revert correctly?
people dont really want to have to open a stranger's google drive to help you tbh
i recommend getting verified and uploading the video directly or uploading it on youtube
whenever you do getState you're creating a copy of the block state, and it's then meant to be modified and re-applied with Block#update(). you're not modifying the state but the block, and then when you update the block it applies the state to the block, undoing your block edits
so you should set the block state's material and data instead of the block's
simply edit your restore() method to use the state instead of block
all fixed ty!
not choco but curious about it, did you find out?
if not, can you upload the region data somewhere, I want to try and profile it
my assumption is that it is doing some unncessary IO but could be wrong
probably has to load the first region into memory
and that needs io
it also has to decompress it most likely
they said they disabled keep spawn in memory tho
I added a counter and can confirm it’s only loading that one chunk
Shouldn’t have to do any IO reads since it’s a fresh world
what is the best way to delete the main world? am making a version system where it will clean up most plugin data for players and worlds selected and backs it up so I can easily just start a new season on the server. just dont' see a good way of deleting the world map and regenerating it by code?
I know how to actually remove it, but do I do it when the server shutsdown or pre generation?
server shutdown
just onDisable should be fine
onDisable gets fired before the chunk system finishes writing
you can just force it to be called by calling unloadWorld no?
how would the server like unloading the "main" world?
pretty sure you always need one active world
maybe
Could regenerate a different worlds and keep the "main" world til the end I guess
can I catch it before it loads and regenerate it somehow then?
does it allow to remove all the world generators at that stage I wonder
I imagine you could do it at world init event if anything
I did not find it
what can I do to reproduce it
just load a fresh world and see how much the first chunk load takes?
I mean in theory is there a way to change the properties settings which won't take affect until server restart? by generating a new world and just changing the world name in the settings file?
Maybe? Although a lot of hosts like to override that
alright I'll try it out
took me a hot second but it definitely seems to be doing something it shouldn't be doing, something related to structure gen
ring position is strongholds
I didn't change anything from the command you sent, so why is it trying to generate strongholds lol
I'd have to join the server, sec
how can you monitor performance like this?
spark, timings or any other profiler like IJs
How do i use ijs Profiler?
you would need to run CB main as an application run config
and I believe it's only in ultimate
I think JFR can do this too
:shrug: only ever used spark, tracy and IJ
okay thank you guys
- copy your plugins ig
tasks.register("copyJars", Copy::class) {
from(tasks.shadowJar)
into("pathToPluginsDirectory")
}
tasks.assemble {
dependsOn("copyJars")
}
I personally use JProfiler, but it is paid
but you can do most of this with jfr or spark as the others said, jprofiler is just fancier
most profilers have a jfr mode nowadays, since it is more lightweight for general sampling
so you're only using it under the hood 😛
it couldn't find any in a thousand range, but I also can't get it to take more than 164ms to generate the world now lol
i am executing a method async, how do i switch to the sync thread, fire an event, and supply the even to continue the async execution?
if you do this a lot, just use aikar's TaskChain
if you don't, then to go back to the main thread you'd have to schedule a task with the bukkit scheduler inside your async task
that is BukkitScheduler#runTask
now, the issue is that you want to wait for the task to finish before continuing your async task, you'd have to make a completable future and complete it inside your runTask
There's also callSyncMethod
don't those do the same thing
It returns a future
ah, that's convenient
Problem is that the method returns a value and can be executed both sync and async, it isnt an operation that is executed often
I mean, that doesn't really matter, just use the callSyncMethod Coll suggested
Where is that and how does it work
it is in BukkitScheduler
I want my plugin to be folia compatible in the future, will using this method create isues?
and you just do Bukkit.getScheduler().callSyncMethod(yourPlugin.instance(), SomeClass::someMethod)
yes, however I must do the thing
?whereami
Yeah i wanted to keep compatibility with spigot too that is why am here
On paper i just get the executor as there is a method for it and use that but on spigot it doesnt seem as intuitive
I mean, you can just create the executor, it is the same
I can just create a bukkit main thread executor? Wdym
public static final Executor MAIN_THREAD_EXECUTOR = task -> Bukkit.getScheduler().runTask(YourPlugin.instance(), task);
That would be better than chaining stuff together imo
you'd be able to pass that to whenCompleteAsync or thenAcceptAsync so yeah, I guess
Ty
Please don't execute the main thread :( we need it
too bad choco, I need my futures
I want to continue my progress where it left off after completing one achievement, but I can't get it done?
Code
public void setOldProgress(int value) {
try (Connection connection = Database.getConnection()) {
try (PreparedStatement select = connection.prepareStatement("UPDATE survival_" + player.getName() + "_achievements SET achievement_progress=? WHERE achievement_id=?")) {
select.setInt(1, getProgress() + value);
select.setString(2, achievements.getID());
select.execute();
select.close();
connection.close();
}
} catch (SQLException e) {
Logger.DATABASE.log("PlayerData:addOldProgress", e);
}
}
Setting progress:
if (pAData.getProgress() < 6 && !pAData.isAchievementAchieved()) {
pAData.setOldProgress(0);
killMobManager.progressAchievement(total5, entity.getName());
if (pAData.getProgress() == 5) {
String title = FormatUtil.color("&c&lBEHAALD!");
String subTitle = FormatUtil.color("&c&lAchievement '" + pAData.getName() + "' behaald!");
int fadeIn = 20; // Tijd in ticks voor fade-in (1 seconde = 20 ticks)
int stay = 40;
int fadeOut = 20;
sendTitle(player, title, subTitle, fadeIn, stay, fadeOut);
playFireworkAtLocation(player);
pAData.setAchievementAchieved(1);
}
}
```these works fine, but when it comes to this code:
else if (pAData1.getProgress() < 10 && !pAData1.isAchievementAchieved()) {
pAData1.setOldProgress(5);
killMobManager1.progressAchievement(total10, entity.getName());
if (pAData1.getProgress() == 10) {
String title = FormatUtil.color("&c&lBEHAALD!");
String subTitle = FormatUtil.color("&c&lAchievement '" + pAData1.getName() + "' behaald!");
int fadeIn = 20; // Tijd in ticks voor fade-in (1 seconde = 20 ticks)
int stay = 40;
int fadeOut = 20;
sendTitle(player, title, subTitle, fadeIn, stay, fadeOut);
playFireworkAtLocation(player);
pAData1.setAchievementAchieved(1);
}
}
```it sets the progress instantly on `12`, en then go to then next achievement goal.
not related to your issue, but you shouldn't be concating to prepared statements
What?
if you are using prepared statements, then you should be using ? for any placeholder there
it is
if you click on it, it shows properly, discord hates wide images
I'm using ??
not for the player name
oh wait you have a table with a player name on it
that's crazy
well, sorry for derailing without checking properly lol
Yes, the reason for that is the server will only have 2/3 players, and there are so many achievements that otherwise it would be a mess.
Don't matter haha
I'll delay a little more though: you shouldn't be doing database requests on the main thread
it'll kill performance
How then?
If you're on Java 21 use virtual threads
How? Never used that.
Virtual threads are lightweight threads that reduce the effort of writing, maintaining, and debugging high-throughput concurrent applications.
Explains what they are and how to use them
kotlin coroutines :)
wrong emoji kek
olivo you can't 🔫 me before you finish inject-javalin and -spring 🔫
man
what virtual threads, just use BukkitScheduler#runTaskAsynchronously smh
That would be blocking for no reason
wow fabrics maven is incredibly slow
it wouldn't block anything, it is async lol
Where am i needed threads for?
It will block the async threadpool that Spigot uses
that plugins use, spigot itself doesn't use it
and the guy said there will be 3 players or so, I don't think we need to worry about that
if it's 3 users why even bother with a database
that's a good point actually lmao
Soo, can you now help me with my actually problem? 
no idea what your problem is
does getProgress also do a query to the database to get the current progress, or does it get it from memory?
Database
freaking love virtual threads, wish they were available on java 17 instead
using Java 17 smh
you're right on this, and ultimately people should use them however it is easier to recommend something that is well-known rather than something shiny
Only way to make something well known is to give people the information
there isn't much of a difference between a virtual thread and spigot's async scheduler for this kind of usage anyway
Usage isn't much different but the result is
the result definitely isn't, these are one-off requests, the spigot's thread pool would suffice for it
yeah, the only difference is that a virtual thread has its own stack and can pause the thread anywhere to give the ticket to another virtual thread no?
For 3 players running on the main thread would also suffice
not that it's a good idea
I agree, hence why run task asynchronously is the better idea
also VTs aren't magical, they are still backed by a normal thread that at some point has to block too, you aren't taking advantage of them unless you're doing more than, like, 8 concurrent IO requests
ofc they aren't magical
i saw a gif of memory usage to virtual threads and to me it looks pretty good
I'd agree more if the structured concurrency API was out, however without that it is pretty much just a matter of preference
what does memory usage have to do with it lol
but they will scale better
it was like 1000 threads vs 1000 virtual threads and there were also other language versions of these were applicable
but this won't scale, that's the thing. So why give the user the mental overhead of learning what the heck a virtual thread is
It's like 3 lines of code
how to change scale of display entity in my plugin ?
This does not solve the problem. 🤣
so far i use normal threads for my sockets
Set the scale in the display transform
there's like a vector 4
multiply the vector by a scalar
why do i know about vector 4?
That does exist as well I was talking about the transformation object
look at what argument that method takes..
its Transformation
So you get the transformation from your current display entity, change it and set that
You were thinking of Matrix4
declaration: package: org.bukkit.util, class: Transformation
You can use this to visualize the values https://misode.github.io/transformation/
Then you better learn in
Quite literally give it a vector3f with the values 10 10 and 10
(for the scale value in the Transformation constructor)
what does it happen when these 3 vary independently?
They're x y z scale
You can use the link above I sent to visualize it
var transformation = itemDisplay.getTransformation();
transformation.getScale().mul(3);
itemDisplay.setTransformation(transformation);
it was either mul or multiply
@smoky anchor
I had connection issues just as I was answering so it took me too long lmao
pls I read the documentation, try lots of ways and it's still an error, can you just write me an example and I will understand much better
I just did
accidentally mentioned steve instead of you
are you targeting against 8 for the bytecode?
well anyway, just change var for the appropriate type
but you should be ultimately using and targeting java 21 if you are targeting 1.20.6+
thx it's work
I figured it out
For some reason
Recipes which produce leather armor don’t work
what do you mean they don't work
they're transmute recipes now aren't they, maybe something changed in that regard
still, if you added new recipes at runtime, you gotta do minecraft:reload for the player to recognize them iirc
No
Usually they work
Just for whatever reason
Recipes that produce leather armor don’t
It’s fine bc I interrupted craftitemprepare anyway
Spark doesn't seem to have proper mappings for 1.21.3 :c
an interfaces method (from reflection) cant ever be not accessible right?
as they are forced to be public?
if they weren't public, kind of defeats the purpose of the interface
No private methods in interfaces
okay
it's a contract
a contract is visible to any party
an abstract class on the other hand is completely different
it's a skeleton of sort
i can't think of all the ways to use it
Blah
Surely I can just request that the server load/generate a bunch of chunks and have it get back to me when it’s done
Without it killing the main thread
I have source code that has all imports from remapped paths(?), how do I compile souch code
?nms
Oh no..
what
Checkout moonrise 
🥄
It is rewrite chunk gen and it'll be fine!
I mean vanilla does it
sploon?!?
When you explore the server doesn’t die as it waits for new chunks to generate
Mostly
How can I set a player attribute for a single Minecraft world?
I want the players to have generic.scale set to 0.1 only in one world
You’ll have to monitor them entering and leaving the world
for (ItemStack item : player.getInventory().getContents()) {
ArrayList lores = new ArrayList<>();
lores.add("line one lore?");
item.getItemMeta().setLore(lores);
}
i know for the lore to add, I would have to replace the item with the edited version
but im not sure how to do that if im looping through their inventory
No need to replace the item
so my code is enough?
i see
for (ItemStack item : player.getInventory().getContents()) {
ArrayList lores = new ArrayList<>();
lores.add("line one lore?");
ItemStack itemtwo = item;
itemtwo.getItemMeta().setLore(lores);
item.setItemMeta(itemtwo.getItemMeta());
player.getInventory().addItem(item);
}
like this?
forget about the add item part
i create a copy of current item
set that lore i want to the copy
set items meta to the meta of the copy
?
They don’t understand java
(And refuse to learn)
If you knew java you’d understand you aren’t even creating a copy of the item there
yeah I know
I have them blocked with a note
just can't help myself to respond anyway 💀
bro same
well not you blocked
but that
one
bot
" ItemStack itemtwo = item;"
is this not creating a copy of the item
No you don't
yes i do
They do teach you how references work though
^^
This for example is not how it works
and that's just basic Java
(copying part)
the left side creates a copy of the right
It does not
that doesn't create a copy of the object, it creates a reference
that means it is just pointing to the same object in memory
ItemStack itemtwo = item; // the value of itemtwo and item are both the exact same data in the computer
iirc this is only not the case for primitive types
Have you ever heard of a "pointer"
but I dont remember if java works that way too
Sometime when i was messing with c++ but never in Java
In java, every type that isn't a primitive (primitives usually begin with a lowercase letter, instead of an uppercase one) doesn't get copied whenever used and instead is passed as a reference, similar to a pointer
again, this is all very basic programming knowledge, you'd have learnt this by just doing the jetbrains academy course
I am unsure why you are so unwilling to just go and learn it instead of struggling through it, it is just a waste of everyone's time
For identifying primitives, you can just remember:
byte, boolean, char, short, int, float, long, double
Also, please notice that arrays (int[] for example) may seem to be primitive, but they aren't and are passed by reference as well
Yah I know how types work but I was not aware that’s not how copying works
Thanks for the Info
*info
To copy, you either have it be a cloneable type and .clone() it, otherwise you could for example serialize and deserialize, manually transfer all values or use reflection
Tbf this is quite basic java knowledge
for (ItemStack item : player.getInventory().getContents()) {
ArrayList lores = new ArrayList<>();
lores.add("line one lore?");
ItemStack Itemtwo = item.clone();
Itemtwo.getItemMeta().setLore(lores);
item.setItemMeta(Itemtwo.getItemMeta());
player.getInventory().addItem(item);
}
is this it?
no
it'll just keep being the same, some bored person will come and try to explain concepts as best as they can till they get tired of it, and the next person comes
Aight whatever I’ll stop
we've all done that at some point tbf lol
it isn't necessarily bad, just not something you'd expect to have a performance penalty I guess
the naming could be better, but we're way past the point that could've been changed
ArrayList lores = new ArrayList<>();
lores.add("line one lore?");
ItemStack Itemtwo = item.clone();
Itemtwo.getItemMeta().setLore(lores);
item = Itemtwo.clone();
guys im actually so confused
how do i apply it back?
No
ItemMeta is a snapshot of the item state
just like BlockState is a (somewhat live) snapshot of the block state for blocks, or EntitySnapshot of entities
Itemtwo.getItemMeta().setLore(lores); // this line just throws away the result from itemTwo.getItemMeta()
because its resulting item meta isnt being stored anywhere
any modifications you do to the item meta instance will be done to that snapshot, since it has no live reference of the actual item it was captured from
in other words, a snapshot is a copy of the thing you want to edit, not the original
so, for you to apply the changes you've made to the snapshot (i.e., setting the lore), you have to set it to the ItemStack instance, aka doing setItemMeta with your modified meta as parameter
as defined by the documentation https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemStack.html#getItemMeta()
declaration: package: org.bukkit.inventory, class: ItemStack
I have a feeling that they won't read that
🤷♀️
and will ask the same question in a bit
item.setItemMeta(Itemtwo.getItemMeta());
did i not do that here?
yeah I do the same
it gets a copy of the actual meta on itemTwo
I know I'm blocked by a couple people already xD
Yeah I was pretty sure we've had this convo before
which i modified tho
and I checked the history
This is no the first time you have this exact issue
Last time it ended with you being spoonfed
setItemMeta
ItemMeta newMeta = item2.getItemMeta(); newMeta.whatever(); item.setItemMeta(newMeta);
it aint rocket science
I always forget this is an option
No don't spoon
discord way of handling blocked messages is ass though
They'll just be back here again
There's a vencord plugin
They've already shown that to be the case
is there a shelter plugin
for hiding messages from blocked peoples
I don't wanna install vencord
shelter as in porter robinson and madeon!?!?
lmao, I haven't heard that song in years
they will be back regardless
I remember when it blew up
YOU'RE A SHELTER FAN!?!?!?!?!
so what changed
last time I got the cursor item, changed it, then set the cursor item
Not if they're not getting any help here
but I have no idea how to set the item when looping through their inv
like where do i put it
type thing
I loved that song back when it became popular, it is what got me into groove core
do you still love it
if you extract it into a function, would it be easier to write?
I haven't heard it in years, I still do watch the music video from time to time, it is beautiful
it really is
because I dont know the equvilent of setting the players curser
like
Like im looping through their invs
editing the lore
but where do i put the item
last tiem I took the cursor item, changed it then put it back as cursor item
As I've already told you
but this time i take the item
You don't need to
exactly
thats what changed
I didnt know i didnt have to
put the item
like i imagined
player.getInventory().set(whatever
but I want to put it exactly where
it was
for (ItemStack item : player.getInventory().getContents()) {
}
well iirc looping over the contents is in order of the slots
so the first iteration is slot 0 and the 10th one is slot index 9
smth smth for i
thats a hard ?learnjava
command didnt work
They've gotten that command so many times that they've blocked the bot
i know how arrays work
I thought you blocked the bot
Yeah you’d have to do a loop over the slot index rather than the fancy loop
it takes up the whole screen
thats why
if you know how arrays work, you can fix it
Enhanced for loop I believe is the technical term
yah figured
i think i understand it now
thanks
or keep a counter or whatever
pesudo code
for loop where i is less then inv length
then something like item[i] and modify it
then set item i
something like that
I feel like even chatgpt can help with these questions perfectly fine
dont wanna get clowned for using chatgpt
well idk whats worse
You're already getting clowned on here
getting clowned for using chatgpt to solve basic problems or getting clowned for not knowing basic problems
🤡 ^2
if you use chatgpt you likely dont have to ask them here too
if you just feed it the whole convo, chatgpt can figure out the context and explain the issue perfectly fine
that's what I do when I can't be bothered to read a whole convo when someone needs help but I want to understand their issue lol
chatgpt is able to tell you whats wrong if you just post the code snippet and ask whats wrong
"based on this convo, summarize this issue for me"
it can probably understand just from the code snippet, but it is better to give out the convo since the issue was already explained, so they can just ask it to explain it in a way they can understand
because we clearly can't explain it in a way they do
thats a herculean task
I mean, I am not bashing the guy, I'm sure they're struggling enough with the program itself so having people tell you to go learn shit instead is not fun lol
that said, I completely do not understand what kind of foundational knowledge they miss, so I can't possibly explain it in a way that it could be interpreted from my explanation
one could go the extra mile and do baby steps, but that is with the assumption they even want to understand it and they don't, they want to get the shit done. I respect that and hence I just refuse to help up to this point
So I have a sort of programming related question. If you are making a "faction" kind of plugin where players make their own factions, is it a good idea to make a permission node for each faction? Like dynamically making permissions. Or should permissions generally just be set in place
whats the goal of those dynamic permissions
Well the intention would be to be able to check and see what faction someone would be in. I know it's possible and pretty easy to just write a quick API with like sqlite or something, but I was just wondering if it's something advised against.
Rather than writing an API and implementing it in plugins that interact, you can just do a quick permission check instead
Alrighty. The thing I wanted to check with permissions was something with worldguard. A faction would be able to create a "lock" within a region. The locking system already exists with another plugin on the server and it's built to use permissions, so I just needed a way to connect the factions plugin to it tbh
it felt wacky to make permissions dynamic though
If it's stupid and it works it's not stupid
depends what the context is
returning from a function
like for example I have a value called fromString
which returns some data if the string is correct
and before it returned null
but now I wanna use optional to force the user to handle it
not me doing optional.get()
Yeah I would say thats a good usecase for it. But theres a very fine line between utilising it and over using it
the only thing I hate about optional is how verbose it is to just get the option on the callers side
Optional is good if it is truly optional, like it can be either or, not a thing that is most of the time not-null but due to x circumstance that can be avoided by checking other things is
thats like all null checks
i think thats a very good way of articulating it
yes, hence why most possibly null values aren't optional
I still think rust's Result<T, E> type is the best way of handling optionals/results
if the string value came from a plyer typing it in chat, would that be an optional like you describe
result != optional
Option is equal to Optional
so is there a Result in java?
idt there is
Don’t overuse Optional to replace all potential null values. Use it only when it improves readability or conveys intent more clearly. Chat Gpt says this
no, and there shouldn't be
@ancient plank
java is an exception-based langugage, so you should use exceptions
Adele
because java handles exceptions differently
How do i
yea
so I would say yes, If the intent is to potentially handle a bad input i would use it
Make a MaterialChoice as Material.Potion in a recipe
because it used to work
and now
not me catching exeptions and returning false
it just is blank
?staff
Don't ping staff for development/server help, if you have a question just ask it and someone in the discord will respond when they are capable of helping.
i love pinging adele for api questions
right, thats a very gpt answer
"use it if you think you need to"
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: MaterialChoice
then add ur ingredient
but okay
ill use it sparingly at points where i want to convey that it should be explicitly either some value or not one, instead of just null
i hate when methods that should return a nullable T just throw an exception
and crash later
like ??? you want me to try-catch?
(kotlin runCatching {}.getOrNull() :D)
(kotlin does actually have results but the error type is just Throwable)
getOrCrash()
the craftbook*
is it a specific potion? is it a custom item?
e.g.
getOrException() actually
ItemStack starFruit = new ItemStack(Material.CHORUS_FRUIT);
ItemMeta fruitItemMeta = starFruit.getItemMeta();
fruitItemMeta.displayName(Component.text("Starfruit").decorate(TextDecoration.BOLD).color(NamedTextColor.LIGHT_PURPLE));
fruitItemMeta.lore(LoreUtility.buildLore("Fruit that has been charged with celestial power.", false));
fruitItemMeta.getPersistentDataContainer().set(StarSign.getFruitKey(), PersistentDataType.STRING, "fruit");
starFruit.setItemMeta(fruitItemMeta);
ShapelessRecipe starfruit = new ShapelessRecipe(new NamespacedKey(StarSign.get(), "starfruit"), starFruit);
starfruit.addIngredient(Material.POTION);
starfruit.addIngredient(Material.APPLE);
if (Bukkit.getRecipe(new NamespacedKey(StarSign.get(), "starfruit")) != null) {
Bukkit.removeRecipe(new NamespacedKey(StarSign.get(), "starfruit"));
}
Bukkit.addRecipe(starfruit);
rust unwrap be like (it just panics)
my eyes
In the craftbook, the recipe for that starfruit item has just a blank spot, and then an apple.
getOrPanic(!)
then rusts unwrap is just for you
The craftbook being like the crafting guidebook you get when opening a crafting menu
it panics with a line number
yes exactly
rust is good
which makes going back to work on my java plugin feel like a cave man task
epicebic
i love panicking
can thou explain
sorry went to see my dog, is it a specific potion or just any
send minnie pics
shes so cuteee
any
using Material.Potion
is the issue
nvm
maybe im an idiot
bois how do I generate javadocs (im using maven) without duplicating these annotations
also unrelated but how do I
- generate a javadoc jar on package
- generate a javadoc report on site
without regenerating the javadoc?
rn I have an
<executions>
<execution>
<id>default-jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
in build and a
<reportSets>
<reportSet>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
in reporting
https://bugs.openjdk.org/browse/JDK-8175533 kind of an unresolved javadoc bug
iirc, if you use java5 annotations, it stops doing that (since they didn't have the type use context)
the other option is to use some processing tool and remove them instead
yep, thats why we use the java5 annotations
what version's that
or they could just remove every other target type that isn't type_use 💤
That would be ridiculous!
mh? central says it got moved
The latest version of
annotations-java5is24.1.0
or is that the non-java5 continuation
I wonder if the jspecify annotations have this issue
they don't have that issue because they only target type_use
instead of method,field,parameter,type_use
then jspecify would probably be the better option if you can help it Phoenix
It was a different time in Java 5 - 7
>:( Don't get smart with me, young lady
or does it? * insert vsauce song *
That totally would be a vsauce intro line too...
java5 annotations are deprecated
I'd be surprised if they weren't
nowadays the popular standard is jspecify, wonder how long it will last
I like that they have package-level nullability definitions like eclipse ones, if anything
ur face is deprecated
who enforces that
idk god or some shit
I am restraining myself from saying ur mom to that statement
you can say it
@worldly ingot
ur mom does, get rkt
It’s actually the 11th commandment

why did you have to say that just as I was taking a bite out of my pizza, dang it
im desensitised to it from volunteering at a farm, nothing like that ruins my appetite
Hey VSauce, Michael here, where are your fingers?
Idk tbh
Idk if he’s meant to be VSauce: Micheal
Or if VSauce is how he refers to the audience
Lowkey though this said Hey VSCode, at first
Hey, VSCode, Microsoft here, do you spend too much time working with computers?
Clippy was better
I'm currently having the problem that I'm trying to change the text of a score in the scoreboard but instead of replacing it just adds another line spigot 1.8.8
public void updateScore(Player player, String text, int score) {
player.getScoreboard().resetScores(text);
player.getScoreboard().getObjective("aaa").getScore(text).setScore(score);
}
is it not possible to update a single line?
Normally people use prefix and suffix for scoreboards
And empty text (via a colour character) for the actual text
It looks like you are resetting your new text and not the old one

i should stop coding at night
i will try it out
😭
"This list contains asynch tasks that are being executed by separate threads." somebody was drunk while writing docs
Or they don't speak English lol
can people pls help me fix my gosh darn plugin. it aint loading 😦
It's within BukkitScheduler#getActiveWorkers
?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.
Alright 👍🏼
I'm glad it's there
?paste
Kekw running on purpur asking for help on spigot that's somw real shit right there. You're either not shading a dependency you should be
ok how do i do that, this is my first plugin
?whereami
ok mb
Learn to use maven properly
😦
Its fine. Just be aware of the server implementations you are using because most times your issues will be specific to such server types. However your current issue in regards to shading is with maven and fortunately that has nothing to do with server implementations
so uh how do I fix it?
Depends on your setup
If you're using maven you'd use the maven shade plugin
If you're using gradle checkout shadowjar by gradleup
If you're using neither you're on your own good luck
What scope is your dependency at in maven
I think the question to answer is are you using maven to build or gradle?
maven
Well first I should ask is this dependency another plugin
ok
should I paste my pom
Just keep note that this pom is a tad outdated so you might need to adjust the version
?paste
You can find the latest on the official maven website
You need to have the repositories tags and repository for where you are pulling the dependency from. And then you need the plugin tag for the shade plugin. For all the dependencies you specify in the dependencies tag you need to add the scope tag to them. Use provided for it to not be shaded and compile if you want it shaded
i love making plugins
Its also nice when you have communities to help you get answers too
well uh, if it helps at all heres my pom: https://paste.md-5.net/avujiqeyes.xml
And as y2k said my pom there is outdated for the version number on the shade plugin
You can visit maven website to find latest version numbers to use
ok ill do that
Also my shade plugin is setup so it doesnt shade the api into my plugin
Was having issues with maven wanting to do that so you should be able to exclude the config tags of maven shade
But its also safe for you to copy too
i changed it to the shaded version of the jar and now its giving a new error message https://paste.md-5.net/xulohajodi.bash
Well you made some progress
Now we need to resolve your config.yml
I am not sure what purpur requires in the yml file but we can resolve it not being included.
What does your project structure look like?
Just fyi if i dont respond right away its because i am at work and using a phone lol
@quick shoal
I FIXED IT!!!
lol the config was in the wrong place
just gotta get commands working now
Progress at least
SO MANY ERRORSS HOLY GUACAMOLE
Can someone help me with commands .W.
?ask
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!
my plugin isnt giving any errors, and yet the plugin command /RKS isnt working/showing up
is it registered in your plugin.yml ?
commandExecutor: https://paste.md-5.net/ugixigiqov.java
plugin.yml: https://paste.md-5.net/hihoguqigo.sql
help!
Show onEnable
in main?
Yup
https://paste.md-5.net/hanacoquwe.coffeescript Am I the only one who thinks that last condition is redundant? Why does inteliji warn me
inteliji not can undestand boolean checking method?
Howdy! A quick question.
Since having all the things in a single plugin is not good because if one thing breaks than it means that it might break the whole plugin, is it smart to make a command handler for all the plugins you'll have in the server? Because it'll just be useless to have the whole thing copy/pasted over and over, and the plugin might just have a couple of commands.
it cannot know without seeing the implementation, configuration section is just an interface, it does now come with a body and even if it did the class could be overriden
@upper hazel
hm
it depends on your big picture, a command library is redudent
I was thinking about finding a plugin for a compiler that analyzes code for archetypal errors including improved analysis of null values.
someone know examples?
So creating a library where I store the code that'll be used in multiple plugins for the server I'm making is probably the smartest idea, right?
it's really up to you
it won't make a difference either if it's shaded or not, for the plugins it'll be like a few megabytes on memory extra or less
probably won't even make a difference for memory if you're instantiating the whole command handler for the plugin
I mean the thing is, I just want the plugin to look cleaner, so a custom library is probably a good thing to make, right ?
Because look, instead of having org.example.utils.CommandHandler in every project, you can just have it in a custom library and re-use it from there.
Or is that a bad practice ?
it won't be cleaner
you can as well create a core that you can shade in each plugin
even then, if you write a whole core you are planning on shading into all your plugins, depending on the scale, could bloat your plugin
could just follow what fr33styler is saying and shade individual modules with your plugin
if you are still new, which i assume you may be by the questions; shading is when you package all the dependencies for your plugin to work in one jar or one uber jar
You can always minimize it when shading
CMI has api for create npc?
i not can find it
i mean CMI API
oh i
mixed up the name of the plugin
Yup, that's what I was about to say
Why do minigame servers open a separate server for each game?
example survival games
players are sent to a different server when they start the game
what is the advantage of this?
java.lang.IllegalArgumentException: `The found tag instance cannot store Float as it is a NBTTagInt
What does this mean
LIFETIME("lifetime", DataType.FLOAT)
it is a float
performance
how could this be more performant?
it doesn't have everything running on one server
i.e. you should never have all your players on a singular game server, because that will degrade performance for everybody
I mean it exists
declaration: package: org.bukkit.persistence, interface: PersistentDataType
For example, should I open a special server for each game?
Hub Skywars Lobby
↓ ↓
Server 1 Server 2
↓
Skywars Game 1 Skywars Game 2
↓ ↓
Server 2 Server 2
Skywars Lobby
↓
Server 2
↓
Skywars Game 1 Skywars Game 2
↓ ↓
Server 3 Server 4
can i prefer first one?
this is super annoying
the stack trace isnt telling me enough dude
how much compatibility do you want? ¯_(ツ)_/¯
then fire it lol
what are you trying to do
squared
cubed
even call and spawn npc with citizes not enaugh?
I mean might as well just use https://github.com/lucyydotp/marionette
no
but citizes create entity
they are not registered on the server
BRUH
told ya
you can, you know
just like
do a connection to localhost
and implement the client proto...
would be easier
it's just 100x easier if you actually have control over internals you know
and use offline mode-
this core?
or buy a mc account for every NPC-
nah just verify the login using a bit of nms
you what
this core fork of paper?
"core"?
"kernel","nucleus"?
???
server core
wtf is a server core
you seriasly
@rough drift any idea what this guy is on about 😭
yes
they are asking if Marionette is a separate server jar
it is
Not my personal choice, but it's a developer's lazy solution that will usually work perfectly fine, if you don't care about server costs. You should look into cloudnet to automate that
their website looks like they haven't updated it since 1987
just use hetzner ffs
Cloudnet is a software you run on your (hetzner) server to automate the creation of that kind of servers. It's very well maintained
A modern application that can dynamically and easily deploy Minecraft oriented software.
wasn't there a way to make it so you could consume an item indefinitely
like cancelling interact event if you're trying to eat bread type deal
cancelling consume event just returns the item
I wonder how viabackwards plays it
basically this guy wants custom consumption lengths but support for 1.19+
Yeah it just resets the item
sadge
only solution might be to fuck with packets
what about the interact event
in 1.20.6 it just prevents the item entirely
I think it has to do with an nms change
packets might solve
Does viabackwards actually handle it
This being the case, I will have to do most of the data transfer work with the database, right?
it depends on the minigame, anyways the primary reason is because instead of rebuilding the map slowly they just delete the server, create a new one with a fresh copy of the world
also, you don't want players waiting around for a game
so you spin up another server
you keep your lobby servers separate because you can put a bunch of lobbies on the same server instance since they generally don't consume very much resources
the thing consuming resources is however many players you got in the lobbie's
Normally they run a few worlds per server
yeah normally
so im new to making plugins and got into it bc i wana make a small server and wanna know how to change the server icon in code but i have 2 problems:
- dunno how to load stuff from the resources folder into File var type
- found event.setServerIcon and Bukkit.loadServerIcon but it takes a File and again i dunno how to do that with the rs folder
and i cant find a solution, can some1 give me a code snippet and explain how this works?
well then explain atleast, thats what this channel is for
Make a file object and pass it to the loadServerIcon
basicaly how to load file from resources folder in jar to File vartype