Sketch of proper KickPlayerAfterBan system
This commit is contained in:
parent
4e760a54bc
commit
422bbcfdf4
2 changed files with 19 additions and 0 deletions
|
|
@ -17,6 +17,9 @@ import java.util.Objects;
|
|||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
||||
public class Ban implements CommandExecutor {
|
||||
|
||||
BanHammer plugin;
|
||||
|
|
@ -309,6 +312,21 @@ public class Ban implements CommandExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
private void kickPlayer(PlayerBan b){
|
||||
final Gson gson = new Gson();
|
||||
try {
|
||||
Connection conn = plugin.db.getConnection();
|
||||
|
||||
String preparedJson = gson.toJson(b);
|
||||
PreparedStatement ps = conn.prepareStatement("SELECT pg_notify('ban_jobs', ?)");
|
||||
ps.setString(1, preparedJson);
|
||||
ps.execute();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
plugin.getLogger().severe(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveBanMessagePlaceholders(String s, String player, String scope, String reason, String operator) {
|
||||
return s.replace("{player}", player)
|
||||
.replace("{scope}", scope)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue