#help-development

1 messages · Page 1155 of 1

junior pewter
#

this is code for assigning variable value

chrome beacon
#

Again that's not the gameManager variable

#

That's the state

junior pewter
chrome beacon
#

._.

#

null.getState won't work

#

it's null

junior pewter
#

what should i write then to get it from other classes?

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

junior pewter
#

i thought that by gameManager i would get access to the class and then by .getState() getting the state

chrome beacon
#

gameManager isn't initialized

#

it is null

#

This is the 4th time I tell you

junior pewter
#

oh, now i get it...

#

sorry, i'm not really expert at javascript, just learning

chrome beacon
#

JavaScript 🔫

#

This is Java

#

Not JavaScript

#

They are two quite different languages

#

and before you run in to problems with your string comparisons use .equals instead of ==

junior pewter
#

🤦‍♂️

#

that's funny, yeah i know, all the time i've mistaken those two languages

#

well thanks for reminding

lean pumice
#

why the head dont appear?

lost matrix
blazing ocean
#

?1.8

undone axleBOT
lost matrix
#

thx

#

Decade old software, yay

junior pewter
lost matrix
#

?paste

undone axleBOT
fair rock
#

here

junior pewter
#

here

#

yes

chrome beacon
#

You call the constructor

#

?learnjava!

undone axleBOT
blazing ocean
lost matrix
# junior pewter here

Initialize it in the constructor of your GameManager

    private final Main plugin;
    private GameState state;
    
    public GameManager(Main plugin){
        this.plugin = plugin;
        this.state = GameState.WAITING;
        Bukkit.getPluginManager().registerEvents(this, plugin);
    }
#

And pls auto format your code, its messed up

chrome beacon
#

That's not the entire issue here

#

The problem is they're trying to call getState on their gameManager variable

#

Which is never initialized anywhere

#

and there for is null

#

The game state is being set in other methods (which they've said are being called... I do agree that initializing state in the constructor is a good idea)

lost matrix
#

Ah in the ProtectionListeners. Yeah that as well.

remote swallow
#

then alex showed up and made the normal one long

blazing ocean
#

smh

lost matrix
fair rock
#

Im going off for today

lost matrix
#

Im judging you for this code

blazing ocean
#

what 😭😭😭

lilac dagger
#

the states themselves are already initiated

lost matrix
# junior pewter this?

I think the main problem is that the lines of text you are writing, make no logical sense to you.
You need to stop what you are doing and start with something extremely basic, to understand how a computer actually runs code.

lilac dagger
#

the field is what you wanna initiate

#

they're different things

junior pewter
#

well, i guess i'll go sleep now and tomorrow start with basics...

lilac dagger
#

Also a game manager is probably not the class you wanna store your state

#

A game manager is supposed to handle your games

#

A game is what I'd say would hold a state

junior pewter
#

game manager is supposed to manage game generally - states, etc...

mortal hare
#

oh boy after watching 6 hour course of kotlin

#

i feel like i've unlocked new level of syntax sugar in JVM

blazing ocean
#

!!!!

mortal hare
blazing ocean
#

facts!!!

mortal hare
#

and sequences

#

lmao

#

its so cool

blazing ocean
#

And all the stdlib functions

#

Smile will NOT be happy about this

lost matrix
#

I feel like lambdas should be kept to a minimum anyways. So one liners, otherwise create an actual method and reference it. 🙂

mortal hare
#

i like how lambda expressions that are present in kotlin std are mostly inline

#

so they cost nothing when compiled

lost matrix
#

For me it took a while to accept it as a keyword

blazing ocean
#

I really don't like it for semi-large stuff

#

For a tiny expression like it.toMap().entries or something it's fine ig

mortal hare
#

the only thing is weird is the destructuring objects

blazing ocean
#

But stuff like command contexts

blazing ocean
mortal hare
#

i mean why not destructure by property name

#

why by order

#

_ is ugly

#

my precious clean syntax sugar

blazing ocean
blazing ocean
mortal hare
#

add TS like destructuring propertyName: newPropertyName which compiles to smth like val newPropertyName = propertyName

blazing ocean
#

no

lost matrix
#

What i dont like is returning values from lambdas. It makes their scope ambigous. Something like

ints.filter {
    val shouldFilter = it > 0
    return@filter shouldFilter
}
mortal hare
#

but you can use anonymous functions

#

which works the same as lambdas but use proper return functionality

blazing ocean
#

and you can label your lambda

#
ints.filter filterNotZero@ {
    val shouldFilter = it > 0
    return @filterNotZero shouldFilter
}
#

This is very useful when you're iterating over multiple lists

mortal hare
#

also null type assertion at compile time is chefskiss

blazing ocean
#

real

remote swallow
blazing ocean
#

Did you learn about inline and reified too

blazing ocean
dry hazel
#

what about tailrec

mortal hare
blazing ocean
#

reified is good

blazing ocean
dry hazel
#

well you don't actually need it

#

it just makes the compiler go beep boop

#

instead of you the programmer

blazing ocean
#

question

#

do you guys make your builders inline

dry hazel
#

don't remember

blazing ocean
#

I always do

#

A lot of the stdlib and compiler code does that too so why not ig

last ledge
dry hazel
#

okay

blazing ocean
#

wow that's crazy

remote swallow
#

yup

lilac dagger
#

I dunno what I'm looking at on first glance

#

What does that annotation even do?

dry hazel
#

that's a label for the lambda

#

not an annotation

lilac dagger
#

No idea why you wanna label lambdas probably makes sense it kotlin tho

dry hazel
#

?? lol

blazing ocean
#

not an annotation

dry hazel
#

it's for returning on a different level if you have multiple nested lambdas

lilac dagger
#

Oh

#

This is not possible in Java as far as I know

#

So similar to label: for loops in Java

dry hazel
#

also for referencing the lambda receiver of a different level

lilac dagger
#

But I don't see myself nesting

dry hazel
#

there are some places where I've used it but not very often

blazing ocean
blazing ocean
lilac dagger
#

Yeah figured it is just like for loop labels in java

#

What's a fir tree?

blazing ocean
#

ignore the actual code its a very unfinished thing

lilac dagger
#

switched to pc, my phone just broke, what was that? 😭

#

I was jk btw

blazing ocean
#

I mean yeah there isn't really another good way to do trees in code without nesting

lilac dagger
#

Understandable

#

The code is not bad I may say

vital ridge
#

This is my function for serializing PlayerCourse class.
https://paste.md-5.net/exinefeyaf.js
I'm putting courseFeatures in the map, which is List<CourseFeature>, note that CourseFeature is my custom class. Since its my custom class, it implements ConfigurationSerializable and also it's own serialization method.
https://paste.md-5.net/bacijemihu.js

The thing is I'm somehow serializing the CourseFeature incorrectly. It failes to serialize and throws an error in the console telling me that object serialization failed.

lilac dagger
#

Course status must be also serializable

vital ridge
#

Its an enum

#

And it doesnt have to be, I already tested by setting it and updating the pdc after that

#

no errors

lilac dagger
#

Well the error might help you out

vital ridge
#

Worked perfectly, I've only gotten errors when adding coursefeatures to the list, it fails to serialize them

lost matrix
#

Show the exception pls

#

Is CourseFeature also ConfigurationSerializable?

vital ridge
#

Yes

#

it is

#

This is the error

#
@Override
    public @NotNull PlayerCourse fromPrimitive(@NotNull byte[] primitive, @NotNull PersistentDataAdapterContext context) {

        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(primitive);

        try {

            /*
            private UUID owner;
            private String name;
            private CourseStatus courseStatus;
            private int size;
            private List<CourseFeature> courseFeatures;
            */

            BukkitObjectInputStream bukkitObjectInputStream = new BukkitObjectInputStream(byteArrayInputStream);

            Map<String, Object> playerCourseMap = (Map<String, Object>) bukkitObjectInputStream.readObject();

            UUID owner = UUID.fromString(String.valueOf(playerCourseMap.get("owner")));
            String name = String.valueOf(playerCourseMap.get("name"));
            CourseStatus courseStatus = CourseStatus.valueOf(String.valueOf(playerCourseMap.get("courseStatus")));
            int size = (int) playerCourseMap.get("size");
            List<CourseFeature> courseFeatures = (List<CourseFeature>) playerCourseMap.get("courseFeatures");

            return new PlayerCourse(owner, name, courseStatus, size, courseFeatures);

        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

    }

Map<String, Object> playerCourseMap = (Map<String, Object>) bukkitObjectInputStream.readObject(); this returns null

lilac dagger
#

It is on read

#

You need a deserialize constructor

sly topaz
#

BukkitObjectInputStream 💀

lilac dagger
#

The class is not bad ^

sly topaz
#

also, use a try-with-resources

vital ridge
#
@Override
    public @NotNull Map<String, Object> serialize() {

        Map<String, Object> serializedMap = new HashMap<>();
        String type = "";

        if (this instanceof CheckPoint)
            type = "checkpoint";
        else if (this instanceof SpawnPoint)
            type = "spawnpoint";

        serializedMap.put("location", location);
        serializedMap.put("type", type);

        return serializedMap;

    }
#

so this method needs to be a constructor?

#

In CourseFeature class?

#

No waitr

#

you said

lilac dagger
#

The reverse of it actuwlly

vital ridge
#

deserialize

lost matrix
#

At that point its time to shove spigots serialization system in the bin and use an actual serialization library like Gson or Jackson.
Storing ConfigurationSerializables in a PDC is def not the way to go.

vital ridge
#

my bad

chrome beacon
#

Configurate uwu

young knoll
#

Have you heard of

#

NBT

blazing ocean
#

Just do what Telekom does

#

Store configs + data in bytes in memory

lilac dagger
#

Isn't all memory in bytes?

remote swallow
#

my memory is in bits

vital ridge
#

How would I return the deserialized obj?

blazing ocean
lilac dagger
#

The deserialization is to give you back the object

#

Serialized is to pack up your object

#

You need both

fair rock
blazing ocean
fair rock
#

Memory too 💀

vital ridge
young knoll
#

RAM has ADHD

vital ridge
#

I cant return anything from the constructor

young knoll
#

That’s why we need SSDs/harddrives

blazing ocean
#

trueee

remote swallow
#

whatever you set in the deserialize method you would set in the constructor

#

you dont need a constructor either

#

pick 1 and use it

vital ridge
#

I used deserialize

#

method

remote swallow
#

is it static

vital ridge
#

Yes

remote swallow
#

?paste ur full class and any errors

undone axleBOT
remote swallow
#

on seperate pastes

vital ridge
remote swallow
#

that is just a lot of jank

#

you cant return an instance of the abstract course feature

vital ridge
#

I'm not

#

Im returning a proper child class

#

Under #deserialize

remote swallow
#

its expecting a course feature not a subclass

vital ridge
#

Oh shit frl?

#

Cant i just return a subclass anywas

#

anyways*

#

Since its pretty much the same as coursefeature

#

Okay sht I think im fking up the basics of java now

worldly ingot
#

Maybe I'm missing it but I haven't seen you register the actual serialization anywhere

vital ridge
#

I did register it in my main method

worldly ingot
#

Okay just making sure :p

#

Generally we do it in static blocks in the plugin's init, if I'm remembering correctly

vital ridge
#

I did it under onEnable()

worldly ingot
#

Yeah that's probably fine

vital ridge
#
public static CourseFeature deserialize(Map<String, Object> serializedMap) {

        ConsoleManager.message(ChatColor.RED + "USING THIS METHOD!!!!!");

        String type = String.valueOf(serializedMap.get("type"));
        Location loc = (Location) serializedMap.get("location");

        if (type.equals("checkpoint"))
            return new CheckPoint(loc);
        else if (type.equals("spawnpoint"))
            return new SpawnPoint(loc);

        return null;

    }
#

my debug message here never was ran

#

I cant find it in console

remote swallow
#

this just seems like a

#

?learnjava moment

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

vital ridge
#

added deserialization constructors for the child classes

quaint mantle
#

Does anyone know how to send a hotbar text? I don't mean actionbar, i mean hot bar

young knoll
#

What

#

That’s not a thing?

quaint mantle
#

it is

young knoll
#

You can’t control that

#

The client just shows item names there

quaint mantle
#

It is possible

young knoll
#

Okay

#

Then you must know how to do it

rough ibex
#

you know it is possible because...?

sly topaz
#

it isn't possible to show that without setting an item name

young knoll
#

Yeah you could forcibly rename a held item

#

But like, janky hack mate

sly topaz
#

the other thing you can do is send a title/subtitle with a custom font that offsets it by just the right amount

quaint mantle
quaint mantle
sly topaz
#

why not

#

most servers do it nowadays, it allows you to do so much more

quaint mantle
#

it is annoying when you join a server you have to download smth

quaint mantle
sly topaz
#

you can just send it in the configuration phase so they won't even notice it

#

well, it will prompt the yes or no but that's it

quaint mantle
#

no external things

remote swallow
#

you can host the resourcepack on the server through your plugin

young knoll
#

I don’t see this issue with server resource packs anymore

#

A few versions back sure, but they are pretty great now

fading drift
#

just sent info above the item name

quaint mantle
#

i know i just don't want to make ppl need to download something to play my server

slender elbow
#

there are heaps of servers that do resource packs and tens of thousands of people play with no issue

torn shuttle
#

I have a development question

slender elbow
#

players are far more willing to download a resource pack to have a better playing experience

torn shuttle
#

who do I have to pay to assassinate the person who came up with the idea that vector.add modifies the vector instead of returning a new vector

#

and how much

#

and who wants in on the crowdfunding

remote swallow
#

2015 md_5

#

or 2011 sk89q

torn shuttle
#

actually this time it was joml that did it to me

remote swallow
torn shuttle
#

🗡️

#

got me good once again

young knoll
#

All of JOMLs objects are mutable

#

It’s designed for maximum speed

torn shuttle
#

I'm about to make someone's face mutable

young knoll
#

Well, I think there are immutable variants

#

But still

#

Even the fields are public

slender elbow
#

there are immutable interfaces and mutable impls

#

then there is SpongePowered's math library which is immutable

#

it's alright

young knoll
#

Ah right the immutable one is just an interface

worthy yarrow
solid apex
#

anyone experienced that essentials nick do not change in TAB or in chat? Im using LuckPerms aswell

timber crescent
#

is using a library like fastuuid actually worth it?

glad prawn
#

you want it fast but wonder if it's worth it?

pliant topaz
#

If you work with large quantities of uuids, ig give it a shot, otherwise you probably won't need it or can expect next to none real performance benefits

fading drift
#

would there be a way to inject into this class to change the return value of the last method

dry hazel
#

override it

#

use a mixin bootstrapper

#

use a java agent

blazing ocean
#

asm

#

bytebuddy

quaint mantle
#

is this okay to call a custom event and check if it's cancelled?

proud badge
#

I dont think so

blazing ocean
proud badge
#

On the next tick

quaint mantle
#

damn i think im stupid

proud badge
quaint mantle
#

i have to run all async

quaint mantle
proud badge
#

So if youre writing to some stream it might become out of sync

quaint mantle
#

it's a packet handler

#

will it?

proud badge
#

Idk

quaint mantle
#

Lol

#

Haha

proud badge
#

Try it

#

See if stuff breaks

quaint mantle
#

Okay

fading drift
#

holy fuck finally

#

I got health in tablist as numbers by literally modifying the packet before it was sent to the client

quaint mantle
#

damn im doing the same here

fading drift
#

wait like literally the exact same

quaint mantle
#

nah, trying to create tab list

#

smth like this

fading drift
#

you can do header and footer with this method here

#
    private static void sendHeaderAndFooter(Player player, String header, String footer) {
        PlayerConnection con = ((CraftPlayer) player).getHandle().playerConnection;

        String headerJson = ComponentSerializer.toString(new ComponentBuilder(header).create());
        String footerJson = ComponentSerializer.toString(new ComponentBuilder(footer).create());

        IChatBaseComponent tabHeader = IChatBaseComponent.ChatSerializer.a(headerJson);
        IChatBaseComponent tabFooter = IChatBaseComponent.ChatSerializer.a(footerJson);

        PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(tabHeader);
        Field f;

        try {
            f = packet.getClass().getDeclaredField("b");
        } catch (NoSuchFieldException e) {
            throw new RuntimeException(e);
        }

        f.setAccessible(true);

        try {
            f.set(packet, tabFooter);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }

        con.sendPacket(packet);
    }```
quaint mantle
#

i did

fading drift
#

did you do it a better way than I did?

quaint mantle
#

im using this

#
        serverPlayer.connection.connection.send(
                new ClientboundTabListPacket(
                        net.minecraft.network.chat.Component.literal(
                                SkyblockServer.getTabHeader()
                        ),
                        net.minecraft.network.chat.Component.literal(
                                SkyblockServer.getTabFooter()
                        )
                )
        );
#

getTabHeader and getTabFooter methos js return strings

#

im using nms mappings btw

#
        final ServerPlayer serverPlayer = ((CraftPlayer) e.getPlayer()).getHandle();
        serverPlayer.connection.connection.send(
                new ClientboundTabListPacket(
                        net.minecraft.network.chat.Component.literal(
                                SkyblockServer.getTabHeader()
                        ),
                        net.minecraft.network.chat.Component.literal(
                                SkyblockServer.getTabFooter()
                        )
                )
        );
fading drift
#

what is ClientboundTabListPacket

quaint mantle
#

The NMS mapping for PacketPlayOutPlayerListHeaderFooter

#

You are using spigot mappings

#

I'm using NMS

fading drift
#

I see

#

ah weird my PacketPlayOutPlayerListHeaderFooter only accepts a header argument so I have to use reflection to set the footer

#

but I'm on 1.8.8 so could of changed

quaint mantle
#

Lol

quaint mantle
undone axleBOT
fading drift
#

womp womp

quaint mantle
#

😭

#

Lmao

dawn flower
#

How do I do Player#chat but visible to one player only?

paper viper
#

And then format it like chat

dawn flower
#

Because I don't know what the chat format is

sullen marlin
#

What context are you in?

#

You could fire the chat event

quaint mantle
#

Hi god md_5

#

Lol

vague dawn
#

guys, how do i get last damager in PlayerMoveEvent?

#

i do not want to combine 2 EventHandlers.. i only need to get the last damager, store him in the hashmap and then after teleport remove him.. i am struggling to get the last damager (Players name)

#

or will it be better just make new listener that is checking the lastdamager (EntityDamageEntity Event)

smoky anchor
#

#1 this code will crash if the entity is not a player (ClassCastException)
#2 what exactly are you trying to achieve, as in what is all this supposed to do ?
Not "get damager, store in hashmap, teleport"

twin venture
#

simple combat log i think that's what he want to make if iam not mistaken ..

vague dawn
#

Basically… yes

slate siren
#

I forgot there was a way to hide the armor stand on the player's screen. Can you remind me guys

young knoll
#

Set it to be invisible?

slate siren
#

Only on that player's screen, other players will see it

#

When the player goes into spectate mode, I need to make armor stands invisible from his screen

chrome beacon
#

player#hideEntity

slate siren
#

Ty

tidal fog
#

how can i check if a block was placed by a player or naturally generated?

#

save the location of every block placed? how do i go about saving it?

chrome beacon
#

How often do you plan on accesing it

#

And what do you want to do with the information

tidal fog
chrome beacon
tidal fog
#

yea pretty rarely i imagine

chrome beacon
#

You can probably just go with chunk pdc to store the value

#

?blockpdc

undone axleBOT
chrome beacon
#

?pdc

tidal fog
#

is this the same?

chrome beacon
#

Yes

tidal fog
#

it said you can only give pdc to only some blocks

#

not including ancient debris

chrome beacon
#

^^

tidal fog
#

so youse customBlockData?

chrome beacon
#

CustomBlockData is a library that helps you store pdc on blocks that don't support it

tidal fog
#

gotcha

#

awesome thanks alot man

#

one last thing

chrome beacon
#

It works by storing it in the chunk instead

tidal fog
#

cool

#

im pretty new to java how do i add the package?

chrome beacon
#

Are you using maven?

tidal fog
#

let me check

#

pretty sure i am

#

yep maven

chrome beacon
#

And how to shade/relocate

tidal fog
chrome beacon
#

Shading means including in your jar

#

Relocating is changing where in your jar it's included

tidal fog
chrome beacon
#

What part?

sinful stag
#

Maybe he isn’t talking about a maven package

tidal fog
#

do i just add this to pom.xml

    <groupId>com.jeff-media</groupId>
    <artifactId>custom-block-data</artifactId>
    <version>2.2.3</version>
    <scope>compile</scope>```
chrome beacon
#

You need to keep the dependency tag surrounding that

tidal fog
#

and just add it at the end or smth?

chrome beacon
#

Add it to the dependencies section

#

Spigot should already be added there

sinful stag
#

Oh he is, yeah you have to add the dependency tag and put the dependency in the dependencies project section

#

Oops*

tidal fog
novel frost
#

it's critical that you shade and relocate it though, or you can interfere with other plugins

tidal fog
#

how do i go about shading it?

chrome beacon
#

Guide above shows it

#

Just under the dependency section

novel frost
#

Shading and relocating

#

If you've never shaded anything before though, you may not have the section that alex is referring to

tidal fog
#

theres nothing under the dependencies other than </project>

silk mirage
#

guys

novel frost
silk mirage
#

any utils for hex color handling?

#

(would love it if it has gradient as well as rgb & legacy support)

#

i've been trying to find a good one for the past hour and i cant find a single one

silk mirage
tidal fog
# novel frost have a quick look at https://maven.apache.org/plugins/maven-shade-plugin/example...

so add this bellow the dependencies in pom.xml

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.6.0</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <relocations>
                <relocation>
                  <pattern>org.codehaus.plexus.util</pattern>
                  <shadedPattern>org.shaded.plexus.util</shadedPattern>
                  <excludes>
                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                  </excludes>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
novel frost
# tidal fog theres nothing under the dependencies other than </project>

after you've finished adding shading and relocating for the first time, you should double check the jar that you made, in an archive tool that can open it, I use winrar myself, but there's a few options like 7zip i think can do it too.

it will let you see the directory structure inside.

my group name for my plugin is au.id.rleach

and see how there's a shaded directory, that's where I relocated my stuff to

chrome beacon
#

Windows can do it too

#

If you rename from jar to zip

novel frost
tidal fog
novel frost
#

Like you don't want to have 2 <build>'s you need to merge the example into your file

chrome beacon
novel frost
#

Yeah but you can't just append it

#

e.g. the plugin that's in that example, should go in your plugins section

#

and rip out this

                <relocation>
                  <pattern>org.codehaus.plexus.util</pattern>
                  <shadedPattern>org.shaded.plexus.util</shadedPattern>
                  <excludes>
                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                  </excludes>
                </relocation>
#

because that's just the example

#

alex provides you with a <relocation> for you to use in the guide

#

Do you kinda understand how the xml document is like a tree? (if you've done HTML before it's very similar)

tidal fog
#

yea ive done html

#

looks literaly the same to me

novel frost
#

Yeah, so xml is similar, except it's data

tidal fog
#

gotcha

novel frost
#

so instead of ripping out the "section" tag that has an article, you need to merge the structure, and replace it with the "section" that you need

#

in this case you are subsituting the relocation for the one provided in the guide

#

and adding a plugin to your plugins section

#

"phase" package, is the part of the build that bundles up all the classes

tidal fog
#

i didnt understand any of that

novel frost
#

and the goal 'shade' is the step of that, which is copying classes from one classpath to another, and is provided by the plugin you just added

#

sorry was trying to use html as an analogy when I was talking about 'section' tags

tidal fog
#

ive done html (i made snake in it) i dont know much about it

novel frost
#

Yeah it's all good

normal lantern
#

hey guys im trying to make a server where armor trims give effects, like silence would give strenght 2 or rib would give fire rezistance, and when you take the armor off the effects go away.

#

but like so that i can have 4 effects at once by wearing armor

#

can anyone help me pls

novel frost
#

anyway, relocating is basically scanning your classes and renaming the packages

                  <pattern>org.codehaus.plexus.util</pattern>
                  <shadedPattern>org.shaded.plexus.util</shadedPattern>

means that it turns org.codehaus.plexus.util into org.shaded.plexus.util in your code. so by renaming the package, you 'adopt' the code into your codebase, so other plugins can't accidentally use it unintentionally. which means you don't need to worry about version conflicts etc.

                  <excludes>
                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                  </excludes>

in the example is showing how to exclude a package of classes from being scanned, presumably because if you changed them, stuff would break

summer scroll
novel frost
#

post a paste to your pom afterwards, and I can double check it

tidal fog
novel frost
#

I was using the example

tidal fog
#

oh

#

😭

normal lantern
summer scroll
normal lantern
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! 🎉

tidal fog
# normal lantern i dont know how to code.. im trying though

i remember learning how to code it was rough and hell and i didnt understand anything and it was so frustrating i was just copying code and i felt overwhelmed 24/7 but then i just kinda stopped using tutorials less and less untill i noticed i was using a lot less tutorials, hindsight i definitly should have asked for help other than just googling and youtube

#

so youre already doing better than i did

river oracle
#

Unironically for the dead basics I'd reccomend just using Google and chatgpt. Now when I say dead basics with chatgpt I mean it your questions should be like how do I take user input or how do I loop over a list vs how do I write my entire project

#

If you stay dedicated you'll beable to write pretty much anything you want within a few months

#

It won't be easy but totally worth

novel frost
#

Stuff that you know has been done 100 times, and doesn't rely on niche libraries. the second you start using niche libraries, chatGPT hallucinates like crazy

river oracle
# chrome beacon AI 🔫

I found it useful for the start of my C journey tbh I know it won't fuck up how struct syntax or null ptr checks work

novel frost
#

stupidly, chatgpt could probably pass a lot of the simple uni assignments I had in uni, because people keep publishing them publically on github to cheat off of and resume build

river oracle
#

Not to mention I force it to give a short summary

tidal fog
river oracle
#

Syntax is something I consider dead basic theirs millions if examples

#

ChatGPT basically would have to be persuaded into fucking it up

novel frost
#

it likes inventing methods that don't exist

tidal fog
#

still variables and loops and if statments are very simple and should be plenty of examples for it to not be drunk and high

novel frost
#

Also, it merges all versions that ever got published together

river oracle
novel frost
#

like it has a LOT of trouble with groovy vs kotlin gradle builds

#

granted, human's struggle with old examples too

river oracle
#

I'm an avid AI hater I'm just pointing out where I've found it useful as an experienced programmer

novel frost
#

I think it's gradle's secret plot to get people to actually learn the tooling to change and break it constantly

#

otherwise if it worked forever, and was backwards compatible, you'd deskill and get frustrated every time you touched it

river oracle
#

And honestly using it with basic C alongside a search engine has been nice it requires less optimized search terms for very basic stuff for how to make a struct or do string concatonation has been nice asf

river oracle
#

I always stay latest pretty much too

novel frost
#

as someone that programs in a few languages, it REALLY shines for going, I have this java code, and I'm trying to learn, lets say, GO, how would you turn this into GO code, and can you explain and link me the language features used

tidal fog
rough drift
novel frost
#

works pretty well for learning names of stuff

river oracle
novel frost
#

It's because of the context windows

river oracle
#

Half the books it said didn't exist or were named differently

novel frost
#

they are way too small for it to process a whole book

tidal fog
river oracle
#

The context window is too small for an entire 800 page book

#

I can read I don't need an AI with shit ass memory for that

fallen patrol
#

Hi there, I am having some issues with my NPCs I am creating. Whenever I spawn the npcs they are located exactly on top of the player, not at their set positions, their heads are rotated correctly.

This is my code:

public void spawn(Player player) {
    CraftPlayer craftPlayer = (CraftPlayer) player;
    ServerPlayer serverPlayer = craftPlayer.getHandle();

    ServerGamePacketListenerImpl ps = serverPlayer.connection;

    MinecraftServer server = serverPlayer.getServer();
    ServerLevel level = ((CraftWorld) player.getWorld()).getHandle();
    GameProfile profile = new GameProfile(UUID.randomUUID(), "npc");
    profile.getProperties().put("textures", new Property("textures",
        texture, signature));

    ServerPlayer npc = new ServerPlayer(server, level, profile, serverPlayer.clientInformation());
    npc.connection = new NetworkHandler(server, npc, CommonListenerCookie.createInitial(profile, true));
    npc.setPos(location.getX(), location.getY(), location.getZ());
    npc.setCustomNameVisible(false);
    ServerEntity npcServerEntity = new ServerEntity(serverPlayer.serverLevel(), serverPlayer, 0, false, packet -> {
    }, Set.of());

    SynchedEntityData synchedEntityData = npc.getEntityData();
    synchedEntityData.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE),
        (byte) (0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));

    ps.send(new ClientboundPlayerInfoUpdatePacket(Action.ADD_PLAYER, npc));
    ps.send(serverPlayer.getAddEntityPacket(npcServerEntity));
    ps.send(new ClientboundAddEntityPacket(npc, npcServerEntity));
    ps.send(new ClientboundSetEntityDataPacket(npc.getId(),
        synchedEntityData.getNonDefaultValues()));
    ps.send(new ClientboundRotateHeadPacket(npc, (byte) ((location.getYaw() %
        360) * 256 / 360)));
    ps.send(new ClientboundMoveEntityPacket.Rot(npc.getBukkitEntity().getEntityId(),
        (byte) ((location.getYaw() + bodyOffset % 360) * 256 / 360),
        (byte) ((location.getPitch() % 360) * 256 / 360),
        false));
}

The location is filled btw with the correct values
If I am at the wrong section, I am sorry, please let me know where to be

fallen patrol
#

I am sorry, I'll add some comments

novel frost
#

that's a heck of a lot of NMS and packet hacking going on

fallen patrol
#

Is there a way to combine things then? :o

fallen patrol
# tidal fog no comments 😔

What it comes down to, I make a ServerPlayer and use .setPos, but somehow even tho all the values are filled, they don't go to that spot but instead will spawn on top of the player

novel frost
#
npc.setPos(location.getX(), location.getY(), location.getZ());

where is location defined?

fallen patrol
#

In itself, it's an entire class, perhaps a way I could share the entire class without spamming the discord? A pastebin or anything?

novel frost
#

Also, I'd set a breakpoint right after that, and double check npc.getPos is right

fallen patrol
#

This is my BaseNPC class

novel frost
novel frost
#

if EVERY investigation fails, I'd try changing the timing up, or comparing it to normal entities

eternal oxide
#

he is using Lombok

#

so he sets it in the all args constructor

#

show your code to spawn this npc

fallen patrol
#

Yea the location is set in an class which extends the base

novel frost
#
    ServerPlayer npc = new ServerPlayer(server, level, profile, serverPlayer.clientInformation());

This looks like it's cloning a player here, so it's probably cloning the location right in the constructor

eternal oxide
#

no

#

he uses setpos so he is using teh location field

#

his fault is in calling his class

novel frost
#

nm, didn't realize the snippet above was the same class in the paste

fallen patrol
#
public static void addNpcsToPlayer(Player player) {
    npcPlayerActions.put(player, new ArrayList<>());

    for (BaseNpc npc : NpcData.npcs) {
      NpcPlayerAction hubPlayerAction = npc.spawn(player);
      npcPlayerActions.get(player).add(hubPlayerAction);
    }
  }

I mean this is where I execute the spawn() function

eternal oxide
#

where do you create the npc instances?

fallen patrol
eternal oxide
#

so all spawn at new Location(Bukkit.getWorlds().get(0), -16.01, 64.06, -21.5, 13, 20),

novel frost
#

So does Timmy also spawn on the player?

fallen patrol
#

Only this "npc"

#

Yea

#

Timmy spawns on the player

eternal oxide
#

oh I see

#

your npcServerEntity uses the serverPlayer and not npc in its constructor. Ryan was correct

fallen patrol
#

Ah crap, how could I make such mistake

#

Will check right away!

eternal oxide
#

you setPos on npc, then use serverPlayer instead

novel frost
#

not really the constructor, but I was in the ball-park

#

I was just trying to trace where the players location could have been poisoning stuff

fallen patrol
#

Thank you guys, it works!

#

Yea the code is a bit messy too, got some good improving to do

novel frost
#

if it makes you feel better Mau, I was stuck for 3 days on the following.

I felt REAL silly afterwards

#

also came down to how messy the code was, simplifying it for a friend who was new at coding, it becomes very obvious

fallen patrol
#

You start to understand how important it is after getting stuck on it like that haha

novel frost
#

I'd started debugging both Spigot and Paper, but I should have stepped through my own code more carefully

rough drift
novel frost
#

I was trialiing it in it's free period, because I was trying to see if I got value from changing some theme's that wern't possible otherwise

#

but if you like the complexity analysis that bits free

remote swallow
#

get urself some rainbow brackets

novel frost
#

Themeing wise, I'd love to experiment with something that exposes public method usage (within your project and classes only) with different fonts, https://monaspace.githubnext.com/#learn-more

But I think I'd need to swap to VSCode, as intellij's themeing is surprisingly limited.

An innovative superfamily of fonts for code

#

having Comic Sans ish font, for anything I expose as API, would be a good reminder to not expose it by accident

#

and when I was doing C# dev, being able to highlight methods that were considered internal, would have helped to tell at-a-glance where user input validation was leaking

#

think we have a lot of room for Human Computer Interface design in editors yet

rough drift
blazing ocean
#

Because they made a great font

rough drift
#

Mid asf

blazing ocean
#

no u

remote swallow
#

hear me out

#

jetbrains mono

blazing ocean
#

No

#

JBM is so mid and overused

novel frost
#

using Firacode with ligatures atm, but not in love with it

blazing ocean
vague dawn
#

hey, going for another help...

#

why the hell i get this error:

#

it should put the damager inside the map, when he hit the victim right?

#

like the victim will containkey damager?

fallen patrol
#

How did you initiate your PlayerDamageListener? The error is about damageMap being null, not anything related to the behaviour of th emap

vague dawn
#

but why is it null?

#

what do u mean ny initiate?

fallen patrol
#

Your class PlayerDamageListener, where do you create an instance of it

vague dawn
#

nowhere

fallen patrol
#

Making a class implement Listener doesn't immediately make it a listener, where do you register your listener

vague dawn
#

in main class

fallen patrol
#

Can you show the code

vague dawn
#

or the whole code?

fallen patrol
#

Yea the whole code

vague dawn
#

give me a minute

hybrid spoke
#

timer started

fallen patrol
#

I mean given you're using a singleton for you damagerMap, you probably don't need to pass it through your entire code, you could just do inside you PlayerDamageListener a DamagerMap.getInstance() inside the constructor and remove the parameter

#

But whatever you're passing onwards into the function is null

hybrid spoke
#

you never call getInstance

#

so damagerMap is always null

#

since you only instantiate it there

vague dawn
#

u can have a look

hybrid spoke
#

i dont quite get why you wrapped a map in a map object but anyways

#

you never call getInstance anywhere

#

so your instance in DamagerMap will remain null

vague dawn
hybrid spoke
vague dawn
#

can i call it inside the PlayerDamageListener like this:

hybrid spoke
#

yes but that wont fix your problem since you dont use that instance but a field of your main class instead

vague dawn
#

in main?

hybrid spoke
#

where i linked it

vague dawn
#

okey

fallen patrol
hybrid spoke
#

that would be the better approach

#

and then you pass it to where you need it, a la PlayerDamageListener

fallen patrol
#

Unless he wants to use it elsewhere

#

Oh in the main you mean?

vague dawn
hybrid spoke
#

thats what DI is for

#

best to lead them away from static abuse before they even get to it

vague dawn
#

when i remove the getInstance method in DamagerMap i get this error:

#

i guess i need it in DamagerMap class

hybrid spoke
#

the singleton pattern is a bad pattern with only little of justified usecases

hybrid spoke
#

create a new one

vague dawn
hybrid spoke
#

?learnjava may help you as well

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

vague dawn
#

oh okey

#

so PlayerDamageListener will look like this?

#

i hope xd

hybrid spoke
#

yes

#

you can make plugin final as well tho

vague dawn
#

yeah, thank you

#

its woking nicely

#

thank u to @fallen patrol

slate siren
#

Wowaawww

hybrid spoke
slate siren
#

I did the job that I should have done with 6 lines of code, with 7 lines of code.

#

Actually, it is not 7 lines, its 7 classes

lilac dagger
#

what happened

#

we need to know lol

#

oh, you're refering classes

#

i thought you went from 6 lines of code to 7 classes

slate siren
#

I implemented a fake death mechanism and needed to add a bit system, I created 8 classes while I needed to handle it with 7-8 lines with the worldguard API

#

Luckily I fixed it

#

Xd

lilac dagger
#

just fake death?

#

it shouldn't take more than 2 classes

#

i have that in all my plugins

kindred sentinel
#

What's wrong?

System.out.println(NamespacedKey.fromString("wblockhandler:breakingTime"));
System.out.println("Why?");
lilac dagger
#

i think you need to register the key first

slate siren
#

I have set up all the statistics and lastdamager addition in the fake death mechanism, when the player is hit in a closed area in pvp, it adds a damager like 0.00003, which is when the player dies. It was causing the kill to be added

#

:d

kindred sentinel
slate siren
#

I also disabled lastdamager in certain regions with worldguard

quaint mantle
eternal oxide
kindred sentinel
quaint mantle
#

where**

kindred sentinel
eternal oxide
#

I guess it just looks like a space in discord

blazing ocean
#

no

#

identifiers need to be all lowercase

#

use snake_case

kindred sentinel
#

So, I should firstly use new NamespacedKey(...) and after that I can use NamespacedKey.fromString(...)?

blazing ocean
#

no

#

just do what you currently do

kindred sentinel
#

it should be all lowercase?

blazing ocean
#

yes

eternal oxide
blazing ocean
#

identifiers/resource locations/namespaced keys need to be [a-z0-9/._-]

kindred sentinel
#

ty

#

I just use NamespacedKey.fromString in order to use this plugin as a library for other my plugin, that's why I can't use new NamespacedKey(plugin,String)

slate siren
#

A player switched to Spectate mode, I hid armor stands in his screen with Packet, and I also made him fly and invisible. But I forgot to hide the items and armor in your hand. Remind me

#

Ops I remember

#

I did

#

Ty

noble flume
#

How might I orient an item display to conform to the players line of sight

#

I want to make an item display essentially face the way the player is looking

glossy laurel
#

R u making nametags

noble flume
glossy laurel
mortal hare
#

kotlin's object and companion objects are so weird

noble flume
mortal hare
#

it eliminates the need of static

#

but at the same time introduces singletons

#

i guess its easier to unit test non static fields and properties

remote swallow
#

object fields are static anything else is a singleton

glossy laurel
noble flume
#

Wait how?

#

I thought I had to do shit with rotation

eternal oxide
#

you want it to always face the player? just set billboard

mortal hare
remote swallow
#

methods are under a singleton structure

noble flume
remote swallow
#

class variables are not

eternal oxide
#

ok

noble flume
eternal oxide
#

as pumpkin said, set the direction

noble flume
#

I didn’t know there was a function for the items direction

mortal hare
#

its so hard to adapt from java to kotlin

#

i would need at least couple weeks to get into the workflow

#

if not months

blazing ocean
#

I didn't really find it that hard tbh

#

It was only a year ago

mortal hare
#

its not that its hard i tend to google things of how would it look in java

remote swallow
#

once i figured out what everything did its not hard

#

it took me like a week

blazing ocean
noble flume
#

How do I set a direction to a display?

eternal oxide
#

for an ItemDisplay you rotateY of the right rotation (transformation)

#
Transformation transformation = entity.getTransformation();
transformation.getRightRotation().rotateY(rotation);
entity.setTransformation(transformation);```
#

rotation being in Radians

noble flume
eternal oxide
#

yaw

noble flume
#

I set it to the yaw?

worthy yarrow
#

Time to open up block bench and make some discs

eternal oxide
#

if you want it to face teh same direction as the player

blazing ocean
#

lmk if you need any help with resource packs

worthy yarrow
#

Omg please help with the resource packs

blazing ocean
noble flume
#

Ok I’ll check it out

worthy yarrow
blazing ocean
#

Ah lmao

worthy yarrow
#

Maybe we can do it early tomorrow I don’t work

#

Early for me I mean

blazing ocean
#

Not gonna be able to vc but I'll try to help anyway

worthy yarrow
#

Maybe tomorrow just better then

blazing ocean
#

Yeah I have lotta time tmrw

worthy yarrow
#

Ok cool I will dm you

eternal oxide
mortal hare
#

kotlin keeps surprising me

blazing ocean
#

inline classes are cool

mortal hare
#

I can already see "Parse, dont validate" approach with this

blazing ocean
remote swallow
#

anyone else had issues with any issues with inventories recently, somehow im unable to set slot 0 in an inv, other items get set and the item exists in the contents but the client isnt being sent the item

remote swallow
#

miles doesnt know either

#

hes confused too

river oracle
#

this is something I'd have to open CraftBukkit and NMS packets and source to figure out in all likelyhood

#

I'm on my laptop rn which makes that a no go

remote swallow
blazing ocean
#

wtf @river oracle !

river oracle
river oracle
blazing ocean
#

my fault

river oracle
#

yeah fucking slacker

#

you're bringing the team down

remote swallow
#

when did rad join pineapple

river oracle
#

he has no other role or purpose

#

he's doing a shit job I ain't got no nitro from him yet 🤷‍♂️

blazing ocean
#

And, good kotlin

#

100% will be builder DSLs

remote swallow
#

oh please do

#

ty

#

cant use ij convert to kotlin either

#

and cant dmca us later

blazing ocean
remote swallow
#

thats why i said you cant useit

#

when you realise how much there is to convert you'll say no

blazing ocean
#

hm

burnt cosmos
#

Trying to use buildtools but whenever I select version 1.21 it builds 1.21.1, am I doing something wrong?

#

Version says 1.21 at the top of the gui but in the console output it says
Building Bukkit 1.21.1-R0.1-SNAPSHOT

chrome beacon
#

1.21 was superceeded by 1.21.1

#

As there is no reason to ever use 1.21

burnt cosmos
#

NMS version changed

chrome beacon
#

All plugins compatible with 1.21 are compatible with 1.21.1

chrome beacon
burnt cosmos
#

api version is 1.21.1_R0.1 instead of 1.21_r0.1 isnt it?

#

Or is it the same

chrome beacon
#

The NMS version is 1_21_R1

#

for both

burnt cosmos
#

Ah okay my bad

#

Thanks

chrome beacon
#

For reference 1.21.1 just patches two bugs and added two languages

burnt cosmos
#

Ye it was a server crash bug or something wasn't it

chrome beacon
#

yes

#

It's a tiny bug fix

burnt cosmos
#

Oh the api version changed not nms version

#

Yeah im just dumb

#

LOL

noble flume
#

sorry about the reply lol

blazing ocean
#

?paste

undone axleBOT
grand flint
#

Is spigot forum trustable for devs?

remote swallow
#

sure

noble flume
#

how might I dotaht

mortal hare
#

do you know if this still the case

#

it seems that previously default impls on interfaces produced static class inside an interface, instead of utilizing default keyword inside jvm

grave kayak
#

I've made a plugin that uses custom heads for some of the items. when testing this on a test server of the same version (1.21.1) I get no errors. when we have moved it over to our main server I am getting this error. does anyone have an idea as to what this could be caused by ? \https://pastebin.com/5XP1KQJd

young knoll
#

?whereami

quaint mantle
river oracle
quaint mantle
#

frsvn — today at 20:18
🚫 no kotlin

#

why did you even enter to mi profile

#

🥁

remote swallow
#

To see who you are saying weird stuff

quaint mantle
remote swallow
#

I am y2k_ yes

quaint mantle
young knoll
#

Hey they actually fixed it

#

Hopefully this isn’t another hypixel skyblock clone

echo basalt
#

good ol' kotlin

glad prawn
#

whats that

sterile axle
#

wrong channel

#

#general

glad prawn
obtuse hedge
#

can someone help me figure out which packet contains the visual lines of text for the scoreboard and not the title

wary oyster
#

how do i load in a json that im using for some precalculated data that i need loaded? ive heard you use the resources folder but im new to spigot dev but i already know java to some extent (im in cs class in college rn)

obtuse hedge
#

?

blazing ocean
#

Don't know the packets name rn but should be along the lines of that

wheat kiln
#

I want to get into plugin development and I know you probably get a lot of new people who just beg for help and I may seem like one of them but I am making a mistake during just setting up a basic plugin somewhere and cannot for the life of me find what I am doing wrong. If someone could join me in general-1 vc to help me out that would be great.
Cheers,
Acevatex

obtuse hedge
quaint mantle
#

open a issue on viaversion github

obtuse hedge
#

its known

quaint mantle
#

what is it? 16<XX error?

#

too long scoreboard

obtuse hedge
#

?

#

no

#

wrong colors

quaint mantle
#

what's the error

obtuse hedge
quaint mantle
quaint mantle
obtuse hedge
quaint mantle
#

then

obtuse hedge
#

then what

quaint mantle
#

Like rgb converts to minecraft's default colors?

obtuse hedge
#

no, it continues to the next line

#

empty line of one color "&b" (no visible text), next line inherits color when it shouldn't

blazing ocean
obtuse hedge
#

issue?

#

ok

obtuse hedge
#

lol

blazing ocean
#

you should be using custom objective names anyway

obtuse hedge
#

yes but this is a pre 1.13 server

paper viper
#

Breh ok

quaint mantle
#

bro why is he modifying smth with nms instead of fixing it normally

obtuse hedge
#

??

quaint mantle
blazing ocean
quaint mantle
#

ta-da

blazing ocean
#

now what if you wanna actually fix the issue? lol

blazing ocean
quaint mantle
#

-# *💀 *

blazing ocean
#

I genuinely don't get what your problem is

quaint mantle
#

alr 👍🏻

paper viper
#

I think people would like it

#

Don’t you think

quaint mantle
#

let's goooooo

quaint mantle
#

why not

wheat kiln
obtuse hedge
#

I found the packet just for it to be spitting nonsense/garbage, fun

#

why must it be a string of only the color codes? wtf wheres the actual text

pliant topaz
#

theoretically you could maybe find a solution in newer versions of viaversion's code

#

maybe it works for your version, maybe not

obtuse hedge
#

its in the 1.12->1.13 conversion

#

i tested 1.8-1.12 and 1.13 is when the issue appears and lasts till 1.21 (latest)

#

packet id 0x45 in the 1.12.2 protocol, Update Score

#

which creates the lines and sets the text

#

I print out the data from that packet

#

and the text is just color codes

#

i've also printed out the data from the objective ones too

#

none it matches what i see ingame

#

theres 10 prints of SET_SCORE display name which is the same amount of lines there is on the scoreboard but the data it prints is just wrong

obtuse hedge
#

i give up for tonight

wheat kiln
#

is there a way to stop a block placing using PlayerInteractEvent?

smoky anchor
#

just cancel the event

torn bough
#

I'm trying to get the players current World id that way I can use it to save their Location

#

Should I really just loop through each getWorlds() and check the name until it matches to get the id of the current world in the array? Or is there a better way? (almost like toName, but I want toInt)

smoky anchor
#

player.getWorld should exist

torn bough
#

Doesn't that return a World?

smoky anchor
#

I'm trying to get the players current World

#

well ye, thats what you want, no ?

torn bough
#

That's only the first half of the sentence lol

#

I want the integer id

smoky anchor
#

oh world ID
That is.. not a thing ?

torn bough
#

So I later can do Location (getWorld(here will be the id), -, -, -)

smoky anchor
#

you mean UUID ?

torn bough
#

Because right now I have it default to getWorld(0)

#

And that works but that will always teleport to the overworld, not nether or end

#

And if I change it to getWorld(1), then it'll work

#

So I'm trying to convert the players current world to a int

smoky anchor
#

Ye I don't think that is how you should manage the worlds
Give me a minute

#

I'm in a meeting at work lol, I'll have to re-read this so I can give proper answer lul
(or get sniped by the big man)

sullen marlin
#

List.indexOf, but this doesn't seem like a good idea

#

You want to save the world name or uuid

#

Not int

#

Location is already serializable

smoky anchor
#

I would do UUID
World.getUID
(Why is this the name md, why)

sullen marlin
#

You can .get and .set it from a config

torn bough
#

Okay I think needed context

#

I'm making a home plugin, and when the player runs a command it saves their location

#

And if they go to a different world, they need to be able to /home back to their saved world

#

The UUID method would work well but I save all the player home data in PersistentData

smoky anchor
#

Ye, just store the UUID with the coordinates

#

?morepdc

undone axleBOT
torn bough
#

I will try to UUID

smoky anchor
#

Idk which resource gave PDC for UUID only

wheat kiln
#
if (p.getInventory().contains(new ItemStack(Material.GRAVEL))) {
    p.getInventory().removeItem(new ItemStack(Material.GRAVEL));
    p.getInventory().addItem(new ItemStack(Material.FLINT));
}
#

This only allows it if its a stack of one item and if I add an amount it sets it to only that amount

#

how can I allow it to be an ItemStack of any amount

sullen marlin
#

Look at the other contains overrides and/or the docs for removeItem

torn bough
#

World world = [retrieve the world using the uuid]

smoky anchor
#

Bukkit.getWorld(UUID) does exist

smoky anchor
sullen marlin
#

They're probably on 1.8 or smthing

smoky anchor
#

not if they are using PDC

torn bough
#

I don't know why it wasn't popping up when typing getWorld. I had to specifically do Bukkit first but alright

sullen marlin
#

Do you know java?

smoky anchor
#

welll- ye
Are you new to Java ?

torn bough
#

I don't consider myself new?

#

I mostly do C# I don't know if that changes anything though

#

Anyway, testing right now

quaint mantle
#

.GetWord ahh

torn bough
#

How do you force getWorld to take in a UUID instead of a String?

#

A UUID is a String right?

smoky anchor
#

You just pass the UUID

#

UUID is not a string

quaint mantle
quaint mantle
torn bough
#

Perfect, thanks both of you

#

UUID method is much better

halcyon hemlock
#

did you know c# code is offloaded to microsoft datacenters to be ran? the memory usage you see is for the Telemetry and Spyware

smoky anchor
#

How do things work when I am without internet connection tho 🤔

quaint mantle
#

Microsoft do some telemetry on .NET

wheat kiln
#

I got my first plugin completed 😄
probably the wrong channel to say this tho

quaint mantle
#

Home plugin?

wheat kiln
#

nothing too advanced just a basic if you right click stone with gravel it removes the gravel and gives you flint

#

very very simple stuff

#

not bad for 4 hours

#

and for a first attempt while learning java im pretty happy

#
package me.acevatex.gravelBreak;

import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class GravelBreak extends JavaPlugin implements Listener {
    
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        JavaPlugin.getPlugin(GravelBreak.class).getLogger().info("[GravelBreak] - Plugin Enabled");
    }

    @Override
    public void onDisable() {
        JavaPlugin.getPlugin(GravelBreak.class).getLogger().info("[GravelBreak] - Plugin Disabled");
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Player p = event.getPlayer();
        if (!event.hasItem()) {
            return;
        }
        if (event.getMaterial() == Material.GRAVEL && Objects.requireNonNull(event.getClickedBlock()).getType() == Material.STONE) {
            ItemStack handItem = event.getItem();
            if (handItem == null) {
                return;
            }
            if (handItem.getType() == Material.GRAVEL) {
                p.getInventory().removeItem(new ItemStack(handItem.getType(),handItem.getAmount()));
                p.getInventory().addItem(new ItemStack(Material.FLINT,handItem.getAmount()));
            }
            p.spawnParticle(Particle.BLOCK_DUST, Objects.requireNonNull(event.getInteractionPoint()),10, Material.GRAVEL.createBlockData());
        }
    }

    @EventHandler
    public void onBlockPlace(BlockPlaceEvent event) {
        if (event.getBlockPlaced().getType() == Material.GRAVEL && event.getBlockAgainst().getType() == Material.STONE) {
            event.setCancelled(true);
        }
    }
}
#

the entirety of the code ^

#

most of the 4 hours was scouring docs / forums and learning about common practises

smoky anchor
#

can you put java behind the ``` ?
```java
code```
It makes stuff colorful

wheat kiln
#

ah yea I forgot lol

smoky anchor
#

tyy <3

wheat kiln
#

I think I have the knowledge for a basic claims plugin now

#

and that will allow me to start learning about inventory gui's

#

which will be fun