#development

1 messages · Page 8 of 1

lyric gyro
#

I know dude

merry knoll
#

using the "blueprint"

lyric gyro
#

I know

icy shadow
#

honestly i barely have any idea what you're trying to with that code. do you want to make a new ArrowTrapEvent?

lyric gyro
#

blueprint is interface

#

nah

#

its not

merry knoll
#

a class is also a blueprint

lyric gyro
#

yeah

granite hound
merry knoll
#

and an interface is a blueprint

#

for classes

lyric gyro
#

man I already watched 41 java tutorials

#

you can expect i know how to print hello world

#

and make a method

granite hound
#

have you tried working with them do

winged pebble
#

an interface is a "contract" technically

lyric gyro
granite hound
#

i did exercises after tutorials for c#

icy shadow
lyric gyro
winged pebble
#

c# and java really aren't that different

merry knoll
#

syntax is nearly the same

granite hound
#

yeah

merry knoll
#

naming conventions are a bit different though

winged pebble
#

Which is why I'm confused why he's having such a hard time with stuff he most definitely encountered in c#

granite hound
#

i only have some problems with some stuff so i think after i learn some more java i will be a bit better

#

its mostly spigot stuff

merry knoll
icy shadow
#

theres nothing code-wise that's spigot-specific

lyric gyro
#

should I just skip threads for now?

granite hound
#

yeah i dont know either

icy shadow
#

it's not like it adds any extra syntax or ideas

winged pebble
merry knoll
#

i think you are probably at a point

icy shadow
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

merry knoll
#

where you should just write something

lyric gyro
#

so let me understand

#

heres the problem

#

if i just skip threads

merry knoll
#

tutorials help but i think programming is learned the best when you just do it

#

you wont need threads for 99% of use cases

lyric gyro
#

I might need them to learn the next thing in the playlist

#

you know

merry knoll
#

yes but if you are struggling to understand the code in the block you posted

#

i feel like you need to get used to the older topics first

lyric gyro
merry knoll
#

anything that uses io

#

so databases, file operations

#

or if you want to pull something from the web

#

if the thing you want to do will take some time

#

you give that job to a worker to not freeze the server

#

and even then spigot itself

#

has some easier ways to handle multi threading

#

in those specific use cases

icy shadow
#

yeah using the Thread class is a bit of an antipattern in many cases

#

because it's usually not actually a great idea

lyric gyro
#

i think ill just drop java and develop games for kids in scratch

#

its easier

icy shadow
#

creating new threads for short lived tasks is very much a bad idea

lyric gyro
#

so

#

I don't really

#

really

#

need to learn threads

merry knoll
#

unless you need to do file operations

#

you dont need multi threading

lyric gyro
#

what are those

#

file operations

merry knoll
#

write and read from a database for example

#

and no config files dont really count

#

since they are cached

lyric gyro
#

so you need threads for writing and reading?

winged pebble
#

You don't NEED it

merry knoll
#

you dont need threads

#

but if you dont use them, your server needs to wait

#

until that operation is done

winged pebble
#

But it can help prevent slower operations from slowing the rest of your program down

merry knoll
#

meaning if it takes 1 second to read, server freezes for 1 second

lyric gyro
#

yeah

#

i get it

#

1 second of lag is bad

icy shadow
#

you do not need to know how threads actually work to do this mind you

merry knoll
#

^

icy shadow
#

in spigot it's really simple

merry knoll
#

you can use already implemented scheduler for it

#

you DO need to be careful to not interact with anything thats not made for concurrent use though

icy shadow
#

indeed

#

the best way of doing that is avoiding mutability as much as possible

lyric gyro
#

every 2 messages you send, one of them has a therm i never heard before @merry knoll

somber gale
#

Is there a way to make a function handle any exceptions?
Like that I could have something like

someMethod(SomeClass::methodThatCanThrowException);

instead of

someMethod(lambda -> {
    try {
        return SomeClass.methodThatCanThrowException(lambda);
    } catch (Exception ex) {
        return null;
    }
});
merry knoll
#

you could throw runtimeException

icy shadow
#

not trivially, you could either make a function that wraps your function, or make a new functional interface and defer the exceptions to someMethod

lyric gyro
#

why threads most of the time need to be wrapped with try and catch?

icy shadow
#

because their operations are not always safe

merry knoll
icy shadow
#

they can be interrupted or suspended or stopped by other parts of the program or the operating system

icy shadow
merry knoll
#

i think thats what will make you learn the best currently

#

take a project and dive in

lyric gyro
#

guys i have a question

#

another one that is

#

the same dude which is teaching me java through a yt playlist also has a spigot playlist

icy shadow
#

oh dear

lyric gyro
#

should I watch both playlists at the same time

#

or

icy shadow
#

spigot tutorials almost always suck

lyric gyro
#

no

#

but its the only way to learn the api

proud pebble
#

tutorials dont teach you how to think

merry knoll
icy shadow
proud pebble
#

just find something to make and do it

merry knoll
#

just go and start soemthing

icy shadow
#

if you're confident with java then learning the api is pretty easy

merry knoll
#

you get stuck, you google

icy shadow
#

^

merry knoll
#

repeat until you dont suck

icy shadow
#

hi dkim19375 aka kotlin = best aka hello how r u? kotlin = best btw

lyric gyro
#

should I just drop off the tutorial playlist

dusky harness
#

Hello

lyric gyro
#

and start learning things by myself?

merry knoll
#

with what you learned so far

#

what you need to do imho

#

is to just code something

pulsar ferry
#

Get stuck for a while, lose interest, give up, move to a new project, repeat until you have a folder of 50+ unfinished projects

lyric gyro
#

in spigot?

merry knoll
#

in anything

icy shadow
#

whatever

#

just code

merry knoll
#

if spigot is what takes your interest

lyric gyro
#

System.out.println("Hello world!!")

#

there guys

#

I am a java expert now

proud pebble
#

its what i did, just find something i wanted to make and try it

lyric gyro
#

how do i make a hub world and a survival world??

lyric gyro
dusky harness
#

!!

lyric gyro
#

oh shit

lyric gyro
#

and what are they calle

lyric gyro
merry knoll
lyric gyro
dusky harness
#

Hehe

#

Multiverse

lyric gyro
merry knoll
#

fuck py

dusky harness
#

Ew

lyric gyro
#

LMAO

dusky harness
#

Lol

lyric gyro
#

aight

#

I'll just start doing what I wanted to do in spigot

#

but how could I

#

I don't know how to connect different

#

oh I know

#

extends

icy shadow
#

lol

#

uh

#

it sounds like what you want is dependency injection

#

you may want to just practice some OOP stuff

merry knoll
#

just start writing

lyric gyro
#

jesus that is annoying

merry knoll
#

it will get spaghetti but thats fine

dusky harness
#

What is

icy shadow
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

lyric gyro
#

look at him

#

so proud of himself

dusky harness
#

Oh imagine being able to be stopped by Barry for caps

icy shadow
#

TRUE COULDNT BE ME

lyric gyro
#

this reminded me of a game that I used to play called Mindustry

proud pebble
#

god the spagetti ive written

dusky harness
#

Hehe

merry knoll
winged pebble
#

same

icy shadow
#

@staff

#

hes a hacker

merry knoll
#

write shit code - get annoyed - learn to fix - go back to step 1

dusky harness
#

Oh boy

#

Bm

#

Do u rember magicitems

lyric gyro
#

you just basically needed to mine resources with drills and use conveyor belts to lead them to your core, so you could build towers and defend yourself from a wave of enemies

icy shadow
lyric gyro
#

so you would expect that this is pretty much like coding

icy shadow
#

was that ur first plugin

dusky harness
#

Wow

#

Yes

#

How do u remeber

proud pebble
icy shadow
#

im extremely clever

lyric gyro
#

sometimes the conveyor belts get 'spagghetied' and all messed up

icy shadow
#

plus it was only like a year ago

lyric gyro
#

but eventually i learnt how to play the game and didn't mess up

#

and I didnt watch any tutorials i just kept playing

#

until i got good

merry knoll
#

coding is basically that honestly

#

and its even better since all the issues that you can run into

#

has happened to someone else before

lyric gyro
#

thats how you learnt how to code

merry knoll
#

so there are solutions you can google to how to structure

lyric gyro
#

just learnt the basics of java

#

and started coding

#

?

pulsar ferry
icy shadow
#

hmm

merry knoll
#

nah, i went to uni for it

lyric gyro
#

fuck you

icy shadow
#

oh god it was

#

AAAAA

lyric gyro
#

jk

pulsar ferry
#

From 2020 to 2022 we just skipped time

icy shadow
#

jesus christ

merry knoll
#

couldnt code for shit while i was learning there, got way better once i started to actually use the languages i learned

#

so, just start

lyric gyro
#

thats the thing

#

I don't know how to start

#

what I want to do

merry knoll
#

okay, choose a project first

lyric gyro
#

I know what I want to do

#

but

#

I just don't know the commands

#

sure i know the basics of java but

#

I don't know the spigot api

merry knoll
#

@dusky harness

#

how did you not get tired while writing this

lyric gyro
#

"fun"

icy shadow
dusky harness
#

I meqn

#

Meqn

#

Mean

#

You can't really write that in a better way

#

Since u have to specify the items

lyric gyro
#

kotlin: legends create, idiots replicate

#

.

winged pebble
#

You could static import Material

merry knoll
#

thats not importing

lyric gyro
#

java ripoff

dusky harness
#

Eh

icy shadow
#

i would just do arrayOf(BOW, ARROW, BLAH).map(::getItem)

dusky harness
#

¯_(ツ)_/¯

lyric gyro
#

koltin is the ripoff language you learn to make ripoff games on android

icy shadow
#

...

dusky harness
#

?

icy shadow
dusky harness
#

I can just add those

#

At the end

#

Ig

icy shadow
#

yeah but it's a bit messy

winged pebble
dusky harness
#

Also aki that's my rewrite

#

Not the one that bm knoww

#

Knows

icy shadow
#

you say "knows"

merry knoll
#

do we have the original somewhere

dusky harness
#

Iirc the old one is in a branch

icy shadow
#

all i remember is the name and the fact that it was not very good

lyric gyro
#

found a video called

#

"why 95% self taught programmers fail"

dusky harness
#

Do they sell courses

icy shadow
#

hehe

lyric gyro
#

its a free study manual

#

does it count

dusky harness
#

Hmmm

pulsar ferry
#

Most ripoff android games are made in unity lol

lyric gyro
#

and its a pdf

#

yeah

#

im sure

#

i'll not learn java with a pdf file

icy shadow
#

lmao

#

theres nothing wrong with pdf files

dusky harness
#

Video >

pulsar ferry
#

Videos are good if the person explaining is good, which for spigot most aren't
Idk about Java videos though

lyric gyro
#

well

winged pebble
#

There are some good java videos

lyric gyro
#

the playlist im watching is making java look like a piece of cake for me

#

the guy who made it is kody simpson btw

merry knoll
#

yeah since its easy

#

just make something

lyric gyro
#

i already made a few things

#

when I finish learning something new

#

I always think of how can I improve my knowledge on what I just learnt and how can I use the other things I learnt to improve it the program I made

winged pebble
#

Everytime you learn a new concept, make something that incorporates it

lyric gyro
#

like today I made a plugin that you insert a digit and the thread will starting counting from that digit to infinity

#

(it didnt work but i made other things that did work)

#

it started counting on random numbers rather then the one you inserted

merry knoll
#

yeah but make something that you would use

#

you will run into a lot of design issues along the way

lyric gyro
merry knoll
#

as it gets more complex

icy shadow
#

it's got a great first episode

#

and thats it

pulsar ferry
icy shadow
#

hehe

#

soon tm

lyric gyro
#

yeah

#

I don't think I can just start making what I want on Spigot if I don't know the basics of the API

#

regardless of all the motivation you guys give me

#

So I have decided that

#

I'll just watch the spigot series

icy shadow
#

ok

lyric gyro
#

thats

#

thats it?

winged pebble
#

You could probably do a part of what you want though

icy shadow
#

pretty much

winged pebble
#

Which is a good place to start

pulsar ferry
lyric gyro
#

I wanted to make kind of "wave plugin"

#

in which mobs spawn at specific locations

#

for you to kill them

#

and once you kill them

#

it goes to the next wave

#

so what I have to do is

#

get world i guess

#

thats all

winged pebble
#

I see plenty of portions that you could work on, are they custom mobs? then work on creating the mobs first

lyric gyro
#

idk how to proceed

merry knoll
#

google is your best friend

lyric gyro
winged pebble
#

Just pick one part of it, and think if you need to know something else to complete it

lyric gyro
#

I don't have to create them

#

I just have to find a way to spawn them

#

integrating plugins sounds like a hard thing to do mate

#

i dont have to worry about custom mobs for now

pulsar ferry
#

If you're using a plugin for it, the plugin should hopefully have an api to spawn them

lyric gyro
#

i just have to worry about regular mobs

merry knoll
#

okay

#

google how you would spawn a mob

winged pebble
#

Just pick one part

lyric gyro
#

first part

winged pebble
#

You'll go crazy trying to figure it out all at once

lyric gyro
#

the waves mechanic

#

there needs to have a command to enable and disable this mechanic

merry knoll
#

for a wave to happen you need to spawn mobs first

lyric gyro
#

because my friend, who created the minigame likes to control the waves

#

we even had an argument about this

merry knoll
#

start from a small part

lyric gyro
#

hmmm

winged pebble
#

Or you need to choose random locations around the player

lyric gyro
#

like wholes

#

gates

#

etc

#

that stuff

#

holes*

#

not wholes lol

#

ok

#

so I need to

#

spawn mobs at a specific location

#

lets say

#

I actually manage to do that

#

whats next

winged pebble
#

How are you going to detect if the waves are done?

lyric gyro
#

well

#

first I need to develop the wave mechanic

#

when the command is activated

#

so we have an if statement (?)

merry knoll
#

how about you start

#

and actually get stuck

lyric gyro
#

aki teached me that

#

when I become one of the most respected minecraft plugin developers in the community

#

ill thank you all

#

dont worry

#

I kinda sounded like naruto rn

#

but thats just inspiration and ambition ig

#

naming your plugin is probably the hardest part

#

what is groupid and artifact id again

#

@merry knoll

#

i forgot the difference

#

oh wait i remember

#

groupid is the developer and artifact id is the name of the project

#

correct?

winged pebble
#

Basically

merry knoll
#

you also want to set up your package in an unique way

#

so it avoids clashes

lyric gyro
#

i came up with a clash before

#

didnt really know what it meant

merry knoll
#

convention is to use domain name for it

#

as in :

#

then you name your package as

#

net.minecraft.projectname

winged pebble
#

I usually do io.github.deerjump

#

You could do me.<your name>

merry knoll
#

if you dont have a domain

#

^ best ways to handle it

#

just make sure that its unique

dusky harness
icy shadow
#

Welcome to GitHub Pages
Welcome to GitHub Pages

You can use the editor on GitHub to maintain and preview the content for your website in Markdown files.

Whenever you commit to this repository, GitHub Pages will run Jekyll to rebuild the pages in your site, from the content in your Markdown files.

Markdown

Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for

merry knoll
#

love how the links are broken in it as well

#

on a separate note

dusky harness
#

It made me make a website when I got my domain

#

So I just decided to use this theme

merry knoll
#

what do you guys think is the best way to sync up between servers? (for economy in this case)

dusky harness
#

(free for students btw)

merry knoll
#

database seems meh, since redis is available

dusky harness
#

Btw what's the diff between the two

merry knoll
#

redis is stored on memory

#

aka cached basically

#

so its fast but not permanent (altho it has permanent option too)

dusky harness
#

Isn't it still IO tho? Which means it should be cached in like a map

merry knoll
#

no

#

there is no files if you use the memory

lyric gyro
#

i'll just put one of my monickers in group id and the project name in artifact id

#

is that ok?

dusky harness
#

Isn't it a network call

icy shadow
#

you still have to perform a network operation to query the database lol

#

whether it's in memory or not

dusky harness
#

So a caching 'db' that u still have to cache

#

I still do not see the purpose

merry knoll
#

its a shared cache between jvms

#
  • you dont need to deal with concurrency and race conditions
#

since it runs sequentially

#

except for pipelines but thats a bit more different

dusky harness
#

Concurrenthashmap

#

👍

icy shadow
#

lol

lyric gyro
merry knoll
dusky harness
#

What is example usage

merry knoll
#

caching something that will be used by multiple servers

#

if you want a spigot usage case

dusky harness
#

Wb code?

lyric gyro
#

are you trying to correct me or asking what it is

dusky harness
#

Asking

#

That was autocorrect

lyric gyro
#

sometimes

#

an artist is known by more than one name

#

like the caretaker

#

hes also known as v/vm

#

or his own name

dusky harness
#

if u were to make a domain

#

And it ended with. me

#

What would u make it

#

And it is abt u

#

And has ur "name"

merry knoll
lyric gyro
#

warner bros

merry knoll
#

ah ofc

winged pebble
#

what about

dusky harness
#

nvm

icy shadow
#

you forgot to delete your messages

lyric gyro
icy shadow
#

dont nerd emoji me

lyric gyro
#

use the appropriate channel please 🤓

merry knoll
icy shadow
#

this is the appropriate channel

#

i was speaking to dkim19375 aka kotlin = best aka hello how r u? kotlin = best btw

dusky harness
#

I would never delete my messages like that

#

😃

#

I only delete it when necessary

icy shadow
#

but you said nvm

#

it was necessary

dusky harness
#

I decided to see if Aki.. would never mind it

#

and he did indeed never mind it

#

so I have deemed it unneccessary

icy shadow
#

hmm

dusky harness
#

It was an experiment

icy shadow
#

i see

cunning kraken
#

Hello, i wanted to create a Material list without the eggs but a for loop to check all material names that end with egg (dont think its really efficient) didnt work it miss a lot of eggs

icy shadow
#

it's perfectly efficient as long as you only do it once

#

can you show your code?

cunning kraken
#
List<Material> matlist = new ArrayList<>(Arrays.asList(Material.values()));

for(int i = 0; i< matlist.size(); i++){
       if(MaterialChecker.hasEggMaterial(matlist.get(i))){
                System.out.println(matlist.get(i).name());
                matlist.remove(matlist.get(i));
            }

            return matlist;

        }

#
return mat.name().endsWith("EGG");
fiery pollen
#

for(Material material : Material.values())
use a foreach

cunning kraken
#

oh i hadn't thought of that, i'll try that

icy shadow
#

consider also using an EnumSet, it will provide much better performance than an ArrayList

#

but also use removeIf rather than removing in a loop, that'll throw ConcurrentModificationException

marble nimbus
#

(sorry 4 ping) How?

pulsar ferry
#

Packet ;p

marble nimbus
#

A little more Info, I couldn't find a Packet that fits

#

I know how to do it in Forge (sorta)

dusky harness
#

also note that it's possible to bypass that system

#

especially hack clients

marble nimbus
#

does Fabric do it like Forge when handshaking?

#

because I can't find any info

lyric gyro
#

guys I made a plugin that makes the spectral arrow explosive

#

and it isn't working

#

did i mess up setting it up on the server?

wintry grove
#

and you can probably use plugin messages to get the mods

lyric gyro
#

i wanted to create an explosion when a spectral arrow hit something

#

i managed to do that

#

except it destroys blocks

#

i dont want it to destroy blocks

#

and for some reason

#

my ide isnt allowing me to set only the location of the impact

#

power

#

and the two booleans which are setFire and destroyBlocks

#

how can I fix this

marble nimbus
winged pebble
wintry grove
#

but I dont remember which one

#

probably also plugin messages

nimble pelican
#

do you know how to set a location of a player and not inform the client of the teleport

merry knoll
#

what would be the point?

#

you could probably do it by canceling the packets

misty dragon
#

i've tried many ways but i can't

#

even like this

 public void onPlayerClick(InventoryClickEvent e) {
        if (e.getAction() == InventoryAction.NOTHING) {
            return;
        } else {
            if (e.getClickedInventory().getType() == InventoryType.PLAYER) {
                return;
            }
        }
        e.setCancelled(true); //i cancel the right here

        if (e.getClickedInventory().equals(plugin.quarry.quarry)) {
            for (InventoryAction a : InventoryAction.values()) {
                if (e.getAction() == a) {
                    e.setCancelled(true);
                    return;
                }
            }
        }
}
#

player still can place blocks to my gui

proud pebble
#

cus that doesnt exist in 1.12.2 which i remember you wanted to make it for

proud pebble
proud pebble
#

also the forloop is kinda pointless

misty dragon
proud pebble
#

because its nolonger the same inventory

#

which is why you use inventoryholder to check it

#

because its consistent then the content of the inventory

misty dragon
misty dragon
# proud pebble which is why you use inventoryholder to check it

i've tried like this

        if (e.getClickedInventory().getHolder().equals(Plugin.quarry.quarry.getHolder())) {
            if (e.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD) {
                e.setCancelled(true);
                return;
            } else if (e.getAction() == InventoryAction.SWAP_WITH_CURSOR) {
                e.setCancelled(true);
                return;
            } else if (e.getAction() == InventoryAction.HOTBAR_SWAP) {
                e.setCancelled(true);
                return;
            } else if (e.getAction() == InventoryAction.PLACE_ALL) {
                e.setCancelled(true);
                return;
            } else if (e.getAction() == InventoryAction.PLACE_ONE) {
                e.setCancelled(true);
                return;
            } else {
                e.setCancelled(true);
                return;
            }
        }
#

should i reassign all the items in the gui?, that's kinda weird tbh

warm steppe
#

use switch

misty dragon
misty dragon
warm steppe
#
switch (e.getAction()) {
    //...
}
misty dragon
warm steppe
#

Why can't you?

misty dragon
warm steppe
#

np 👍

misty dragon
#

I fixed it by cancel the drag event, it was because the drag event when i trying to place block to inventory it'll stack and drag a little

proud pebble
#

at the tine didnt know it existed

lyric gyro
dense galleon
#

Trying to update a plugin I made in 1.17 to 1.19, getting this error: error: release version 17 not supported

#

I tried changing my paper version in here:

    <description>MobMadness is back, better than ever.</description>
    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>```
#

But that didn't do anything

proud pebble
#

but you can still do it

somber gale
proud pebble
lyric gyro
#

and it worked perfectly

#

i just did

#

location.getX(), location.getY(), location.getZ()

proud pebble
#

the 3rd createexplosion method

dense galleon
dense galleon
#

it says nothing else so idk

#

I haven't programmed in Spigot/Paper in ages I honestly barely remember anything

#

Like, how do you export your plugin to a Jar file using maven again? 😂

sterile hinge
#

mvn package

dense galleon
#

Ah right right

#

Moving to Gradle anyway oop

#

I'm trying to add Matt's Framework to my project's dependencies

dense galleon
#

Ah alright the wiki is 2 years old

dusky harness
#

use this method

dense galleon
#

yeah got it got it

dusky harness
#

alr

#

👍

dense galleon
#

Though when I launch the server, it gives an error saying java.lang.NoClassDefFoundError: me/mattstudios/mf/base/CommandBase

#

So I assume I did something wrong with the shadowing

dusky harness
dense galleon
#

yeah didn't I relocate at the bottom

#

I think I did it right?

dusky harness
#

oh hmm

#

oh are you running gradle shadowJar?

#

or gradle build

dense galleon
#

gradle build

dusky harness
#

u have to run gradle shadowJar

#

or set it up to run shadowJar after build

#

¯_(ツ)_/¯

dense galleon
#

Hmm is there a way to create a run configuration to execute those two

dusky harness
#

you only need to run shadowJar

#

since it runs build already

dense galleon
#

Ahh okay

dark garnet
#

how can i cancel player movement but not looking?

#

so like they cant change X, Y, or Z, but they can change yaw and pitch

dusky harness
dusky harness
#

hmm not sure

proud pebble
dark garnet
proud pebble
#

its what came up when i searched

hoary scarab
proud pebble
#

well wouldnt suprise me if playermoveevent is fired at the same time as other movement events like teleport

#

its been opened since 1.15.2

dark garnet
dusky harness
#

you need to teleport if the yaw/pitch are not the same and the xyz are not the same

lyric gyro
#

don't do player.teleport in there

#

change the target location

dark garnet
#

changed it to this:

final Location from = event.getFrom();
final Location to = event.getTo();
if (to != null && from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ()) {
    if (from.getPitch() == to.getPitch() && from.getYaw() == to.getYaw()) {
        event.setCancelled(true);
    }
    return;
}
event.setCancelled(true);```
#

which works

dusky harness
#

welp

somber gale
#

Also, include seems to completely ignore relocations as the dependency is stored under its usual location

dense drift
#

minimize is not so great

#

I think I've used it once, had problems and then removed it

broken elbow
#

yeah. I haven't used minimize in a long long time

#

it was removing some classes that I needed bcz it looks for classes that are not used to remove them or something like that

#

it was weird but yeah

lyric gyro
#
        private final @NonNull EntityType type;

        private final @NonNull Location location;

        public WaveMob(@NonNull EntityType type, @NonNull Location location) {
            this.type = type;
            this.location = location;
        }

        @NonNull
        public EntityType getMobType() {
            return this.type;
        }

        @NonNull
        public Location getLocation() {
            return this.location;
        }
    }```
#
    private final int waveId;
    private final @NonNull List<WaveMob> waveMobs;
    private final @NotNull List<Mob> spawnMobs = new LinkedList<>();
    private boolean isStart = false;

    public Wave(int waveId, @NonNull List<WaveMob> waveMobs) {
        this.waveId = waveId;
        this.waveMobs = waveMobs;
    }

    public void spawnWave() {
        this.waveMobs.forEach((waveMob -> {
            final Location location = waveMob.getLocation();
            final World world = location.getWorld();
            if (world == null)
                throw new NullPointerException("The world is not found .");
            final EntityType mobType = waveMob.getMobType();
            final Mob entityMob = (Mob) world.spawnEntity(location, mobType);
            /*
            entityMob.setAI(false);
            entityMob.setHealth(5.0);
            entityMob.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(5);
            */
            this.spawnMobs.add(entityMob);
        }));
        this.isStart = true;
    }

    public void stopWave() {
        this.spawnMobs.forEach((Entity::remove));
        this.spawnMobs.clear();
        this.isStart = false;
    }

    public int getWaveId() {
        return this.waveId;
    }

    public @NotNull List<WaveMob> getWaveMobs() {
        return this.waveMobs;
    }

    public @NotNull List<Mob> getSpawnMobs() {
        return this.spawnMobs;
    }

    public boolean isStart() {
        return this.isStart;
    }
}```
#

I need someone to help me understand this code

#

im confused as to how it works

dense drift
#

Spawn all waveMobs with no AI and 2.5 hearts

lyric gyro
#

for some reason i cant understand

#

so it's creating a public class called WaveMob

#

with private objects

#

why are the objects private

#

why do they need to be private

dense drift
#

Thats called encapsulation, you define the fields as private and allow the outside to access them trough getters. E.g. if you have a list you can return an immutable (can not be modified) copy trough a getter

lyric gyro
#

and I know what private, public, and protected mean

#

I am just confused as to why do they Have to be private

#

is it because the plugin will try to modify them?

dense drift
#
lyric gyro
#

but why?

dense drift
#

read what I sent

lyric gyro
#

my brain just isnt working today

#

you can add behaviour to getters and setters, such as state or parameter validation, logging, copying something etc
you can't add any of that when someone is able to access a field directly

#

oh

#

and in this case

#

we are doing this

#

right?

#

so that's what the text meant with total control of what is stored

#

so after that, its creating a public constructor and adding some getters

#

now lets see

#

can someone explain to me what is going on in the second message?

#

ignored 😡

lyric gyro
lyric gyro
#

thank you for asking this

#

so

#

what I think is going on is

#

on the second part of the code

#

it's creating a public final class (it has to be final for some reason that i dont understand, ik what it means i just dont understand why)

#

and then it's creating 4 private objects

#

one of which is a boolean variable

#

and the first one is an integer

#

then i don't know what is going on

#

i can see that it creates a few methods which set the boolean isStart to false and true

lyric gyro
#

How long have you been learning java? While its good to look at code to get a better grasp, you should learn more about the language first so you could gauge what the code is doing

#

You will likely end up overwhelming yourself if you head straight into bukkit or look at plugin code

lyric gyro
#

though i dont know how to use the api

#

nah that's not enough java haha

#

Don't use an API yet

#

and im just really slow today

#

for some reason

#

its saturady and idk

#

my mind isnt working properly

lyric gyro
#

Just make some cool projects with plain java. By using an API when you're still learning java you're A) writing your own software, B) using other people's software, and C) trying to understand how to turn an abstract idea into a complex web of simple instructions. It gets frustrating when you combine those three and not lock onto one or two at once

lyric gyro
#

whats cooler than a counter that uses threads to count to infinite?

#

like

#

i made so that you can input a number

#

and then

#

the console will start counting from that number to the limit of an int

#

which is

#

2 billion

#

isnt that cool?

#

That is just a for loop with extra steps haha

#

people in this server

#

just told me to leap ahead

#

and get involved in my first project

#

im doing that

#

learning by myself

#

im just confused as to what is the next step

#

Yes that's fine, but your project should not include a framework or API imo

lyric gyro
lyric gyro
#

you'll see

proud pebble
#

tbh i found working with base java kinda boring cusni could never figure out what to make, i just ran through some shit and stsrted trying to make a custom anvil inventory

#

which i eventually did after a couple of rewrites and abandoning of the project and trying tmsomething else

lyric gyro
#

yeah

#

the problem of not working with an api

#

is that sooner or later

#

you will run out of ideas

#

a programming language without an api gets boring quickly

#

you will run out of stuff to do

#

even though

#

there are infinite possibilities

#

Where have you been learning java primarily?

lyric gyro
#

just watching

#

observing

#

understanding

#

and doing

#

different from a lot of people

#

i try to understand what i am doing

#

before replicating

#

and then i try to improve what i just wrote

#

using things i learnt before

#

this way i learn java faster

proud pebble
#

i found that spigot tutorials were shit and never made much sense, i watched alex lee and usednw3schools alot and eventually just slowly made stuff debugged it cus inventorydragevent exists

lyric gyro
#

you can watch a video while you are in the bus

#

or in the metro

#

or even in school

#

because they are quick and really easy to understand

#

im not sure about his spigot playlist though

proud pebble
#

learning java faster is kinda difficult when it can take months to years to hrasp the entire language and really understand the concept of programming. Also i found his tutorials to be bad

lyric gyro
#

why

proud pebble
#

or atleast they werent helpful to me

lyric gyro
#

alex lee's tutorial?

#

s

proud pebble
#

i wasnt gettingnanywherr cus i had no idea why he was doing what he was doing and was just copy and pasting his stuff

lyric gyro
#

that's why I try to understand

#

Have you tried reading any books about the language?

#

what is a 'book'

proud pebble
#

i was thinking just that

lyric gyro
#

where the fuck can i find a book about java

proud pebble
#

library id assume

lyric gyro
#

not something you'd find in your school library

#

which is like

#

The internet is a vast place haha

#

the only library in a few km radius

#

I'd recommend reading Head First: Java

lyric gyro
proud pebble
#

they had a couple books on a few languages in my old colleges library

lyric gyro
#

you can just copy everything of the internet

#

and get an A+

#

but you won't really get anywhere with this

#

you can try and read the answer

#

this will get you somewhere

#

or you could just copy it off as it is and move on

#

this won't get you anywhere

#

get what im saying

#

Well yeah that's pretty much essential to learning anything

#

I would still recommend the book over the tutorials though. This one especially is a pretty good read and explains a lot of the fundamentals and more advanced topics without being boring like a typical programming book

#

Chances are you'll wind up learning a lot more than just going through videos

proud pebble
#

alex lee taught the different terms in java alot better atleast to how it was displayed on w3schools, and w3 is what i used for the rest, like variables, operators, forloops switch cases, etc

lyric gyro
#

Yeah w3 is more like a reference guide I feel like

proud pebble
#

i kinda struggled hardbtill it eventially just hit me and made sense and its gettingneasiee

broken elbow
# lyric gyro im not sure about his spigot playlist though

I'm pretty sure someone already recommended you this, but you should try Jetbrains Academy. They have like a 3 months free trial, no credit card required. It is very common for youtube tutorials to be outdated, not very complete, etc. I've seen so many times tutorial series where from 1 episode to another or even in the same episode there are huge amounts of code just randomly showing up without any explanations or people using and recommending bad practices or using outdated stuff, etc.

lyric gyro
broken elbow
#

Well, that's not how this works. If you learn java first, you won't need a course for spigot. All you'll need is the javadocs.

#

You're supposed to first get familiar with the language and then jump into using big APIs and stuff.

#

It's a very common mistake people do, (including myself) and most regret it in the end (including myself).

lyric gyro
#

Yeah that's what I'm sayin

broken elbow
#

well not even mistake. Sometimes its just laziness, or indifference.

#

And in some rare cases even stupidity.

lyric gyro
#

And I was about to get a link to jetbrains. The projects on there should keep you busy if you want something to build without overwhelming yourself with a framework

#

Once you know what you're doing with Java all you have to do is just figure out the spigot specific stuff, like event handlers, scheduling, etc, and you'd pretty much be good to go

lyric gyro
#

i just dont know how to code in spigot

#

when I look at a java code im like

#

"oh i can understand this"

#

but when I look like at a spigot code

#

im like

#

"what"

#

thats my problem

broken elbow
lyric gyro
#

from your questions and descriptions up there, you may feel confident but your knowledge is lacking

#

yea

#

what exactly

broken elbow
#

The fact that "you don't know how to code in spigot". Java is the same no matter where you code or what API you use.

lyric gyro
#

theres not much new things in java i can learn that will be useful in spigot besides improving my already existing knowledge on the things i know

lyric gyro
proud pebble
#

just learn it anyways

lyric gyro
broken elbow
#

You don't use a different language for spigot. You use the exact same stuff as before. I know people have spent time in here before trying to help you understand the event pattern which is very common in spigot, and some other stuff but it seems like you don't really care or you just forget very easily.

proud pebble
#

the commands? what

lyric gyro
#

i dont know man

#

i dont know what i am supposed to do

#

We've already told you haha

broken elbow
#

If you still won't get it, then I suggest you go back to the basics and start taking it step by step.

proud pebble
lyric gyro
#

yep, and I recommended a book as well

proud pebble
#

we csnt exactlt hand hold you through spigot

lyric gyro
#

Not legally

broken elbow
#

Well that's not a bad idea. You can get java books online for free. And usually they give you a lot of knowledge but you can also just do the free jetbrains trial and in 3 months you'll most likely be at a way higher level.

lyric gyro
#

I can't get it

broken elbow
#

well.

lyric gyro
#

you can if you try

broken elbow
#

you can get it. you just have to try hard enough 🙂

lyric gyro
#

I already know a little bit of java

#

and if i do this jetbrains thingy

#

I will be restarting

broken elbow
# lyric gyro I already know a little bit of java

a little bit. That won't be enough. I know that when you know a bit, it is boring to go thru the starting stuff because its exactly how I was at first. But spending just that extra time helped me so much.

lyric gyro
#

it's never a bad idea to refresh your knowledge to enhance and strengthen it

#

i want to cry

#

same

lyric gyro
proud pebble
#

same

broken elbow
#

This is a friendly advice, and I know what I'm talking about because I Went thru the same experience you go right now. You're lazy, and it's a pain to go thru a few chapters knowing most of that stuff, and sometimes you even skip stuff but I did the same and I had to just start over bcz I just used to skip over important stuff without realising

#

I strongly suggest you start from 0. Forget everything you know. Or most at least.

lyric gyro
#

i really don't

lyric gyro
# lyric gyro i dont know what i am supposed to do

I mean you are not "supposed" to do anything in particular, you are supposed to make use of the API to achieve whatever you want to do - this does not apply specifically to Spigot only, it applies to every framework you'll ever use
If it's running commands a player will send, you're supposed to make a command executor and parse the arguments to do whatever you want with them (or use a command library to do the parsing for you)
If it's taking http requests with spring framework, then you gotta learn how to use spring to respond to it, but you are not "supposed to do" anything with the request other than take whatever the request has and respond with whatever your goal is

broken elbow
lyric gyro
#

You are supposed to do whatever your goal is, APIs and frameworks provide you the means for them, and it will always take time to learn those

#

Even if it's the JDK itself

#

the jdk is MASSIVE

broken elbow
lyric gyro
#

some people say i should just start coding others say i should use things like jetbrains or even a book

#

i am divided

lyric gyro
#

you're just making me feel sad

lyric gyro
broken elbow
#

You're just going to waste more time here if you don't start from the basics.

lyric gyro
#

jb academy has a lot of projects

#

idk which one will be useful

#

it doesn't have to be useful

#

its just practice really

#

They make you use the concepts you learn in a project so you can strengthen your knowledge

#

So whichever one you pick will leave you with a lot at the end of it

#

there are far too many ideas out there you can make something out of to practice your knowledge, enhance it and gather more

#

doing things on spigot is an extremely slim slice of that

#

it would be so great if i could just learn what i need

#

i just

#

there is no "what i need"

#

you need everything

#

don't want to forget hours watching tutorials

#

just start learning a bit of everything

#

which helped me a lot

#

start learning about manipulating files

#

start learning about JDBC and SQL

#

start learning about streams

icy shadow
#

streams relieved

lyric gyro
#

start learning about sockets

#

start learning about regex

hushed badge
lyric gyro
#

eventually you will use a bit of everything, there is not really "what i need" because you can use multiple tools to solve a single problem

icy shadow
#

stuck out tongue closed eyes

lyric gyro
#

trying to find the perfect tool to solve a problem you don't know if the tool will be useful is just wasting your time if you don't just give it a try

#

give everything a try

#

maybe it will be useful in the future, maybe not

#

but you'll recognise its usefulness when you see a problem that it might help you with

#

that's too much for me

#

i need to take a break

#

programming is not an easy task you can learn in a day or two

#

each "system", paradigm, library, anything that can be qualified as a "tool" you need to try sometime to later recognise when to use it

#

it's literally a toolbox

#

you don't have tools you don't know how to use, and you know which one of the ones you do have you can use for a certain problem

#

but to get more tools in there you need to try them out

#

even if it's in a stupid example environment with mock data

dusty frost
#

bro I do that even with vim plugins

#

like i slowly integrate a new motion or something into my life, things take time

lyric gyro
#

I think I'll just start to cry

#

and see where this leads me

#

that is a wonderful idea

lyric gyro
#

thats how bad i feel

#

but i guess

#

all of you programmers have been there

#

which makes me fell atleast a little bit better with myself

#

but not much

lyric gyro
lyric gyro
#

should I go back to watching tutorials?

#

I don't want to simply forget hours of watching videos

#

creating variables and classes

#

typing out hundreds of words

#

simply because i couldnt understand a simple piece of code

#

which I would understand if it was any other day

#

my brain just.. just isnt working today

#

y'all divided me

#

thats the truth

lyric gyro
#

but the more you learn, the more you realise how little you know and how much there is to learn

#

there are so many technologies to enjoy

lyric gyro
#

i mean it in a sense of, there is so much to grow onto and improve

#

but you gotta start somewhere, and it's not gonna be on the big leagues

lyric gyro
#

you can't undo what you already know

#

I agree that reviewing certain basics can reinforce what you already know or think you know

#

mmh

lyric gyro
#

I should probably raise my head and do what I gotta do

#

and just move on

#

There is no way I can forget something like that

#

like I have watched so many videos and read so many blogs on even the same topic, not every time did I learn something new but I certainly took things from the whole

lyric gyro
#

knowing I can do better than where I am now

#

and all by using fancy libraries and enjoyable languages and frameworks

icy shadow
#

it's about drive it's about power

lyric gyro
#

it's about the family

#

well

#

but what if it's only today that i am confused

#

because

#

as I mentioned

#

today my brain isnt working properly

#

that code i sent here

#

had only concepts in java that i had already seen

#

i am mostly sure i could understand it

#

uh I didn't really see your issue, I came here after but yeah there are days you just can't even

lyric gyro
#

and for some reason

#

my brain decided to go dumb mode today

lyric gyro
#

Humans are complicated :D

#

i try doing that

#

yet my mind cant think of anything else besides

#

coding

#

well

#

coding is something that can just fill your mind very easily

#

and make you stressed

#

depressed even

#

maybe taking a break is the best option

#

and then seeing what I should do

dark garnet
#
if (check1) {
    blah1
    return;
}
if (check2) {
    blah2
    return;
}
return;``````java
if (check1) {
    blah1
}
if (check2) {
    blah2
}
return;```is there any difference in speed/performance? *its impossible for both `check1` and `check2` to be `true`*
lyric gyro
#

is there a difference? yes, will it like literally absolutely ever in history matter? not in the slightest

#

personally I would do if (check1) .. else if (check2) .., mostly for readability reasons

pulsar ferry
#

Well in this case there is a slight difference in the execution too, in the first example if check1 and check2 are true only blah1 runs
While on the second if check1 and check2(i assume you had a typo) are true then both blah1 and blah2 will run

lyric gyro
#

yeah but "impossible for both check1 and check2 to be true" then it's not really gonna be a problem, though that scenario is something I want to ensure and communicate when I read that piece of code

#

@lyric gyro could you explain what does the command return does

#

I don't know its utility lol

lyric gyro
# lyric gyro <@456226577798135808> could you explain what does the command ``return`` does

basically it "exits" or "quits" the current method and returns back to the caller, if the method is not void it will give back a value as well

// return type is void, so no value is given back to the caller of this method
void foo() {
  int number = randomNumber();
  if (number >= 100) {
    // if the number is 100 or larger, it will "exit" this method
    return;
  }

  // if it's less than 100, it will continue execution
  System.out.println("Matt stinks");
}

// return type is int
int randomNumber() {
  return 36; // give back a "random" number
}
lyric gyro
#

it will ignore the code

#

if a specific condition is met?

#

mm i guess you can put it like that yea, it's more like "i'm done here, get back to whoever called me"

thorny ibex
#

Simple one(hopefully) - I need my Discord ID (the numerical string). But I only use Discord on mobile

#

How do I get it?

lyric gyro
#

344536094785667082

#

uh if you hold on your name and scroll down it should show a "Copy ID" button I think

lyric gyro
#

might need to enable developer options somewhere in user settings, no clue where that's about

thorny ibex
#

I’ll look ty

lyric gyro
#

like

#

the object that called the method

#

is that what you mean

lyric gyro
#

oh

#

so the caller is actually the method

#

and its calling a variable

#

let me edit that a bit

dark garnet
lyric gyro
#

in there both foo and randomNumber are methods, foo is calling randomNumber and putting its result into the variable called number (the randomNumber method is unaware of it, it only gives back an int to the caller (foo))

lyric gyro
#

hows this concept called

#

no an integer is not a method

#

I call the method randomNumber

#

it gives me an integer

#

i put that result in a very suitable int variable

#

so

#

uh

#

a method doesnt need to be void

#

void only means a method does not give back anything to whoever called/invoked it

#

if it's anything else other than void, it gives back / returns a value of that type

#

in the case of randomNumber(), it gives back an int value

#

foo(), the caller of randomNumber(), puts that value in a variable of that same type

#

why do java developers like to call a method before its even been declared

#

this just makes life harder

#

so the int named number

#

is equal to randomNumber

#

which returns 36

#

it's equal to whatever randomNumber returns, which happens to always be 36, yes

thorny pollen
#

what exactly is "ChatChat"?

lyric gyro
#

a chat plugin

thorny pollen
#

is it good? like better than essentials chat/deluxe chat

lyric gyro
#

im like that dr johnson painting by joshua reymonds

thorny pollen
#

I usually just make my own plugin for it

lyric gyro
#

it's far from being complete, very much WIP

#

nowadays CarbonChat is the general suggestion

thorny pollen
#

ok ty!

lyric gyro
#

@lyric gyro you may think that I am annoying but trust me

#

It will be even more annoying if I don't understand java

#

I am dumber than a bucket

#

and my brain just doesn't feel like working properly today

#

so I didn't really understand

#

Picture two people, Alice and Bob, Alice asks Bob if he has a sheet of paper he can give her, she will ask him that and wait patiently until he gives her any, and so he does
In the same sense that foo calls randomNumber and it gives it back an integer value