#help-development

1 messages · Page 765 of 1

lost matrix
#

Show some code pls. Comparing the distance between two colors can be done via an N-dimensional vector (3 without and 4 with alpha)

storm crystal
#

is this correct to do something to each entity that's been scanned

#

or did I do this wrong as well

grim hound
#

It's like watching a gore video and discovering how much you can bend the human body

glad prawn
rotund ravine
#

@storm crystal That’s a fine loop

prisma sedge
rotund ravine
grim hound
#

Like you don't even think about it

prisma sedge
#

I can't figure out a way to compare them at all

rotund ravine
#

Just show us where you are at

prisma sedge
#

alright

#
        int PURPLE_R = 150;
        int PURPLE_G = 80;
        int PURPLE_B = 150;
        int TOLERANCE = 60;
        return (PURPLE_R - TOLERANCE < color.getRed() && color.getRed() < PURPLE_R + TOLERANCE) &&
                (PURPLE_G - TOLERANCE < color.getGreen() && color.getGreen() < PURPLE_G + TOLERANCE) &&
                (PURPLE_B - TOLERANCE < color.getBlue() && color.getBlue() < PURPLE_B + TOLERANCE);
    }```
rotund ravine
grim hound
prisma sedge
#

I know it's not polished I just need it to work atm

grim hound
#

Cuz what the hell

rotund ravine
lost matrix
rotund ravine
#

I am alien

storm crystal
#

since Im not using i at all and just refer to living entity

prisma sedge
#

I tried the solution they had, it didn't work very well.

lost matrix
prisma sedge
#

I tried messing with the tolerance and everything but nope

rotund ravine
#

Just call i entity and it looks even better

lost matrix
rotund ravine
#

More different ways to compare

compact haven
#

ive put classes inside of methods before

#

in kotlin

prisma sedge
compact haven
#

nope

rotund ravine
#

Sounds dumb

compact haven
#

nah nah watch

storm crystal
#

how do sound and category look like, whats the base volume and pitch for sound effects?

rotund ravine
#

Probably 1 and 1

grim hound
rotund ravine
compact haven
#
fun onCreate(ctx: Context) {
  class CreateResponse(val something: Int)
  
  ...

  val response = CreateResponse(15)
  ctx.respondJson(response)
}
rotund ravine
#

Ah

grim hound
#

Man just make it outside or use many variables

compact haven
#

I trick gson into serializing it without exposing needless classes that arent use outside the rest handler

grim hound
#

Like why

#

Why

compact haven
#

because I decided to

#

that's why

compact haven
#

now to be fair, that is pretty bad. I would actually abstract the Requests and Responses into a separate dependency, so it can be made part of a lib that calls the rest api as well

#

then it can also be unit & integration tested without duplicate code

#

but if you're not doing that, then it's great

prisma sedge
#

@lost matrix I just noticed that it was because my tolerance was too high

#

sorry but all is well

dry hazel
lost matrix
# prisma sedge <@220605553368498176> I just noticed that it was because my tolerance was too h...

Untested code. Let me know if this works.

  public double calculatePerceivedDifference(Color from, Color to) {
    float[] fromYuv = new float[3];
    float[] toYuv = new float[3];
    ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.TYPE_YCbCr);
    from.getComponents(colorSpace, fromYuv);
    to.getComponents(colorSpace, toYuv);
    float dx = fromYuv[0] - toYuv[0];
    float dy = fromYuv[1] - toYuv[1];
    float dz = fromYuv[2] - toYuv[2];
    return Math.sqrt(dx * dx + dy * dy + dz * dz);
  }
#
  • YUV color space btw
prisma sedge
#

ok I'll see if it works rq

lost matrix
prisma sedge
#

well if it works better.

#

where?

lost matrix
glad prawn
#

dy +

prisma sedge
#

oh

#

so this returns a percent?

storm crystal
#

is this a proper way of catching if player is interacting with nothing and then just ignore the rest?

lost matrix
umbral ridge
#

Made it like so

lost matrix
prisma sedge
inland apex
#

I'm trying to create a 1.8.9 spigot plugin using the IntelliJ "Minecraft Development" plugin but it only goes down to 1.12 how do i change that

prisma sedge
#

thanks for the help though

storm crystal
#

why

umbral ridge
rotund ravine
#

@storm crystal If they have nothing in their hand right?

inland apex
rotund ravine
#

That’s what ur going for?

lost matrix
# inland apex ...

But just let the plugin create a 1.12 project and change the version in your pom.xml

inland apex
#

nah but fr

rotund ravine
inland apex
#

kk

rotund ravine
#

Smh

#

1.8.9 should just die

#

It has lived long enough

lost matrix
rotund ravine
#

We don’t want it anymore

storm crystal
#

and that doesnt give me any errors

rotund ravine
#

Then check if it’s null or air

lost matrix
rotund ravine
#

We don’t want exceptions to be thrown is probably the easiest way to explain it

storm crystal
#

thats literally why I decided to remove interacting with nullpointerexception

rotund ravine
#

Don’t get it if it can produce a nullpointer

#

Before checking first

quaint mantle
#

It can be null if player in login state. i think.

rotund ravine
#

if (item == null || !item.hasItemMeta()) it’s probably air

#

Woops

quaint mantle
#

Bruh this is itemstack

rotund ravine
#

Yes

lost matrix
rotund ravine
#

Also

#

Also itemmeta will always be null on air

lost matrix
storm crystal
#

what does this mean

rotund ravine
#

It means it’s old

#

player has two hands

lost matrix
# storm crystal what does this mean

Deprecated methods are candidates for removal and should not be used.
There are always alternatives if a method gets deprecated in Spigot.
(Aside from two or so exceptions to this rule)

storm crystal
#

so how do I get player's item in hand

#

right hand

rotund ravine
#

It’s called the main hand

#

?jd-s

undone axleBOT
lost matrix
storm crystal
#

how do I check if it returns an empty collection

lost matrix
#

Collection<T>#isEmpty() -> boolean

storm crystal
#

whats ->

lost matrix
#

return type

rotund ravine
#

You know

#

If you went through some basics in a java programming course. That’d be super duper cool

glad prawn
#

l-learnj

storm crystal
#

last time I checked it's not a strict requirement to pass some kind of exam to be allowed to type here

rotund ravine
#

It’s not. It’s just painful to see you making very basic mistakes that could easily be rectified if you spent an hour or two learning via a course.

storm crystal
#

Why do you care

#

its my problem

lost matrix
#

Yeah but it is a little bit rude if you didnt put in a bit of your time into getting the basics done to be honest

rotund ravine
#

We’re not always nice and helpful, so please do take your time in getting some basics down. We do not expect you to know everything, nor should you really cause we don’t. Just like general layout of the language as well as general conventions would be a major improvement in your efficiency.

rotund ravine
#

Need more code to answer

#

Wait i don’t

storm crystal
rotund ravine
#

Alright it’s marked ss notnull

#

Right after the getItem line. Put “if (!item.hasItemMeta()) return;”

#

Also what is getType telling you?

lost matrix
# storm crystal

Checking objects if they are null after using them is not useful

storm crystal
#

where did I use it

rotund ravine
#

After

#

Which is not useful

storm crystal
#

same problems

#

getting nullpointerexception all the time

lost matrix
rotund ravine
#

That’s not after, but before

storm crystal
#

pretty funny since using try and catch actually removes that problem

storm crystal
rotund ravine
#

You are using it

lost matrix
#

Yeah. Then just try catch with general Exception
This removes all problems

rotund ravine
#

Sry it’s not marked as notnull i see i see

rotund ravine
# lost matrix

You just gotta move the pieces you already have here around

lost matrix
prisma raft
#

ItemStack item <- declares the item variable
item.getType() <- takes the object referenced by the item variable and attempts to call its getType() method. This will throw a runtime error if item is null, because null objects can't have methods called on them

#

you would want to check if it's null after declaring it but before using it

storm crystal
rotund ravine
#

We just told you the proper way

#

After getItem

storm crystal
#

nuh uh, didnt work

rotund ravine
#

Check

lost matrix
rotund ravine
hazy parrot
#

if you are missing fundamentals, can you atleast try to not be rude

storm crystal
#

why not use something made to catch errors to catch errors

rotund ravine
#

Sec

lost matrix
lost matrix
rotund ravine
# storm crystal you still havent told me why I shouldnt do it

A NullPointerException is an error that happens when you try to use a variable that has no value. For example, if you declare a variable like this:

String name;

and then try to do something with it, like this:

System.out.println(name.length());

you will get a NullPointerException, because name has no value assigned to it. It is like trying to measure the length of nothing.

One way to avoid NullPointerExceptions is to check if the variable is null before using it, like this:

if (name != null) {
  System.out.println(name.length());
}

This way, you will not try to use a variable that has no value.

Another way to avoid NullPointerExceptions is to make sure that you always assign a value to your variables when you declare them or soon after, like this:

String name = "Alice";
System.out.println(name.length());

This way, you will not have any variables that are null.

Some people might think that catching a NullPointerException with a try-catch block is a good way to handle this error, like this:

try {
  System.out.println(name.length());
} catch (NullPointerException e) {
  System.out.println("Oops, name is null!");
}

However, this is generally a bad practice for several reasons¹²³⁴:

  • Catching a NullPointerException means you are hiding or ignoring the actual bug in your code. Instead of fixing the problem that causes the variable to be null, you are just covering it up with a catch block. This can make your code harder to debug and maintain.
  • Catching a NullPointerException can make your program behave unpredictably. For example, if you catch a NullPointerException and then return a default value, you might end up with incorrect or inconsistent results. For example, if you catch a NullPointerException and return 0 for the length of a name, you might end up with wrong calculations or comparisons later on.
  • Catching a NullPointerException can make your code less readable and understandable. For example, if you catch a NullPointerException and then print a message or log an error, you might confuse yourself or other developers who read your code. They might wonder why you are catching this error and what it means for the logic of your program.

Therefore, it is better to avoid causing NullPointerExceptions than to catch them. You should always initialize your variables with proper values and check for null values before using them. This will make your code more reliable, robust, and clear.

Source: Conversation with Bing, 29/10/2023
(1) java - When is it OK to catch NullPointerException? - Stack Overflow. https://stackoverflow.com/questions/18265940/when-is-it-ok-to-catch-nullpointerexception.
(2) java - What is a NullPointerException, and how do I fix it? - Stack .... https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it.
(3) Is it a acceptable approach to put try catch wherever null pointer .... https://softwareengineering.stackexchange.com/questions/187175/is-it-a-acceptable-approach-to-put-try-catch-wherever-null-pointer-exception-occ.
(4) Catch NullPointerException | OWASP Foundation. https://owasp.org/www-community/vulnerabilities/Catch_NullPointerException.
(5) java - Null Pointer exception within a try catch block - Stack Overflow. https://stackoverflow.com/questions/21288433/null-pointer-exception-within-a-try-catch-block.

glad prawn
#

longer than my phone screen 😭

rotund ravine
#

@storm crystal

Java is a popular and powerful programming language that can be used to create various applications, including spigot plugins for Minecraft servers. Spigot plugins are pieces of code that add or modify the features and behavior of the game¹. To create spigot plugins, you need to have a good understanding of the Java basics, such as syntax, variables, data types, operators, control structures, methods, classes, inheritance, interfaces, exceptions, and collections².

Learning Java basics before using it for spigot plugins is the best way to start because it will help you to:

  • Write clear and efficient code that follows the Java conventions and standards³.
  • Avoid common errors and bugs that can cause your plugin to malfunction or crash the server⁴.
  • Use the spigot API and documentation effectively to access and manipulate the game elements⁵.
  • Debug and test your plugin easily using various tools and methods⁶.
  • Extend and improve your plugin with more features and functionality using advanced Java concepts⁷.

Asking basic questions without at least trying to learn is rude to the ones answering because it shows that you are not willing to put any effort or time into learning Java. It also wastes the time and energy of the people who are trying to help you. There are many resources available online that can teach you Java basics, such as tutorials, courses, books, videos, blogs, forums, etc⁸. You should use these resources first before asking for help. If you still have questions or problems after trying to learn, you should ask them in a polite and respectful way, providing as much detail and context as possible. You should also acknowledge and appreciate the answers that you receive from others.

If you continue to ask basic questions without trying to learn, you should seek help elsewhere because you will not be able to create spigot plugins successfully. You will also annoy and discourage the people who are trying to help you. You may even get banned from some communities or platforms for spamming or violating their rules⁹. Therefore, it is better for you to find another way to learn Java basics or another project to work on.

I hope this explanation helps you understand why learning Java basics before using it for spigot plugins is the best way to start. If you have any other questions or requests, please let me know. 😊

¹: 1
²: 4
³: 7
⁴: 8
⁵: 5
⁶: 2
⁷: 6
⁸: 3
⁹: 9.

Source: Conversation with Bing, 29/10/2023
(1) Bukkit Plugins - Projects - Bukkit. https://dev.bukkit.org/bukkit-plugins.
(2) Overview - EssentialsX - Bukkit Plugins - Projects - Bukkit. https://dev.bukkit.org/projects/essentialsx.
(3) Overview - WorldEdit for Bukkit - Bukkit Plugins - Projects - Bukkit. https://dev.bukkit.org/projects/worldedit.
(4) Java Tutorial - W3Schools. https://www.w3schools.com/java/.
(5) Java Basics | Basics of Java - Javatpoint. https://www.javatpoint.com/java-basics.
(6) Learn Java | Codecademy. https://www.codecademy.com/learn/learn-java.
(7) The Java™ Tutorials - Oracle Help Center. https://docs.oracle.com/javase/tutorial/.
(8) Basics of Java - Complete guide to Java Basics - Codestudio - Coding Ninjas. https://www.codingninjas.com/studio/guided-paths/basics-of-java.
(9) undefined. https://www.oracle.com.
(10) Getty Images. https://www.gettyimages.com/detail/photo/java-programming-concept-virtual-machine-on-server-royalty-free-image/1131109259.

storm crystal
#

last time I asked someone on discord if I know enough java basics for plugins they told meI do after asking a few questions

glad prawn
#

ur not

prisma raft
#

also, when your two alternatives are

if (will error) {
  // do nothing
} else {
  // do stuff that you now know won't error
}

and

try {
  // do stuff that may error
} catch (Exception e) {
  // do nothing
}

then both of them are pretty bad, because of how "do nothing" usually isn't exactly what you would want to happen when something doesn't work as expected (because that way, when something goes wrong, it won't blow up instantly and tell you about it, but instead the error will sneak around your program), but that being said:

handling your logic through try-catch blocks isn't really how java is designed and really bad for performance, so if your program is just performing normal logic and you have the choice between doing the same thing with if else or with try catch, never do the latter

rotund ravine
#

You're not at a point where i would say you know java basics to any point that is reasonable to start asking questions here. At this point it feels like we are writing your plugin and you are just directing ideas. We are not being paid for this, and that is the reason we usually program for someone. Whoever said you knew enough are clearly either taking the piss on you or have poor judgement. You have displayed a reasonable doubt on your knowledge of even simple sequential execution, simple nesting and scopes as well as simple conventions. I say simple because, these are what you will be learning at the start of any simple programming course. There is no doubt in my mind that you either need to learn by fire and simply do things yourself, or go take a basic course before continuing ask questions, because I will at least not entertain you anymore than I already have.

umbral ridge
#

hey what's that line in jetbrains ide?

A code guideline?

river oracle
#

your lines will wrap if you go past that point

umbral ridge
#

okok

umbral ridge
#

I never type code that's longer than that now anyways

river oracle
#

no I don't believe java has any set standard on how long your code can be in asingle line

#

usually people use like 80 pretty sure

#

my code wraps at 144 characters though

umbral ridge
#

Oh

echo basalt
prisma raft
#

there are various standards, but they aren't exactly "global"

echo basalt
#

80 is a bit short

#

I just use google style with 120 wrap

river oracle
#

for reference thef irst line is 80 characters the second line is 144

echo basalt
#

imagine using an arch background lmao nerd

river oracle
echo basalt
#

looks like arch

river oracle
#

who are you talking about

#

its not lmao

prisma raft
river oracle
umbral ridge
#

I put javadoc everywhere

lost matrix
river oracle
lost matrix
prisma raft
#

just saying that there are standards, but not everyone is using the same standards

inner mulch
#

Is there an event that listens to a player using the middle click to copy a block to the hot bar in creative?

river oracle
#

I mean that could be said for anything, my initial response of there being no java standard was quite correct

#

there are company standard

river oracle
#

creative mode is mostly clientside

inner mulch
#

is there one for survival tho?

#

doesnt need to be creative

umbral ridge
#

Is this required? The warning is annoying

lost matrix
compact haven
#

it’s there because getString can return null if that key isn’t in the config

umbral ridge
#

Alright

prisma raft
#

but we can probably agree that you just meant that there is no standard that everyone adheres to, which is most definitely correct

#

Anyways, to talk about what I came here for:

I've been thinking about writing a tool to convert the schematic files that you get from worldedit to nbt files that you could load in vanilla, and what I found so far was this:
https://github.com/EngineHub/WorldEdit/blob/master/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java
which is referenced in the minecraft wiki as an implementation of the schematic file format used by mcedit and other mods/programs.
I've read through the code a bit and figured out that it probably reads from this file:
https://github.com/EngineHub/WorldEdit/blob/master/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json
to convert from the legacy numeric IDs that the file format uses to get actual BlockState values that can actually be useful.

Now what I wanted to ask is whether anyone knows if this format seriously is what MCEdit uses, because

  1. the format is crazy convoluted, and at least when having its core component be a method with the word "legacy" in the name you'd expect the dev to think twice and start deprecating the format, but I don't see the class being described as deprecated anywhere, and
  2. as opposed to other files in the same folder, legacy.json hasn't been updated for 2 years, so it probably doesn't even have newer blocks reflected in it, which is also hard for me to believe.

So, does anyone know if I can find a newer implementation anywhere, or if I misinterpreted something and the implementation that I pointed to actually does handle the newest version just fine, or if MCEdit is just that bad?

#

also please tell me if I'm asking in the wrong place, like if you'd rather I annoy the actual worldedit devs about this

#

I only just noticed that they have their own discord server

lost matrix
prisma raft
#

yeah that's what I thought, the question is where I'd find a documentation of the format as it's used in modern versions

#

since the one that I found seems to only be mapping from the numbers it reads using legacy.json

lost matrix
#

I dont think the schematic file format changed in the last 5 years or so

dry hazel
prisma raft
#

oh I've been misspeaking this whole time, I think I said MCEdit a few times when I've been referencing (and meaning) WorldEdit

lost matrix
#

I remember when Sponge was big hype. Was still during bukkit times 🙂

prisma raft
#

but you seem to have understood correctly despite me misspeaking

lost matrix
#

MCEdit and WorldEdit both support the .schematic format so its fine

young knoll
#

Worldedit uses sponge version 3 schematics atm

prisma raft
#

anyways, the wiki page that you linked to is what I started with, and the java class that I linked to is what the wiki gives as the first entry under "Implementations"

lost matrix
young knoll
#

It can load various versions

prisma raft
prisma raft
storm crystal
#

what am I doing wrong with spawning a particle

smoky oak
#

maybe ur spawning it at the wrong location

lost matrix
zinc lintel
#

i have a question

#

will this work the way i did it?

#

its just so i can have it organised

dry hazel
#

yes

echo basalt
#

?conventions

storm crystal
#

how do I make short delay

inner mulch
storm crystal
#

no, just a short delay like 0.1s

inner mulch
#

that pretty much a cooldown

#

hashmap<UUID, Long>
and for the long you use system.currenttimeinmillis or something

#

when the player tries to do next action

#

just see if previous time equals current time

hazy parrot
#

You mean delay in your code or cooldown?

storm crystal
#

former

#

I want to make one action, wait 0.1s and then do another action

tall dragon
#

Thread.sleep Business_Okayge

storm crystal
tall dragon
#

oh i was jokin dont do that ;d

#

?scheduling

undone axleBOT
storm crystal
#

???

tall dragon
#

what

quaint mantle
echo basalt
#

sigh

#

do it

#

no balls

#

see what happens

hazy parrot
#

Why do you want to wait?

storm crystal
#

nevermind ill just make it half work

hazy parrot
#

You can use BukkitSchedluer#runTaskLater

vocal cloud
#

Can’t Keep Up! Is the Server Overloaded

hazy parrot
#

Just keep up smh

prisma raft
# storm crystal ???

when someone sends a guide that explains what you do, good responses would be either to read the guide and do what it says or, if you don't understand something about the guide, not just say "???" but actually explain which part of the guide you're having issues with

quaint mantle
#

Thread.getCurrentThread().join() to get max performance /s

warm mica
# storm crystal

If you do not know what this method does and what the consequences are, do not use it

storm crystal
prisma raft
#

well that part is what the guide explains in the first paragraph

inner mulch
#

if i connect a sql database in the onEnable method, how do i return the connection to a class that manages the data from the database?

ivory sleet
storm crystal
rotund ravine
#

Just use thread.sleep no balls

prisma raft
#

but shuriken wasn't around to see other people already having pointed out that you don't have that, which probably is why they misjudged that

storm crystal
#

mhm

#

how can I make a code that would run every x seconds when a certain condition is met

chrome beacon
#

Use the scheduler

thin iris
#

use a scheduler

chrome beacon
#

?scheduling

undone axleBOT
storm crystal
#

is there no other option?

hazy parrot
#

Yes there is, use executor service

chrome beacon
hazy parrot
#

Altrough no reason for other option lol

storm crystal
hazy parrot
#

BukkitSchedluer made it easy enough

chrome beacon
storm crystal
#

like tf is lambda

lost matrix
#

You dont need a lambda for this

storm crystal
#

lambdaexpression, lambdabody, extends, , supplier

lost matrix
#

Yeah, skip all of that

chrome beacon
storm crystal
#

?

chrome beacon
#

I suggest you look at some Java tutorials

rotund ravine
#

Just use the bukkitrunnable with the anonymous inner class

rotund ravine
#

A few hours ago

chrome beacon
#

Yeah that usually happens

prisma raft
#

lambda expression is a shorthand that lets you create anonymous classes where only one method is left to be implemented

chrome beacon
#

They always refuse to learn java for some reason

storm crystal
#

what does anonymous class mean

prisma raft
#

it's the concept that lambda expressions are based on

rotund ravine
#

I told em we would get tired of writing his code for him

#

And that i would ignore him

storm crystal
prisma raft
#

basically, when you have an interface, you don't need to create a new class implementing the interface to be able to instantiate it, you can instantiate directly and put the class implementation right after the object constructor

rotund ravine
#

I do wonder if a porcupine baby is spiky

#

Cause that’s about the size i can swallow

#

I think

chrome beacon
rotund ravine
#

Idk how big a porcupine baby is

lost matrix
# storm crystal lambdaexpression, lambdabody, extends, , supplier

Step 1) Write a class which extends BukkitRunnable

public class SomeScheduledTask extends BukkitRunnable {

  @Override
  public void run() {
    System.out.println("Test");
  }

}

Step 2) Get your JavaPlugin instance and start this task:

    JavaPlugin plugin = ...;
    SomeScheduledTask task = new SomeScheduledTask();
    int initialDelay = 5;
    int repeatedDelay = 100;
    task.runTaskTimer(plugin, initialDelay, repeatedDelay);

This will call the run() method after 5 ticks (which is ~250ms) and then every 100 ticks (which is ~5s)

rotund ravine
#

Yeah i can’t swallow that

lost matrix
prisma raft
storm crystal
prisma raft
#

that's why it's called "anonymous"

storm crystal
#

I didnt force you at all to help me, you did it willingly lol

rotund ravine
#

We all make poor choices

lost matrix
rotund ravine
lost matrix
#

Dont like how he strikes his wiener but the thing is cute

prisma raft
#

I think the point is that they have no problem with helping, but are warning you that that won't be the case if it turns into them writing all the code for you, or them giving a full guide on java basics

rotund ravine
#

Baby getting some special service then

lost matrix
#

lol

prisma raft
storm crystal
lost matrix
#

I told him to make a concrete impl of BukkitRunnable

rotund ravine
#

Why do you think

#

?learnjava

undone axleBOT
prisma raft
#

oh you're right, I thought someone mentioned lambdas to them and then they asked, but they just asked on their own

prisma raft
#

I don't think people will blame you for asking questions without knowing the basics, though some seem annoyed that you claimed to know the basics despite having to ask about basically every basic java concept that was relevant so far

storm crystal
#

let me get it straight, am I or am I not in any right to ask questions here despite apparently not getting all basics

rotund ravine
#

You are allowed to be here just fine. Expect to get told to learn the basics at each question though

wind veldt
wind veldt
#

thx

prisma raft
#

(that was already answered btw, they were just complaining about the manner in which it was answered)

rotund ravine
#

Can’t u add a few more

storm crystal
rotund ravine
#

No i was talking to

#

Ehhh that other guy

prisma raft
wind veldt
#

Let's end the argument here, @storm crystal man if you feel their answer is incomplete or the guide they sent is too complex, just DM me and I'll quickly explain what and why

rotund ravine
#

That’s nice of you

#

I’d be way too lazy

#

Also rip chandler bing

#

Is this a prelude to some bible thingV

wind veldt
#

He's bout to tell us some prophecies

#

shush

#

xD

rotund ravine
#

He got quiet

#

Nvm

#

Woah

lost matrix
#

Did they update it finally?

prisma raft
# undone axle Here are some links to get you started on learning Java: - <https://www.codeca...

also I think "basic java" is pretty poorly defined. Most of the guides that the bot lists here already count just inheritance as advanced knowledge, while the people here seem to count anything as basic that is a commonly used concept or language feature. Which I'd agree with, because I'd call something basic if it's used for basically everything, but it's still hard to tell someone "learn the basics" and then link a guide that lists the thing that they just said to learn as being an "advanced topic"

rotund ravine
#

I have never used any of these guides so wouldn’t know 😬

storm crystal
umbral ridge
#

I'm trying to detect if player moved for 1 block, is this how it's supposed to be done? any better way? less code?

rotund ravine
#

We work by a principle called Don’t reinvent the wheel

wind veldt
#

Wait guys

#

You know what the guy DMed me?

rotund ravine
#

Thst you suck?

#

Jkjk

wind veldt
#

He DMed me in polish, saying that no one asked for my opinion and I didnt bring anything into the convo

lost matrix
wind veldt
#

Crazy

rotund ravine
#

He did?

#

That’s funny

wind veldt
rotund ravine
#

Guess he’s a troll then

wind veldt
umbral ridge
#

I'm not good at maths, help me out? xD

lost matrix
#

Ah its BlockX
In that case you should not use floats

rotund ravine
umbral ridge
rotund ravine
#

Called distanceSquared

storm crystal
lost matrix
storm crystal
#

like how can you be sure that they do cover basics

umbral ridge
#

that's about it?

rotund ravine
umbral ridge
#

Nice

#

easy peasy

rotund ravine
umbral ridge
#

squezy

#

what's wrong with it

storm crystal
wind veldt
prisma raft
storm crystal
#

I read it and what else

umbral ridge
storm crystal
#

is that enough

umbral ridge
#

Not sure why i'll have to look into it

prisma raft
#

definitely

rotund ravine
prisma raft
#

also most people seem to have issues with learning from text guides, though it might be a good fit since you said you're not looking forward to a 12h youtube tutorial

storm crystal
#

I read something similar on w3schools but apparently this wasnt enough basics

rotund ravine
#

Fairly certain duskgaler is just trolling at this point

storm crystal
#

even though someone did recommend me it earlier here

rotund ravine
#

Oh oh

#

Good thing i haven’t opened minecraft in over a year

wind veldt
#

lmao

storm crystal
rotund ravine
#

sry new people needed to know my amazing deduction

prisma raft
#

btw I wouldn't say it's necessary for you to internalize every part of the oracle guide, it's mainly good for giving an overview of which concepts even exist in the language, how they're related, and you can use it to look up something when you need to know more about it

lost matrix
# umbral ridge Yea sure
  @EventHandler
  public void onMove(PlayerMoveEvent event) {
    Location from = event.getFrom();
    Location to = event.getTo();
    int fx = from.getBlockX();
    int fy = from.getBlockY();
    int fz = from.getBlockZ();

    int tx = to.getBlockX();
    int ty = to.getBlockY();
    int tz = to.getBlockZ();

    if (fx == tx && fy == ty && fz == tz) {
      return;
    }

    System.out.println("Player crossed a block corner.");
  }

And if you really want to nerd about a few clock cycles then you can do this:

    if ((fx ^ tx | fy ^ ty | fz ^ tz) == 0) {
      return;
    }
umbral ridge
#

thank you

prisma raft
#

a helper will quickly get exhausted when they need to explain every single concept, but if you can go there to read about it first and only ask when you have problems understanding, it'll probably be a much smoother experience for both ends

storm crystal
wind veldt
rotund ravine
#

Ur chinese?

wind veldt
#

Just a tryhard in anything I do

rotund ravine
#

You learning chinese?

umbral ridge
hazy parrot
#

Bitwise OR

rotund ravine
#

Spread the influence of god by posting the bible plugin on chinese pages

umbral ridge
#

ahh

wind veldt
umbral ridge
#

okok

rotund ravine
#

Poor you

wind veldt
#

💀

#

insane use

storm crystal
rotund ravine
#

If i mention taiwan do i get banned

wind veldt
umbral ridge
rotund ravine
#

Why, wouldn’t the “one-china” thing allow me to mention it by saying they are one of us

wind veldt
#

good tip, will be executed immediately

storm crystal
#

Mhm, yeah

lost matrix
rotund ravine
#

台湾是我们的一部分

storm crystal
#

Thats what I was talking about but ig

lost matrix
hazy parrot
rotund ravine
wind veldt
rotund ravine
#

Racistt

#

Banned

umbral ridge
prisma raft
rotund ravine
#

Funny

prisma raft
#

as a general tip, anything that needs to be imported first with a minecraft-specific prefix or something like that is part of spigot, and anything that looks like it's part of the syntax or is part of a java library (so it's imported as something not minecraft-specific) is part of general java

rotund ravine
#

What’s an import

tall dragon
#

why is this not possible ;,/

wind veldt
rotund ravine
lost matrix
echo basalt
rotund ravine
#

Class<? extends event>

tall dragon
#

yea im about to throw my pc out the window

#

fking generics

echo basalt
#

yeah they easy

rotund ravine
#

As the lord praised

storm crystal
wind veldt
tall dragon
#

or should i forget it

#

xd

lost matrix
#
Map<Class<? extends Event>, Consumer<? extends Event>>
echo basalt
#

:)

rotund ravine
#

In the realm of software development, Java Generics are a blessing, akin to divine favor. Just as the Lord praised the heavens and the earth, so too do Java developers extol the virtues of generics.

In the beginning, there was chaos in the land of Java. Developers were constrained by the limitations of non-generic code, as they could only deal with objects of a specific type. It was a time of great toil and inefficiency.

Then, in their wisdom, the creators of Java bestowed Generics upon the codebase. And it was good. With Generics, developers could create classes, methods, and interfaces that were not bound to a single type but could work with a multitude of types. This was a revelation, much like the parting of the Red Sea.

As the Lord divided light from darkness, so did Java Generics separate type safety from ambiguity. With the power of Generics, developers could catch type-related errors at compile time, preventing the plague of runtime errors that plagued the non-generic code of old.

Just as the Lord's commandments guided the people of old, so too do the principles of type erasure and wildcards guide Java Generics. They offer flexibility, yet with great responsibility. Developers must heed these principles to ensure the sanctity of their code.

Like a divine choir, Java Generics allow for more elegant and reusable code, bringing joy and harmony to the land of Java. The ability to create generic collections, classes, and methods is a testament to their versatility.

In the annals of Java, Generics are celebrated as a gift from above. They are a testament to the power of abstraction and polymorphism, allowing developers to write code that is more generic and adaptable, much like the wisdom of the scriptures.

Indeed, in the world of programming, Java Generics are a blessing bestowed upon the faithful, enabling them to write code that is both powerful and safe. So, let us continue to sing praises to Generics, for they are as easy to use as the Lord's grace is to receive.

prisma raft
rotund ravine
#

Probably

tall dragon
# lost matrix Sure

right but then u run in into the next problem on the other end when u have an instance of Event but it wants a capture of ? extends Event

echo basalt
#

make a hacky cast

rotund ravine
#

Well casting 💪🏻

storm crystal
#

Is there any skript guide I could watch/read?

tall dragon
#

😂

rotund ravine
#

We don’t really help with skript here i think

lost matrix
# tall dragon

Unsafe cast is fine here as long as you strongly encapsulate your map

rotund ravine
#

They do on the forums

wind veldt
storm crystal
rotund ravine
#

Thought u were talking about twitter for a moment

#

Spigot forums

#

Idk if there are other forums

storm crystal
#

Well idk either

tall dragon
rotund ravine
#

I would suggest trying to google skript

storm crystal
#

I guess I could work with that

wind veldt
storm crystal
lost matrix
# tall dragon right yea i guess ur right
  @SuppressWarnings("unchecked")
  public <T extends Event> void publish(T event) {
    Consumer<T> consumer = (Consumer<T>) this.eventHandlers.get(event.getClass());
    consumer.accept(event);
  }

In the end your map is just a Map<Object, Object> and you need to make sure that nothing is added
to this map, unless its done with your method. This method creates constraints that make your code safe (at least on compiletime)

echo basalt
#

null check

lost matrix
#

Yeah, sure do that as well

tall dragon
#

alright il go ahead and try that

prisma raft
storm crystal
#

Whats that

rotund ravine
#

Idk

#

Smth visual

#

Like how programming is taught to kids

storm crystal
#

Mhm

lost matrix
# echo basalt null check
  @SuppressWarnings("unchecked")
  public <T extends Event> void publish(T event) {
    Optional.ofNullable(this.eventHandlers.get(event.getClass()))
        .map(consumer -> (Consumer<T>) consumer)
        .ifPresent(consumer -> consumer.accept(event));
  }

Just for you without null check 🫰

storm crystal
#

What kind of plugins can be made with this

#

As in to what extent

echo basalt
#

optional woe

wind veldt
echo basalt
#

nooo

wind veldt
prisma raft
#

the list isn't super long

storm crystal
echo basalt
#

let's create a new object for checking nullability hurray

rotund ravine
#

We do that a lot

wind veldt
rotund ravine
#

I just checked over the description and documentation

wind veldt
#

Dude you just wanna turn down everything people say here, whats up with you man

rotund ravine
#

I mean i could have said it was visual programming instead of idk

storm crystal
#

Im not forcing you to help me

wind veldt
#

Overview
Visual Bukkit is a visual programming language for Bukkit plugins, allowing you to create plugins without knowing Java.

rotund ravine
wind veldt
storm crystal
#

I asked to what extent can you make plugins

lost matrix
rotund ravine
#

Would be interesting to expand on

storm crystal
#

Like database management wouldnt be possible would it

rotund ravine
#

Idk

lost matrix
rotund ravine
#

Seems like it would i guess

prisma raft
#

btw, most browsers have a feature that they let you search for stuff by pressing Ctrl + F

prisma raft
# storm crystal I asked to what extent can you make plugins

after I told you at the start that the answer to that question would be to look at what's under "Documentation" and the detail you had in mind was whether it supports databases, you could've gone through the list of 13 entries and seen that what you're asking for is literally part of the list, or you could've used Ctrl + F to see if the page has any mention of it and make the computer do it for you

#

you're right in that nobody is forced to keep engaging with you, but you're making that sound like a suggestion

storm crystal
wind veldt
river oracle
#

wtf visual bukkit uspports databases

rotund ravine
#

It’s actually also pretty recently updated

#

Does this warn me

#

No it didn’t

prisma raft
rotund ravine
storm crystal
tall dragon
#

e.g if the map looks like this Map<Class<? extends Event>, List<Consumer<? extends Event>>> f = null;

#

like do i rlly need to cast each one then

lost matrix
#

Use a raw Map and

@SuppressWarnings({"unchecked", "rawtypes"})

over your class. Im going to sleep PES2_AngerySleep

#

semi-kappa btw

tall dragon
storm crystal
#

Well nvm I read documentation and it didnt have what I needed

#

Are there any other alternatives to java than skript?

wet breach
#

o.O

tall dragon
#

u can do it in any language if you are brave enough

wet breach
#

except probably don't want to. the implementation is in java, so you are best with using what the implementation does

storm crystal
tall dragon
#

looks like that indeed been done bfore yea

#

but i really dont recommend it

storm crystal
#

Why?

tall dragon
#

cuz its going to be slower for one

#

and it will probably limit what u can do by alot

storm crystal
#

Damn

#

There is really no other option than java?

rotund ravine
tall dragon
#

yea for example kotlin as well

storm crystal
#

Are they easier than what the hell java is?

rotund ravine
#

Ehh

#

I mean probably not

#

Skript is probably the easiest you can get

storm crystal
#

Do they also have shit like classes lambdas methods and such

rotund ravine
#

Probably not visible without some expansion plugin

storm crystal
#

Do you know any kotlin guides for plugins

glad prawn
#

i wonder if Kotlin is easier than Java.

rotund ravine
#

It’s not really

#

We have everything java has and some syntax sugar.

clever whale
#

Java isn't that hard to learn, you just need to put some time and effort in to understand it

#

It's probably better to have that skill than look for workarounds

storm crystal
#

Idk it just doesnt seem like im capable of using java properly

wet breach
#

it takes approximately 3 months to learn some of the basics of java, and then probably 6-7 months to really get some proficiency. But this depends how well you are able to learn on your own and teach yourself. Most languages in regards to programming are relatively the same or take longer. Java is one of the few where it doesn't really take a lot of time

clever whale
storm crystal
#

I wanted it to be a small and fast project not something that would require year of studying before I could actually do it

wet breach
#

you don't need a year of studying, rather need about 6-7 months of actually using it

#

over time, as you use it you will become better at it

#

but, sounds like you just don't want to put any effort into it which is really lazy

#

I don't know of any other languages programming wise that doesn't require some sort of effort to learn it

#

so seems you are out of luck on the not learning portion

storm crystal
#

But what else am I supposed to use java for if not plugins

wet breach
#

there is all kinds of uses for java o.O

worldly ingot
#

You could make the next Minecraft!

wet breach
#

buildtools for example is made with java

#

just fyi

worldly ingot
#

It's used a lot in web backends as well

storm crystal
#

I dont do web

#

I dont know html

#

Sounds excessive to learn web dev to learn java

worldly ingot
#

It's for the backend, so no HTML

#

HTML, CSS, etc. are all front end

kind hatch
#

SASS is king. 💪

rotund ravine
#

I am wondering if i should eat some hot cheetos when my ass already burns when going to shit

wet breach
wet breach
rotund ravine
#

I guess that’s true they’re through in a few hours anyway

#

Pain is for the week thx

wet breach
#

over time your body gets used to it 😛

#

so eventually its not an issue XD

storm crystal
#

Well I didnt make programming so weird and have lack of sense

#

I cant do anything about it

wet breach
#

idk what makes you think its weird or it lacks sense

#

but this could just be due to the fact you actually don't understand how computers work though or programs in general

dire maple
#

Is it possible to convert BaseComponent[] into a BaseComponent for the ProxyPingEvent? I want a gradient with a utility class that I have but if I use motdComponent[0] it just returns the first letter.. which makes sense seeing as each Component is a different RGB value.

kind hatch
dire maple
storm crystal
#

I thought I at least know something

rotund ravine
#

Programming is all about logic mostly

river oracle
rotund ravine
#

?jd-s

undone axleBOT
dire maple
#

If I was doing Spigot it would be easy as using a String

river oracle
dire maple
#

Is there?

#

👉 Point me there!

river oracle
#

are you coding for the latest version of bungeecord

storm crystal
river oracle
#

use ComponentBuilder#build

storm crystal
#

Awful shit with a ton of operators and 1s and 0s

river oracle
#

its a new method you may have to redownload the dependency

dire maple
#

Ahhh

river oracle
#

this can be done by pressing the refresh button

storm crystal
#

Dont think ill pass this class

dire maple
#

Let me update then, hold on

river oracle
#

build returns the single

dire maple
river oracle
#

create returns the array

dire maple
#

Still 1.19-R0.1?

worldly ingot
#

build() is the new and more recommended way to do it. Was added in 1.20.1

dire maple
#

Oh

worldly ingot
#

If you're on 1.19, I don't think there really is a good way to do it

dire maple
#

The Spigot maven for Bungeecord is outdated then, is the new version tag 1.20.1-R0.1-SNAPSHOT?

river oracle
#

BungeeCord should always just be latest

#

there's no reason to be using an older version

worldly ingot
#

It should be 1.20-R0.2-SNAPSHOT I think?

dire maple
#

I ripped it from the website

worldly ingot
#

I can't remember. It's on GitHub

dire maple
#

I should check GitHub more often 😳

worldly ingot
#

Yeah that's the correct version string

dire maple
#

Updating right now!

worldly ingot
#

From there you can use build()

dire maple
#

Yes, I'll try that now! Thanks guys

#

Yep! It worked - thanks so much ❤️

umbral ridge
#

What's better performance wise? Any better way to do this?

quaint mantle
#

how would i make colored args in commands liek this:

ivory sleet
#

can u even call remove()?

umbral ridge
worldly ingot
#

It returns a copy iirc, it's mutable

umbral ridge
#

oo

#

didnt even notice

worldly ingot
#

The latter is more performant because iirc, internally it's an ArrayList, so the remove() call will have to iterate to remove

#

So you're effectively iterating twice, worst case

#

Also, != here instead of !.equals() is fine

umbral ridge
#

So the 2nd picture is better?

worldly ingot
#

Yes

umbral ridge
#

I though you have to use equals when you are comparing objects

worldly ingot
#

Not always. In this case you're comparing Player instances which will match referentially

umbral ridge
#

Ohh okay

worldly ingot
#

I'm assuming the player you're comparing against is local

#

And not saved in some field or something

umbral ridge
#

It's a temp variable defined within the same function, PlayerMoveEvent. I had to define it because I'm using it multiple times.

worldly ingot
#

If I'm being honest, equals() is probably safer, but you can use != specifically in this case :P

worldly ingot
#

Just one is fine. You can keep the equals lol

umbral ridge
#

Also, can you create mutiple events? Eg. multiple PlayerMoveEvent and use each one differently? Eg. one for checking the AFK movement and stuff, the other one for something else

rotund ravine
#

Yes

umbral ridge
#

I don't want to throw everything I have to a single class

#

Ok awesome

remote swallow
quaint mantle
#

?

remote swallow
#

Thats how you get colored args

quaint mantle
#

is it an addon

rotund ravine
#

?brigadier

#

Nah

#

It’s just smth you need to interact with

river oracle
#

Can't even use brig properly with spigot AFAIK

rotund ravine
#

I am sure you can find some guide somewhere

river oracle
#

If you can that'd be news to me

#

Maybe I'll wrap brig for my next pr

#

Seems ambitious enough to me

remote swallow
#

Good fucking luck theres been like 4 pr attempts and none got far

river oracle
#

I'll maybe look at them then

#

Learning from previous mistakes goes a long ways

#

Also it's important to once you figure out it's not working to keep at it and find a good solution

remote swallow
#

Lies

#

Its better to have a mental breakdown and try the exact same way tomorrow

thin iris
#

@worldly ingot are u the right or left person

rotund ravine
#

He’s everything

carmine mica
#

its an unmodifiable view of the online players

#

its also one of the only non-copy collections. As in if you have a reference to the collection returned there, it automatically changes when players join/leave

echo basalt
#

I was thinking of a proxy map where the removal op just does nothing

#

or does something useless

north canyon
#

Is there any way to detect when another plugin runs Bukkit.reloadData()? It's clearing the custom recipes I've added with Bukkit.addRecipe()

spare hazel
north canyon
#

Paper has ServerResourcesReloadedEvent which seems to do the trick, but I'd like my plugin to work on Spigot too

#

So when someone goes to craft, check to see if my recipes exist, and if not, add them again?

spare hazel
#

No

#

If the recipe entered is right then set the reseult to the recipe's result

#

You might need to mess around with nbt checks to get it right

north canyon
#

Oh, implement recipes manually?

spare hazel
#

Yeah

north canyon
#

I guess I could do that. But then why does Bukkit.addRecipe() exist if there's no way to safely use it?

rotund ravine
#

I mean

#

Just yell at authors reloading the data

#

Make a suggestion though

spare hazel
#

Btw you can also use datapacks for simple recipes

north canyon
#

My recipes use custom nbt data (player heads) so sadly that isn't an option

quaint mantle
#

@wet breach they blocked all my cards 😭

#

"However, I hope you understand that Microsoft’s top priority is the safety and security of all the accounts, and it has the Microsoft system has the ability to evaluate payment options."

wet breach
#

well, could always call them 🙂

torn shuttle
#

I keep running into super cursed issues with my code

#

this sucks

#

I restart and get a different result

#

super weird

wet breach
#

those are the best bugs

echo basalt
#

avg magmaguy project

wet breach
#

last time you encountered this kind of issue I recall it resolving itself 😛

rotund ravine
#

@torn shuttle doing stuff async?

torn shuttle
#

no, resource pack work

#

I'm suspecting this is caching data in completely counter-intuitive ways or something

#

I'm not even joking, I changed nothing and my cube is now rotating on a completely different axis

rotund ravine
#

Fun

torn shuttle
#

oh my god now it's doing a completely different rotation pattern, what

gray saddle
#

how do i get the hex color of a string?

rotund ravine
torn shuttle
#

give me a break

rotund ravine
gray saddle
#

ChatColor#getLastColors only returns non hex colors

rotund ravine
#

Yes

gray saddle
#

hm ok

rotund ravine
#

StringUtils.difference maybe

wet breach
torn shuttle
#

part of it seems to be that this is somehow sensitive to my viewing direction which it should not be

#

so I need to fix that

rotund ravine
# gray saddle hm ok

So.

String mySuperColoredString  = smth

String stripped = ChatColor.stripColor(mySuperColoredString)

String myColors = StringUtils.difference(mySuperColoredString, stripped)
#

Idk if that even works

#

I am not sure how components work jere

kind hatch
#

@river oracle You around?

rotund ravine
torn shuttle
#

now this is interesting

#

I thought the interpolation of teleports was only visual

#

does it actually get acknowledged by the server?

#

I think I'm starting to see why this is acting weird, I need to take a breather before I really get into it

echo basalt
#

Illusion Search Index - Event Lambdas

During the development of a project, you may come to a situation where your project's structure requires the registration of an event listener in runtime.
Below is a simple utility method that may end up coming handy.

public interface EventBus {

  /**
   * Registers an event handler for the specified event class
   * @param eventClass The event class
   * @param handler The event handler
   * @param <T> The event type
   */
  <T extends Event> void subscribe(Class<T> eventClass, Consumer<T> handler);

  /**
   * Unregisters all associated handlers
   */
  void dispose(); 

}

And a simple implementation

public class SimpleEventBus implements EventBus, Listener {

  private final JavaPlugin plugin;

  public SimpleEventBus(JavaPlugin plugin) {
    this.plugin = plugin; // Dependency inject the plugin variable
  }

  @Override
  public <T extends Event> void subscribe(Class<T> eventClass, Consumer<T> handler) {
    // Event Class, Listener, Event Priority, EventExecutor, Plugin, Ignore Cancelled
    Bukkit.getPluginManager().registerEvent(eventClass, this, EventPriority.NORMAL, (listener, event) -> {
      if(eventClass.isInstance(event)) {
        handler.accept(eventClass.cast(event));
      }
    }, plugin, true);
  }  

  @Override
  public void dispose() {
    HandlerList.unregisterAll(this);
  }
}

Sample usage:

EventBus bus = new SimpleEventBus(plugin);

bus.subscribe(PlayerJoinEvent.class, (event) -> {
  Player player = event.getPlayer();
  ...
});

Avoid using this when regular listener usage is possible. This is handy for niche situations (Minigame development)

rotund ravine
#

Eyy you copied me way back in the day

echo basalt
#

what the index?

#

I have like 10 posts

torn shuttle
#

Illusion Search Index - This should be a website

During the development of a knowledge database, you may come to a situation where you realize you have made it as bad as imaginable, because anyone can write on discord.

Below is a simple solution that will avoid this issue:

  • Make a website dumdum
echo basalt
#

fun thing

#

I blocked you so that you don't show up when I look at my index

#

:)

torn shuttle
#

man if I was a bigger memelord I'd go to my discord and ask them to add their own entries here

#

I must be getting old to not really want to do that

rotund ravine
# echo basalt what the index?

Noo i just mean that lol


    public void init() {
        registerEvent(EntityDamageByEntityEvent.class, event -> {
            if (event.getEntity() instanceof Player && checkArmor(event.getEntity())) {
                Player player = (Player) event.getEntity();
                Island island = SuperiorSkyblockAPI.getPlayer(player).getIsland();
                if (island.getIslandMembers(true).contains(SuperiorSkyblockAPI.getPlayer(event.getDamager().getUniqueId()))) {
                    return;
                }
                   World world = player.getLocation().getWorld();
                    if (!world.getName().equalsIgnoreCase("world")) {
                        if (Bukkit.getWorld("Wars") != null) {
                            if (!world.getName().equalsIgnoreCase("Wars")) {
                                return;
                            }
                        }
                        return;
                    }
                if (player.getHealth() <= 3) {
                    Arrays.stream(player.getInventory().getArmorContents()).filter(itemStack -> ItemUtil.validate(itemStack, ItemUtil.Check.DEFAULT_META) && EnchantAPI.getEnchantAPI().hasEnchant(itemStack, this)).forEach(itemStack -> {
                        int level = EnchantAPI.getEnchantAPI().getEnchantLevel(itemStack, this);
                        player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20*5, level-1));
                    });
                }
            }
        });

echo basalt
#

lmfao

#

arrays.stream nooo

#

I still do this for minigame development

rotund ravine
#

Don’t think i wrote that might have

echo basalt
#

ãnd stuff like quests plugins

rotund ravine
#

Was working on an enchant plugin for someone ages ago and it had that

torn shuttle
#

can't use arrays.stream if you don't use arrays in the first place

#

god I hate arrays

echo basalt
torn shuttle
#

what is that cursed thing

echo basalt
#

lets me do this

torn shuttle
#

thanks I hate it

echo basalt
#

minigame development is wack

torn shuttle
#

eh

#

ETD wasn't that bad to make

rotund ravine
#

I’ve seen very bad minigame systems

torn shuttle
#

if you want to see cursed just take a peek at how the workflow is to go from bbmodel files to functioning in-game models

#

I think I'll print some 3d models to take a breather here

wet breach
rotund ravine
#

Ohh magma

torn shuttle
#

when you tell something to teleport

wet breach
#

I haven't really looked recently in the code for teleporting, but in the past teleporting was just glorified super fast walking and you could only see this happen if you slowed the tick speed down and watched someone teleport across your view path lol

#

idk if this is still true or not

torn shuttle
#

yeah so that is still true, that's what I'm calling interpolation

#

the thing is I thought that was mostly client-side and that server-side it was actually instant

#

but I saw something earlier that made me think the server actually is keeping track of these interpolated positions as well and that the client does not desync from the server when it shows the intermediate points

wet breach
#

that is why you usually have to wait a tick or so after teleporting a player to do more things with the player

torn shuttle
#

nms has a method called setPos for entities

#

and that is the exact same as teleports

#

don't ask me how I wasted my time finding that out

wet breach
#

lol

torn shuttle
#

resin printing particulates are no joke

#

my air purifier is very unhappy

full holly
#

Is there any way to check if a mob is able to walk through a specific block material (for example grass) by only knowing the material?

eternal oxide
#

.isSolid()

full holly
#

perfect, ty

eternal oxide
#

or better, isPassable()

full holly
#

working, ty

tiny sleet
#

whats the best language to start with java or kotlin

eternal oxide
#

java

tiny sleet
#

ok

ivory sleet
valid burrow
#

(if you are trying to make plugins)

ivory sleet
#

I mean there are plenty resources

#

And they are usually coded much better since static abuse isn’t a thing in kotlin for instance

valid burrow
#

at least in my experience

ivory sleet
#

In terms of quantity yes, but in terms of quality its pretty fine

#

Its not at all too hard to find resources

#

And if you find something in java its not a bad practice to convert it to kotlin

valid burrow
#

yh but at certain lvls its already hard to find specific resources for java so i can only imagine the struggle for kotlin

ivory sleet
#

assuming you’te trying to learn a language

ivory sleet
valid burrow
#

well not level

#

but

#

just specific things

ivory sleet
#

Such as?

#

I can almost guarantee you, that if you are developing stuff that don’t have any documentation or resources covered for you, then that’s not a newbie friendly project you have there

valid burrow
#

never said they are newbie friendly

#

but

ivory sleet
valid burrow
#

in spigot and java the line you need to cross to get into rather ‘complicated‘ topics isnt that far

ivory sleet
#

Not true at all

valid burrow
#

well that may be your experience but i can say it was the other way around for me

ivory sleet
#

Spigot is almost entirely single threaded, the api is java 8 ish, what line are you referring to?

ivory sleet
#

I just do think if you choose the right project to learn a language with, kotlin will be just (almost) as straightforward as java will be

valid burrow
#

well i wasnt a complete newbi when i started with java so that probably also influenced it a bit

ivory sleet
#

Hmm, yeah, i mean its one thing if there is a topic no one has really sort of dived into before you have

#

so that’s a fair point

valid burrow
lost matrix
#

I really dont like the idea of starting with kotlin because you have never experienced the importance of null safety.
This makes one of the best selling points of kotlin hard to understand and appreciate for beginners.
Like, what are they gonna do with all those signs, named after dead musicians?:

onyx fjord
#

Kotlin is fake

lost matrix
#

I kinda like it. But i also think that it needs more constraints. Some features just break code standards by simply existing.

valid burrow
onyx fjord
#

Might as well be called android lang

eternal oxide
#

I dislike optional

ivory sleet
#

yeah Optional is goofy

glad prawn
#

why 😭

ivory sleet
#

because its engineered incorrectly

#

for one there is no subtype of optional that defines presence/absence

#

let me explain

slender elbow
#

jdk's Optional is pretty mediocre

glad prawn
#

Optional is primarily intended for use as a method return type where there is a clear need to represent ‘no result,’ and where using null is likely to cause errors. A variable whose type is Optional should never itself be null; it should always point to an Optional instance. i just hope no one uses it the wrong way

loud herald
#

Hello, does anyone know how i can fix that when a armorstand is riding a player, i can't teleport the player through dims? Nether portals don't work and /tp also not. But if i remove the stand, it works. No tp event is triggered when the stand is riding the player.

ivory sleet
#
//assume this method is very huge
void doStuff(Optional<User> userOption) {
  //here is a lot of code (imagine it)

  //later in the function
  if (userOption.isEmpty()) {
    UserSerializer.serialize(userOption.get())
  }
}

//now lets say we wanna make that method smaller

void doStuff(Optional<User> userOption) {
  //here is a lot of code (imagine it)

  //later in the function
  if (userOption.isEmpty()) {
    serializeUser(userOption);
  }
}

//one of our extracted functions
void serializeUser(Optional<User> userOption) {
UserSerializer.serialize(userOption.get())
}

this might not be the best example as serializeUser() could simply take a User instead, but that may not always be possible. So the issue here is that we lose any awareness of the presence of the value in the optional, which happens often when we jump to a new scope of code.

wet breach
#

and then remount after teleporting

#

this is also true if it was the other way around

loud herald
#

How can i detect if the player is being ridden?

wet breach
#

check for riders?

#

or passengers

loud herald
#

I mean like no teleport event is called so i can't detect if the player tries to get tped

wet breach
#

which would be the first event that gets fired

loud herald
wet breach
#

there is a portal event if I recall

ivory sleet
#

ik you never said it

loud herald
#

Yes but /tp playerThatHasAPassenger @s also doesn't work

wet breach
#

that is a command

#

commands have their own events

loud herald
#

Yes obv i could make a custom tp command but that is kinda hacky and probably not the way to go

wet breach
#

you don't need a custom tp command

#

commands in the server throw their own command event

loud herald
#

Yes i could listen...

ivory sleet
#

yes but if you go up and read the message history again you may find out that the message wasn't to you

loud herald
#

But this is hacky

wet breach
#

you are the one that wants armorstands riding players

#

so its already hacky and weird

loud herald
ivory sleet
#

@umbral ridge why?

wet breach
umbral ridge
#

nvm

loud herald
ivory sleet
#

mye, well you can send gifs in general, a bit more appropriate there 😅

rotund ravine
#

Functional programming stonks

ivory sleet
#

mye that'd be nice, with some jit optimizations and what not

wet breach
# loud herald Wdym

attaching an entity to another just makes it convenient in terms of you don't have to implement anything to keep it near the player, however you could always simulate the entity being attached to another manually by making use of vectors, velocities etc.

ivory sleet
#

tho java alr said that they dont plan on improving nullability

loud herald
#

Hmhmh

rotund ravine
#

Just use kotlin 🤪

ivory sleet
#

true!!

wet breach
ivory sleet
wet breach
#

well yes and no, depends I suppose

ivory sleet
#

but iirc it got mentioned that improved nullpointerexceptions is one of the tools they think should be adequate

wet breach
#

but most people argue from the subjective side though

#

so I suppose that is true

ivory sleet
#

but like, bringing a binary typed union into the jdk is prob not gonna happen anytime soon

#

yea frost

#

got the @NonNullByDefault or w/e its called

#

and then we have the java nullness project thingy

lost matrix
#
if(param == null) {
  System.exit();
}
ivory sleet
#

right decision 👍

eternal night
#

just wait for valhalla's non nullable types

#

easy

lost matrix
#

Gonna be nice when my grandchildren will be able to experience the first incubation

ivory sleet
#

lmao

rotund ravine
#

exec shutdown

wet breach
ivory sleet
eternal night
#

Truely 😂

pine forge
#
Vindicator vindicator = (Vindicator) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.VINDICATOR);
AttributeInstance attribute = vindicator.getAttribute(Attribute.GENERIC_MAX_HEALTH);
attribute.addModifier(new AttributeModifier(UUID.randomUUID(), "Viking Horn", 2, AttributeModifier.Operation.MULTIPLY_SCALAR_1));
vindicator.getPersistentDataContainer().set(DominionSMP.DOMINION_ENTITY_KEY, PersistentDataType.STRING, "VIKING_" + event.getPlayer().getUniqueId());

Im trying to spawn this vindicator with double the health but for some reason, it vanishes after a fraction of a second, no error in the console

smoky anchor
#

Switch difficulty from peaceful ?

pine forge
#

oops

#

-_-

#

cant remember setting that to peaceful but it is

smoky anchor
#

-_-

pine forge
#

well thanks

#

it works now

smoky anchor
#

you're welcome
ty for giving me a laugh :D

pine forge
#

np haha

#

the health seems to still be at 24 though, do i have to setHealth(getHealth() * 2) after adding the modifier?

pine forge
#

only works on the player

ivory sleet
#

oh wait i didnt read at all

#

well I think it should work fine to change max health the way you do it, and then set the health?

#

i mean I would probably do it in the spawn callback instead, but doubt that'd make a difference

pine forge
#
        AttributeInstance attribute = vindicator.getAttribute(Attribute.GENERIC_MAX_HEALTH);
        attribute.addModifier(new AttributeModifier(UUID.randomUUID(), "Viking Horn", 1, AttributeModifier.Operation.MULTIPLY_SCALAR_1));
        vindicator.setHealth(vindicator.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());

yeah this works, i did have to change the modifier value to 1

#

even though its multiply

smoky oak
#

i believe both addition and multiplication for attributemodifier are called scalar

pine forge
#

not sure what that scalar thing means

ivory sleet
#

nms wise u have one add, and then one of them is multiplication with base, and the other one is multiply total

pine forge
#

why doess multiply with 1 double the value then?

ivory sleet
#

prob because this baseValue *= 1.0 + modifier

#

is the code pretty much

#

so it becomes 1.0 + 1 = 2

#

then 2*baseValue

#

:)

pine forge
#

okay thats confusing

#

but alr

#

not my code

ivory sleet
#

yeah well javadocs says:
Multiply amount by this value, after adding 1 to it.

pine forge
#

okay

storm crystal
#

How big my plugins should be, as in when I should make a separate plugin for something

#

Can I access whatever I make in one plugin to other plugin?

hazy parrot
#

If you make some kind of api, sure

storm crystal
#

Whats api