added list command

This commit is contained in:
mikx 2023-12-03 11:36:57 -05:00
parent bed97d278a
commit f831320411
4 changed files with 32 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<groupId>ovh.mxg</groupId>
<artifactId>CubeTP</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
<packaging>jar</packaging>
<name>CubeTP</name>

View File

@ -1,10 +1,14 @@
package ovh.mxg.cubetp;
import org.bukkit.Material;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.MessageFormat;
public class Command implements CommandExecutor {
@Override
@ -21,6 +25,31 @@ public class Command implements CommandExecutor {
}
} else {
switch(strings[0]){
case "list":
try {
String uuid = player.getUniqueId().toString();
String lang = Localization.GetPlayerLang(player);
SQL.connect();
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE uuid IS NULL");
ResultSet rs = ps.executeQuery();
player.sendMessage(Localization.GetLocal(player, 16));
while(rs != null && rs.next()) {
player.sendMessage(MessageFormat.format(Localization.GetLocal(player, 18), rs.getString("name"), rs.getDouble("x"), rs.getDouble("y"), rs.getDouble("z")));
}
SQL.connect();
PreparedStatement psp = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE uuid = ?");
psp.setString(1, uuid);
ResultSet rsp = psp.executeQuery();
if(rsp != null){
player.sendMessage(Localization.GetLocal(player, 17));
}
while(rsp != null && rsp.next()) {
player.sendMessage(MessageFormat.format(Localization.GetLocal(player, 18), rsp.getString("name"), rsp.getDouble("x"), rsp.getDouble("y"), rsp.getDouble("z")));
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
break;
case "local":
if(strings[1].isEmpty()){
try {

View File

@ -1,5 +1,5 @@
name: CubeTP
version: '1.5.0'
version: '1.6.0'
main: ovh.mxg.cubetp.CubeTP
api-version: '1.20'
commands:

View File

@ -1,5 +1,5 @@
name: CubeTP
version: '1.5.0'
version: '1.6.0'
main: ovh.mxg.cubetp.CubeTP
api-version: '1.20'
commands: