public long getPointsCount(PlayerData player) throws SQLException { return queryRawValue( "SELECT SUM(points) FROM " + getTableInfo().getTableName() + " WHERE player_id = UNHEX('" + player.getUUID().toString().replace("-", "") + "')"); }
private void denyAlts(List<PlayerData> duplicates, final UUID uuid) throws SQLException { if (plugin.getPlayerBanStorage().isBanned(uuid)) { return; } for (final PlayerData player : duplicates) { if (player.getUUID().equals(uuid)) { continue; } final PlayerBanData ban = plugin.getPlayerBanStorage().getBan(player.getUUID()); if (ban == null) { continue; } if (ban.hasExpired()) { continue; } plugin .getServer() .getScheduler() .runTask( plugin, new Runnable() { @Override public void run() { Player bukkitPlayer = plugin.getServer().getPlayer(uuid); Message kickMessage = Message.get("denyalts.player.disallowed") .set("player", player.getName()) .set("reason", ban.getReason()) .set("actor", ban.getActor().getName()); bukkitPlayer.kickPlayer(kickMessage.toString()); } }); } }
private void punishAlts(List<PlayerData> duplicates, UUID uuid) throws SQLException { if (!plugin.getPlayerBanStorage().isBanned(uuid)) { // Auto ban for (PlayerData player : duplicates) { if (player.getUUID().equals(uuid)) { continue; } PlayerBanData ban = plugin.getPlayerBanStorage().getBan(player.getUUID()); if (ban == null) { continue; } if (ban.hasExpired()) { continue; } final PlayerBanData newBan = new PlayerBanData( plugin.getPlayerStorage().queryForId(UUIDUtils.toBytes(uuid)), plugin.getPlayerStorage().getConsole(), ban.getReason(), ban.getExpires()); plugin.getPlayerBanStorage().ban(newBan, false); plugin .getServer() .getScheduler() .runTask( plugin, new Runnable() { @Override public void run() { Player bukkitPlayer = plugin.getServer().getPlayer(newBan.getPlayer().getUUID()); Message kickMessage = Message.get("ban.player.kick") .set("displayName", bukkitPlayer.getDisplayName()) .set("player", newBan.getPlayer().getName()) .set("reason", newBan.getReason()) .set("actor", newBan.getActor().getName()); bukkitPlayer.kickPlayer(kickMessage.toString()); } }); } } else if (!plugin.getPlayerMuteStorage().isMuted(uuid)) { // Auto mute for (PlayerData player : duplicates) { if (player.getUUID().equals(uuid)) { continue; } PlayerMuteData mute = plugin.getPlayerMuteStorage().getMute(player.getUUID()); if (mute == null) { continue; } if (mute.hasExpired()) { continue; } PlayerMuteData newMute = new PlayerMuteData( plugin.getPlayerStorage().queryForId(UUIDUtils.toBytes(uuid)), plugin.getPlayerStorage().getConsole(), mute.getReason(), mute.isSoft(), mute.getExpires()); plugin.getPlayerMuteStorage().mute(newMute, false); } } }