#development
1 messages · Page 8 of 1
using the "blueprint"
I know
honestly i barely have any idea what you're trying to with that code. do you want to make a new ArrowTrapEvent?
a class is also a blueprint
yeah
im trying to call that event
man I already watched 41 java tutorials
you can expect i know how to print hello world
and make a method
have you tried working with them do
an interface is a "contract" technically
yes
i did exercises after tutorials for c#
so to do that you need an event object
something like this ```java
ArrowTrapEvent event = new ArrowTrapEvent(blah);
Bukkit.getPluginManager().callEvent(event);
where can i get exercises
c# and java really aren't that different
syntax is nearly the same
yeah
naming conventions are a bit different though
Which is why I'm confused why he's having such a hard time with stuff he most definitely encountered in c#
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
its defo not spigot stuff
theres nothing code-wise that's spigot-specific
should I just skip threads for now?
yeah i dont know either
it's not like it adds any extra syntax or ideas
yes
yes
i think you are probably at a point
yes, you shouldnt really be trying to study this until you have a very strong understanding of oop
B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7
where you should just write something
tutorials help but i think programming is learned the best when you just do it
you wont need threads for 99% of use cases
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
can you please mention an example of when ill use threads in spigot
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
yeah using the Thread class is a bit of an antipattern in many cases
because it's usually not actually a great idea
creating new threads for short lived tasks is very much a bad idea
write and read from a database for example
and no config files dont really count
since they are cached
so you need threads for writing and reading?
You don't NEED it
you dont need threads
but if you dont use them, your server needs to wait
until that operation is done
But it can help prevent slower operations from slowing the rest of your program down
meaning if it takes 1 second to read, server freezes for 1 second
you do not need to know how threads actually work to do this mind you
^
in spigot it's really simple
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
every 2 messages you send, one of them has a therm i never heard before @merry knoll
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;
}
});
you could throw runtimeException
not trivially, you could either make a function that wraps your function, or make a new functional interface and defer the exceptions to someMethod
why threads most of the time need to be wrapped with try and catch?
because their operations are not always safe
anything that can throw an exception needs to be wrapped in java
they can be interrupted or suspended or stopped by other parts of the program or the operating system
for example ```java
public static <A, B> Function<A, B> wrapSafely(Function<A, B> f) {
return a -> {
try {
return f.apply(a);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
imho, just code something
i think thats what will make you learn the best currently
take a project and dive in
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
oh dear
spigot tutorials almost always suck
tutorials dont teach you how to think
my man
ehh not really
just find something to make and do it
just go and start soemthing
if you're confident with java then learning the api is pretty easy
you get stuck, you google
^
repeat until you dont suck
hi dkim19375 aka kotlin = best aka hello how r u? kotlin = best btw
should I just drop off the tutorial playlist
Hello
and start learning things by myself?
Get stuck for a while, lose interest, give up, move to a new project, repeat until you have a folder of 50+ unfinished projects
in spigot?
in anything
^ This is the way
if spigot is what takes your interest
its what i did, just find something i wanted to make and try it
how do i make a hub world and a survival world??
there are plugins for that
oh shit
internet
is this a signal to switch to kotlin
probably hub worlds, idk, but my friend uses a plugin which allows you to do that
signal to switch to python
fuck py
Ew
LMAO
Lol
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
lol
uh
it sounds like what you want is dependency injection
you may want to just practice some OOP stuff
just start writing
jesus that is annoying
it will get spaghetti but thats fine
What is
B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7
Oh imagine being able to be stopped by Barry for caps
TRUE COULDNT BE ME
you know
this reminded me of a game that I used to play called Mindustry
god the spagetti ive written
thats how you get better though
same
write shit code - get annoyed - learn to fix - go back to step 1
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
uhhhh vaguely
so you would expect that this is pretty much like coding
was that ur first plugin
yep, spagetti, refactor, abandon, rewrite from scratch in a new project and repeat
im extremely clever
sometimes the conveyor belts get 'spagghetied' and all messed up
plus it was only like a year ago
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
coding is basically that honestly
and its even better since all the issues that you can run into
has happened to someone else before
thats how you learnt how to code
so there are solutions you can google to how to structure
It was like over 2 years ago
hmm
nah, i went to uni for it
fuck you
jk
From 2020 to 2022 we just skipped time
jesus christ
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
okay, choose a project first
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
"fun"
kotlin = best
I meqn
Meqn
Mean
You can't really write that in a better way
Since u have to specify the items
You could static import Material
thats not importing
java ripoff
Eh
i would just do arrayOf(BOW, ARROW, BLAH).map(::getItem)
True
¯_(ツ)_/¯
koltin is the ripoff language you learn to make ripoff games on android
...
?
but ofc you need some of them to have the true parameter
yeah but it's a bit messy
I meant to cut down on clutter
you say "knows"
do we have the original somewhere
Iirc the old one is in a branch
all i remember is the name and the fact that it was not very good
Do they sell courses
hehe
Hmmm
Most ripoff android games are made in unity lol
Video >
Videos are good if the person explaining is good, which for spigot most aren't
Idk about Java videos though
well
There are some good java videos
the playlist im watching is making java look like a piece of cake for me
the guy who made it is kody simpson btw
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
Everytime you learn a new concept, make something that incorporates it
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
yeah but make something that you would use
you will run into a lot of design issues along the way
I love @icy shadow's Introduction to Java series
as it gets more complex
me too
it's got a great first episode
and thats it
Great series, only problem is that it never happened
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
ok
You could probably do a part of what you want though
pretty much
Which is a good place to start
You can though, if you want to figure a specific part of the api search it, or ask here
so let me guess
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
I see plenty of portions that you could work on, are they custom mobs? then work on creating the mobs first
idk how to proceed
google is your best friend
they are custom mobs and we will be using a plugin to create those
Just pick one part of it, and think if you need to know something else to complete it
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
If you're using a plugin for it, the plugin should hopefully have an api to spawn them
i just have to worry about regular mobs
Just pick one part
first part
You'll go crazy trying to figure it out all at once
for a wave to happen you need to spawn mobs first
because my friend, who created the minigame likes to control the waves
we even had an argument about this
start from a small part
Or you need to choose random locations around the player
they are going to spawn in set locations
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
How are you going to detect if the waves are done?
well
first I need to develop the wave mechanic
when the command is activated
so we have an if statement (?)
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?
Basically
convention is to use domain name for it
as in :
minecraft.net is your domain
then you name your package as
net.minecraft.projectname
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
It made me make a website when I got my domain
So I just decided to use this theme
what do you guys think is the best way to sync up between servers? (for economy in this case)
(free for students btw)
database seems meh, since redis is available
Btw what's the diff between the two
redis is stored on memory
aka cached basically
so its fast but not permanent (altho it has permanent option too)
Isn't it still IO tho? Which means it should be cached in like a map
i'll just put one of my monickers in group id and the project name in artifact id
is that ok?
Isn't it a network call
you still have to perform a network operation to query the database lol
whether it's in memory or not
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
lol
✨ is it or not ✨
between jvms
What is example usage
caching something that will be used by multiple servers
if you want a spigot usage case
Wb code?
Monikers?
are you trying to correct me or asking what it is
sometimes
an artist is known by more than one name
like the caretaker
hes also known as v/vm
or his own name
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"
wb?
warner bros
ah ofc
what about
nvm
you forgot to delete your messages
🤓
dont nerd emoji me
use the appropriate channel please 🤓

this is the appropriate channel
i was speaking to dkim19375 aka kotlin = best aka hello how r u? kotlin = best btw
Smh Brister Mitten aka Brister Mitten19375 aka MinecraftKnightz
I would never delete my messages like that
😃
I only delete it when necessary
I decided to see if Aki.. would never mind it
and he did indeed never mind it
so I have deemed it unneccessary
hmm
It was an experiment
i see
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
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");
for(Material material : Material.values())
use a foreach
oh i hadn't thought of that, i'll try that
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
(sorry 4 ping) How?
Packet ;p
A little more Info, I couldn't find a Packet that fits
I know how to do it in Forge (sorta)
yea I know
does Fabric do it like Forge when handshaking?
because I can't find any info
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?
ik how to get the brand
and you can probably use plugin messages to get the mods
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
Could you tell me how?
What version are you in?
Ty
I remember seeing a packet that sent that
but I dont remember which one
probably also plugin messages
do you know how to set a location of a player and not inform the client of the teleport
I want to stop play from placing blocks to my gui, https://imgur.com/a/jMcLR7c
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
what version are you making this for? cus it feels like an older version that the method doesnt have that argument set.
cus that doesnt exist in 1.12.2 which i remember you wanted to make it for
use inventoryholder to identify your inventory, also id recommend that you just cancel the click event if its the quarry inventory, your not gunna be putting anything in the inventory right?
yes
also the forloop is kinda pointless
i just wanna cancel all the action, but they're still can place item in gui
because its nolonger the same inventory
which is why you use inventoryholder to check it
because its consistent then the content of the inventory
Ok i'll try, thank you!
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
use switch
Ok i'll try, thanks!
I can't use switch to compare InventoryAction
switch (e.getAction()) {
//...
}
yes i did just like that
Why can't you?
Ah it works, i wrote "Inventory.HOTBAR_SWAP" instead of HOTBAR_SWAP, ok im trying to use switch, thanks
np 👍
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
ahhh i completely forgot about the drag event, it tripped me up quite a bit too
at the tine didnt know it existed
1.12.2
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
the createexplosion arguments doesnt exist for that version.
but you can still do it
Encounter some strange exception and I can't figure out what exactly isn't working here (See screenshot).
I have Caffeine used as a dependency in my core module and use it in this class: https://paste.helpch.at/nipucihaqi.java
The class itself is initialized inside the plugin's main class (See the onEnable() void): https://paste.helpch.at/jedeniqeyo.java
It also gets the T set there...
I do shade in the library in the core module: https://paste.helpch.at/uyerayetog.xml
i already figured a way to do it
and it worked perfectly
i just did
location.getX(), location.getY(), location.getZ()
the 3rd createexplosion method
Bump? I assumed there would be a simple solution
isnt that a java error?
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? 😂
mvn package
Ah right right
Moving to Gradle anyway oop
I'm trying to add Matt's Framework to my project's dependencies
https://paste.helpch.at/hilukileqe.rb here's my build.gradle
https://paste.helpch.at/diwocozejo.http thought when I refresh gradle, I get this strange error?
don't use apply plugin: in the base build.gradle
Ah alright the wiki is 2 years old
yeah got it got it
https://paste.helpch.at/uzukibacen.rb Does this look right? tried adding a few dependencies to my build.gradle
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
implementation instead of compileOnly - implementation = shade
and make sure to relocate
gradle build
u have to run gradle shadowJar
or set it up to run shadowJar after build
¯_(ツ)_/¯
Hmm is there a way to create a run configuration to execute those two
Ahh okay
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
you can listen to playermoveevent and if the yaw/pitch are the same, cancel the event, if they're different, teleport the player to the same location but with the new yaw/pitch (and maybe cancel the event)
why is event.getTo() nullable?
hmm not sure
apparently it can be null if you try to teleport with a portal and the world is disabled
what a strangely specific thing lmao
its what came up when i searched
That should only be on portalteleport lol. Spigot/bukkit api is weird sometimes
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
didnt work unless im doing it wrong:
event.setCancelled(true);
if (to != null && from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ()) {
player.teleport(new Location(player.getWorld(), from.getX(), from.getY(), from.getZ(), to.getYaw(), to.getPitch()));
return;
}```
if the xyz are the same, then you only need to return
you need to teleport if the yaw/pitch are not the same and the xyz are not the same
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
welp
I found the cause but now have another issue....
The cause was that <minimizeJar> removes code it thinks is unused while it actually is used. Now I tried to apply some include filters, but this opens another issue where the main classes from my core module aren't found instead (It somehow doesn't include them....
Also, include seems to completely ignore relocations as the dependency is stored under its usual location
minimize is not so great
I think I've used it once, had problems and then removed it
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
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
Spawn all waveMobs with no AI and 2.5 hearts
i want to understand this code from the begging
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
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
it's encapsulation
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?
Java - Encapsulation, This Java tutorial covers basic to advanced concepts related to Java Programming including What is Java, Java Environment Setup, Java Objects and Classes, Datatypes, Variable Types, Modifiers, Operators, Loops, Decision Making Statements, Date, Time, Regular Expressions, Files, I/O, Exceptions, Inheritance, Overriding, Pol...
so basically to hide from other classes?
but why?
read what I sent
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 😡
What do you think is going on?
that's the best way to explain something to someone who doesn't understand
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
It doesn't have to be final. If its final that just means other classes can't extend it.
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
around 1 or 2 weeks, i know enough java to code in spigot
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
what would you consider "enough" java
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
cool?
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
but with the advantage that i can make intervals between each number as long as i like
thats not what people here told me
you'll see
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
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?
kody simpson's java tutorial playlist
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
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
kody simpson's java tutorial playlist is excellent
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
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
why
or atleast they werent helpful to me
i wasnt gettingnanywherr cus i had no idea why he was doing what he was doing and was just copy and pasting his stuff
that's why I try to understand
Have you tried reading any books about the language?
what is a 'book'
i was thinking just that
no
where the fuck can i find a book about java
library id assume
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
its just like learning math
they had a couple books on a few languages in my old colleges library
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
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
Yeah w3 is more like a reference guide I feel like
i kinda struggled hardbtill it eventially just hit me and made sense and its gettingneasiee
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.
do they have a course for spigot?
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).
Yeah that's what I'm sayin
well not even mistake. Sometimes its just laziness, or indifference.
And in some rare cases even stupidity.
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
i feel confident with my java skill
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
Well, that should instantly tell you that your java skills are not good enough.
from your questions and descriptions up there, you may feel confident but your knowledge is lacking
yea
what exactly
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.
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
i don't know like, the commands and stuff
just learn it anyways
From what you've described here you're not familiar with lambdas, collections, encapsulation, or any of that stuff
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.
the commands? what
Anyways. If you feel that confident, I recommend you start getting in the spigot API by following their simple examples at this link: https://www.spigotmc.org/wiki/spigot-plugin-development/.
If you still won't get it, then I suggest you go back to the basics and start taking it step by step.

you told me to read a book
yep, and I recommended a book as well
we csnt exactlt hand hold you through spigot
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.
well.
you can if you try
the issue is
you can get it. you just have to try hard enough 🙂
I already know a little bit of java
and if i do this jetbrains thingy
I will be restarting
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.
it's never a bad idea to refresh your knowledge to enhance and strengthen it
i want to cry
same
You won't be restarting anything. There's a sorta entry test at jetbrains that makes you skip parts that they think you know
same
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.
i don't want to do that
i really don't
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
Well, that's to your own detriment.
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
We've gave you more than enough advice and help. From now on, don't be surprised if people will start ignoring you.
some people say i should just start coding others say i should use things like jetbrains or even a book
i am divided
dont talk like that
you're just making me feel sad
If this is true, I strongly, very strongly recommend you check out the JB academy
you should code. but don't jump directly into a framework or a huge API like spigot. Do the exercises JB Academy gives you
You're just going to waste more time here if you don't start from the basics.
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
streams relieved
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
stuck out tongue closed eyes
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
bro I do that even with vim plugins
like i slowly integrate a new motion or something into my life, things take time
I think I'll just start to cry
and see where this leads me
that is a wonderful idea
i have never felt so demotivated to do something in my entire life
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
We're really just tryna help you out, not demotivate you. Truth can be harsh but you have to accept that you can't just dive in like that
i know
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
well, i can't speak for the rest but it was very demoralising in that same sense when i first started
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
and i don't mean this in a belittling way,, though it can certainly be interpreted that way
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
but... is starting over the best option?
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
maybe you are right
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
this is what drives my motivation
knowing I can do better than where I am now
and all by using fancy libraries and enjoyable languages and frameworks
it's about drive it's about power
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
I've been coding all week
and for some reason
my brain decided to go dumb mode today
and yeah I'm not gonna lie I feel like shit when I get like that but I just try to do something else, play a game, watch videos or documentaries, take a walk, or go full unproductive and just lie in bed and scroll on tiktok or whatever
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
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`*
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
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
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
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
}
so
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"
Simple one(hopefully) - I need my Discord ID (the numerical string). But I only use Discord on mobile
How do I get it?
344536094785667082
344536094785667082
uh if you hold on your name and scroll down it should show a "Copy ID" button I think
it's still not clear
you need to have dev mode on
might need to enable developer options somewhere in user settings, no clue where that's about
I’ll look ty
what do you mean by caller
like
the object that called the method
is that what you mean
in this example, foo is calling randomNumber, so foo is the caller
oh
so the caller is actually the method
and its calling a variable
let me edit that a bit
wow that "matt stinks" was very unnecessary and very rude i think matt should ban u for that smh smh smh my head wowwww
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))
an integer can be a method?
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
what exactly is "ChatChat"?
a chat plugin
is it good? like better than essentials chat/deluxe chat
im like that dr johnson painting by joshua reymonds
I usually just make my own plugin for it
it's far from being complete, very much WIP
nowadays CarbonChat is the general suggestion
ok ty!
@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



