Merge branch 'dev'
This commit is contained in:
commit
fb5b1cab86
8 changed files with 56 additions and 32 deletions
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="D:/OneDrive/Programming/APIs/spigot-1.16.4.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
|||
bin/
|
||||
.idea/
|
||||
little-minecraft-vanilla-extension.iml
|
||||
.vscode/
|
||||
.classpath
|
||||
.project
|
||||
11
.project
11
.project
|
|
@ -14,15 +14,4 @@
|
|||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1604515347360</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
|
|
|
|||
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"files.exclude": {
|
||||
"**/.classpath": true,
|
||||
"**/.project": true,
|
||||
"**/.settings": true,
|
||||
"**/.factorypath": true
|
||||
}
|
||||
}
|
||||
|
|
@ -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!
|
||||
|
|
|
|||
|
|
@ -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: /<command>
|
||||
|
|
|
|||
|
|
@ -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 ("
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue