Unban Command
This commit is contained in:
parent
2df9d0c293
commit
2f24f61b16
8
TODO.md
Normal file
8
TODO.md
Normal file
@ -0,0 +1,8 @@
|
||||
# TODO list
|
||||
|
||||
- [ ] i18n
|
||||
- [-] Make Discord Webhoook for item changes
|
||||
- [ ] deathBan reset
|
||||
- [ ] voids exchanges
|
||||
- [ ] chest name
|
||||
- [ ] /void manage bring
|
@ -2,6 +2,7 @@ package ovh.herisson.thevoidroad.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -58,6 +59,10 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
|
||||
case "reset":
|
||||
DatabaseManager.getInstance().setConfig("init", "false");
|
||||
break;
|
||||
case "unban":
|
||||
UUID target_uuid = Bukkit.getPlayerUniqueId(args[2]);
|
||||
DatabaseManager.getInstance().unban(target_uuid);
|
||||
return true;
|
||||
case "skip":
|
||||
//TODO(Merchand): Skip trade
|
||||
break;
|
||||
|
@ -11,6 +11,7 @@ import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DatabaseManager {
|
||||
@ -176,6 +177,18 @@ public class DatabaseManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void unban(UUID uuid) {
|
||||
try {
|
||||
Statement st = con.createStatement();
|
||||
String query = "INSERT OR REPLACE INTO deaths (uuid, lastDeath) SELECT uuid, lastDeath - 1 FROM deaths WHERE uuid = ?";
|
||||
PreparedStatement p = con.prepareStatement(query);
|
||||
p.setString(1, uuid.toString());
|
||||
p.execute();
|
||||
st.close();
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void close(){
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user