#help-development
1 messages Β· Page 1119 of 1
You mean an artifact dependency? Like a jar file in a folder?
peak mockbukkit experience
yeah a jar in a folder directly on my computer
idk where I should put it and what do I need to change in build.gradle
Did you make sure that this dependency is not available via a repository?
it is
But for some reason you dont want to use that repo?
yeah

lets say its a bit broken with the repo
Just install it into your local maven repository then
Otherwise the common approach is to create a libs folder inside your gradle project, and import all jars from within this folder.
Groovy DSL:
implementation fileTree(dir: 'libs', include: ['*.jar'])
Currently I got this :
dependencies {
compileOnly fileTree(include: ['*.jar'], dir: 'libs')
implementation 'private'
}
where do I put ur thingy lol ?
What you got is pretty much the same
its using a maven.pkg.github link to get the dependency but like the files do not longer exists there
It cant pull fileTree dependencies from anywhere. It wont even try to.
wdym ?
Is it possible to make double jump without nms?
Yes, i dont even know why you would use nms in the first place for that
PlayerToggleFlightEvent
But that requires double click
Ther eis no event
Only the PlayerToggleGlideEvent but you need an elytra equiped
Or whatever that elytra event is called
You can detect it (to some degree) but its fudgery
EntityToggleGlideEvent, sorry. I was close lol
Ah makes more sense yeah. And i believe you can allow a player to toggle gliding, even without him having an elytra equipped.
nobody is mentioning nms lol
Right ik
Dont quote me on that
My perception of nms is just "everything idk how to do with spigot can magically be done with nms"
XD
I got this to register a health obj to a scoreboard:
private void registerHealthScoreboard() {
Objective obj = this.scoreboard.registerNewObjective("health", Criteria.HEALTH, ChatColor.RED + "β€");
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
Bukkit.getOnlinePlayers()
.forEach(player -> {
Score score = obj.getScore(player.getName());
score.setScore(Math.round((float) player.getHealth()));
});
}
The console throws an IllegalStateException because i'm trying to write to a read-only score.
If I DON'T do that or try-catch it, I (obviously) don't get the error BUT the health is not initially set, wtf?
i mean i guess that's TECHNICALLY correct?? NMS can do anything the normal minecraft server could do.
since you can modify packets you can functionally do anything if it can be done on server end
health objective sets itself automatically
use a dummy objective for when you wanna manually do that
apparently not? lol
it tells me i cant set it but then sets it xD
well
ig there's an error in the console now π
the bukkit api isn't allowing you to set it because to it, it's just a read-only objective
nms handles that
so it tells me i cant but then it still does?
bukkit can't set it
nms can
yeah you CAN but you're not allowed to
well guess i gotta live with that ugly stack trace in my console now
please don't do that
if it throws an error it should most certainly not continue the method execution
not my fault nms is garbage
...but you're not using nms
how else should I do it then?
yeah but u said nms handled that
if you really don't want to have it be at zero, make a dummy objective and update it using events or a task
you're using the bukkit api which is implemented by craftbukkit which uses nms. craftbukkit throws an error. if it doesn't, it executes the nms code
why does it update then even tho there's an error
it does
@lost matrix I set the world min y limit and when it reached the limit specified with OnplayerMove I killed it with player.sethealt 0 but there is a problem
hm ah yes
hmmmmmmmmmmm
Turn on desktop mode if you are on mobile
The fake death mechanism I prepared here is not activated
I think I need to integrate it but I have no idea to be honest
andd
looks like it is nms doing that
min limit
or you could, yk, try/catch
what's the actual error message
i wanna check nms code rq
?paste
huh
In net.minecraft.world.scores obviousky
π€·ββοΈ
Hello my kotlin friends.
I need to use kotlin from another plugin in my plugins, how to correctly configure gradle?
what should i do
relocate the stdlib
what, how
relocate the kotlin package
ok then
i dont need another kotlin library in my plugin
i need to take stdlib from another plugin and use it without implementation
Get the ability to run and develop Kotlin plugins on your Minecraft server or proxy - 4drian3d/MCKotlin
or you can kotlin("jvm") version "2.0.20" apply false in all other plugins i believe
idk but i use compileOnly it not works
compileOnly(fileTree("../libs/compileOnly/"))
...what
i have my api here, but gradle can`t find them
wdym π
i have my api plugin with kotlin in compileOnly directory
and i use this line in my gradle
why are you compileOnly'ing a plugin again
but it not works
again? it another plugin
with kotlin
then i have another plugin
for example skyblock
...why are you shading plugins me dumb
what i should do
just have your plugins on your server and apply the kotlin gradle plugin as normal in some common plugin, and then do this for the others
yes
and i need to use my api kotlin plugin too
Why it not works?
i have 2 kotlin plugin, api and skyblock.
In skyblock kotlin plugin i need to use api kotlin plugin, but it not works
because you shade it so its different in both
not works
Guysguys
Now I set a Y min limit and when it falls there the player dies and is instantly teleported to spawn but when teleporting the player looks like he is falling from a height
Player loses 1 heart
Why might it have happened? I couldn't find it. π€
zero velocity
il ltestingb
you are takign fall damage, so either you hit the groiund before teleport or you are teleporting before zeroign velocity so you take damage when landing at spawn
if i wanted to do a simple anticheat in 1.21
would some packet lib like protocollib be best? or make my own packet reader
Hey yo, some tips/tricks when creating arenas using 2 corners? Like coding it, what do u recommend?
recommend in terms of what
I mean some useful things? I hope u get what i mean, English is not my Native
declaration: package: org.bukkit.structure, interface: StructureManager
does location.toVector() just makes like a vector from 0 0 0 to location coordinates? i dont understand vectors perfectly yet
it just makes a vector of the xyz
so Location{x=5.0, y=2.0, z=-3.0, ...} becomes [5.0, 2.0, -3.0]
yeah so like it would be a vector form 000 to 5 2 3
-3*
oh you also missed the -
ok i get it i was confused with location.getDirection() wchich also returns a vector
yeah cuz locations also store yaw and pitch, that direction is the one returned by getDirection as a vector
that's just gonna be a point on a sphere
direction() is a vector with direction the same as player direction with length 1
toVector() is vector from 0 0 0 to players location, length varys
i kinda dont know if i get that
well, the length is gonna be the distance between those two points (0 to player pos)
it'll vary as the player moves around
ye
yeah
soo... vector made of location and vector made of direction
anyone knows why this SOMETIMES gets me some exception? it tells me that x is 0 or infinite or something like that, and because i dont understand vectors so well i dont know how to fix that and whats wrong
player2.getLocation().toVector().subtract(player.getLocation().toVector())
.normalize()
.multiply(1.5)
.setY(0.5);
player2.setVelocity(vector); //exception here
and what i was trying to do is push player 2 from player 1
okI give up I actually need help
give teh exact exception. We can;t work on something like that
for some reason my main class of my shaded library isn't updating
when I modify it
but other classes are
IJ moment
Help him?
setting it to zero should be fine, but it must be finite yeah, that's only really gonna blow up if the distance between both players is zero
clear caches and restart. and clean build
I have cleaned, invalidated caches, restarted
none of it worked
I'm cleaning both the libarry and the local
ide
I am also versioning the library to try to get a clean version
I swear it's like it's pulling it from a different place
Ij is a bitch when it messes up. I've seen some had to delete some folder, but mostly just caches and clean package
I swear I must've cleaned but at least 100 times a piece
there is an IJ cache folder in teh project I believe (I don't use IJ).
ok just for a sanity check I'm even decompiling the output
and I can see the shaded library does in fact have the stuff I put in it
wtf intellij
that sounds like a build tool or publishing issue than an ide issue
I decompiled the code intellij compiled and check the library
intellij doesn't compile
the library has the modifications
maven/gradle does
well no because no amount of trying to fix the ide is gonna fix your broken build setup
except it builds correctly
clearly it doesn't if the published library isn't correct
it is correct in what it is actually outputs
but the jar that the library consumer consumes isn't correct, so the published jar that it's consuming isn't correct
or the build setup of the library consumer is bad
how can the jar I installed not be correct when I can see that it is correct both on the jar that got installed and on the shaded output
Did you try invalidating caches?
yes, many times
all of them?
yes
you know what I even just went a step further and installed a completely differnt version of intellij just now
and did not import the values from the previous version
and it's still not doing it right
or the build setup of the library consumer is bad
ok how can that even happen
people writing shit build scripts happen
there isn't a single maven property or gradle method that fucks up the setup xD
the only thing I have is the most basic shadowjar thing possible in gradle which, to be clear, worked for all changes up until yesterday
and I didn't modify it
and still works for all changes done not to the main class
but it ignores the main class
if the published jar is correct then the consumer is somehow bad
care to share the actual build script?
?paste
is this the library or the consumer?
consumer
library is implementation group: 'com.magmaguy', name: 'MagmaCore', version: '4.0-SNAPSHOT'
this fking thing, I know what it did
I knew this was going to be a problem
because magmacore is shaded across multiple of my plugins and because I have an implements on one of those plugins intellij is incorrectly pulling the magmacore version associated to my implementation and not the one associated to the plugin
I'm not even sure this is fixable other than keeping them synced
public void createIslandWorld(){
WorldCreator creator = new WorldCreator("IslandWorld");
creator.generateStructures(false);
creator.type(WorldType.FLAT);
creator.environment(World.Environment.NORMAL);
creator.createWorld();
}```
So I see in the docs that there is a generatorSettings method taking a string and the example usage is: ```{"layers": [{"block": "stone", "height": 1}, {"block": "grass_block", "height": 1}], "biome":"plains"}```
When trying to create an empty world would I just define an empty layers array here?
I assume generateStructures just decides whether or not villages/etc are generated
yes
kek that easy eh?
Yes
package com.magmaguy.magmacore.util;
import org.bukkit.Bukkit;
import org.bukkit.Difficulty;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.generator.WorldInfo;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Random;
import java.util.logging.Filter;
public class WorldLoader {
/**
* Generates a world which does not save, does not keep spawn loaded and is a void world
*
* @param worldName
* @param environment
* @return
*/
public static World loadVoidTemporaryWorld(String worldName, World.Environment environment) {
//Case where the world is already loaded
if (Bukkit.getWorld(worldName) != null) return Bukkit.getWorld(worldName);
File folder = new File(Bukkit.getWorldContainer().getAbsolutePath());
if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) {
Logger.warn("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!");
return null;
}
Logger.info("Loading world " + worldName + " !");
Filter filter = newFilter -> false;
Filter previousFilter = Bukkit.getLogger().getFilter();
Bukkit.getLogger().setFilter(filter);
try {
WorldCreator worldCreator = new WorldCreator(worldName);
worldCreator.environment(environment);
worldCreator.keepSpawnInMemory(false);
worldCreator.generator(new VoidGenerator());
World world = Bukkit.createWorld(worldCreator);
if (world != null) world.setKeepSpawnInMemory(false);
world.setDifficulty(Difficulty.HARD);
world.setAutoSave(false);
Bukkit.getLogger().setFilter(previousFilter);
return world;
} catch (Exception exception) {
Bukkit.getLogger().setFilter(previousFilter);
Logger.warn("Failed to load world " + worldName + " !");
exception.printStackTrace();
}
return null;
}
private static class VoidGenerator extends ChunkGenerator {
@Override
public void generateSurface(WorldInfo info, Random random, int x, int z, ChunkData data) {}
@Override
public boolean shouldGenerateNoise() {
return false;
}
@Override
public boolean shouldGenerateBedrock() {
return false;
}
@Override
public boolean shouldGenerateCaves() {
return false;
}
}
}
Also what's the modern way to gather world references? I want to avoid Bukkit.getWorld(""), I thought this was uh bad
kek
Thank you
Shoulda worked with worlds prior to this project but eh whatcha gonna do
read? nah
uhm, guys, you can run a server with a debugger?
you don't even need those chunk gen impls
ty π
is this the hammer button?
All those shouldGenerate methods return false by default anyway
public class IslandWorldBuilder extends WorldCreator {
public IslandWorldBuilder(String name) {
super(name);
}
}
You mean to say creating void worlds has been this easy?
has anyone forked MobChip or is there an alternative for it? Considering it was discontinued
Hello, how do I automatically update my plugin files after updating or uploading a new version of the plugin to the Minecraft server?
Hello, who do you suggest me for the database ?
intellij is fucking with me
Use Eclipse
MobChipLite
Believe thereβs a resource post on the forums
So when creating a world, that world is automatically loaded to memory right? but how is this state treated given no one ever goes to this world and there's nothing technically loading anything... do I have to keep some chunk loaded within the world to maintain this?
Why i canβt edit my ressource Description there is no Button next to the Report button
server automatically loads up the spawn point of the world when world is loaded
Is there a default spawn location for any and every world created?
Ah cool ok
no, the game will attempt to find a suitable safe spawn location
which is quite the expensive operation
if the world created is void?
were you Talking to me?
private void initIslandWorld() {
IslandChunkGenerator chunkGenerator = new IslandChunkGenerator();
WorldCreator creator = new WorldCreator("IslandWorld");
creator.generator(chunkGenerator);
creator.generateStructures(false);
creator.createWorld();
}
public class IslandChunkGenerator extends ChunkGenerator {
@Override
public void generateSurface(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, ChunkData chunkData) {
}
}
such as this?
yes
provide a fixed spawn location
you don't even need an impl for that tho i believe
in the generator
but the distance was not 0, and what should i set to 0? .setX? but why
something else
yea i just do this
but alr cool
I just assumed that the super had some default impl for chunk gen π€·
when a player goes to that world yes, however the default spawn location of the world by default is 0,0 unless something set it differently or changed it.
it is recommended that at the default spawn location you put a platform otherwise you might cause issues with people forever dying in the void and making it really difficult to escape that XD
This world is not supposed to have an actual spawn
Just a container world for islands
maybe put one just in case?
anyways you should always plan for something unexpected, while players are not supposed to end up there I can forsee someone having perms or ability to change worlds just seeing thatt world and going to it
fair enough
no, it still runs a bunch of search logic when the world is first loaded
it also skips a bunch of logic, but a lot of logic still runs
instantanious world generation if you do something like this
was planning to enforce world borders around peoples island regions
Not that world borders ever stopped anyone
.setWorldBorder in player is uhhh what would you say packet based? ie: fake world border essntially?
Yes
awesome
idk what search logic you are talking about, but default spawn of a world is 0,0 maybe you are referring to the default worlds like nether or end? But the wiki even says 0,0,0 is always the origin point
which is how I have always known it as well
try comparing worldgen time without the getFixedSpawnPosition method implemented (blankly) and without it
The game searchs for a valid block to place the world spawn on
Is the world border displayed centered based on the world? Or some other params I can define?
Which is mostly natural blocks like grass, sand, etc
WorldBorder has a setCenter function
Smh read the docs!!!1
ok, and this would only happen on world creation right? Because world loading shouldn't do this
Might as well get some help while I'm here π
i'm talking about the search logic that runs in initWorld which calls findSpawnPosition and getSpawnPosInChunk for the spawn position
this makes sense if this is ran on world creation, would be quite dumb to have this on world loading o.O
since you know spawn point is saved in NBT of the world
if you consider creating a world loading it for the first time
this only runs when the level is init'd for the first time
uh
hu
does anyone know how I can use a .jar file from my pc as a library using Kotlin Gradle?
Ah alright, still quite dumb to have though maybe there should be some kind of setting for it
compileOnly(file("path"))
still recommened to maven local it
i mean you can skip the search by overriding getFixedSpawnLocation in your ChunkGenerator
isn't this noted in the javadoc for WorldCreator? π€
have no idea but good to know I suppose
ish
what does Maven Local do?
in keepSpawnInMemory
you put it on your local maven repo
how do you not know what maven local is
uh
I am uneducated
xD
learning stuff as I go
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingβgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! π
was that on purpose this time?
"no idea what you mean I just wanted the links"
Youβre welcome!
yeah I don't think your good at making friends
He'll probably always blame it on "Inconvenient timing"
well I guess some people are just
very self-unaware
you only realise it in the future
don't need to be good at something if you don't need it π
?paste
Shadow don't be mad frost sent it from a friendly context I'm sure
I'm pretty sure he just doesn't like me
aaaand he doesn't care whether he's offending someone most of the time
anyway, I started my intelliJ, and it just stopped performing highlighting checks
and this blue bar popped up
why would that have to be your problem tho
reload gradle
I did
wait for it to finish
e: file:///C:/Users/Kubia/Desktop/client/eclipse/SuperCrates/build.gradle.kts:51:5: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val NamedDomainObjectContainer<Configuration>.compileOnly: NamedDomainObjectProvider<Configuration> defined in org.gradle.kotlin.dsl
this is accurate
;]
I get it
it was the unfinished part
but still no highlights
and no debug even during build
just
it usually says a lot of stuff
ay another kotlineer
paper sex
"PAPER SEX" mhmm ah yes
just 'disabled
oh shi-
rm -rf .idea my beloved
close ide and rm -rf
what does -rf mean?
--recursive --force
does force mean, like, at all cost?
ah okay
yeee it works
I wonder whether it's because
I 'terminate' the process when I open intellij and want to switch to another project
probably some fucked up config or something
hey, you know how to fix that? i didnt get that, i can show the exception
@slender elbow
di the skull meta trickery change with 1.21?
seems like my player heads stopped working at some point
mah boy look what they did to mah boy
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. Iβll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
wow that's kinda gay
yes very
i c url trickery
going to take a wild guess and say I should probably cache it
fun question, is stuff like MHF_ArrowLeft still viable?
sure, aren't those actual player accounts?
no idea, try printing the final vector? also yeah what's the full exception
umm
it was illegalargumentexception: x not finite
i mean
i cannot find it, i have to try to get that again
because this wordked, but sometimes didnt for some reason
somewhere you are dividing a value, which you then set
Your issue is you are tryign to divide by 0
umm but how to fix that, when im dividing by 0
show some code and we can probably tell you
i showed
where?
it was it
show your actual code
thats a problem π
oh
wait
no i have it
public class TestCommand1 implements CommandExecutor { //TODO TEST COMMAND
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
Player player = (Player) sender;
Player player2 = Bukkit.getOnlinePlayers().iterator().next();
Vector vector = player2.getLocation().toVector().subtract(player.getLocation().toVector())
.normalize()
.multiply(1.5)
.setY(0.5);
player2.setVelocity(vector);
return true;
}
}
and its a test soo
ignore the way i got player 2 lol
That can;t be the code you are getting the error with
You have cut something out or modified it before posting
i dont think so
The only way setVelocity will throw an exception for not finite is if you pass in a value divided by zero
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
List<String> flags = getKitItemFlags(player);
if (flags != null && flags.contains("self-drops")) {
ItemStack item = event.getItemDrop().getItemStack();
if (isKitItem(item, flags)) {
event.setCancelled(true); // Prevent kit item from being dropped
// Send warning message to the player
String warningMessage = formatMessage( ChatColor.RED + "You cannot drop this item. Use /trash to remove it.");
player.sendMessage(warningMessage);
}
}
}```
With a single click it gives the same warning 3 times.
single click? Thats a drop item event
Yes
And a little code that prevents this item from being thrown to the ground
When I try to throw the item on the ground, it writes the warning message 3 times at the same time
And I'm only trying to throw it once
It should give only one warning but it gives 3
I'd guess you have created 3 instances and registered them
nope
@eternal oxidehttps://pastes.dev/9RormztXsU
here a
code
where do you create your KitHandler instance?
Folder named kit pvp
No, this is a Listener called KitHandler. you create an instance of this in your main class
u mean getServer().getPluginManager().registerEvents(new KitHandler(this), this); ?
yes
you are double registering
that code registers events in a new KitHandler, The KitHandler instance also registers the listener
in your main just call new KitHandler(this);
getServer().getPluginManager().registerEvents(new KitHandler(this);
or just
new KitHandler(this);
just
then you are also creating another instance in your code elsewhere
// Initialize KitHandler
new KitHandler(this);
getServer().getPluginManager().registerEvents(new KitRespawnHandler(this), this);
go over your code and find wher you use new KitHandler(this)
Hey look at that gridding algo works, same with the island structure generation
I feel amazing
Wow maths
You have to paste from the origin
it doesnt paste automatically in its original place
Hello! I have these methods to get the items needed for a recipe to be crafted, but I don't know how to get the items from a ComplexRecipe. Does anyone know how it works or how I can do it?
Complex recipes are⦠complex
They can take different amounts and types of ingredients
Cry
wtf
ok so with the new skull meta as of 1.18 is there a way to use a specific player head easily? Seems like it use base 64 skins? I'm so tired that reading the documentation is putting me to sleep
or maybe get it from a url or something
client side, or server?
Server is simple https://blog.jeff-media.com/creating-custom-heads-in-spigot-1-18-1/
server
like I want to use a skin from a specific player
I don't know if that's even possible
yes
seems like it should be
how do you get the url that matches the player?
also is the server clever enough to cache that
I assume no
the skin comes from mojang, you can lookup any player by uuid
but what's the format for that then
it's not just dumping the uuid to the url is it
let me open my ide
man I really need to change my diet, I can't live with this energy level
ok, you can get everything from the sessionserver
from that you can get teh name and texture id
p.getInventory(); IS necessary for plugins that set custom itens on players inventory ?
danke
so just plug a url there right
call that URL with the uuid, then fetch the properties
Hey elgarl
value and signature are the textures
How are you doing?
uh which is which?
Properties.value is the Texture. Properties.signature is teh signature
hi, I want to adjust the weapon durability lost when it hits a mob, how can I manage that?
clearly I don't even know what the signature is for
hm
what exactly are you trying to do?
and the texture is the one I would plug into the base64 part of the jett-media method?
I just want the menu to have my player head, then the player heads that were supposedly kind default provided by mojang for arrows
mhf left arrow or whatever that was
yes, the Texture is a base64 encoded piece of json
what a weird choice
you pull the url from that
hm ok I think I got it
any idea about the old mojang default heads
I guess they could just be obtained the same way maybe
but they used to not require any queries
(I believe)
I've not used them
well
guess I'll use this method then
oh last thing is there a convenient way to look up uuid from name
that would be neat
(for offline players)
?paste
thanks
I have a bunch of runTaskLaters nested (for a countdown + deathmatch timer) but I need a way to clear them all to reset the game.
I have a separate class for /stop which clears all tasks (hopefully) but I need to get all of the tasks' IDs. Does anyone know how to do this? Everywhere online ive looked involves a Task variable but the way I've done this I'm not sure how to do that :/
Thanks :P
Bukkit.getScheduler().runTaskLater(Main.getPlugin(), new Runnable() { @Override public void run() {
for (Player p : activeplayers) {
p.sendTitle(ChatColor.GREEN + "4", "");
}
Bukkit.getScheduler().runTaskLater(Main.getPlugin(), new Runnable() { @Override public void run() {
for (Player p : activeplayers) {
p.sendTitle(ChatColor.YELLOW + "3", "");
}
Bukkit.getScheduler().runTaskLater(Main.getPlugin(), new Runnable() { @Override public void run() {
for (Player p : activeplayers) {
p.sendTitle(ChatColor.YELLOW + "2", "");
}
}
}```
Probably a better way to do this is to create your own task manager class and have a schedule method that adds your task to some sort of collection
that way you store all your tasks of the current game somewhere
and then you can cancel them all at game end
Also, you can use lambdas ()-> instead of new Runnable()
where have you been all my life
ok ill try, thanks
Create like a TaskManager class with its own schedule methods and stuff
also create like a Set<BukkitTask> in there and everytime you run the schedule method add it to the set
then create like a shutdown method that iterates through the set and cancels them all
alr tysm
bro didn't know
i created a class that extended bukkittask but same idea
any idea what the resolution of a mc item in the ui is?
like an item texture?
yeah in the hotbar and such
16x16, 32x32, 64x64, etc
yes, the default
16x16
you just asked chatgpt didn't you
no i googled
but i may be wrong
i can check on mc assets
but it is 16x16 after checking on mc assets i believe
I really zoomed in on an item, yeah it's probably 16x16
16 x 16
well this is going to hard to make icons for
chatgpt is ass lmao
what for
^
you can do anything up to 256x256
like why would anyone use 16x16 tbh lol
I want to make custom icons for every piece of content in this menu
it doesnt have to be 16x16
yeah I know
you can just do anything
ok but realistically if I try to fit in a 4k image in there it won't look good
I'm just getting an idea of how it would scale based on the current res
thats not the point lmao
you can only do up to 256x256 as i said
16x16 is too small for any sort of detail
I'm sure you can tell it was this all along
Oh yeah that's what I said innit?
sounds not so fun
I might just outsource it to an artist
Is every individual slot supposed to be like one of these?
yeah piece of content is a completely different build so no
but it's in the same spirit that they should be showing what they have
And max you're allowed per slot is 256x256 pixels to play with?
the problem is not the native resolution you can do, it's how small minecraft crushes it to be in the ui
you actually need a magnifying glass to see even a fraction of the detail of it at 256x
Does that mean delegating pages per design?
what?
Like one page for each design
I've seen a lot of modern servers with those not so vanilla ui designs
Yeah
nah I'd rather retain the slot count
fair enough
tbf I'd think more based on that one pic
plus it would look like nothing if you don't use the pack
not for my plugins when avoidable
Optional at least I assume?
it's always encouraged, hell I made Resourcepack Manager didn't I
Yeah that's right I forget about that
Idk why I get you and simple mixed up
I think it's because of the dark purple name kek
the metrics lead me to think less than 50% of people currently use the rsp, this will change after this big update push but it's still so low that I definitely don't want to have to rely on it
Clearly you gotta auto host the pack on the server
ive been using this to generate my resourcepacks on runtime and its been great
it can host em too
but i also made my own utility class to auto upload to mcpacks
that's not the primary function of the manager, though it getting a version of that on steroids soon
I still have to figure out the details but I really want it to be able to provide unused ids to any plugin that wishes to use it as an api
so you can safely build a rsp on top of it without running into overlaps
it needs to also account for scenarios where maybe 5 different plugins are queued the build
Hence the atomic part
i'm not saying it's hard, I'm mostly just trying to think of how I can make it convenient
I might work on a pack creation api after I finish my hosting api
It can host any number of packs on the server without requiring another port
that'd be cool
(The secret is jank)
I could've guessed that one
u could do that?
Yeah
how
Hehe
well my secret is using other people's public services π
I inject a handler at the front of the netty pipeline that handles the http request from the client
Oh lmao
i used jsoup to upload my pack on mcpacks lmao https://github.com/PulseBeat02/MurderRun/blob/main/src/main/java/io/github/pulsebeat02/murderrun/resourcepack/provider/MCPackHosting.java
Yeah
it's fine guys I'm sure it will be in the modding tools update we were promised
Hey at least we have automatic pack merging now
at least we can send multiple resourcepacks to the client now instead of one
Thatβs exactly what I meant
Ya
The client handles the βmergingβ
we love sending data don't we
we just send all the data we can
even if 80% overlaps
if I can't fill my 10tb hdd with resource packs then what did I even buy it for
prolly majority of resourcepack size comes from sound
that's what modding is for
and yeah it's definitely the sound
90% of my rsp is just sound
maybe more actually
Thatβs why origin realms still has like a < 20mb pack
They donβt have many (any?) sounds
if you stick to vanilla resolutions it's hard to actually reach big numbers just with textures and json
even if you get wild with it
Yeah
You can always compress the shit out of your sounds like the Pikachu cry in PokΓ©mon yellow
like I used to casually have a png in the resource pack that was several orders of magnitude larger than every actual proper texture in there
I still technically do too, I have to optimize my maps
Imagine you join a server and just hear
This is the original sound, and I did not boost the audio of this video.
how to make your sound 10 bytes
i know ogg is great but many conversion is so annoying sometimes
very good for compression
ogg is trash
why
I don't like compressed audio and I have a very good internet connection
if I had it my way I'd be distributing my audio in a flac format
Alternatively just split the sounds into a bunch of separate resource packs and dos the client on join
man it's crazy just how much I am procrastinating right now
I wonder how the client would feel about 10 250mb packs being sent
Send the entire NES library in a resource pack
(For legal reasons thatβs a joke, donβt sue me Nintendo)
ban this kid!
what a great list
who made that
a genius
Those donβt maintain order
Well the base HashSet doesnβt
What if I need my order!!!!111
I just realized they wrapped the list twice
:)
clearly you don't fold your toiler paper
imagine the following
you have >400 instances of list.of that needs to be mutable
but about 550 instances of list.of in total in the code base
do you
A) spend a week going through each one
B) replace all
C) code better in the first place smh
well buddy if spigot and mojang didn't change the enums for 1.20.6 I would've been fine with them being immutable
but suddenly I need a layer that modifies them to a more recent version of the api
no?
and even if it did it would still cause the same underlying problem with the list being immutable
1.20.6 had breaking enum changes for half the shit I use
like most potion effects were affected
enchants
so on
Yeah those get updated afaik
Thatβs what commodore is for
Granted you have to build against the older api for that to work
what a fantastic solution
not to mention one that might've not been out when I first started writing this code
Itβs more to support old plugins
who are you calling old
it's a moot point anyway the whole point of my 9.0 update was to become free of the shackles of other people's libs
no more cloudcommandframework no more worldguard/worldedit no more modelengine
I'll make my own
why
because they break shit, they don't update when I update, they deprecate out of nowhere and I have walk thousands of people through problems like reading which download link downloads the correct version of worldguard
whereas if I just do it myself I can make sure everything works together and is not confusing to use or install
so you think you are better than them
yeah that's definitely what I said good job with your reading comprehension
it's right below the part where I said I think I might be the next mr beast
except more popular
they break shit, they don't update when I update, they deprecate out of nowhere
whereas if I just do it myself I can make sure everything works together and is not confusing to use or install
that doesn't mean I think I'm better than them, that means I think I can make an integrated system that works better than having to rely on several third parties
which is not a challenge
cloudcommandframework can not reload to any extent, and can not load new suggestions to autofill. This is a trivial thing to implement myself
modelengine decided to jump off of spigot and start a new version elsewhere where you have to buy it again
I have over 250 tickets of people who failed to install the right version of either worldedit or worldguard or both, in the last 3 months
this is such a stupid attitude to have
really not only not constructive but actively destructive
no, because if people cant even install the right version of software is it really the developer's fault?
did you read the part where I said I have 250 tickets with this problem
who do you think has to answer those tickets
then don't answer them and leave them with some automated msg
why do you feel you need to solve it
their problem is my problem when they're trying to get my software to run and some dependency doesn't work
because I make good plugins
not really, if they can't install right software thats like a setup issue not a developer issue
redirect them to a mini guide on how to install all your dependencies properly, and if that's not enough, then why are they even hosting a server in the first place
you're not going to convince me that I need to start to be shittier towards the people who use and sometimes buy my software so don't even bother trying to make an argument for it
you don't have to act "shittier", you just send them a mini guide and lead them in the right direction
if something is actively a problem and you can solve it for not only the hundreds of people having the problem but the thousands in the future who will have the problem with just a few hours of work and you decide not to do it I would argue you're being a shitty dev and just overall making a worse experience
yes but is installing dependencies really that difficult?
yes
it is, as it turns out
I have literally thousands of support tickets about it
and i'm guessing you had a guide and everything for it?
ok then like
its not worth your time to do that tho cause you already put forth the effort to give server owners a chance to learn how to install these dependencies
most likely they arent reading those guides
or watching those videos
who are you to tell me what is and isn't worth my time
well that's just my opinion, as you said you can spend your time however you'd like
you seem to be so self-assured this is the correct way of doing things that I'm sure your plugins have millions of downloads
must really have a lot of experience
ok but like users installing dependencies incorrectly is like bruh
do you have anything complicated like anything to compile?
ok but using #help-development instead of reading the documentation is like bruh
md5 should shut this down and make a bot that tells you you're cringe when you need help
I can fill the role of said bot
hey col can you give me an example using pulse as your target
I regret to inform you pulsebeat_02, but asking for help is a cringe activity done by cringe people
lol
you know what @paper viper I think you're on to something now that I'm looking at col's message
there's definitely something to it
I like it
In all honestly I do agree with many of your points
But i'd take a different approach personally
I'm sure it will be met with lots of success and people loving what you made
ok π
on skibidi
Anyone know the calculations used to determine the position of the sun in the sky in degrees, based on the Minecraft time of day?
the sun is actually larger around sun rise / sun set
But you want a sin wave iirc
so something like an asin(time / 24000 * 2PI) or whatever
isn't it linear?
Yeah I used this
But itβs not right
The sun speeds up and slows down around sunset/sunrise
And thatβs the problem
I think I've created the least efficient chain of list operations imaginable
an accomplishment in pasta
huh
max laziness, all copy pasted and post-patched
real
So as I understand, the difference between Inventory and it's contents is that the inventory has a holder and when you modify the contents it doesnt reflect on the actual inventory?
commands:
sharelocation:
enabled: true
permission: ""
ping:
enabled: true
permission: ""
how would i go about getting all of these in a hashmap? i have CommandData but idk how to get these with a FileConfiguration
my work is halted till i can fix this
It will change the contents of the actual inventory iirc.
you could also just getValues
Inventory is an abstraction around contents
InventoryHolder is mostly used for internals. You shouldn't use it
Hello everyone,
I've encountered an issue while developing with Spigot 1.21.1, and I hope someone can help me. Here's the situation:
Problem:
My IntelliJ IDEA can't find the org.bukkit.attribute.Attribute class. It seems all enum classes have become unreferenceable.
Details:
I'm using Spigot 1.21.1
Java version: 21
IDE: IntelliJ IDEA
What I've tried:
Checked and updated all dependencies in pom.xml
Invalidated caches and restarted IntelliJ
Confirmed that the API is in the classpath
Questions:
Could this be related to the enum conversion mentioned in recent Spigot updates?
Are there any specific settings I need to adjust in my project or IDE?
Does Spigot have any special configurations or features that might be causing this issue?
Any help or guidance would be greatly appreciated. If you need any more information, please let me know.
Thank you in advance!
hey, im trying to load command data from the config, am i doing this right?
ConfigurationSection commandsSection = config.getConfigurationSection("commands");
assert commandsSection != null;
for(String key : commandsSection.getKeys(false)){
ConfigurationSection command = commandsSection.getConfigurationSection(key);
CommandData commandData = new CommandData();
if(command.getString("permission") != null) commandData.setPermission(command.getString("permission"));
commandData.setEnabled(command.getBoolean("enabled"));
COMMANDS.put(key, commandData);
}
how my config looks:
commands:
sharelocation:
enabled: true
permission: ""
ping:
enabled: true
permission: ""
update your intellij, it cant handle versions of its runtime being lower than the java version you use (21)
thank you!
?jd-s
hmmm i'm not sure if i'm missing somehting in the docs but since the server tracks advancements via json, can i access that and show the player what e.g. cats they're missing for "a complete CATalogue" or what food they're missing for "a healthy diet"?
bump
Looks fine to me. You could use Objects#requiresNotNull (or smth like that) instead of assert and check if command in your loop is not null (i.e. the value is not a section)
this does not look right to me:
public class ShareLocationCommand extends BaseCommand {
public boolean handle(CommandSender commandSender, Command command, String s, String[] args) {
public abstract class BaseCommand implements CommandExecutor {
private final String commandDisabledMessage = ChatColor.RED + "This command is disabled";
private final String lackingPermissionMessage = ChatColor.RED + "You are lacking the required permission!";
@Override
public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) {
CommandData commandData = Survival.getInstance().config.COMMANDS.get(command.getName());
if(!commandData.isEnabled()){
if(commandSender instanceof Player p){
p.sendMessage(commandDisabledMessage);
return true;
}
Survival.getInstance().getLogger().info(lackingPermissionMessage);
return true;
}
if(commandData.getPermission() != null && commandSender instanceof Player p){
if(!p.hasPermission(commandData.getPermission())){
p.sendMessage();
}
}
return handle(commandSender, command, label, args);
}
public abstract boolean handle(CommandSender commandSender, Command command, String label, String[] args);
}
is there an easy way to run a java snippet inside a running minecraft server?
Easy? Probably not in the way u want
Well
Compile it and run it programaticslly
Some JVMs have a javascript engine u can use for easy scripting addition
No clue about skript or what effect commands are
I know of skript. We shit on skript
I suppose to a degree
If the player does not have the perm you send and empty message and handle the command process anyway which is kinda weird but it might be intentional
yup, average
fixed it rn
effect commands are a thing where you can send a prefix followed by skript code in chat and it runs
Otherwise, the only problem is that you never check for null values when you retrieve your command data. If the entry is deleted from the config then you will end up with a npe
tbh skill issue
shouldn't have touched the config
π€·
also fixed that
I mean reflection exists
Years told me to never trust server owners
Indeed x)
btw are these really complicated stacks actually used in big mc servers like? Microservices, Messaging Brokers, Orchestration Tools (Kubernetes)
just add a command that says "dont touch" and boom
no responsibility
Null check >>>> 5h spent with an owner stuck in the infernal loop of "whY Is NoT woRkinG"
actually
fair enough
Probably to a degree
but make it show an error in console that says "You're a bloody idiot"
They don't know how to read errors
LMFAO
I show them warnings
true true
nah like yk
Then I don't respond until they fixed the warnings
getLogger().severe
-> πΏ
so it just shows red text
I mean they can surely read that right?
Apparently when it's red, they read it, but when it's big they don't
I mean
yeah
I had this guy
he didnt read warning either
but
he just got like errors
and he either ignored them
with serialization with objectoutputstream to a blob, are itemstacks and inventories serializable in that format? also what do you have to do to make your custom class serializable? also are location variables invalid if loaded from a blob?
sorry for the spam of questions. been really intrigued by serialization in this method because in some cases it seems really unnecessary and time-consuming to model everything in tables (like itemstacks, inventories, lore, etc)
I mean, a server can run even if it spams errors in the console
x)
Actually most of them are fine
Runtime exception be like
90% of errors are config errors or npe which occurs on command execs
yeah ik
Ik that you do it through yaml serialization (with ConfigurationSerializable or smth) and then encode it with base64
Load data from the config into a serverdatamanager. do your null checks there and all done
only have to do them once
i hate when i have to self host a testing mc server on a windows machine.
Switch to Linux. You're welcome
(i read the messages from before about the NPEs when deleting entries from the config.yml)
what's the problem?
Windows
never really had any issues, even tho linux is better, yes
mine window's fine π€·ββοΈ
Facts
i dont like linux as a everyday os but love it on the server
I mean
i have to switch the PATH env everytime i want to run a mc server π¦
It's pain in the ass, you can't replace server jars in a running server
nnnno?
Linux everyday
Just put the path in the batch file
Do a batch script ?
@echo off
title 1.21.1 Spigot Server
cls
"C:\Program Files\Java\jdk-21\bin\java.exe" -Xmx8192M -Xms8192M -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar spigot-1.21.1.jar nogui
PAUSE
and boom
no more path changing
Title π€©
oh also cmd is the biggest piece of shit i have seen
Or you could just define the path in your system environment...
powershell is a lot better now
windows came a long way since 7 or sum
or 8
(tbf we don't talk about 8)
skill issue tbh
and bcz i live in a shit country i cant use WSL
but ik wym