diff --git a/.classpath b/.classpath
index a7a337a..7262be5 100644
--- a/.classpath
+++ b/.classpath
@@ -1,11 +1,11 @@
-
+
diff --git a/.gitignore b/.gitignore
index e0d5a12..164f0d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
bin/
.idea/
-little-minecraft-vanilla-extension.iml
\ No newline at end of file
+little-minecraft-vanilla-extension.iml
+.vscode/
+.classpath
+.project
\ No newline at end of file
diff --git a/.project b/.project
index 112b72a..9e710a1 100644
--- a/.project
+++ b/.project
@@ -14,15 +14,4 @@
org.eclipse.jdt.core.javanature
-
-
- 1604515347360
-
- 30
-
- org.eclipse.core.resources.regexFilterMatcher
- node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
-
-
-
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 2421e38..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "files.exclude": {
- "**/.classpath": true,
- "**/.project": true,
- "**/.settings": true,
- "**/.factorypath": true
- }
-}
\ No newline at end of file
diff --git a/README.md b/README.md
index 9623c75..f268411 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,11 @@
A litte fun project of mine to add some features and
crafting recipes to Minecraft.
-Used API: *Spigot-1.15.2*
+Used API: *Spigot-1.16.4*
-Minecraft Version: *1.15.2*
+Minecraft Version: *1.16.4*
-Plugin Version: *Beta-1.1.0*
+Plugin Version: *Beta-1.2.0*
#### Features:
- Custom Crafting Recipes!
diff --git a/plugin.yml b/plugin.yml
index 73bb44c..70032be 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -2,7 +2,7 @@ name: LittleMinecraftVanillaExtension
main: ml.codenoodles.lmve.Main
api-version: 1.15
author: netbenix
-version: Beta-1.1.0
+version: Beta-1.2.0
commands:
lmve:
usage: /
diff --git a/src/ml/codenoodles/lmve/modules/PlayerStatistics.java b/src/ml/codenoodles/lmve/modules/PlayerStatistics.java
index ed4711c..4414655 100644
--- a/src/ml/codenoodles/lmve/modules/PlayerStatistics.java
+++ b/src/ml/codenoodles/lmve/modules/PlayerStatistics.java
@@ -22,6 +22,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import ml.codenoodles.lmve.Main;
import ml.codenoodles.lmve.other.ConsoleColor;
+
public class PlayerStatistics implements Listener{
private Main main;
@@ -41,6 +42,7 @@ public class PlayerStatistics implements Listener{
Boolean existsPlayerHKills = false;
Boolean existsPlayerNKills = false;
Boolean existsPlayerFKills = false;
+ Boolean existsPlayerSettings = false;
UUID uuid = e.getPlayer().getUniqueId();
String path = "jdbc:sqlite:" + main.getDataFolder().getAbsolutePath() + "/" + "Players.db";
try { //Try connection
@@ -105,8 +107,29 @@ public class PlayerStatistics implements Listener{
}catch(SQLException sqlEx) {
System.out.println(ConsoleColor.RED + "[LMVE]" + sqlEx.getMessage() + ConsoleColor.RESET);
}
+ try {//Check if entry in tblPlayerSettings already exists
+ String query = "SELECT (COUNT(*) 0) FROM tblPlayerSettings WHERE UUID = '" + uuid.toString() + "'";
+ Statement stmt = conn.createStatement();
+ ResultSet rs = stmt.executeQuery(query);
+ rs.next();
+ existsPlayerSettings = rs.getBoolean(1);
+ rs.close();
+ }catch(SQLException sqlEx) {
+ System.out.println(ConsoleColor.RED + "[LMVE]" + sqlEx.getMessage() + ConsoleColor.RESET);
+ }
- // TODO Add Entry for PlayerSettings
+ if(!existsPlayerSettings) {
+ try {// Create default entry for tblPlayerSettings
+ String query = "INSERT INTO tblPlayerSetings VALUES ("
+ + (totalPlayers + 1) + ","
+ + "'" + uuid.toString() + "',"
+ + "true);";
+ Statement stmt = conn.createStatement();
+ stmt.execute(query);
+ }catch(SQLException sqlEx) {
+ System.out.println(ConsoleColor.RED + "[LMVE]" + sqlEx.getMessage() + ConsoleColor.RESET);
+ }
+ }
if(!existsPlayerStats) {
try { //Create default entry for tblPlayerStats
String query = "INSERT INTO tblPlayerStats VALUES ("
diff --git a/src/ml/codenoodles/lmve/sounds/ChatNotification.java b/src/ml/codenoodles/lmve/sounds/ChatNotification.java
index 3d82f98..d84d133 100644
--- a/src/ml/codenoodles/lmve/sounds/ChatNotification.java
+++ b/src/ml/codenoodles/lmve/sounds/ChatNotification.java
@@ -1,19 +1,24 @@
package ml.codenoodles.lmve.sounds;
-import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Instrument;
import org.bukkit.Note;
import org.bukkit.Note.Tone;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
+
import ml.codenoodles.lmve.Main;
+import ml.codenoodles.lmve.other.ConsoleColor;
public class ChatNotification implements Listener{
@@ -26,9 +31,21 @@ public class ChatNotification implements Listener{
private void ChatNotifiy(AsyncPlayerChatEvent e) {
if(!main.getConfigFile().getBoolean("Chat.global-mute")) {
for(Player players : Bukkit.getOnlinePlayers()){
- File playerStats = new File(main.getDataFolder() + "/Players", players.getUniqueId() + ".yml");
- FileConfiguration player_stat = YamlConfiguration.loadConfiguration(playerStats);
- if(player_stat.getBoolean(players.getUniqueId() + ".Settings.Sounds.ChatNotify")) {
+ Connection conn = null;
+ UUID uuid = e.getPlayer().getUniqueId();
+ String path = "jdbc:sqlite:" + main.getDataFolder().getAbsolutePath() + "/Players.db";
+ Boolean isEnabled = false;
+ try {
+ conn = DriverManager.getConnection(path);
+ Statement stmt = conn.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT ChatNotify AS chatnotify FROM tblPlayerSettings WHERE UUID = '" + uuid.toString() + "';");
+ rs.next();
+ isEnabled = rs.getBoolean(1);
+ rs.close();
+ } catch(SQLException sqlEx) {
+ System.out.println(ConsoleColor.RED + "[LMVE]" + sqlEx.getMessage() + ConsoleColor.RESET);
+ }
+ if(isEnabled) {
if(players.getPlayer().getName() != e.getPlayer().getName()) {
players.playNote(players.getLocation(), Instrument.BANJO, Note.natural(1, Tone.C));
}