#help-development
1 messages · Page 1189 of 1
its already registered in that which is why im always confused but oh well
that ik but if i put it in that i must have registered the command in the main class yk what i mean but idk anymore
okay shows no errors only warnings hopefully it works
package me.lyamray.test;
import me.lyamray.test.commands.commandyarak;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public final class Main extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
Objects.requireNonNull(this.getCommand("yarak")).setExecutor(new commandyarak());
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
name: Test
version: '1.0'
main: me.lyamray.test.Main
api-version: '1.21'
load: STARTUP
authors: [ LyamRay ]
description: BackPack Plugin
commands:
yarak:
description: yarak
usage: /yarak
aliases:
- yarakamk
- amk
i always use that
idk saw it somewhere and since then use it, if i dont use it it also gives a warning
That’s just IntelliJ being annoying
@chrome beacon plugin now not working at all 💀
AddCrateLocation - https://paste.md-5.net/ofeqoqazeb.java
Main Class - https://paste.md-5.net/lufuvilevo.java
Plugin.yml - https://paste.md-5.net/azuvarubel.makefile
yes and where do you register the command in your main?
that isnt the updated main but i put it
public void onEnable() {
getLogger().info("CratesSkyblock enabled.");
getCommand("addcratelocation").setExecutor(new AddLocationCommand());
this.config = loadConfig("config.yml");
and the error?
Should be an error in the console telling you why it's not loading
let me reload it see if i can find the error for that then
the command is loading before the config thing
so in other words, the command should work because you properly register it
Surely you don't mean /reload command, right
indeed NEVER use /reload to reload your updated plugin..
when you insert, remove or update your plugin file always turn off the server
-# I wrote my plugins to specifically support this, I still however do not recommend it lul, I know few things that can break horribly
this ? [13:22:42 ERROR]: Error occurred while enabling crateshub v1.0-SNAPSHOT (Is it up to date?)
Yes but the full error
Are you making a new instance of your plugin
Why do you load your own config
You seem to have an error when disabling as well
Cannot invoke "org.bukkit.configuration.file.YamlConfiguration.set(String, Object)" because "this.config" is null
i believe so
my config has this in it crateLocations: so when i do /addcratelocation it will log that in the config so it stays during restarts etc without that it wont save
i only have 1 main class i think im getting myself confused here
wrong
learn how to use spigot configs
it worked with it and didnt work without it
surely it cant be the config being the main issue
It's not
It's probably not, but you're doing something unnecessarily. In a non-standardized way.
the main issue is you making a new plugin instance
when i added the getCommand etc thats all i did
what's "that"
because the code you've sent either doesn't compile or is missing parts of it
Rule one. dont. learn. configs.
why would u even use a config besides of message storage
you dont store inventorys in their
maybe for small number storage
or booleans
when i first added the getCommand i got this error https://gyazo.com/1a33b3eb79d8b997689707d7a85f3e89
Wait until you learn how most games store data
im stupid so it is what it is
yeah
It’s usually either xml or similar, or some actual binary format
but connor remember, dont store large amount of data in it like inventories, ist not that good ahha
just learn a small and easy database like sqlite then
it also stores locally on the server files
and its easy
but first we fix your error
maybe if i can even get this command to work first then thats something i can learn next
okay!
i will show my code in a second
so you can look at it and maybe see your fault
i cant promise you that i might see it cause i am known to not see mistakes unless pointed out but ill try
quick fix shows this https://gyazo.com/52cd0a889c746094bedcf86022589351
none of those is what you want to do
i tried 1 and thats when i tested it on my server maybe thats why
what can i do to fix it
remove it
getter lombok 🤫
Not relavant here
okay dont be annoyed but im a little lost cause i will say all i added was
getCommand("addcratelocation").setExecutor(new AddLocationCommand()); and have the error
Yeah
AddLocationCommand expects a param
and that param is an instance of your main class
so remove AddLocationCommand?
no
You really don't want to 🥄, do you :D
🔫 You better not spoon this
yh ill be honest i dont really know where im looking for this instance im really being stupid
Kinda sounds like lack of knowledge to me tbh
Yeah it's obvious someone skipped the learn java part
aint wrong about that 1
when i asked someone what to learn they only sent me a video thing for spigot...
?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! 🎉
?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! 🎉
Oh god double text wall
💀
https://gyazo.com/fe2f609cfb2c62b51eaf7f096afbe072 at all on about this ?
Please watch those 2 channels first
and learn from there
they explain you everything to do
Do no check the command name
It is pointless
1st channel i was watching
oh?
Imo youtube videos are the inferior way to learn anything programming related
It is usually bloated with useless info that you just cannot easily skip over and consumes more time than just reading an article
But that's just my opinion, do whatever helps you better
90% of the youtube "teachers" are amateur developers
legit 2-3 years of experience
they know enough but they haven't mastered any of the concepts
i only try to look at youtube cause i find it easiest to follow and stuff
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class testcommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (!(commandSender instanceof Player)) {
commandSender.sendMessage("You are not a player but the console, dirty man!");
return true;
}
commandSender.sendMessage("Hey you are a player!");
return false;
}
}
oh hell nah
testcommand
dawg at least follow naming conventions
String s
what is "s" HMMM
oh tyty
I sometimes forget how generics work lol
this is the basic method bukkit gives you lmao
And even if you provide the registration of the command, it will not help the guy solve his problem
public class TestCommand implements CommandExecutor {
private final MyPlugin plugin;
public TestCommand(MyPlugin plugin) {
this.plugin = plugin;
}
@Override
public void onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("You need to be a player in order to execute this command.");
return true;
}
sender.sendMessage("You are a player, hurray!");
return true;
}
}
ezpz
There you go
It's not
you sure?
where can i post screens
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
I wrote that from memory btw
Sometimes the IDE will generate an override with just single letter variables names
fixed it
Yeah that can happen in Intellij
Usually fixed by downloading sources and documentation
@grave depot what was this database thing you was telling me to use? or learn
sqlite
any videos or anything i can use to learn that stuff
Yeah that's Intellij not knowing the names
Tell it to download the docs
so is that my fault then?
more work for what?
if i know that s is my label
1 button if your project is setup correctly
And you get proper docs inside of your IDE
that's not the good mentality
we follow that logic and drop all standards because I understand my own code and that's enough
https://www.youtube.com/watch?v=lF_a8H679OI @jade oasis
Just a note as well
Saving the config every time you make a change is bad
Ideally you would save the config onDisable (via the proper methods I linked earlier)
Or save every ~15 minutes
pretty sure I have a plugin that fixes all of that lmfao
does config caching, async preloading, async saves and autosaves
and injects straight into bukkit with bytebuddy :3
would this require me to take the config code out and add this etc
lets just dont discuss about how intellij makes my method haha, you guys want to get your right and i want to have my right
Database would replace the config, yes
what do you want to store in your database?
the cratelocation logs etc
oh yeah for sure it would replace your config
i mean, a config you use almost only for messages like 'you cant do this sir!'
wonky advice
Or the actual config of the plugin
As is in the name
Configs IMO should be read-only
You can toss whatever configurable values you need there, like database credentials, messages
the config only does this for me
crateLocations:
- Spawn,10,66,12
- Spawn,-15,66,12
We use configs at work for "entity templates"
except we do it in toml because we're quirky
🤓
Nice follow range
toml my beloved
Man I want to be able to have a generic custom NMS entity class where I think just pass in the type
The problem is synced data values
I wish we had Polymer for bukkit
That can go onto my list of projects I'll never finish
this isnt ideal i assume then
I could do some janky stuff to get a map of entity type -> synced data values
what filetype is that again?
toml
kk
any math nerds in here? how can i easily tell if one of 2 large numbers is divisible by another
let's say 4123 and 12345 divisible by 3
isn't it fairly easy to if-check
i need to do this on paper not in a programming language
in programming i just do 4123 % 3 == 0
as in sum of the digits of the number?
yes, that is one way wiki suggests
let's test
4+1+2+3 = 10
so not divisible
10 isn’t divisible?
oh yeah
it does check out for the other
10 is not divisible by 3
not without a remainder of 1
i'll write a small program to check if this works for a long range of numbers so it's not just luck
yeah, 10 is divisible by 1, 2, 5 and 10
but not 3
anyway, i gotta write the small test now brb 😄
The 13 rule is a little useless but whatever
this is the funniest
i assume there is no easy route to find prime numbers
i'll just gamble and say 37 is prime
I think if you were to find one you would get a Nobel Prize :D
hopefully i won't have to memorize all of these
that is if i'm becoming smart enough
but even then it's not guaranteed 😦
the only algorithm for finding prime numbers is to check each number against all the numbers below it, but that's n^2 it won't go far
lol
or if i'm thinking about it, a number that's higher than half of n cannot divide it anymore
You only need to check up to the square root of N
You can also skip even values of N
so there are smart ways to reduce the complexity further nice
but imagine pluging x in a constant function that tells you if x is prime
that'd be the dream
or even better having a function that can give you the prime number by specifying its position in constant time
Does anyone know where to find the repo for the newest plotsquared version?
PlotSquared - Reinventing the plotworld. Contribute to IntellectualSites/PlotSquared development by creating an account on GitHub.
What link exact link would I need to use to make it work with The repository thing from gradle?
Ive never used repositories before...
thx
If you want to check if any two numbers are divisible by another, use the advanced euclidic algorithm
If the outcome is 1 they are not divisible by another
it's used to get the highest posibble divider
let me check
This is a bit over my head
You can get gcd pretty simply with recursion
public int gcd(int a, int b) {
if (b==0) return a;
return gcd(b,a%b);
}
Obviously big runtime footprint tho
Pretty sure theres a better way of doing it with a tree and BFS search but thats a pain to implement
does EntitySpawnEvent cover absolutely all entity spawns?
like world loading, chunk loading etc
I don’t know if it covers mobs spawned during worldgen
guess not
if (event.getCurrentItem().getCustomModelData() == 1) {```
what am i doing wrong here?
`getCustomModelData` is red. I've imported everything needed
ModelData is on the Meta
send ip[
Huh? So what am I doing wrong?
you need to get the ItemMeta
?jd-s
declaration: package: org.bukkit.inventory, class: ItemStack
tbf we have the custom texture path now
which is far superior so like custom model data more like custom mid data
Well
The new custom model data can actually do wild stuff
But yeah for just changing a static model item_model is much better
why
cAN model data be null
phat int
I’ve developed a new distain for primitives/wrapper types after working with arrays
You can’t just rely on autoboxing/unboxing for arrays
Generics also suck in this situation
is there a backup for https://wiki.vg/Protocol ?
It’s on the minecraft wiki now
wiki.vg, a wiki that documents Minecraft's protocol extensively, was sunset on November 30, 2024. As the announcement posts reads, "The final content will be archived and made available for download in MediaWiki's XML export format under the CC-BY-SA license, along with an archive of images and other media." The sunsetting announcement can be re...
thanks
this is when one just codegen to not have to manually make a separate method for each primitive lol
asd
what happened to coll1234567890
they accepted their fate and changed their username to match the forums'
also, weren't you already in this server, why is the new leaf icon popping there
rejoin
I assume that was the case, my question was more aiming at why they left in the first place
I believe they got banned or something
oh
got banned
and unbanned
"harrassing and doxxing"
just don't harras and dox bro 👍
that time when i asked why machinemaker had "Paper > Spigot" on his status
well, you don't have to go into details, don't wanna get banned again for questioning punishment or something lol
js read the chat ig lmao
does someone know how to use the method
getAddEntityPacket on a NMS-Entity with the argument ServerEntity ?
i dont know how to get the ServerEntity obj
Easier to just make the packet yourself tbh
I believe the server entity is made somewhere in the entity tracker
^^ it is
what entity tracker ?
ChunkMap class
Though it appears Paper modifies that system quite a bit
so that might not be correct for Spigot as well*
it got a little bit complicated with packets and stuff in 1.20 to 1.21 i guess
?xy
there is no api for custom entities oOo
Yeah but you don’t need to worry about ServerEntity for that
but the serverentity is the player for who i am spawning the fake player right ?
No
The ServerEntity is the object that’s used to track what players can see the entity
The player you are spawning it for is… whatever player you want to spawn it for
uff uff
yes
then you don't need to do all of this
nowadays the easiest way to go about that is just spawning a normal entity and intercepting the metadata packet to change the entity type to a player
hmm problem is that i want to update the old stuff where i created completly custom entities that allow /summon and so on
what does allowing /summon mean
/summon test:newentity instead of /summon zombie
for example
this allows also some interaction with the API and other stuff too
the easier way to go about that would probably be to intercept the summon command instead of relying on modifying the register which ends up being quite hacky
you can interact with the API just fine with what I said since it is an actual entity on the server side, not a fake entity
it is just disguised as a player
is there a reason you want it to be summonable by the command though?
i was using your method before but something didnt worked like expected i think ...
Problem is synced data values
Different entities have different ones
So if the underlying entity doesn’t have one that a player does, it’ll never sync properly
this could be true ... there was a field that had wrong type and spammed errors on clients
Granted idk what synced values a player has, I’ve never looked
I don't think there's much of an issue with it? I've seen people spawn zombies disguised as players just fine
let me try it I guess
Those probably have most of the same values
Zombies have armor, can hold items, can have a left or right main hand
the zombie would get attacked by iron golems for example
if you remove the attack villager pathfinder goal, will it still be attacked by golems I wonder
Is it possible to access a sqlite database from a different plugin than it was created in? I have access to the whole server file directory from it, so I don't see why not, just wondering if there's anything preventing me from doing that or otherwise if it's bad practice
Yes
is it possible? Yes, is it recommendable? Depends
if it is a database that some random plugin created and you just want to share it, probably not
if it is from a plugin you have control of and you want to share the database between different plugins then sure
Seems players have a few unique synced data values
DATA_PLAYER_ABSORPTION_ID
DATA_SCORE_ID
DATA_PLAYER_MODE_CUSTOMISATION
DATA_PLAYER_MAIN_HAND
DATA_SHOULDER_LEFT
DATA_SHOULDER_RIGHT
I want to create a central core plugin that allows different plugins to share common data (stuff like player stats and what not)
and another thing was to call the tick method manually ...
So the two shoulder entities, the main hand, and whatever the first 3 are
Also Zombies have some synced values that the players don't, which is probably what causes the log warnings
that should be fine
those warnings dropped the fps too
there's no way a warning drops fps lol
but then again, since you are already intercepting the metadata packet, it is just matter of intercepting the synched data values as well anyway
not for 1 entity .... but for 100 entities for every packet that was wrong it did
just how many npcs are you spawning
they are there for fighting ^^
like pvp bots?
exactly
can anyone guide me in the right direction of how i can use pathFinding stuff in a paper project? i think it has something to do with dependencies but honestly i have no idea
?whereami
arent paper plugins vertially identical to the devs pov?
what kind of pathfinding stuff?
lemme find the video that goes over it, im just looking to pretty much make a custom pet
also i was not aware of that
well, thats advanced NMS stuff
á la fucking with the minecraft code
that is nothing you really want to do yet if you have clearly no expertise in that area
well in that case are there any other options for a custom pet?
paper has a pathfinding class which might do the job for you https://jd.papermc.io/paper/1.21.3/com/destroystokyo/paper/entity/Pathfinder.html#moveTo(com.destroystokyo.paper.entity.Pathfinder.PathResult)
otherwise there are pathfinding libraries like pathetic
pathetic is a wild name for a pathfinding lib lol
It sure is pathetic
is there a way to get damage dealt in entitydeathevent where the killer is a player?
I want to detect when a player does 500+ damage with a mace in the death event
getLastDamage
thanks!
How do I get all advancements? I got Bukkit#advancementIterator but that also includes recipes, I want only advancements
seems like those that have getDisplay set to null are advancements, got it
I mean, they are all advancements
The recipe ones are just hidden and used to unlock recipes
Does anyone know how to make a local maven repo? I have some plugins that have stored information and I need to connect them in some way. I want to make a little API. I think maybe Github Packages might be the right direction? Idk I'm new to this lol
You already have a local maven repo
mavenLocal is just files on your harddrive
On windows the default is C/users/youruser/.m2
Hmm maybe I don't know terminology well enough to fully articulate what I'm trying to do then
Essentially I have two plugins. I want plugin a to depend on plugin b, and I want to have a package for plugin b in plugin a that allows me to access it
so like if I had a class, say ClassB in plugin b with a static method "test()" I should be able to call ClassB.test() in plugin a
I want to fully import it in, but through github
I think jitpack allows you to use GitHub repos as maven dependencies
Though setting up a proper repo or just using mavenLocal is easier
what is a proper repo? Would this allow me to connect 2 plugins together?
I mean, you can even connect them together just using jar dependencies
A proper repo would be a maven repo like the one spigot uses, you just need a system to host it on
And some software like reposlite
So let's say I did this, right, would they work in tandum on the server? If I connect them together with jar dependencies, would plugin a be able to access the same data from plugin b?
Could there be a size issue?
No
Jar dependencies don’t affect the size
You aren’t combining them, you are just telling your IDE that the code from plugin b should be available to plugin a
You also should add depend: [PluginB] to the plugin.yml of plugin a
I see, alright. Cool
To be clear, is there any other way for me to combine two plugins by having one plugin depending on another and having a gradle import, but without manually having to combine the jars?
Publish it to you maven local and import it that way
is there something wrong with 1.21.4 mojmap
I just built it fine, and it is on the maven repo but it is failing to find it for some reason
even though it does fine with 1.21.3
Did you use the remapped flag
it did say this:
[WARNING] Failed to download maven-metadata-minecraft-libraries.xml [https://libraries.minecraft.net/]
What does World.getHighestBlockAt(int x, int z) return if theres no blocks at all in the column
min world height?
Try it and find out, docs don't say what happens in that case
I tried looking at the code but it is pretty complex so yeah, just gotta try it out
Hey everyone, does anyone know how to make an entity attach to a player's back(torso) in the same way that the MCCI devs did?
They’re using armor stand and mount them on players
but how does it copy the player's torso rotation
Why it don't work?
Only the prefix works but nothing around it.
public class MainConfig {
public static String prefix = getString("chat.prefix");
public static String getString(String path) {
return Main.getInstance().getConfig().getString(path);
}
public static int getInt(String path) {
return Main.getInstance().getConfig().getInt(path);
}
public static boolean getBoolean(String path) {
return Main.getInstance().getConfig().getBoolean(path);
}
public static double getDouble(String path) {
return Main.getInstance().getConfig().getDouble(path);
}
public static long getLong(String path) {
return Main.getInstance().getConfig().getLong(path);
}
public static List getList(String path) {
return Main.getInstance().getConfig().getList(path);
}
public static void set(String path, Object value) {
Main.getInstance().getConfig().set(path, value);
Main.getInstance().saveConfig();
}
public static Boolean init() {
boolean bool = true;
try {
Main.getInstance().saveDefaultConfig();
} catch (Exception e) {
bool = false;
}
return bool;
}
}
The error message is this:
java.util.UnknownFormatConversionException: Conversion = 'l'
at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:105) ~[purpur-api-1.20.4-R0.1-SNAPSHOT.jar:?]```
I have the problem:
The PlaceholderAPI don't do the job
?paste your AsyncPlayerChatEvent listener
what is your chat.format string?
chat:
# The Chat Formatting
format: "%luckperms_prefix%§7%player%§r%luckperms_suffix% §7» %message%"
all your .replace are wrong
What do you mean?
.replace("%prefix%",But in yrou actual format its%luckperms_prefix%
Yes but I want to test the PlaceholderAPI and it doesn't works and I don't no why
I found the problem:
I didn't install Luckperms as Placeholder
But %prefix% works fine
[19:19:03] [Server thread/ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'MythicMobs-5.7.1.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.RuntimeException: Error resolving libraries
When i start my paper sever it says this can someone help me
The error tells you the issue
but i dont know how to fix
should i install the spigot one?
Go plugin page and see what dependencies the plugin have
If you are using spigot u should yeah
how to play specific cave sound (for example cave sound 2)?
wdym
the playSound method can take a number as a seed
Which determines which random sound is played for sounds that have multiple possibilities
Idk, trial and error I guess
it worked, thnks
I have a custom config problem:
I have some language files but my plugin don't find any string.
Can someone help?
It returns every time null
How do I get the default name of an item? E. G. "Diamond chestplate"?
use "languages/" not language folder + "/"
it will also save it to the same location in the data folder
actually, /languages/
that doesnt matter
okay have you ever had it not work without the starting slash using saveResource
oh, saveResource
In line 26
@cedar saffron boy you up?
So?
private static final File languageFolder = new File(Main.getInstance().getDataFolder(), "languages/");
public static Boolean init() {
try {
if (!languageFolder.exists()) {
if (!languageFolder.mkdir()) {
return false;
}
}
for (String languageCode : List.of("de", "en", "esp", "fr")) {
if (!getLanguageFile(languageCode).exists()) {
Main.getInstance().saveResource(languageCode + ".yml", false);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return true;
}
so add debug statements
Make the armor stand follow player's head
It is around
langConfig.load(langFile);
String message = (langConfig.getString(path) == null ? "" : langConfig.getString(path));
if (usePlaceholderAPI) {
message = PlaceholderAPI.setPlaceholders(player, message);
}
return message;
Because it is ""
But in the configuration it is "§aTest message"
why are you returning a boxed primitive
print langConfig.getValues and see what the values the server has are
How do I get the default name of a material? E. G. "Diamond Chestplate"?
use a translatable
if you cant (choco where component pr) you either have to make it urself or get it from the language file urself
For hoverable, clickable, hex colored, or otherwise complex text, use the component API. Documentation can be found here:
https://www.spigotmc.org/wiki/the-chat-component-api/
How can I make this?
System.out.println(langConfig.getValues());
if you dont know how to println i think you should go back and learn java
so look at the file its saved, if thats empty use debug statements to figure out whats causing it to be empty
The files are not empty
is 1.21.4 craftbukkit version 1.21.R2 or R3
r3
1.21.3 is r2
i was under the impression that 1.21.3 was replaced by .4
nah .4 is a new version
cool cool
1.21.0 and .1 is R1, .2 and .3 is R2 and .4 is R3
I have the error: the MySQL entry was wrong
?paste the full error
No it wasn't a error
it was a wrong entry
A file that IS empty
so why say i have the error, put your full class on a paste then
Yurr
Any of y'all nerds ever experienced any issues when copypasting code?
I have code in plugin A that runs perfectly fine
I copy-pasted it into plugin B and now mythicmobs refuses to spawn mobs
If I switch back to plugin A it works
(they both just run a command on a timer)
schrodinger's code
Is it recommended to use ticks instead of System#currentTimeMillis?
When keeping track of timers and stuff
Anywhere it’s possible
i mean, it depends
if the timer is walltime-based or tick-based
e.g. if something runs based on in-game time or actions (in-game midnight, custom effect durations etc), vs "just do something in one hour"
hi anyones knows
If I have a special plant that is harvestable every 20 min and I need to throw in a BukkitScheduler#runTaskLater to give a notification when it’s ready to harvest, should I use milliseconds for the cooldown timer and ticks for the notification delay, or should I change the timer to ticks too?
how to measure the mspt on bukkit ?
im using a simple method, but cannot use paper and bukkit api same time getting error
this is my function : new BukkitRunnable() { @Override public void run() { long currentTime = System.nanoTime(); long timeTakenForTick = currentTime - lastTickTime; // Time in nanoseconds lastTickTime = currentTime; mspt = timeTakenForTick / 1_000_000.0; // Convert to milliseconds , but i dont know if am i right, not sure how to proper measure it.
You should keep it consistent.
If your underlying system relies on ticks, then use ticks.
Otherwise, if the server is lagging behind and you send out notifications in real time, the notifications will be ahead of schedule.
all my timer logic is based around ticking and tickables
Any one experience with factions ? want to create a server and need someone who’s knows how to setup everything has portfolio of previous work of factions , good pay if you follow through
should you add enchatnments to meta or itemstack
what do you mean cloning?
getItemMeta returns a copy
oh
yeha
you mean that calling addenchantment on itemstack
call getItemMeta() anyway
or what
kinda yea
I wanted to use the setDamage method because the setDurability method is deprecated. Unfortunately, it is not recognized. Here is my code: // Gérer la durabilité via Damageable
if (meta instanceof Damageable damageable) {
int maxDurability = bow.getType().getMaxDurability();
int damage = (int) ((1 - (durability / 100)) * maxDurability);
damageable.setDamage(damage); // Appliquer les dégâts
bow.setItemMeta((ItemMeta) damageable); // Sauvegarder le méta modifié
} Spigot API version 1.20.4-R0.1-SNAPSHOT
Which part isn’t being recognized? I assume the meta instanceof line?
setDamage
Make sure you're using meta Damageable and not the entity one
I will verify this.
The cast at the end makes me think you're initially casting to the wrong one
Because otherwise you wouldn't need that cast
I used to have a working if statement under my command: if (args.length >= 4) do this, but now even the idea says that args.length is never >= 4 and the same code just doesnt work anymore
I have a code
if (args.length >= 4) {
}
Even if I run the command and type 4 or more arguments it just doesnt satisfy the if statement
sounds like something else would run when that happens
It used to work
Send the entire code
No nothing runs literally
?paste
seems like you should just use a command framework
I think we need the whole.... yeah
https://paste.md-5.net/tetemazoro.java
Its very messy rn
But yeah xd thats the whole class
Here's your problem
what else do I do?
I mean double check you're actually doing everything correctly
look at the compiled classfile or sth
if i sent a vid could someone help me out
with what
?paste the error
the error makes sense
but when looking at my code it doesnt
its just a cast exception
show the error anyway
what video
i could just make one rq
nah
Send the code and error
the whole StorageComponent class
yes
always paste code and stacktraces
👍
whats DataTypeImpl
What is IPDCKey
Send it
thank you so much for helping btw guys
perhpas you guys wanted to see this aswell
im getting slightly confused about how ur getting this error
public @NotNull EnumMap<DataTypeImpl, Float> toEnumMap() {
EnumMap<DataTypeImpl, Float> enumMap = new EnumMap<>(DataTypeImpl.class);
for (Map.Entry<DataTypeImpl, AbstractDataType> entry : this.getMap().entrySet()) {
enumMap.put(entry.getKey(), entry.getValue().getAmount());
}
return enumMap;
}
thats what i been saying
it makes ZERO sense
Could you show AbstractDataType
yes
@Getter
@Setter
@AllArgsConstructor
public abstract class AbstractDataType {
private final DataTypeImpl dataType;
private final int multiplier;
private float amount;
}
also double check that the jar you're running is up to date
it is it is
Attach a debugger and step through what happened
you can do that with mc plugins?
ofc you can
yeah
?debugging
watchdog gets a bit annoyed but ye
smh no command
Can be disabled
yeah
how do i do that
Are you using gradle or maven?
Are you using the paper userdev plugin?
yes
then it's already builtin for you
ah right I forgot it's a separate gradle plugin
I always use the paperuser dev test plugin
run server from jnp
which as it by default
could u link that
id("xyz.jpenilla.run-paper") version "2.3.1"
do i replace the regular paperdev or na
run task depends on paper userdcev if you want to run the dev bundle server
though most times that isn't necessary
You can use this as a reference for a project setup
do they have a java 17 version
i cant it will; break
what version are you developing against
1.19.4
a newer JDK can compile against an older Java version
It's fine
use a newer gradle version
^^
latest is 8.11.1
idk how to update it
you can change it in the gradle/gradle-wrapper.properties file
kk thx
Just change the version in the url
if you want to be extra safe run the wrapper task after
gradlew wrapper --gradle-version=8.11.1 to update and create the new wrappers
^^ that does both in 1 command
the task will fail since the jvm version was changed
^^ So run wrapper task after
aighty
if it ends up shitting on itself, change it back to 17, update gradle and only then update java
I doubt it will but in case it does
what is that error
i have no idea let me restart intellij
does anyone know how i can change the max speed of minecarts without them derailing?
What version are you on
1.21.1
How are you currently changing the max speed?
im using an event handler, when an minecart entity is created it just does minecart.setMaxSpeed(24.0);
only gives me that error when i have the jpenilla plugin
is there another way to debug
this error is so annoying theres literally nothing wrong with the code i think its a java bug
Doubt
anyways run paper is the easiest way of debugging
It also allows for hotswapping
does it hit breakpoints n stuff?
you can also debug by making a run config, adding the cmd to ur server script then starting that debug thing when the server starts
yes
does it support dependancies
yes
bruh whats wrong with it whys it not working
"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.
Any chance you could put the project on Github
scroll up
no thanks
ah im not the "leader" of this project, its a private one unfortunately sorry about that
(CLICK ME)[#help-development message]
Can you share only your build files then
tf is that format
sure
should i send the build.gradle.kts
yes
yes
?paste
it is commented out
i know
use gradleup shadow
i commented it out cuz it wouldnt build
error?
how is that relevant
this is the error rad
johnrengelman shadow is outdated and does not worky with java 21
that is not the full error
show the full error
it was the full error
ight i will after sec
Yeah update shadow
also this is redundant, userdev should already take care of this
build {
dependsOn(reobfJar)
dependsOn(shadowJar)
}
and for your plugin.yml I suggest using the resource factory plugin
Like shown in the test plugin I linked earlier
it seems to have built now with jpenilla
i updated paper userdev from 1.5.5 to 1.7.7
and it seems to work
although the run configuration is still missing
I was about to ask if that was up to date
There should be a run paper task
but since you haven't run it before it won't be in your existing run configurations
oh on github it says u need to manually add it
tasks and run configs are different
a run config can be created to run a task, ij will create a run config once youve ran a task once
regular is fine
doesn't make a difference with regular paper
It will shut itself down the first time
You need to accept the EULA just as with any server
ah yeah
i'm surprised anyone helped you this much in the spigot discord for paper stuff
fr
it feels like it should be 2 am or smth
oh yeah thank you for the tip
also since you have compileOnly dependencies you'll need to place those plugins in the plugins directory
If you want you can specifically allow those to be version controlled
you can
but it's more work than it's worth
no?
i mean it depends on stuff that arent on modrinth
is it running as a debug run with a break point setup
For Spigot plugins
oh nah let me make one, where shall i place the break point
though ig you could use Spiget
You can tell it to make one on the exception
kk
theres ai on my github homepage now, this is getting ridiculous
There’s ai on my ai
hi coll
yea
there is why
i don't even use it
have you seen those copilot laptops
...why would I want that
with a copilot button
absoluté bullshité
to see all those linux commits
™
so you can update ur arch fork
how do i op myself
/op?
the terminal is read only
intellij run debug
you definitely can
the uwuboykisser arch
provided your cursor is in the correct location
that still leaves room for 28 forks
that doesnt look like intellij
are you sure you clicked the down arrow on the right side
it is
i hit my breakpoint but not at the right time hmm
let me set it up rq
oh the world isnt savng
?
lol
idk bro shits just mad annoying not working idk why
like what is this dumbass error anyway
Take a break
what dumbass error
is com.himerarp.computer3.pc.impl.component.storage.StorageComponent a class of yours
also that is... a package lol
Is there an elegant alternative to Paper's getTPS method using Spigot API?
yeah its a class of mine
what is at line 54 of that class
nah i doubt its lombok in the code
in the stack trace what does it say it is
i dont have it open
at com.himerarp.computer3.pc.impl.component.storage.StorageComponent.getItemStack(StorageComponent.java:54) ~[RPComputer3-1.0.0-SNAPSHOT.jar:?]
getItemStack
ah ok
not really, no
@Override
public @NotNull ItemStack getItemStack() {
ItemStack itemStack = super.getItemStack();
itemStack.editMeta(meta -> StorageKey.DATA.set(meta, this.data.toEnumMap()));
return itemStack;
}
but what are you doing with it
I think this might just be the same error as the other time
you have an item with old pdc
what does super#getItemstack return
public @NotNull ItemStack getItemStack() {
ItemStack clone = itemStack.clone();
clone.editMeta(meta -> {
PCItemKey.ID.set(meta, this.getItemId());
PCItemKey.ITEM_TYPE.set(meta, this.getItemType());
if (this instanceof WearableComponent<?> wearable) {
WearableKey.LIFETIME.set(meta, wearable.getLifetime());
WearableKey.WORN_OUT.set(meta, wearable.isWornOut());
}
if (this instanceof PCComponent component) {
ComponentKey.POWER.set(meta, component.getWattage());
ComponentKey.BROKEN.set(meta, component.isBroken());
}
});
return clone;
}
hold my org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl.factory
hm, you're only setting for this, not getting
unless those Key setters are getting the value in order to set it
default <T> void set(@Nullable PersistentDataHolder holder, T value) {
if (holder != null) {
PersistentDataType<Object, T> type = this.getType();
holder.getPersistentDataContainer().set(this.getNamespace(), type, value);
}
}
yeah it gets
yeah but from the object itself, not the given pdc, so it shouldn't be an issue
what does wearable#get whatever do
does it get anything from the pdc itself?
same for PCComponent
eh, let's just walk through the stack trace
alright
what is PCCaseLargeGUI 54
lemme checkl
com.himerarp.computer3.pc.impl.pc_case.gui.PCCaseLargeGUI.lambda$setupComponents$1
@Override
void setupComponents() {
this.componentMap.forEach((s, pair) -> {
@Nullable List<? extends PCComponent> components = pair.getRight();
OutlinePane pane = pair.getLeft();
for (int i = 0; i < (pane.getLength() * pane.getHeight()); i++) {
GuiItem guiItem;
if (components.size() - 1 >= i) {
guiItem = new GuiItem(components.get(i).getItemStack(), this::getRemoveComponentAction);
} else {
guiItem = new GuiItem(new ItemBuilder(Material.BARRIER)
.displayName(Component.text("Empty " + s + " slot", NamedTextColor.GRAY))
.build(), event -> event.setCancelled(true));
}
pane.addItem(guiItem);
}
});
}```
yeah, doesn't look like the error would be there
can you send the nbt of the item which causes this
it is whatever item was at slot 31
kk
oh thats just the
ehh
sec
its just a barrier block
in the gui
waiting for a component to enter
i dont think it would have nbt
can u create a pr to JAVA
lmao what
surely its a java bug
hello guys, i am currently trying to upgrade my server from 1.20.x -> 1.21.4, I downloaded the build tool "java -jar BuildTools.jar --rev 1.21.4" and tried to launch with --forceUpgrade as ab arg. After the server launched the version was still on 1.20.x. Would really appreciate your help :)
what does PCComponent#getWattage return and what does ComponentKey.POWER expect?
sec
i doubt this is where the errors would be
that's the only one that would ultimately expect a float in that code
i mean the pc case gui large allows every item except storage
get wattage is just lombok, ComponentKey.POWER expects integer
well one of those keys has the wrong PDT, because somewhere you're passing a float but it is expecting AbstractDataType, it seems like generics gone wrong on this one
my recommendation is to put some breakpoints in the set methods of ComponentKey and WearableKey
just to see which type is being passed, and what is expected
oh so should i look thru which key expects AbstractDataType
yeah
dude ive already removed all that like execution just stops after it hits it oncer
( i dont think any expect it but ill check )
ill show u which key i think causes the problem
@RequiredArgsConstructor
@Getter
public enum StorageKey implements IPDCKey {
DATA("data", DataType.asEnumMap(DataTypeImpl.class, DataType.FLOAT));
private final @NotNull String key;
private final @NotNull PersistentDataType<?, ?> type;
private final @NotNull RPComputer3 instance = RPComputer3.instance;
}
this one right here
that sounds like a #help-server problem, but just to answer, did you switch out the jars properly?
itemStack.editMeta(meta -> StorageKey.DATA.set(meta, this.data.toEnumMap()));
this is where it errors cuzz toEnumMap is tryna cast or smth>
public @NotNull EnumMap<DataTypeImpl, Float> toEnumMap() {
EnumMap<DataTypeImpl, Float> enumMap = new EnumMap<>(DataTypeImpl.class);
for (Map.Entry<DataTypeImpl, AbstractDataType> entry : this.getMap().entrySet()) {
enumMap.put(entry.getKey(), entry.getValue().getAmount());
}
return enumMap;
}
thats to Enum Map
since your saying it, i totally missclicked the channel xd, i downloaded the jar, deleted the old one, replaced it, and it build me a spigot folder
what is asEnumMap
that's clearly a Float cast to whatever there
lemme check
asEnumMap is from more pdc
static <E extends Enum<E>, V> MapDataType<EnumMap<E, V>, E, V> asEnumMap(@NotNull Class<E> enumClazz, @NotNull PersistentDataType<?, V> valueType) {
return asGenericMap(() -> {
return new EnumMap(enumClazz);
}, asEnum(enumClazz), valueType);
}
what AbstractDataType#getAmount return ig
@Getter
@Setter
@AllArgsConstructor
public abstract class AbstractDataType {
private final DataTypeImpl dataType;
private final int multiplier;
private float amount;
}
it is in fact a float so why smh
a float! thats why this whole thing should work!
BUT IDK WHY IT DOESNT 😭
why was the thing triggered on a barrier block when the gui object is PCCaseLargeGUI
yeah I'm lost on this one, I feel like there's clearly somewhere things went wrong however it isn't immediately clear where from my perspective lol
Yeah which is why I recommended using the Debugger
neither, ive tried to use claude aswell but no luck
AI won't help you here
ultimately it is about the data you have
so there's somewhere that the input isn't what is being expected, a debugger will definitely let you find out which input exactly is that
what is this.data here?
also, just to try something, can you chagne this to:
EnumMap<DataTypeImpl, AbstractDataType> enumMap = new EnumMap<>(DataTypeImpl.class);
for (var entry : this.getMap().entrySet()) {
enumMap.put(entry.getKey(), entry.getValue());
}
hm? Here's the cast nvm
@proper cobalt ^^
well, try to do what I said just to see if an error pops up elsewhere
yeah kk
What is getMap
if it wants an AbstractDataType map, lets give it an abstract data type map