#help-development

1 messages · Page 798 of 1

rotund ravine
#

Class file

#

Interface file

storm crystal
#

why is there separate file type for interfaces?

remote swallow
#

public interface

echo basalt
#

Regardless of implementation, I get the interface

remote swallow
#

public class

storm crystal
rotund ravine
echo basalt
#

and call the method defined on that interface

quaint mantle
#

Hell nah bros using notepad++ for usre

echo basalt
#

Which the implementation.. implements

storm crystal
#

empty

#

you still need to make the code in that method

echo basalt
#

The interface defines that the method exists

#

And it is up to each implementation of the interface to define its functionality

#

The mongo implementation grabs the data and sticks it in a mongodb database

storm crystal
#

but inteface is literally made out of empty shit

echo basalt
#

The mysql implementation grabs the data and sticks it in a mysql database

storm crystal
#

how is it supposed to tell how empty shit is supposed to work

echo basalt
#

The interface is a common contract that they all follow, so that regardless of implementation I'm calling the same method

#

And if you don't get these explicit technical words then just ask chatgpt and fuck off

rotund ravine
storm crystal
#

of course I dont get them lol

echo basalt
#

50$/hr

#

pain in the ass fee included

storm crystal
rotund ravine
#

I can’t recall the 2nd law of thermodynamics either so don’t trust me too

storm crystal
#

why not just make class for database

storm crystal
#

and method for putting information

#

getting information

#

removing etc.

echo basalt
#

you will make a class

storm crystal
#

what advantage is in using interfaces

echo basalt
#

that implements the interface

#

you can do it later

#

You can rely on interfaces while you design your program's architecture

rotund ravine
#

We will just repeat what we have already said lol

storm crystal
#

you havent told me once whats the advantage

#

no comparison at all

rotund ravine
#

Gl emily

pseudo hazel
#

its mainly so that other parts of the code dont have to be a pain in the ass when interacting with the classes that implement interfaces

storm crystal
#

then why not just not implement them at all?

slender elbow
#

interface Storage {
void saveItem(ItemStack)
}
class SqlStorage implements Storage {
// implement saveItem for sql
}
class YamlStorage implements Storage {
// implement saveItem for yml
}

then in your plugin you use Storage but it can be either SQL or yaml
this is called abstraction

pseudo hazel
#

if you dont see the benefit you either dont understand, or have not made big enough code to see why its useful

storm crystal
slender elbow
#

because you want to use one kind of storage that is determined at startup

#

and then you aren't doing if (storage == sql) savesql else saveyml

#

every single time

storm crystal
#

I wouldnt

#

id just do storage.saveItemSQL or storage.saveItemYaml

#

id just do two methods for it

#

and use whichever one Id need

slender elbow
#

but you want to use one storage type

#

not both at random

storm crystal
#

yeah, I can just make one instance of Storage, pass it to whatever class needs it and just cast whichever method I need

#

I wouldnt care about the other one

slender elbow
#

yes

#

and wherever you need to save the item just call saveItem on the Storage instance, where you use it you don't need to care what kind of storage it is

quaint mantle
storm crystal
quaint mantle
#

Like if you want to remove the "yaml" saving most of parts of app just give compile error.

#

And you have to refactor it.

storm crystal
#

isnt programming about rewriting

slender elbow
#

no

pseudo hazel
#

not if you do it right

slender elbow
#

good code is that that has the least friction to changes elsewhere

#

it's good to maintain because you don't have to go all over the place adjusting one small thing

storm crystal
#

whats the point of abstraction

#

why would I not give access to data

#

to someone

#

well to something

rotund ravine
#

You mean encapsulation?

eternal oxide
#

?learnjava

undone axleBOT
storm crystal
#

why is it so important to not let other classes or other shit know about stuff

#

what if that class happens to need to know about something

rotund ravine
#

Example?

pseudo hazel
#

stop spamming learnjava, it has no meaning at this point

eternal oxide
#

Bukkit gives you access to a Player but it doesn;t expose the whole Map of Players

storm crystal
eternal oxide
storm crystal
#

im just saying

pseudo hazel
#

not if it gets ignored

storm crystal
eternal oxide
#

then that end up being the only answer

rotund ravine
#

Elgar is 5 so not yet

#

Programming wiz child

eternal oxide
#

at some point he will stop askign basic questions or actually READ

storm crystal
#

I dont recommend making age jokes on discord

#

they take it unnaturally seriously

eternal oxide
storm crystal
rotund ravine
storm crystal
#

the more teacher pushes you to study stuff the less you are inclined to do it

rotund ravine
#

Oh, sooo

storm crystal
#

😭

rotund ravine
eternal oxide
storm crystal
eternal oxide
#

yes

storm crystal
#

out of 13 years of education so far Ive rarely, rarely ever saw people who get motivated when teachers tell them to study this or that, instead of getting demotivated or starting asking questions what is it even for

storm crystal
eternal oxide
#

If a teacher keeps telling you something and you refuse to listen, at some point the teacher gives up as you refuse to learn

echo basalt
#

Bros stubborn

pseudo hazel
#

okay so what is this discussion even about

storm crystal
echo basalt
#

Interfaces and polymorphism

pseudo hazel
#

right

#

that makes sense

storm crystal
#

the more you are pushed towards doing something most of the times you show innertia unless you got a good reason to do it and are motivated enough

eternal oxide
storm crystal
#

like spamming ?learnjava for n'th time wont do stuff, at this point I consider it as a way for someone to deliver their bad blood towards me and simply ignore it

echo basalt
#

Here they always tell you

#

Whether or not you pass, they get paid the same

eternal oxide
#

Its the only answer you will get from me from now, for basic java questions

storm crystal
eternal oxide
#

You've been here a few weeks now and adamantly refused to learn or read anything

echo basalt
#

We've been dumb idiots before, after years and years of experience it is our moral obligation to pass the content down to the new generation of dumb idiots in hopes they get smart

rotund ravine
#

We”re all here because we for some reason or another enjoy helping others. It gets annoying when some dumb idiots don’t listen

echo basalt
#

Think I'm about to get the crustiest pizza

river oracle
eternal oxide
#

We give you answers over and over but all you say is "I don;t understand".

#

We explain it every way possible but you refuse to read the simplest of documents

storm crystal
#

im asking a question not asking for reference duh

echo basalt
#

Throwback to when I tried learning chunk packets and block pallettes in 1.8 without knowing what a bitshift did

pseudo hazel
#

maybe tis cuz we bad at explaining

eternal oxide
#

and we have answered over and over. This question you are asking you asked the near identical question a month ago

storm crystal
#

its like, willingly hurting yourself at this rate

eternal oxide
#

Go away troll.

echo basalt
#

Weren't you arguing that us developers shouldn't be paid at all?

#

Something tells me you have no respect at all for the people attempting to help you

#

Shoo away

eternal oxide
#

He's argued with every person in here

rotund ravine
#

Begone troll

echo basalt
#

Block and move on

river oracle
#

Guys Theresa simple solution here it's ^

#

I'm just a few weeks ahead of you all

eternal oxide
#

block only spams you every time they post

river oracle
#

Which is kinda annoying tbh

eternal oxide
#

if it was a true mute I'd use it

rotund ravine
#

Block is like a fake block

echo basalt
river oracle
storm crystal
rotund ravine
#

What about we send him to helpchat instead

storm crystal
#

which is true because being a student doesnt help with budget lol

echo basalt
#

Bet you see this argument as free entertainment

eternal oxide
#

Yeah. I've never blocked anyone but he's come the closest

echo basalt
#

What about me elgar

storm crystal
echo basalt
#

I'm worthy

eternal oxide
#

Nah you cute 🙂

river oracle
#

Damm illusion isn't worthy

#

Sucks to suck

storm crystal
#

why do people treat blocking someone on discord like it's some kind of divine punishment but still resort to interacting with them

rotund ravine
#

Elgar pleae let me be your first

river oracle
#

Lmfao

eternal oxide
#

lol

storm crystal
#

okay so

#

I have this

echo basalt
#

Got us lunch

#

Ignore my thicc ass wrist

eternal oxide
#

for a sunday?

echo basalt
#

Yes

river oracle
#

I want

eternal oxide
#

I was going to cook a roast but it looks like it will be burgers

echo basalt
#

Was about 2,25$

upper hazel
#

well how i undestand i not can change block hardness blast-resistance ?

eternal oxide
#

2.25? how so cheap?

young knoll
#

You could reflect the blast resistance

echo basalt
#

Hax

young knoll
#

I believe that is all server side

#

maybe

river oracle
#

Since imillusion is here he may have some packet hacks

eternal oxide
#

Has it been on teh floor for it to be cheap?

upper hazel
#

then how this do itemAdder lol

echo basalt
#

You can

upper hazel
#

i copy they config

#

for options

river oracle
echo basalt
young knoll
#

I assume they rewrite the breaking system

#

Good ol mining fatigue

echo basalt
#

They do but you can still reflect

young knoll
#

For blast resistance maybe

#

But not for hardness

upper hazel
#

or what

echo basalt
#

Sure

upper hazel
#

or rewrite core server in runtime?

rotund ravine
young knoll
#

Yes ItemsAdder is in your computer

#

Right in the cpu

#

Deep in there

rotund ravine
eternal oxide
upper hazel
eternal oxide
#

woudl still work 🙂

rotund ravine
#

Oh it’s that

#

My best anticheat, finally found it again

young knoll
#

Great permission

storm crystal
# storm crystal I have this
public interface AnimalStuff {
  void breathe();
}

public class Animal implements AnimalStuff {
  public void breathe() {
    //breathes w/e
  }
}

class Main {
  public static void main(String[] args) {
    Animal cow = new Animal();
    cow.breathe();
  }
}
#

and now

#

how do I make another animal

#

that would breathe differently

#

with interfaces

rotund ravine
#

Animalstuff shouldn’t exist

#

Also an animal is not a cow

storm crystal
pseudo hazel
#

interfaces with 1 implementation are literally useless

vocal cloud
#

Shouldn't it be Breathable as the interface

#

Or Breathing

pseudo hazel
#

it would be Animal implements Breathing

#

and then your cow would extend Animal

#

and if you want you can make another animar that breathes differently

#

but you can also make a Human implements Breathing

storm crystal
#

thats not even the point w/e the semantics

pseudo hazel
#

assuming humans arent animals

storm crystal
pseudo hazel
#

ok

#

then you can have Alien implement Breathing

rotund ravine
#

I feel like animal should either be abstract or the interface considering animals doesn’t breathe the same

#

@storm crystal do you know what an antonym is?

storm crystal
#

yes and relevance?

pseudo hazel
#

I mean the example is just kinda bad

storm crystal
#

I havent asked for critique

#

idc how bad it is

#

whats the point of interface if I supposedly cant even make those methods work differently

rotund ravine
#

You can ur just being dumb about it

pseudo hazel
#

you can

storm crystal
pseudo hazel
#

you can implement breathing in all subclasses f you want to

rotund ravine
#

Make animal an abstract class or interface too

remote swallow
#

are you still not understanding what an interface is for

rotund ravine
#

He is not

eternal oxide
#

¿learnjava

#

🙂

rotund ravine
#

Woah the spanish thing

river oracle
#

¿Tu hables español?

eternal oxide
#

not at all

river oracle
#

Ah

storm crystal
#
public interface Animal {
  void breathe();
  void shit();
}

public class Cow implements Animal {
  public void breathe() {
    //breathes w/e
  }
  public void shit() {
    //comically large amounts of methane
  }
}

public class Pig implements Animal {
  public void breathe() {
    //breathes the other way w/e
  }
  public void shit() {
    //doesnt spit methane violently i guess
  }
}

class Main {
  public static void main(String[] args) {
    Animal cow = new Cow();
    Animal pig = new Pig();
    cow.breathe();
    pig.breathe();
  }
}
river oracle
#

Same

storm crystal
#

better?

rotund ravine
#

Now name animalstuff animal

#

And Cow cow and Pig pig just needs to be Animal instead of their respective classes

storm crystal
#

I dont get

#

the latter

rotund ravine
#

Why?

eternal oxide
#

Most basic definition

storm crystal
#

like that

#

or what

echo basalt
#

Watch me get home and record a 10 minute video

pseudo hazel
#

Animal cow = new Cow()

echo basalt
#

And toss it in the index

wild nexus
#

Hey, how can i create an empty world in spigot 1.20 ? I try use ChunkGenerator but methods that i found on Internet are now deprecated.

remote swallow
#

you cant create an instance of an interface

rotund ravine
storm crystal
pseudo hazel
#

because its funny

#

idk

#

it doesnt really matter in this context

storm crystal
#

helpful

pseudo hazel
#

you would assign it teh most basic iomplementation that you wnat to use

storm crystal
#

why not just make it their respective class

pseudo hazel
#

but in most cases it doesnt really matter I find

rotund ravine
#

Well the idea would be that regardless of what animal it is you can just have one method and be able to call Animal#breathe

#

Instead of 50 methods that does each animal

pseudo hazel
#

he was just asking why it would be Animal cow = new Cow() instead of Cow cow = new Cow()

storm crystal
#

why assign it Animal type

#

what does that even mean

rotund ravine
#

Sigh

#

Goodbye

pseudo hazel
#

there is no reason for it imo

storm crystal
#

in here they would just do Pig pig = new Pig();

orchid gazelle
#

Make sure to get a Turtle too

storm crystal
#

so im asking what the difference is

rotund ravine
rotund ravine
pseudo hazel
#

teh diff is if your pig has another method and you create it with Animal pig, you cnat use that method

rotund ravine
#

Though, that doesn’t breathe

pseudo hazel
#

unless you cast it back to a pig

storm crystal
#

okay so casting Animal t ype

storm crystal
#

gives me only methods of Animal interface

#

right?

rotund ravine
#

Yes

storm crystal
#

if I casted Pig and pig had haveFunInMud() method

#

I could use that method

#

but if I casted Animal

#

I wouldnt

rotund ravine
#

Yes

storm crystal
#

so it just tells me what methods I can cast?

rotund ravine
#

No

icy beacon
#

If you need a pig specifically and really down bad just instantiate Pig pig = new Pig(), but if you need any animal with no quirks, instantiate Animal pig = new Pig()

#

It's a good practice to instantiate the lowest level iirc

storm crystal
#

pretty weird that a fucking java basic course doesnt teach that

river oracle
#

Look up how to use Java modules and then how to use them with maven and just cry its not fun it doesn't make much sense and worst of all its insanely hard to get to compile

rotund ravine
#

It probably does dusk

icy beacon
#

It is just a better practice

storm crystal
#

so if I want to make database for players

#

I make interface for managing data

river oracle
#

I'm never using JavaFX again

storm crystal
#

and make a class for lets say kills

river oracle
#

Fuck that module shit

storm crystal
#

implement interface

#

define methods

river oracle
#

It fucks with your other depenendecies too

storm crystal
#

and call it a day

#

?

rotund ravine
#

Why would there be a class for omly kills

icy beacon
#

Uhh I don't exactly see why you would make a class for kills

storm crystal
icy beacon
#

Why

#

What would the class contain

remote swallow
#

kills isnt a data type

icy beacon
#

^

rotund ravine
#

PlayerStats can be

remote swallow
#

player data is a data type

storm crystal
#

it is

#

literally

#

an

#

integer

icy beacon
#

Yeah that's a data type

#

Not kills

remote swallow
#

what illusion said about data types isnt that

storm crystal
#

class for kills that implements database management or behaviour or whatever you call it

#

you get it

#

and class for deaths

remote swallow
#

no

storm crystal
#

and for other shit like money

remote swallow
#

player stats class has the data behaviour

pseudo hazel
#

sounds like overkill

icy beacon
#

You do not need a class for every statistic

storm crystal
#

Illusion essentially told me that I do

icy beacon
#

Link the message plz

remote swallow
#

it may have sounded like that to you

#

but that is not what he meant

echo basalt
#

Here's the proper explanation because in his eyes the interface can be omitted:

An interface is a sort of empty contract class that defines the methods its implementations (classes that implement the interface) can have.
An interface can extend multiple interfaces, a class can implement multiple interfaces.

public interface Animal {

  void idle(); // A method of the return type "void" named "idle" with no parameters

}
public interface Breathable {

  void breathe();

}
public interface BreathableAnimal extends Animal, Breathable {

}

With these contracts, we can then create a few implementations

public class Snake implements Animal {

  @Override
  public void idle() { // We must override this method or make this class abstract, as the Animal interface states this method exists in all implementations
    System.out.println("I'm a snek");
  }
}
public class Cow implements BreathableAnimal { // This is the same as implementing Animal and Breathable

  @Override
  public void idle() {
    System.out.println("moo");
  }

  @Override
  public void breathe() {
    System.out.println("*cow farts*");
  }
}

We can then instance the classes we created as objects of the interface type, for example

List<Animal> animals = List.of(
  new Cow(),
  new Snake()
);

for(Animal animal : animals) {
  animal.idle();

  if(animal instanceof Breathable) {
    System.out.println("We found a breathable animal!");
    animal.breathe();
  }
}
storm crystal
echo basalt
#

We can pass as many different animal types on our list

icy beacon
#

I scrolled up and I did not see anything that mentioned your idea. Please link the message

echo basalt
rotund ravine
#

Illusion bad programmer? Banned

echo basalt
#

That's because I'm writing platform-agnostic code and linking with the bukkit api

#

It also means I'm applying dependency inversion everywhere

#

Any other questions?

storm crystal
#

I dont get any of it

echo basalt
rotund ravine
#

?tryandsee

undone axleBOT
rotund ravine
#

Tbh

storm crystal
#

why do you link your code that does something that I dont even understand

quaint mantle
#

@storm crystal You should learn C instead of java

#

Its pure math

storm crystal
#

it has pointers and malloc no thanks

rotund ravine
#

And memory management

quaint mantle
#

Haskell

rotund ravine
#

Use rust then

storm crystal
#

can I make plugins

#

in it

quaint mantle
#

Scala

#

Groovy

rotund ravine
storm crystal
#

my friend is obsesseed with C++

#

so I automatically have no respect to any C language

icy beacon
#

Are you that friend that downplays your friends' interests

rotund ravine
#

Seems so

pseudo hazel
#

too bad like everything else is built on top of c languages

storm crystal
#

then I wont get good impression of C++ at all

icy beacon
#

Ah in that case

pseudo hazel
#

thenits not a friend

icy beacon
#

Still though that's more about the C++ community, and even so you've only been exposed to one member of it

icy beacon
rotund ravine
#

I am not a virgin, but i use more kotlin than java

icy beacon
#

^^^^^

echo basalt
#

your virginity just came back

storm crystal
#

maybe ill switch to Kotlin

echo basalt
#

congratulations

storm crystal
#

@rotund ravine wanna help me?

rotund ravine
#

Ahahah

echo basalt
#

pls say no

pseudo hazel
#

kotlin is not much diffeernt from java with what you cna do with it

icy beacon
#

Yep, the biggest difference is probably syntax

#

And well new builtins

#

But I find it much more convenient

rotund ravine
#

Kotlin still requires basic programming knowledge

icy beacon
#

Oh and very strict null control

rotund ravine
icy beacon
#

Haha

remote swallow
#

wait untill dusk finds out about generics

pseudo hazel
rotund ravine
#

On compiler level?

icy beacon
zenith gate
#

I'm sop confused on why this is happening. everything is setup right in my pom.xml, I do get code sense help when typing and no errors when actually writting the code, this only happens when I am trying to compile it to a jar file to test it. toastrpg is my custom library, and is imported from the system, lamp revxrsal is shaded from toastrpg so it comes from that.

icy beacon
#

Because you almost always know when you're working with a nullable object and the compiler will bitch about it if you're not careful

remote swallow
#

Did you add the jar through intellij but are building through maven

remote swallow
#

yes

zenith gate
#

ahhh okay..

remote swallow
#

you should add it through maven

half arrow
#

Would anyone be able to advise on a way to stress test my server with players? Bots of course but I want to best simulate players? Any tools out there ?

zenith gate
rotund ravine
#

Oh u crossposted

#

Blocked

half arrow
#

Most of my plugins are custom, I’d like to test the durability

half arrow
storm crystal
#

like player stats, enemy stats, lootbox drops etc.

pseudo hazel
#

yeah prolly

storm crystal
#

wdym probably

remote swallow
#

we are not illusion

#

we cannot say exactly what illusion means

#

we can interpret what he means

storm crystal
#

@echo basalt what did you mean

pseudo hazel
#

probably as in I would make tehm separate classes

#

and if they share a lot of logic have a superclass or interface above it

zenith gate
echo basalt
#

figure out your own solution

#

I talked about mine because mine works for me

remote swallow
storm crystal
remote swallow
storm crystal
#

Mine will 99% suck either way

rotund ravine
#

We share our ideas and implementation

#

It’s like school you reflect on things and write your own shit

river oracle
#

it sucks its horrible

#

I hate it

#

yes

#

you see I just cry

#

and use swing

rotund ravine
#

Java fx with a theme = stonks

river oracle
#

or cry and use JavaFX

#

it doesn't matter which one you use you'll be crying

rotund ravine
river oracle
#

java modules are fun :3

#

oh don't forget! if you have any dependencies that aren't java modules your build will fail!!!

#

so you have to use a very "easy" to use maven plugin to fix that yourself!

#

then use jlink! and more!

remote swallow
#

maven is ez

river oracle
#

I hate how they made it

remote swallow
#

you know what makes me wanna kms

rotund ravine
#

I just reverted to java 8 when i made javafx stuff

remote swallow
#

life

river oracle
#

I need my java 17 features

rotund ravine
#

Kotlin 🤪

river oracle
#

zany_cat dumblin

storm crystal
#

Motivating

rotund ravine
#

Lol

#

Part of the learning curve sadly

pseudo hazel
#

I refactored my plugin like 3 times by now

river oracle
#

refactoring stuff is fun

quaint mantle
#
val L = db.randomData() ?: throw NullPonterExeption()

:troll:

pseudo hazel
#

yeah exactly

river oracle
#

and entirely motivating you see yourself getting better

#

if you can't deal with having to refactor because you're getting better development isn't for you tbh

pseudo hazel
#

if you dont like rewriting stuff, then dont do programming for fun

#

or only make small projects thats fine too

quaint mantle
#

Refactoring big code is fun fr

#

/s

pseudo hazel
#

especially when it all comes together

#

i mean it can be fun fr

storm crystal
#

I hope programming isnt mandatory for my profession

upper hazel
#

i can change block break sound?

slender elbow
#

idk I use jfx at work with java 17 and it works well

#

although I use gradle :^)

river oracle
#

I have trouble compiling anything because I depend on things that don't use java modules

#

its a headache and quite frankly makes me want to never use jfx again

slender elbow
#

then you don't use them either

river oracle
slender elbow
#

just put javafx in the module path at runtime and your stuff in the classpath

#

that's what I do

river oracle
#

ig I haven't found a nice way to do this with maven I saw one plugin but it pretty much required me to write the module file in xml vs java's syntax

#

and when I did use it, it didn't work nicely either so Jlink still failed to build

slender elbow
#

I can show how I have it set up, it's nothing special, but, yeah, it isn't maven however

#

I pretty much just have a separate task to invoke jpackage correctly, that's all the "special setup"

gritty mist
#

Hey I am learning the basics of spigot events and I struggle with world teleportation

#
public void onBlockBreak(BlockBreakEvent e){
        e.setCancelled(true);
        World world = e.getPlayer().getWorld();
        Location location = new Location(world,0,64,0);
        e.getPlayer().sendMessage("Monde courant : " + world.getName());
        if(world.getName()== "world"){
            world = Bukkit.getWorld("world_nether");
            Bukkit.getLogger().info("World set : " + world.getName());
        }else{
            world = Bukkit.getWorld("world");
            Bukkit.getLogger().info("World set : " + world.getName());
        }
        location.setWorld(world);
        e.getPlayer().teleport(location);
    }
#

here is my function for it, I just switch worlds whenever a block is broken

#

it seems like my program never goes through the first if statement for some reason

eternal night
#

Strings are not compared using instance comparison

#

Use .equals

gritty mist
#

now it works, thank you

#

I am still learning the basics of Java Objects in class rn

river oracle
slender elbow
#

this is why you always use String#intern(), so your string equality checks are always correct

#

v:kappa:

summer scroll
#

Can someone happen to me how is this visual bug can happen? The fireball always curve when I try to increase the speed of the fireball, but if it has default velocity, it will not curve, it will go straight.

rotund ravine
#

You hit it?

eternal oxide
#

nocode

summer scroll
#

No I spawned it with left click air interact.

#

Right, one sec.

    @EventHandler(priority = EventPriority.HIGHEST)
    private void onInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        if (event.getHand() != EquipmentSlot.HAND) return;
        if (event.getAction() == Action.LEFT_CLICK_AIR) {
            // get two blocks in front of player
            Location eye = player.getEyeLocation();
            Location location = eye.add(eye.getDirection().multiply(1.2));

            Fireball fireball = location.getWorld().spawn(location, Fireball.class);
            fireball.setVelocity(location.getDirection().normalize().multiply(5));
            fireball.setShooter(player);
        }
    }
rotund ravine
#

Interact probably runs before the actual hit

summer scroll
#

I heard that it was actually because of 1.20.2 spigot.

eternal oxide
#

you are multiplying by 6 so that will also increase the Y axis by 5

summer scroll
#

I tested it myself and it was fine in 1.19.4

#

Okay, so I need to set the Y to 0 right?

eternal oxide
#

no

#

only if you shoot straight. I thought you had an arc, not what your vid shows

summer scroll
#

Is the problem is in my code?

eternal oxide
#

it looks like it arcs to the right

summer scroll
#

It curves randomly, it can curves below, right or left.

rotund ravine
rotund ravine
eternal oxide
#

yeah nothing wrong with your code

summer scroll
#

Depends on where I'm looking at, if I look at the left, it will curve to the left.

rotund ravine
summer scroll
#

I'll try to delay the set velocity.

eternal oxide
#

oh use setDirection not Velocity

rotund ravine
#

Delay the spawning

rotund ravine
#

Oh

eternal oxide
summer scroll
#

I've tried using setDirection but it will not change the speed.

eternal oxide
#

it should

#

the length of the Vector is the speed

summer scroll
#

Alright, I'll try to use setDirection.

eternal oxide
#

else use the spwn method which accepts a Consumer

#

so you setDirection in the Consumer

summer scroll
#

Oh yeah you're right, I can use consumer okay.

#

It shoots straight but it has default speed, here's my code.

    @EventHandler(priority = EventPriority.HIGHEST)
    private void onInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        if (event.getHand() != EquipmentSlot.HAND) return;
        if (event.getAction() == Action.LEFT_CLICK_AIR) {
            Location eye = player.getEyeLocation();
            Location location = eye.add(eye.getDirection().multiply(1.2));

            location.getWorld().spawn(location, Fireball.class, fireball -> {
                fireball.setShooter(player);
                fireball.setDirection(location.getDirection().normalize().multiply(5));
            });
        }
    }
#

You can compare the speed to the video I've shown above.

eternal oxide
#

what if you increase the 5?

rotund ravine
#

Do 1000 and see that’d be fun

summer scroll
#

Nothing happened.

eternal oxide
#

a normalized vector would be 1 block per second

#

so multiplied by 5 should be 5 blocks per second

#

does the value not affect the speed at all?

summer scroll
#

I'll try to debug the fireball's velocity.

eternal oxide
#

else try....

#
setDirection(...
setVelocity(fireball.getDirection.multiply(5))```
#

err

summer scroll
rotund ravine
#

If you get the direction of the ball?

eternal oxide
#

I guess it does not like setVelocity, as teh javadoc says

rotund ravine
#

Oh well,

#

Tick the ball three times a tick using nms 👌🏻

eternal oxide
#

I assume he used the fireball for getDirection

summer scroll
#

Fireball Power is 15, that means I multiply the Vector by 15.

eternal oxide
#

getDirection of the fireball not the location when you setVelocity

#

oh nm, ignore me

rotund ravine
#

What happens if you mutiply the velocity of the fireball after a tick

eternal oxide
#

sysout the getVelocity.length

#

a vector is annoying

#

you just want to see its actual speed

summer scroll
#

Should I use the setVelocity too?

#

or keep the code like it is

eternal oxide
#

as is for now

summer scroll
rotund ravine
#

What you have now, but.
fireball.setVelocity(fireball.getVelocity().multiply(5))

#

A few ticks after?

eternal oxide
#

should check stash/nms and see if setDirection is normalizing your imput

rotund ravine
#

.

eternal oxide
#

um

rotund ravine
#

I can’t click that for some reason

eternal oxide
#

why is velocity increasing

#

gravity I guess

rotund ravine
#

Probably fireball mechanics

summer scroll
#

yeah i guess

summer scroll
rotund ravine
#

Dang

#

Oh well blame legacy versions

eternal oxide
#

sysout getDirection

#

it should be identical till death

#

unless gravity is arcing

summer scroll
#

The length right?

eternal oxide
#

no vector

#

?stash for me

undone axleBOT
summer scroll
#

Well the getDirection().length() is identical till death, always 0.1

#

Same with sysout getDirection(), it's the same all the time.

eternal oxide
#

um 0.1?

summer scroll
#

Yes, the getDirection().length() is always 0.1

eternal oxide
#

CB doesn;t alter the vector at all in setDirection

summer scroll
#

There is update() method, what is that?

summer scroll
rotund ravine
#

Rip

storm crystal
#

so uh

#

what should I include in the interface

summer scroll
#

@eternal oxide I got this from EntityFireball.class. I'm not sure what it means tho

    public void setDirection(double d3, double d4, double d5) {
        double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
        if (d6 != 0.0) {
            this.xPower = d3 / d6 * 0.1;
            this.yPower = d4 / d6 * 0.1;
            this.zPower = d5 / d6 * 0.1;
        }

    }
storm crystal
#

@echo basalt what are CompletableFuture<UUID>

rotund ravine
#

Oh my

storm crystal
#

do I need anything else?

echo basalt
#

bim bim bam bam

storm crystal
echo basalt
#

I use it

#

some just call the methods async

storm crystal
#

and how to do it?

#

do I just make main class for connecting to databases and class for each db management or include connection within those classes for each database

echo basalt
#

Up to you

#

try every possibility and come up with the best one

storm crystal
#

thats a shit ton of work

echo basalt
#

I went over it all

#

Do it too

#

you'll learn something

storm crystal
#

well I cant even download sqlite

lost matrix
echo basalt
#

It's bundled iwth the spigot jar

storm crystal
#

is it proper way of making connection method?

lost matrix
storm crystal
#

method that would connect to desired database with given prompt

#

or should I remove the prompt and just hardcode it for each database class

lost matrix
#

Usually you would pass all components of your jdbc url to a class and then internally concat it

storm crystal
#

can I just make it like that?

lost matrix
eternal night
#

Well not completely new 😅

summer scroll
lost matrix
#

Well... yeah. Usually you have a bunch of connections and check which ones are valid.

eternal night
#

preferabl you don't do any of this and shade a proper connection pool like hikaricp

summer scroll
storm crystal
scenic onyx
#

Beacue the Custom Enchant is not visible?

#

(in 1.8.8)

rotund ravine
#

@storm crystal You would cache them

#

Hikari is a tool to do this for you

#

Wait no, smile told u to do smth else so why are you trying to get the same one?

storm crystal
#

great idc at this moment because I have those two fuckers

rotund ravine
#

It’s just IJ trying to be helpful

eternal night
#

"Oh no I have a warning about not using connections correctly"
"Use a proper connection pool"
"Great idc"

naive bolt
#

Anyone know a way to in the chat tab completion use essentials x nicknames or simalar?

eternal night
#

you always have to close the statements

storm crystal
#

yeah because SQLite tutorial literally has no mentioning about it

#

and it works for them just fine

eternal night
#

so

try (final PreparedStatement statement = connection.prepareStatment("...")) {
}
#

Well SQLite is a different beast

dry hazel
#

prepareStatement*

rotund ravine
#

Close enjf

eternal night
#

Helpful!

dry hazel
#

koriLaugh

storm crystal
slender elbow
#

yeah now try not copy pasting

storm crystal
#

I didnt

slender elbow
#

x

dry hazel
#

d

rotund ravine
#

x

storm crystal
#

so much copied

eternal night
storm crystal
#

ah you dont know how to write

#

okay

#

so do I

slender elbow
#

me irl

storm crystal
#

I thought its correct way of writing Statement

storm crystal
#

what about this one

rotund ravine
#

IJ is trying to be useful @storm crystal as i said

eternal night
#

Ah fuck yea sorry I misspelled the method you were to lazy to google on my phone 😭

#

mb mb

scenic onyx
rotund ravine
#

You can’t add enchantments like that

#

The client only shows what it knows

#

So you gotta add ur own lore

scenic onyx
rotund ravine
#

Add lore like you normally would with itemmeta on proper events

scenic onyx
rotund ravine
#

What

#

Explain what you mean by that

terse raven
#

how do i use the mojang mappings while using nms?

scenic onyx
rotund ravine
#

? You want to hide them?

terse raven
#

thx

#

i am using that though

#

not working, lemme send my pom

scenic onyx
rotund ravine
scenic onyx
rotund ravine
#

What goes up?

scenic onyx
#

i want create enchant like this

rotund ravine
#

Uses lore

scenic onyx
rotund ravine
#

Up what?

#

Please write coherent messages and include images if needed @scenic onyx

terse raven
#

do you guys have a custom site to upload large files to?

terse raven
#

my pom

rotund ravine
terse raven
terse raven
rotund ravine
#

?paste

undone axleBOT
terse raven
scenic onyx
rotund ravine
#

Yes

scenic onyx
terse raven
rotund ravine
#

He doesn’t want to

storm crystal
#

how do I insert any wanted data into database with a method

rotund ravine
#

?google

undone axleBOT
scenic onyx
#

use ItemFlag to remove

rotund ravine
#

?

storm crystal
#

do I make getter and setter for each datatype that I want to edit/set/get?

#

like UUID, deaths etc.

rotund ravine
#

You would get everything you would need in the immediate future from one connection

storm crystal
#

great I have empty table and I need to fill it first

#

:]

#

I cant make one method to be able to set both UUID and deaths

terse raven
#

follow a tutorial

#

of how to use databases

#

(depends on which database you are using?)

storm crystal
#

its not even about databases

rotund ravine
#

You can make one method to do it

terse raven
storm crystal
#

do I make separate method for each datatype

rotund ravine
#

@storm crystal no

storm crystal
#

so what

terse raven
storm crystal
rotund ravine
#

You would have PlayerStats or smth that has each of the stats and then just have a method that saves and gets that

storm crystal
#

with shit

terse raven
storm crystal
#

its empty

storm crystal
rotund ravine
#

Are you broken

#

Of course there is default values

terse raven
rotund ravine
#

Try and get it

#

If it’s not present

terse raven
#

so i suggested to first learn the basics

rotund ravine
#

Return an empty PlayerStats object

storm crystal
rotund ravine
#

Yes

#

So try and get it

#

If it doesn’t return anything

#

Return an empty object

storm crystal
#

relevance?

rotund ravine
#

Are you broken?

compact haven
#

I'm so unbelievably confused

#

wdym "fill it"

storm crystal
#

what do I need empty object for

compact haven
#

you dont just add random data to the database

rotund ravine
#

He’s so broken

compact haven
#

@storm crystal explain your problem from top to bottom

storm crystal
#

you can either actually explain yourself or just keep saying it

rotund ravine
#

Like he comes off as either absolutely clueless or a troll

storm crystal
#

great itll return an empty row

#

what about it

rotund ravine
#

What?

compact haven
#

Yes, because there's nothing there

#

is there a problem with an empty row?

#

technically it shouldn't return any row

#

the browser just shows an empty row, probably

rotund ravine
#

It should just return nothing when u try and get it

storm crystal
#

and I want to make a method that would fill that empty row with provided information

rotund ravine
#

Yes?

storm crystal
#

but there are a ton of datatypes to cover

#

so I asked

rotund ravine
#

No

storm crystal
#

how do I handle it

compact haven
#

So you want a method to insert data to a database?

storm crystal
#

to make one yeah

rotund ravine
#

You have a data object called PlayerStats that stores your rowdata

#

You have a method called savePlayerStats

#

That insers the data

#

Form the playerstats object

storm crystal
#

because I cant just make setData(UUID playerId, String data)

#

what if I want to update deaths

#

its not a string

compact haven
#

it would be setDeaths(UUID palyerId, int deaths)

#

the whole setData thing was pseudo

storm crystal
#

so it comes to a conclusion that for each datatype I'd have to make separate method

compact haven
#

they idea is setDeaths or setObject(UUID, PlayerStats obj)

rotund ravine
#

No…

compact haven
#

I personally have done it that way, yes

storm crystal
#

then why do you even propose it

compact haven
#

but it's highly inconvenient

#

Because that's what you typed LMAO

rotund ravine
#

He explained it cause ur saving one single thing

storm crystal
#

that is

#

so bullshit

terse raven
compact haven
#
class PlayerStats {
  private final UUID playerId;
  
  @Getter @Setter
  private int deaths;
}
class PlayerRepository {
  public Optional<PlayerStats> get(UUID playerId) {
    ...
  }

  public PlayerStats getOrCreate(UUID playerId) { ... }

  public void store(PlayerStats data) { ... }
}
class MyPlugin extends JavaPlugin {
  public void onEnable() {
    PlayerRepository repository = new PlayerRepository();
    getServer().getPluginManager().registerListeners(new Listener() {
      @EventHandler
      public void onJoin(PlayerJoinEvent event) {
        UUID playerId = event.getPlayer().getUniqueId();
        PlayerStats data = repository.getOrCreate(playerId);

        Bukkit.broadcastMessage("Player just joined with " + data.getDeaths() + " deaths.");
      }
    }, this);
  }
#

There you go. I've jsut typed up exactly what you want through Discord

terse raven
compact haven
#

like what he's saying makes no sense at all

terse raven
#

yea

storm crystal
compact haven
#

it's just an "interface" between your database and your code

#

that's what it is called in Spring, but you can call it anything you want

terse raven
#

for you its just a fancy name

storm crystal
remote swallow
#

oh fuck

terse raven
remote swallow
#

this is gonna start the whats an interface for again

storm crystal
#

its more or less what I've written so far

compact haven
#

it literally explains everything bro

#

getOrCreate means

#

if they don't have a row in the database with their id

#

then create it

#

and return that new row containing the defaults

#

i.e., the default death count, etc., all tied by their UUID which was provided in getOrCreate

storm crystal
#

"PlayerStats data = repository.getOrCreate(playerId);
data.getDeaths()"

compact haven
#

which is what I wrote, yes

storm crystal
#

why is there getDeaths out of nowhere

compact haven
#

bro

#

okay that's a fine question

#

that's called lombok and I used it because I wasnt going to write boilerplate through Discord

class PlayerStats {
  private final UUID playerId;
  
  @Getter @Setter
  private int deaths;
}
#

@Getter just means that getDeaths() and setDeaths(int) exists inside of PlayerStats

rotund ravine
#
import java.util.UUID;

public class PlayerStats {
    private UUID uuid;
    private int deaths;
    private int exp;

    public PlayerStats(UUID uuid, int deaths, int exp) {
        this.uuid = uuid;
        this.deaths = deaths;
        this.exp = exp;
    }

    public UUID getUuid() {
        return uuid;
    }

    public int getDeaths() {
        return deaths;
    }

    public int getExp() {
        return exp;
    }

    public void setDeaths(int deaths) {
        this.deaths = deaths;
    }

    public void setExp(int exp) {
        this.exp = exp;
    }
}
#
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.UUID;

public class SqlManager {
   
    public void insertPlayerStats(PlayerStats playerStats) {
        try {
            PreparedStatement statement = connection.prepareStatement("INSERT INTO player_stats (uuid, deaths, exp) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE deaths = ?, exp = ?");
            statement.setString(1, playerStats.getUuid().toString());
            statement.setInt(2, playerStats.getDeaths());
            statement.setInt(3, playerStats.getExp());
            statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public PlayerStats retrievePlayerStats(UUID uuid) {
        try {
            PreparedStatement statement = connection.prepareStatement("SELECT * FROM player_stats WHERE uuid = ?");
            statement.setString(1, uuid.toString());
            ResultSet resultSet = statement.executeQuery();
            if (resultSet.next()) {
                int deaths = resultSet.getInt("deaths");
                int exp = resultSet.getInt("exp");
                return new PlayerStats(uuid, deaths, exp);
            } else {
                return new PlayerStats(uuid, 0, 0);
            }
        } catch (SQLException e) {
            e.printStackTrace();
            return null;
        }
    }
}
compact haven
#

oh lovely

storm crystal
#

so turns out that I do have to make separate methods for each datatype

compact haven
#

..

rotund ravine
#

No?

terse raven
#

...

compact haven
#

oh my fucking god

storm crystal
#

public UUID getUuid() {
return uuid;
}

public int getDeaths() {
    return deaths;
}

public int getExp() {
    return exp;
}
#

you did it there

remote swallow
#

that is called a getter

compact haven
#

yes that's literally called a getter pattern in Java

storm crystal
#

literally

#

here

compact haven
#

are you so clueless

rotund ravine
#

That is not what you asked

compact haven
#

how clueless are you

rotund ravine
#

Like at all

storm crystal
#

that is literally a method

remote swallow
#

yes

#

no way a getter is a method

#

that is insane

storm crystal
compact haven
#

The point is that it's standard convention to create getters and setters for properties of an object. The reason we didn't say "yes" to your question was because it was about the database

rotund ravine
#

?

compact haven
#

i.e. SQLite, MySQL, PostgreSQL?

storm crystal
#

SQLite with different .db files

#

playerstats.db
somethingelseidk.db

compact haven
#

why would you have different .db files

#

that makes no sense

#

that's a table

rotund ravine
#

Use one db file

remote swallow
#

you have 1 db with mutliple tables

compact haven
#

you have several tables per database, one database file

rotund ravine
#

And multiple tables

storm crystal
#

so do I make separate table manager

compact haven
#

I mean yes

#

you can have a PlayerStatsManager and a BuildLocationManager

#

(i.e.)

storm crystal
#

as a class

#

ye?

compact haven
#

yes

rotund ravine
#

Sure

#

Keep one connection manager though

terse raven
# storm crystal like here?

https://www.youtube.com/watch?v=MbsI0bNxDEc he may be using mysql, but he is trying todo about the same thing as you

In this episode of the Spigot series, I show you how to make your first plugin that connects to and uses a MySQL Database to store player statistics. It uses JDBC to connect and execute SQL statements upon the database. #Spigot #Minecraft #SQL

(Adding video timestamps soon)
Code: https://github.com/Spigot-Plugin-Development-Tutorial/plugin-with...

▶ Play video
#

and explains it pretty well

remote swallow
#

just look at veinminer storage stuff

terse raven
rotund ravine
#

He doesn’t learn by looking at code @remote swallow

remote swallow
#

ah great

storm crystal
#

I dont learn with his videos at all

compact haven
#

well then how do you learn?>

#

because there's 2 ways that we just talked about

storm crystal
#

if that was a case I wouldnt be asking anything here

compact haven
#

Watching a video, or looking at code

storm crystal
#

@terse raven no need to delete ur messages idrc

rotund ravine
#

He asks a ton in here

terse raven
remote swallow
#

most of the stuff i learn is based of getting some code examples

terse raven
#

and then tinker with it

#

expand upon it

compact haven
#

^ I've given epic pseudo code about writing a Factory system for his library and he learnt it very quickly

storm crystal
compact haven
#

very similar to how I tried to teach you by giving you pseudo

compact haven
#

epic is great

remote swallow
#

i mean it took a while but i got there and now it would take minutes to get that

rotund ravine
#

Oh u gave epic it

compact haven
#

yes

rotund ravine
#

I didn’t say epic didn’t learn

remote swallow
compact haven
#

nah I know

storm crystal
rotund ravine
#

I haven’t had any issues with epic not being willing to learn

compact haven
#

it was an example to how I tried to teach Dusk they same way I taught Epic

#

but ig dusk is just trolling or smth

remote swallow
rotund ravine
#

@storm crystal You don’t really since ur not ready for it yet tbh

terse raven
compact haven
#

I can't really tell because I've tried to help dusk twice now, and they just don't absorb

rotund ravine
#

Ikr?

storm crystal
remote swallow
#

i pretty much gave up trying to help

rotund ravine
#

Then stop writing immediately

terse raven
#

thats how you learn

rotund ravine
#

Don’g write anything

remote swallow
#

better ways to spend my time

rotund ravine
#

We rewrite our gode a lot as we go

#

Code

remote swallow
storm crystal
#

you literally said "use this simple thing and you will rewrite it entirely either way"

#

very motivating

remote swallow
#

sure its annoying to rewrite but you will have a much better time interacting with it later in development

terse raven
#

yea later on

slender elbow
#

ligma

robust helm
#

balls

remote swallow
#

make it simple to start, you can then learn how to do it and use it then once you understand moer you can make it better

terse raven
#

its not like you won't start writing a simple english essay rn, because someday you are going to rewrite a better one anyway lol

#

it's all about trial & error and the progression that results from it

storm crystal
#

so I make

terse raven
#

yes

storm crystal
#

connection manager class for one database

terse raven
#

you make something rn

#

see how far you got, post it here

remote swallow
#

i hated rewriting stuff to start with, i still dislike it now but its the life of developing stuff

terse raven
#

and we will give you tips on what todo next

storm crystal
#

and for each row or whatever it was called I make separate class with getters and setters?

terse raven
#

write it out in code

#

as best as you can

storm crystal
remote swallow
#

because you dont learn anything

#

we give you help and info to learn about it but just complain instead

storm crystal
#

how am I supposed to learn with no feedback?

compact haven
#

it's a shocker how many people come into this channel and learn using the exact methods we're using to teach you

#

and succeed

terse raven
storm crystal
rotund ravine
#

It’s because they reflect

rotund ravine
#

We teach by the

#

?tryandsee

undone axleBOT
remote swallow
rotund ravine
#

Method

storm crystal
remote swallow
#

try and find some new things to use it

terse raven
rotund ravine
#

Ikr

remote swallow
#

i might not understand something new, i get an example and dont understand so i try and find some code usages or ask how to use it and then i can test it out

compact haven
chrome beacon
#

I've spent the entire day learning GLSL Shaders

#

Cool stuff

compact haven
#

@chrome beacon how'd you learn GLSL Shaders?

rotund ravine
#

Dying

remote swallow
#

olivio i orded my pc upgrade stuff, arrives thursday

remote swallow
#

happy times

compact haven
#

sorry, I'm using you as an example bro

rotund ravine
#

Why didn’t u ask us ? @chrome beacon

chrome beacon
#

Well do you know anything about them?

compact haven
#

LOL