Seems like this is one of the best quality tutorials out there on RUclips. I love how you did stuff correctly, and following good coding practices (e.g. avoiding static abuse), this is what people should learn from, rather than those other tutorials where stuff is done incorrectly. Anyways, wonderful tutorial
Can u do a part 3 where you use the MySQL asynchronous from the rest. There aren’t much tutorials about that and it’s apparently very handy anti lag tool Also perfect content!
A few notes for people who want to make this even better: 1) don't put redundant data in your db. Ex: he put name and uuid in. Since you have the uuid there is no need for name since you can just grab it. (there are however a few cases where this can be useful. Like a leaderboard) Also, names can change, uuid's can't. This means there needs to be a onjoin if player displayname same as db name etc... 2) primary keys are important if you want to make relations. If you don't know what it means no problem but if you do need to set a PK, choose something that is always unique. In his case that is the UUID, not the name because the names change.
Hey, I have a problem it shows this on the console : com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAT(100),UUID VARCHAT(100),EMERALDS INT(100),PRIMARY KEY (NAME))' at line 1 And 7379857 lines of errors, idk why ._.
I had a problem with the 'createPlayer' reporting database error or syntax I finally tracked this down to the SQL command "INSERT IGNORE INTO mobpoints" Removing the 'IGNORE' solved the problem. CoddedRed never explained why 'IGNORE' should be included. (Spigot 1.19.2)
"INSORT" hahaha. Thanks for making these, as a web developer I'm accustomed to connecting to MongoDB with NodeJS-Express servers. I think it's good that I'll be adding MySQL to my database literacy. I'm also interested in trying to tackle a custom MC server network with my own code so this series is bringing me in the right direction. Have you ever considered working for a company like Hypixel? They would probably love to have someone with your skills and knowledge on the team.
Could you do a tutorial on queuing database queries on a separate thread using and async task? I feel like this is necessary when using a database so you don't slow down the main thread.
Instead of updating the Database every kill try making a cache that will update the database every 5 or 10 minutes, if the plugin is in constant use by 100s of players or even 10 players, it can lag the database and eventually throw a timeout error
Can you make a tutorial on how to make XP bar equal to a variable? Like forexample for a leveling system, the number would be your level and the xp bar would be your progress on leveling up?
I noticed that you can do ps.close(). I wonder if this "frees up" resources. I'm very sure Java does this automatically for you after some time but maybe it's a good idea to include that? Any thoughts?
@@mustafaesattemel Yes. If you coded the egg wars shop yourself, then the player purchases a piece of armor from the shop, you would do p.getInventory().set[PIECE](item) (Replace [PIECE] with whatever armor piece you are replacing). If you did not code it, then I'm you'll probably have to create a plugin that checks their inventory for armor pieces and replaces their armor if it finds any.
That’s what we’re basically doing. We need to get their total points then add one. Our variable “points” equals 1. Because it is just a passed in variable.
@@CodedRed My code is making a command that gives you a sword that insta-kills anything. I don't know the problem and why its not working tho. (I did add plugin.yml) gyazo.com/66f47831b24f911b5a5a5dc4ecc29019 package me.StrideCrafter.UltraSword; import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import com.mojang.brigadier.Command; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; public class Main extends JavaPlugin {
@Override public void onEnable() {
}
@Override
public void onDisable() {
}
public void onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player user = (Player) sender; if(label.equalsIgnoreCase("ultrasword") || label.equalsIgnoreCase("usword")) { ItemStack item = new ItemStack(Material.DIAMOND_SWORD, 1); item.addEnchantment(Enchantment.DAMAGE_ALL, 1000); user.getInventory().setItemInMainHand(item); }
I love your tutorials, but please do me a favour. This music that goes in the background was OK at the beginning, but now it starts to become very annoing especially there is only one song. It is ok to have it on presentation at the begining, but it shouldn't be through whole video.
Seems like this is one of the best quality tutorials out there on RUclips. I love how you did stuff correctly, and following good coding practices (e.g. avoiding static abuse), this is what people should learn from, rather than those other tutorials where stuff is done incorrectly. Anyways, wonderful tutorial
15:27 "INSERT IGNORE INFO" INFO -> INTO :)
Nice guide. Like.
Can u do a part 3 where you use the MySQL asynchronous from the rest. There aren’t much tutorials about that and it’s apparently very handy anti lag tool
Also perfect content!
Thanks m8, really helped me.
A few notes for people who want to make this even better: 1) don't put redundant data in your db. Ex: he put name and uuid in. Since you have the uuid there is no need for name since you can just grab it. (there are however a few cases where this can be useful. Like a leaderboard) Also, names can change, uuid's can't. This means there needs to be a onjoin if player displayname same as db name etc... 2) primary keys are important if you want to make relations. If you don't know what it means no problem but if you do need to set a PK, choose something that is always unique. In his case that is the UUID, not the name because the names change.
This, the tutorial was cool and all but he barely understands sql.
Great comment!
Thank you very much for the help!
Love the work man, keep it up!
Got here in 13 seconds
Hey, I have a problem it shows this on the console :
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAT(100),UUID VARCHAT(100),EMERALDS INT(100),PRIMARY KEY (NAME))' at line 1
And 7379857 lines of errors, idk why ._.
It's VARCHAR not VARCHAT
Great video, Thanks a lot!
Very Very Nice, thanks a lot!
I had a problem with the 'createPlayer' reporting database error or syntax
I finally tracked this down to the SQL command "INSERT IGNORE INTO mobpoints"
Removing the 'IGNORE' solved the problem.
CoddedRed never explained why 'IGNORE' should be included. (Spigot 1.19.2)
"INSORT" hahaha. Thanks for making these, as a web developer I'm accustomed to connecting to MongoDB with NodeJS-Express servers. I think it's good that I'll be adding MySQL to my database literacy. I'm also interested in trying to tackle a custom MC server network with my own code so this series is bringing me in the right direction.
Have you ever considered working for a company like Hypixel? They would probably love to have someone with your skills and knowledge on the team.
I think this isnt enougth skill
@@CookieTriste Yeah, CodedRed is a great dev and all but Hypixel only really hires the best of the best
Loving this!
Hey! Live your video! But how do I set strings instead of int's?
Small tip, since you’re on windows, you can do Win + C to see your clipboard, instead of having to worry about having it copied
7:43, don't worry just marking where I'm at
Can you please make video to code bots for discord?
You might not find this message but there is a good tutorial website to do this, especially if you use intelij
How much storage can xampp hold?
this depends how much storage your laptop/pc has
I added /addpoints command, and whenever I use it, the database gets updated, but when I use /points it doesn't change.
Could you go over how to disguise players as mobs?
Could you do a tutorial on queuing database queries on a separate thread using and async task? I feel like this is necessary when using a database so you don't slow down the main thread.
Good one!
Instead of updating the Database every kill try making a cache that will update the database every 5 or 10 minutes, if the plugin is in constant use by 100s of players or even 10 players, it can lag the database and eventually throw a timeout error
Can you make a tutorial on how to make XP bar equal to a variable? Like forexample for a leveling system, the number would be your level and the xp bar would be your progress on leveling up?
To set the level, you can do p.setLevel(level) and p.setExp(xp) for xp.
Good Work!
I noticed that you can do ps.close(). I wonder if this "frees up" resources. I'm very sure Java does this automatically for you after some time but maybe it's a good idea to include that? Any thoughts?
Always close PreparedStatement and Resulset.
Thanks for the tutorial
MariaDB maybe??? pls help
bro can you make autoequiparmor plugin ? for my egg wars shop sytem ? (when players buy armor auto equip ) ?
You can just do p.getInventory().setHelmet(item) for helmet, p.getInventory().setChestplate(item) for chestplate, etc.
@@Dusk_2_Dawn i dont know coding . With eclipse ?
@@mustafaesattemel Yes. If you coded the egg wars shop yourself, then the player purchases a piece of armor from the shop, you would do p.getInventory().set[PIECE](item) (Replace [PIECE] with whatever armor piece you are replacing). If you did not code it, then I'm you'll probably have to create a plugin that checks their inventory for armor pieces and replaces their armor if it finds any.
@@Dusk_2_Dawn i need to add this code on eggwars jar file ? or new jar file ?
@@mustafaesattemel Yes you will need to add it to the Egg Wars JAR file
cant you use update set points=points+1 ?
That’s what we’re basically doing. We need to get their total points then add one. Our variable “points” equals 1. Because it is just a passed in variable.
How do i do if i want to do more than 1 table?
Simple. Just create A different table using a different table name in the sql connection constructor
Hey, when I use PaperMC for this (my friend told me Paper uses spigot API) it doesnt work and JavaPlugin doesnt exist with it. Any help?
Code the plugin using Spigot. Then have your server run Paper.
@@CodedRed My code is making a command that gives you a sword that insta-kills anything. I don't know the problem and why its not working tho. (I did add plugin.yml)
gyazo.com/66f47831b24f911b5a5a5dc4ecc29019
package me.StrideCrafter.UltraSword;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import com.mojang.brigadier.Command;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
}
@Override
public void onDisable() {
}
public void onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player user = (Player) sender;
if(label.equalsIgnoreCase("ultrasword") || label.equalsIgnoreCase("usword")) {
ItemStack item = new ItemStack(Material.DIAMOND_SWORD, 1);
item.addEnchantment(Enchantment.DAMAGE_ALL, 1000);
user.getInventory().setItemInMainHand(item);
}
}
}
it wont work for me. I don't see a problem.
StrideCrafter your command uses public void, not public boolean
i swear my hands LITERALLY started to bleed
Here before insprill and tank 203
Ok i see how it is stealing my comment
Tank 203 there is that better?
hello there
First
@Eternal hunter idk XD
I love your tutorials, but please do me a favour. This music that goes in the background was OK at the beginning, but now it starts to become very annoing especially there is only one song. It is ok to have it on presentation at the begining, but it shouldn't be through whole video.