#help-development

1 messages · Page 1189 of 1

grave depot
#

getCommand("yourcommandhere").setExecutor(new Yourcommandclasshere));

#

something like that @jade oasis

#

and register the command in the plugin.yml also

jade oasis
#

its already registered in that which is why im always confused but oh well

chrome beacon
#

In the plugin.yml only isn't enough

#

Need to set the executor too

jade oasis
#

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

grave depot
#
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
young knoll
#

Objects.requireNonNull is so strange

#

It just slightly moves the exception

grave depot
#

i always use that

#

idk saw it somewhere and since then use it, if i dont use it it also gives a warning

young knoll
#

That’s just IntelliJ being annoying

jade oasis
#

@chrome beacon plugin now not working at all 💀

grave depot
#

send your main class and the error

#

and maybe the plugin.yml

jade oasis
grave depot
#

yes and where do you register the command in your main?

jade oasis
#

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");
grave depot
#

and the error?

chrome beacon
#

Should be an error in the console telling you why it's not loading

jade oasis
#

let me reload it see if i can find the error for that then

grave depot
#

so in other words, the command should work because you properly register it

smoky anchor
grave depot
#

when you insert, remove or update your plugin file always turn off the server

smoky anchor
#

-# I wrote my plugins to specifically support this, I still however do not recommend it lul, I know few things that can break horribly

jade oasis
chrome beacon
#

Yes but the full error

jade oasis
chrome beacon
#

Are you making a new instance of your plugin

smoky anchor
#

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

jade oasis
jade oasis
young knoll
#

You can’t do that

#

Calling new MainClass() at any point will break

jade oasis
#

i only have 1 main class i think im getting myself confused here

smoky anchor
jade oasis
smoky anchor
jade oasis
#

surely it cant be the config being the main issue

chrome beacon
#

It's not

smoky anchor
#

It's probably not, but you're doing something unnecessarily. In a non-standardized way.

chrome beacon
#

the main issue is you making a new plugin instance

jade oasis
chrome beacon
#

what's "that"

#

because the code you've sent either doesn't compile or is missing parts of it

grave depot
#

why would u even use a config besides of message storage

#

you dont store inventorys in their

#

maybe for small number storage

#

or booleans

chrome beacon
#

eh it's fine

#

They're still learning

grave depot
#

haha

young knoll
#

Wait until you learn how most games store data

jade oasis
young knoll
#

It’s usually either xml or similar, or some actual binary format

grave depot
#

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

jade oasis
grave depot
#

i will show my code in a second

#

so you can look at it and maybe see your fault

jade oasis
#

i cant promise you that i might see it cause i am known to not see mistakes unless pointed out but ill try

jade oasis
chrome beacon
#

none of those is what you want to do

jade oasis
#

i tried 1 and thats when i tested it on my server maybe thats why

chrome beacon
#

you made a new instance of your main class

#

which you cannot do

jade oasis
#

what can i do to fix it

grave depot
#

remove it

chrome beacon
#

Pass your existing instance

#

Don't make a new one

grave depot
chrome beacon
#

Not relavant here

jade oasis
#

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

chrome beacon
#

Yeah

#

AddLocationCommand expects a param

#

and that param is an instance of your main class

jade oasis
#

so remove AddLocationCommand?

smoky anchor
#

no

chrome beacon
#

No

#

I've already told you what to do

smoky anchor
#

You really don't want to 🥄, do you :D

chrome beacon
#

🔫 You better not spoon this

jade oasis
#

yh ill be honest i dont really know where im looking for this instance im really being stupid

shadow night
chrome beacon
#

Yeah it's obvious someone skipped the learn java part

jade oasis
#

aint wrong about that 1

#

when i asked someone what to learn they only sent me a video thing for spigot...

young knoll
#

?learnjava

undone axleBOT
#

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! 🎉

chrome beacon
#

?learnjava

undone axleBOT
#

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! 🎉

young knoll
#

Oh god double text wall

chrome beacon
#

💀

jade oasis
grave depot
#

Please watch those 2 channels first

#

and learn from there

#

they explain you everything to do

smoky anchor
shadow night
#

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

echo basalt
#

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

jade oasis
grave depot
# jade oasis https://gyazo.com/fe2f609cfb2c62b51eaf7f096afbe072 at all on about this ?
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;
    }
}
smoky anchor
#

oh hell nah
testcommand

echo basalt
#

dawg at least follow naming conventions

smoky anchor
#

String s
what is "s" HMMM

chrome beacon
#

strings

#

💀

echo basalt
#

s stands for string

#

fym

smoky anchor
#

oh tyty

shadow night
grave depot
smoky anchor
#

And even if you provide the registration of the command, it will not help the guy solve his problem

echo basalt
#
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

smoky anchor
#

There you go

chrome beacon
grave depot
chrome beacon
grave depot
#

where can i post screens

undone axleBOT
#

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

echo basalt
#

I wrote that from memory btw

young knoll
#

Sometimes the IDE will generate an override with just single letter variables names

jade oasis
#

fixed it

chrome beacon
#

Usually fixed by downloading sources and documentation

jade oasis
#

@grave depot what was this database thing you was telling me to use? or learn

jade oasis
#

any videos or anything i can use to learn that stuff

chrome beacon
#

Tell it to download the docs

grave depot
grave depot
#

if i know that s is my label

chrome beacon
#

1 button if your project is setup correctly

grave depot
#

then its good

#

lmao

chrome beacon
#

And you get proper docs inside of your IDE

grave depot
#

wait

echo basalt
#

we follow that logic and drop all standards because I understand my own code and that's enough

grave depot
smoky anchor
#

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

echo basalt
#

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

jade oasis
grave depot
smoky anchor
grave depot
#

what do you want to store in your database?

jade oasis
#

the cratelocation logs etc

grave depot
#

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!'

echo basalt
#

wonky advice

smoky anchor
#

Or the actual config of the plugin
As is in the name

echo basalt
#

Configs IMO should be read-only

#

You can toss whatever configurable values you need there, like database credentials, messages

jade oasis
#

the config only does this for me

crateLocations:

  • Spawn,10,66,12
  • Spawn,-15,66,12
echo basalt
#

We use configs at work for "entity templates"

#

except we do it in toml because we're quirky

young knoll
#

🤓

echo basalt
young knoll
#

Nice follow range

blazing ocean
young knoll
#

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

echo basalt
#

:(

#

imagine not making ECS

blazing ocean
#

I wish we had Polymer for bukkit

#

That can go onto my list of projects I'll never finish

young knoll
#

I could do some janky stuff to get a map of entity type -> synced data values

zealous osprey
young knoll
#

toml

zealous osprey
#

kk

lilac dagger
#

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

echo basalt
#

isn't it fairly easy to if-check

lilac dagger
#

i need to do this on paper not in a programming language

#

in programming i just do 4123 % 3 == 0

echo basalt
#

you can see if the sum of all numbers is divisible by 3

#

which doesn't help

lilac dagger
#

i don't wanna do long division

#

oh well, i'll look on the internet

lilac dagger
smoky anchor
#

yes, that is one way wiki suggests

lilac dagger
#

let's test

smoky anchor
#

4+1+2+3 = 10
so not divisible

lilac dagger
#

yeah, i tested that and it seems to work

#

one sec for the other

worthy yarrow
#

10 isn’t divisible?

lilac dagger
#

oh yeah

#

it does check out for the other

#

10 is not divisible by 3

#

not without a remainder of 1

worthy yarrow
#

Oh I see lol

#

I was like there are ways to divide 10 wtf

lilac dagger
#

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

worthy yarrow
#

Yea ofc

#

I just hadn’t seen that part

lilac dagger
#

anyway, i gotta write the small test now brb 😄

sterile axle
#

In case you want more rules like that

lilac dagger
#

nicee 😄

#

i'll save this

sterile axle
#

The 13 rule is a little useless but whatever

lilac dagger
#

this is the funniest

#

i assume there is no easy route to find prime numbers

#

i'll just gamble and say 37 is prime

smoky anchor
#

I think if you were to find one you would get a Nobel Prize :D

lilac dagger
lilac dagger
#

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

young knoll
#

You only need to check up to the square root of N

#

You can also skip even values of N

lilac dagger
#

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

wintry anvil
#

Does anyone know where to find the repo for the newest plotsquared version?

blazing ocean
wintry anvil
wintry anvil
#

thx

pliant topaz
#

If the outcome is 1 they are not divisible by another

#

it's used to get the highest posibble divider

lilac dagger
#

let me check

lilac dagger
#

This is a bit over my head

drowsy helm
#

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

lilac dagger
#

thanks for the help 😄

#

i got what i needed for now

grim hound
#

does EntitySpawnEvent cover absolutely all entity spawns?

#

like world loading, chunk loading etc

young knoll
#

I don’t know if it covers mobs spawned during worldgen

grim hound
#

guess not

wintry anvil
#
if (event.getCurrentItem().getCustomModelData() == 1) {```
what am i doing wrong here?
`getCustomModelData` is red. I've imported everything needed
eternal oxide
#

ModelData is on the Meta

proper cobalt
#

send ip[

wintry anvil
river oracle
#

you need to get the ItemMeta

eternal oxide
#

getItemMeta().getCustomModelData()

#

but check each exists

river oracle
#

?jd-s

undone axleBOT
river oracle
young knoll
#

Oh yeah custom model data is an Integer not an int

#

Sadge

river oracle
#

tbf we have the custom texture path now

#

which is far superior so like custom model data more like custom mid data

young knoll
#

Well

#

The new custom model data can actually do wild stuff

#

But yeah for just changing a static model item_model is much better

proper cobalt
#

cAN model data be null

young knoll
#

Yes

#

It’s null by default

proper cobalt
#

phat int

young knoll
#

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

spiral light
young knoll
#

It’s on the minecraft wiki now

#
Minecraft Wiki

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...

spiral light
#

thanks

sly topaz
quaint mantle
#

asd

quaint mantle
sly topaz
#

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

sly topaz
# rough drift rejoin

I assume that was the case, my question was more aiming at why they left in the first place

blazing ocean
sly topaz
#

oh

quaint mantle
#

and unbanned

#

"harrassing and doxxing"

sly topaz
#

just don't harras and dox bro 👍

quaint mantle
#

that time when i asked why machinemaker had "Paper > Spigot" on his status

sly topaz
#

well, you don't have to go into details, don't wanna get banned again for questioning punishment or something lol

quaint mantle
#

js read the chat ig lmao

spiral light
#

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

young knoll
#

Easier to just make the packet yourself tbh

#

I believe the server entity is made somewhere in the entity tracker

chrome beacon
#

^^ it is

spiral light
#

what entity tracker ?

chrome beacon
#

ChunkMap class

#

Though it appears Paper modifies that system quite a bit

#

so that might not be correct for Spigot as well*

young knoll
#

Yeah I believe it’s in ChunkMap

#

We don’t talk about moonrise smh

spiral light
#

it got a little bit complicated with packets and stuff in 1.20 to 1.21 i guess

sullen marlin
#

?xy

undone axleBOT
spiral light
#

there is no api for custom entities oOo

young knoll
#

Yeah but you don’t need to worry about ServerEntity for that

spiral light
#

but the serverentity is the player for who i am spawning the fake player right ?

young knoll
#

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

spiral light
#

uff uff

sly topaz
#

what are you trying to do

#

spawn a fake player?

spiral light
#

yes

sly topaz
#

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

spiral light
#

hmm problem is that i want to update the old stuff where i created completly custom entities that allow /summon and so on

sly topaz
#

what does allowing /summon mean

spiral light
#

/summon test:newentity instead of /summon zombie

#

for example

#

this allows also some interaction with the API and other stuff too

sly topaz
#

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

sly topaz
#

it is just disguised as a player

#

is there a reason you want it to be summonable by the command though?

spiral light
#

i was using your method before but something didnt worked like expected i think ...

young knoll
#

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

spiral light
#

this could be true ... there was a field that had wrong type and spammed errors on clients

young knoll
#

Granted idk what synced values a player has, I’ve never looked

sly topaz
#

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

young knoll
#

Those probably have most of the same values

#

Zombies have armor, can hold items, can have a left or right main hand

spiral light
#

the zombie would get attacked by iron golems for example

young knoll
#

True

#

Of course you could just cancel that with an event

sly topaz
#

if you remove the attack villager pathfinder goal, will it still be attacked by golems I wonder

shadow silo
#

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

sly topaz
#

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

young knoll
#

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
shadow silo
spiral light
young knoll
#

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

spiral light
#

those warnings dropped the fps too

sly topaz
#

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

spiral light
#

not for 1 entity .... but for 100 entities for every packet that was wrong it did

sly topaz
#

just how many npcs are you spawning

spiral light
#

they are there for fighting ^^

sly topaz
#

like pvp bots?

spiral light
#

exactly

cosmic elk
#

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

young knoll
#

?whereami

cosmic elk
#

arent paper plugins vertially identical to the devs pov?

young knoll
#

No

#

Spigot doesn’t have a pathfinder api for example

hybrid spoke
cosmic elk
hybrid spoke
#

á la fucking with the minecraft code

#

that is nothing you really want to do yet if you have clearly no expertise in that area

cosmic elk
#

well in that case are there any other options for a custom pet?

hybrid spoke
cosmic elk
#

thank you! this is very help full

#

if i get confused again ill come back here 👍

ancient plank
wet breach
fossil ridge
#

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

eternal oxide
#

getLastDamage

fossil ridge
#

thanks!

fossil ridge
#

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

young knoll
#

I mean, they are all advancements

#

The recipe ones are just hidden and used to unlock recipes

shadow silo
#

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

young knoll
#

You already have a local maven repo

#

mavenLocal is just files on your harddrive

#

On windows the default is C/users/youruser/.m2

shadow silo
#

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

young knoll
#

I think jitpack allows you to use GitHub repos as maven dependencies

#

Though setting up a proper repo or just using mavenLocal is easier

shadow silo
young knoll
#

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

shadow silo
young knoll
#

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

shadow silo
#

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?

young knoll
#

Publish it to you maven local and import it that way

sly topaz
#

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

young knoll
#

Did you use the remapped flag

sly topaz
#

it did say this:

[WARNING] Failed to download maven-metadata-minecraft-libraries.xml [https://libraries.minecraft.net/]
sly topaz
#

I could've sworn I did

rough ibex
#

What does World.getHighestBlockAt(int x, int z) return if theres no blocks at all in the column

#

min world height?

sonic goblet
#

Try it and find out, docs don't say what happens in that case

sly topaz
#

I tried looking at the code but it is pretty complex so yeah, just gotta try it out

wooden frost
#

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?

summer scroll
wooden frost
rough ibex
#

copy exactly?

#

or with some latency

mighty gazelle
#

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:?]```
rough ibex
#

The error isn't in the code you posted.

#

anything else

mighty gazelle
#

I have the problem:
The PlaceholderAPI don't do the job

eternal oxide
#

?paste your AsyncPlayerChatEvent listener

undone axleBOT
mighty gazelle
eternal oxide
#

what is your chat.format string?

mighty gazelle
#
chat:
  # The Chat Formatting
  format: "%luckperms_prefix%§7%player%§r%luckperms_suffix% §7» %message%"
eternal oxide
#

all your .replace are wrong

mighty gazelle
#

What do you mean?

eternal oxide
#

.replace("%prefix%",But in yrou actual format its%luckperms_prefix%

mighty gazelle
#

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

deep field
#

[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

quaint mantle
deep field
#

should i install the spigot one?

quaint mantle
#

Go plugin page and see what dependencies the plugin have

quaint mantle
rapid wharf
#

how to play specific cave sound (for example cave sound 2)?

young knoll
#

You can specify a seed with playSound

#

You’ll have to figure out what seed works tho

rapid wharf
#

wdym

young knoll
#

the playSound method can take a number as a seed

rapid wharf
#

fr

#

how to find needed?

young knoll
#

Which determines which random sound is played for sounds that have multiple possibilities

#

Idk, trial and error I guess

rapid wharf
mighty gazelle
#

It returns every time null

glossy laurel
#

How do I get the default name of an item? E. G. "Diamond chestplate"?

remote swallow
#

it will also save it to the same location in the data folder

rough drift
remote swallow
rough drift
#

it does

#

java will not find the file in some cases

remote swallow
#

okay have you ever had it not work without the starting slash using saveResource

mighty gazelle
rough drift
#

then nah saveResource works

#

talking about getResourceAsStream lol

remote swallow
rough drift
#

@cedar saffron boy you up?

mighty gazelle
# remote swallow line 12

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;
    }
remote swallow
#

no

#

"languages/" + languageCode

mighty gazelle
#

Ok I will try

#

It don't work

remote swallow
#

so add debug statements

summer scroll
mighty gazelle
# remote swallow so add debug statements

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"

blazing ocean
remote swallow
#

print langConfig.getValues and see what the values the server has are

glossy laurel
#

How do I get the default name of a material? E. G. "Diamond Chestplate"?

blazing ocean
#

use a translatable

remote swallow
#

if you cant (choco where component pr) you either have to make it urself or get it from the language file urself

chrome beacon
#

The server only contains the en_us language file

#

So use translatable components

blazing ocean
#

yup

#

?components

undone axleBOT
mighty gazelle
remote swallow
#

System.out.println(langConfig.getValues());

#

if you dont know how to println i think you should go back and learn java

mighty gazelle
#

There is only {}

#

But the config has values

remote swallow
#

so look at the file its saved, if thats empty use debug statements to figure out whats causing it to be empty

mighty gazelle
#

The files are not empty

hushed spindle
#

is 1.21.4 craftbukkit version 1.21.R2 or R3

remote swallow
#

r3

hushed spindle
#

ahhhh shit

#

thats why my shit broke lol

remote swallow
#

1.21.3 is r2

hushed spindle
#

i was under the impression that 1.21.3 was replaced by .4

remote swallow
#

nah .4 is a new version

hushed spindle
#

cool cool

remote swallow
#

1.21.0 and .1 is R1, .2 and .3 is R2 and .4 is R3

mighty gazelle
#

I have the error: the MySQL entry was wrong

remote swallow
#

?paste the full error

undone axleBOT
mighty gazelle
#

it was a wrong entry

#

A file that IS empty

remote swallow
#

so why say i have the error, put your full class on a paste then

cedar saffron
echo basalt
#

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)

candid galleon
#

schrodinger's code

earnest girder
#

Is it recommended to use ticks instead of System#currentTimeMillis?

blazing ocean
#

yes

#

well

#

depends

earnest girder
#

Anywhere it’s possible

slender elbow
#

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"

tiny tangle
#

hi anyones knows

earnest girder
tiny tangle
#

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.

kind hatch
blazing ocean
#

all my timer logic is based around ticking and tickables

shadow phoenix
#

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

rough ibex
#

'good pay' how much

#

humor me

pure dagger
#

should you add enchatnments to meta or itemstack

blazing ocean
#

so just use that

#

always avoid itemmeta cloning if possible

pure dagger
#

what do you mean cloning?

blazing ocean
#

getItemMeta returns a copy

pure dagger
#

oh

young knoll
#

All that does is call getItemMeta for you

#

afaik

blazing ocean
#

does it

#

lemme check

#

can't rn lmao

pure dagger
#

yeha

pure dagger
#

call getItemMeta() anyway

#

or what

blazing ocean
grim hound
#

gotta love kotlin

sly topaz
#

that's funny, wonder how that happened

#

manually nullchecking in kotlin tho smh

random pagoda
#

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

river oracle
#

Wild

sonic goblet
random pagoda
#

setDamage

river oracle
#

Make sure you're using meta Damageable and not the entity one

random pagoda
#

I will verify this.

river oracle
#

The cast at the end makes me think you're initially casting to the wrong one

#

Because otherwise you wouldn't need that cast

random pagoda
#

I pasted the code. It's possible.

#

It's that. Ty for ur help. I'm so stupid

vital ridge
#

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

chrome beacon
#

sounds like something else would run when that happens

vital ridge
#

It used to work

chrome beacon
#

Send the entire code

vital ridge
#

No nothing runs literally

chrome beacon
#

?paste

undone axleBOT
blazing ocean
#

seems like you should just use a command framework

vital ridge
#

Its a bit messy doe;

chrome beacon
#

Send the entire code

#

That's not all of it

sullen marlin
#

I think we need the whole.... yeah

vital ridge
#

But yeah xd thats the whole class

chrome beacon
#

Here's your problem

vital ridge
#

Shit yeah it contradicts

#

How did I not think about that

grim hound
blazing ocean
#

I mean double check you're actually doing everything correctly

#

look at the compiled classfile or sth

proper cobalt
#

if i sent a vid could someone help me out

remote swallow
#

with what

proper cobalt
#

my plugin is erroring

#

idk whats cuasing it

remote swallow
#

?paste the error

undone axleBOT
proper cobalt
#

the error makes sense

#

but when looking at my code it doesnt

#

its just a cast exception

remote swallow
#

show the error anyway

chrome beacon
#

what video

proper cobalt
proper cobalt
#

sec

chrome beacon
#

oh I missed the if part

#

I thought you already sent it somewhere

proper cobalt
#

nah

chrome beacon
#

Send the code and error

proper cobalt
#

which part of the code should i send

remote swallow
#

the whole StorageComponent class

proper cobalt
#

okay

#

should i paste it

#

dont wanna send a wall

chrome beacon
#

yes

proper cobalt
chrome beacon
#

always paste code and stacktraces

proper cobalt
#

👍

remote swallow
#

imports and package too

#

full class

proper cobalt
#

Ok

remote swallow
#

whats DataTypeImpl

proper cobalt
#

sec

#
public enum DataTypeImpl {
    BTC,
    ETH,
    DOGE,
    MONEY
}
chrome beacon
#

What is IPDCKey

proper cobalt
#

eh so its like a PDC key wrapper

#

ill send it wait

chrome beacon
#

Send it

proper cobalt
#

thank you so much for helping btw guys

#

perhpas you guys wanted to see this aswell

remote swallow
#

im getting slightly confused about how ur getting this error

proper cobalt
#
    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;
    }
proper cobalt
#

it makes ZERO sense

chrome beacon
#

Could you show AbstractDataType

proper cobalt
#

yes

#
@Getter
@Setter
@AllArgsConstructor
public abstract class AbstractDataType {
    private final DataTypeImpl dataType;
    private final int multiplier;
    private float amount;
}
chrome beacon
#

also double check that the jar you're running is up to date

proper cobalt
#

it is it is

chrome beacon
#

Attach a debugger and step through what happened

proper cobalt
#

you can do that with mc plugins?

chrome beacon
#

ofc you can

remote swallow
#

yeah

chrome beacon
#

?debugging

remote swallow
#

watchdog gets a bit annoyed but ye

chrome beacon
#

smh no command

chrome beacon
remote swallow
#

yeah

proper cobalt
#

how do i do that

chrome beacon
#

Are you using gradle or maven?

proper cobalt
#

gradle

#

i just got deja vu lmao

chrome beacon
#

Are you using the paper userdev plugin?

proper cobalt
#

yes

chrome beacon
#

then it's already builtin for you

proper cobalt
#

nice!

#

how do i use it

chrome beacon
#

Just launch the server from your IDE

#

and select your lines you want to debug

proper cobalt
#

i dont have that configuration

chrome beacon
#

ah right I forgot it's a separate gradle plugin

#

I always use the paperuser dev test plugin

remote swallow
#

run server from jnp

chrome beacon
#

which as it by default

proper cobalt
chrome beacon
#

id("xyz.jpenilla.run-paper") version "2.3.1"

proper cobalt
#

do i replace the regular paperdev or na

remote swallow
chrome beacon
#

Just add that plugin

sly topaz
#

run task depends on paper userdcev if you want to run the dev bundle server

#

though most times that isn't necessary

chrome beacon
#

You can use this as a reference for a project setup

proper cobalt
#

do they have a java 17 version

chrome beacon
#

Use Java 21

#

No reason not to

proper cobalt
#

i cant it will; break

sly topaz
#

what version are you developing against

proper cobalt
#

1.19.4

chrome beacon
#

It's fine

proper cobalt
#

aight i set it to 21

#

lets see

#

yeah idk

sly topaz
#

use a newer gradle version

chrome beacon
#

^^

sly topaz
#

latest is 8.11.1

proper cobalt
#

idk how to update it

sly topaz
#

you can change it in the gradle/gradle-wrapper.properties file

proper cobalt
#

kk thx

chrome beacon
#

Just change the version in the url

#

if you want to be extra safe run the wrapper task after

remote swallow
#

gradlew wrapper --gradle-version=8.11.1 to update and create the new wrappers

chrome beacon
#

^^ that does both in 1 command

sly topaz
#

the task will fail since the jvm version was changed

chrome beacon
#

^^ So run wrapper task after

proper cobalt
#

aighty

sly topaz
#

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

proper cobalt
#

just giving me this

sly topaz
#

what is that error

proper cobalt
#

i have no idea let me restart intellij

cosmic elk
#

does anyone know how i can change the max speed of minecarts without them derailing?

cosmic elk
#

1.21.1

chrome beacon
#

How are you currently changing the max speed?

cosmic elk
#

im using an event handler, when an minecart entity is created it just does minecart.setMaxSpeed(24.0);

proper cobalt
#

is there another way to debug

#

this error is so annoying theres literally nothing wrong with the code i think its a java bug

chrome beacon
#

Doubt

#

anyways run paper is the easiest way of debugging

#

It also allows for hotswapping

proper cobalt
#

does it hit breakpoints n stuff?

remote swallow
#

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

chrome beacon
#

yes

proper cobalt
#

does it support dependancies

chrome beacon
#

yes

proper cobalt
#

bruh whats wrong with it whys it not working

blazing ocean
#

what is not working

#

?notworking

undone axleBOT
#

"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.

chrome beacon
#

Any chance you could put the project on Github

remote swallow
blazing ocean
#

no thanks

proper cobalt
remote swallow
chrome beacon
#

Can you share only your build files then

remote swallow
#

tf is that format

proper cobalt
#

sure

remote swallow
#

that

proper cobalt
#

should i send the build.gradle.kts

chrome beacon
#

yes

blazing ocean
#

yes

proper cobalt
#

?paste

undone axleBOT
proper cobalt
blazing ocean
#

it is commented out

proper cobalt
#

i know

blazing ocean
#

use gradleup shadow

proper cobalt
#

i commented it out cuz it wouldnt build

blazing ocean
#

error?

proper cobalt
proper cobalt
blazing ocean
#

johnrengelman shadow is outdated and does not worky with java 21

#

that is not the full error

#

show the full error

proper cobalt
#

it was the full error

blazing ocean
#

it is not

#

build from the terminal and share the log

proper cobalt
#

ight i will after sec

chrome beacon
#

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

proper cobalt
#

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

chrome beacon
#

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

proper cobalt
#

oh on github it says u need to manually add it

remote swallow
#

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

proper cobalt
#

oh yeah i see it in tasks

#

do i do the dev bundle or regular

chrome beacon
#

regular is fine

blazing ocean
#

doesn't make a difference with regular paper

chrome beacon
#

It will shut itself down the first time

#

You need to accept the EULA just as with any server

proper cobalt
#

ah yeah

blazing ocean
#

i'm surprised anyone helped you this much in the spigot discord for paper stuff

chrome beacon
#

you can find it in the run directory

#

Do git ignore that

remote swallow
#

it feels like it should be 2 am or smth

proper cobalt
chrome beacon
#

also since you have compileOnly dependencies you'll need to place those plugins in the plugins directory

blazing ocean
#

well

#

you can configure run task to download plugins

#

from e.g. modrinth

chrome beacon
#

If you want you can specifically allow those to be version controlled

chrome beacon
#

but it's more work than it's worth

blazing ocean
#

no?

proper cobalt
proper cobalt
#

aight the server is running now

#

so do i need to trigger the exception

remote swallow
#

is it running as a debug run with a break point setup

chrome beacon
proper cobalt
#

oh nah let me make one, where shall i place the break point

chrome beacon
#

though ig you could use Spiget

chrome beacon
proper cobalt
#

kk

blazing ocean
#

theres ai on my github homepage now, this is getting ridiculous

remote swallow
#

i dont have that yet

#

do you have student with copilot

young knoll
#

There’s ai on my ai

remote swallow
#

hi coll

blazing ocean
remote swallow
#

there is why

blazing ocean
#

i don't even use it

remote swallow
#

have you seen those copilot laptops

blazing ocean
#

...why would I want that

remote swallow
#

with a copilot button

blazing ocean
remote swallow
blazing ocean
#

remote swallow
#

so you can update ur arch fork

blazing ocean
#

hat arch fork

#

what*

proper cobalt
#

how do i op myself

blazing ocean
#

/op?

proper cobalt
#

the terminal is read only

blazing ocean
#

shouldn't be

#

works fine for me

#

what are you using to run the server

proper cobalt
proper cobalt
blazing ocean
#

while you can at the bottom

proper cobalt
#

nah i couldnt

#

its fine i changed ops.json

blazing ocean
remote swallow
blazing ocean
#

provided your cursor is in the correct location

proper cobalt
blazing ocean
remote swallow
#

that doesnt look like intellij

blazing ocean
blazing ocean
proper cobalt
#

i hit my breakpoint but not at the right time hmm

#

let me set it up rq

#

oh the world isnt savng

chrome beacon
#

It won't save if you kill the task

#

You need to stop the server properly

proper cobalt
#

ah right'

#

fuck this i give up

chrome beacon
#

?

blazing ocean
#

lol

proper cobalt
#

idk bro shits just mad annoying not working idk why

#

like what is this dumbass error anyway

chrome beacon
#

Take a break

blazing ocean
#

what dumbass error

chrome beacon
#

Somethings being cast wrong

#

and it's not entirely clear where

remote swallow
proper cobalt
#

dude where is it casting

#

is there an extended stack trace somewhere

sly topaz
#

is com.himerarp.computer3.pc.impl.component.storage.StorageComponent a class of yours

#

also that is... a package lol

uncut igloo
#

Is there an elegant alternative to Paper's getTPS method using Spigot API?

proper cobalt
#

oh im tweakin

#

yeah that is my class

sly topaz
#

what is at line 54 of that class

proper cobalt
#

@Getter

#

what does it say line 54 is

sly topaz
#

oh it is lombok

#

you might want to use delombok for debugging

proper cobalt
#

nah i doubt its lombok in the code

#

in the stack trace what does it say it is

#

i dont have it open

sly topaz
#

at com.himerarp.computer3.pc.impl.component.storage.StorageComponent.getItemStack(StorageComponent.java:54) ~[RPComputer3-1.0.0-SNAPSHOT.jar:?]

#

getItemStack

proper cobalt
#

ah ok

proper cobalt
#
    @Override
    public @NotNull ItemStack getItemStack() {
        ItemStack itemStack = super.getItemStack();
        itemStack.editMeta(meta -> StorageKey.DATA.set(meta, this.data.toEnumMap()));
        return itemStack;
    }
sly topaz
#

but what are you doing with it

sly topaz
#

you have an item with old pdc

proper cobalt
#

yeah i thought of that

#

doesnt seem like it tho

sly topaz
#

what does super#getItemstack return

proper cobalt
#
    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;
    }
blazing ocean
sly topaz
#

hm, you're only setting for this, not getting

#

unless those Key setters are getting the value in order to set it

proper cobalt
#
    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

sly topaz
#

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

proper cobalt
#

all of that stuff works

#

idk really its voodoo

#

wanna see the interface

sly topaz
#

eh, let's just walk through the stack trace

proper cobalt
#

alright

sly topaz
#

what is PCCaseLargeGUI 54

proper cobalt
#

lemme checkl

sly topaz
#

com.himerarp.computer3.pc.impl.pc_case.gui.PCCaseLargeGUI.lambda$setupComponents$1

proper cobalt
#
    @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);
            }
        });
    }```
sly topaz
#

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

proper cobalt
#

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

sly topaz
#

lmao what

proper cobalt
#

surely its a java bug

mellow pecan
#

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 :)

sly topaz
#

what does PCComponent#getWattage return and what does ComponentKey.POWER expect?

proper cobalt
#

i doubt this is where the errors would be

sly topaz
#

that's the only one that would ultimately expect a float in that code

proper cobalt
#

i mean the pc case gui large allows every item except storage

proper cobalt
sly topaz
#

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

proper cobalt
#

oh so should i look thru which key expects AbstractDataType

sly topaz
#

yeah

proper cobalt
proper cobalt
#

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

sly topaz
proper cobalt
#

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

mellow pecan
sly topaz
#

that's clearly a Float cast to whatever there

proper cobalt
#

lemme check

remote swallow
#

asEnumMap is from more pdc

proper cobalt
sly topaz
proper cobalt
#
@Getter
@Setter
@AllArgsConstructor
public abstract class AbstractDataType {
    private final DataTypeImpl dataType;
    private final int multiplier;
    private float amount;
}
sly topaz
#

it is in fact a float so why smh

proper cobalt
#

a float! thats why this whole thing should work!
BUT IDK WHY IT DOESNT 😭

sly topaz
#

why was the thing triggered on a barrier block when the gui object is PCCaseLargeGUI

proper cobalt
#

PCCaseLargeGUI has barriers

#

inside

sly topaz
#

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

chrome beacon
#

Yeah which is why I recommended using the Debugger

proper cobalt
#

neither, ive tried to use claude aswell but no luck

chrome beacon
#

AI won't help you here

proper cobalt
#

this errors a mad one

#

stumbles the greatest of computer scientists

sly topaz
#

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

sly topaz
chrome beacon
#

@proper cobalt ^^

sly topaz
#

omg how did I not see that lol

#

that's crazy

proper cobalt
#

its different maps

#

its not casted

chrome beacon
#

ah right

#

mb

sly topaz
#

well, try to do what I said just to see if an error pops up elsewhere

proper cobalt
#

yeah kk

chrome beacon
#

What is getMap

sly topaz
#

if it wants an AbstractDataType map, lets give it an abstract data type map