Skip to content

Commit

Permalink
cap sensitivie
Browse files Browse the repository at this point in the history
  • Loading branch information
Cow authored and Cow committed Feb 6, 2022
1 parent 38c1bdb commit f5f11fe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public Profile getProfile(CommandSender sender, PunishmentsX plugin, String play

if (targetProfile == null) {
sender.sendMessage("Player has never logged on the server!");
sender.sendMessage("Names are case-sensitive for offline players!");
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Type type() {
}

public Profile loadProfile(boolean async, String name, boolean store, MongoDeserializedResult mdr) {
getDocument(false, "profiles", "name", name, document -> {
getDocument(false, "profiles", "name", name.toLowerCase(), document -> {
if(document != null) {
UUID uuid = (UUID) document.get("_id");
Profile profile = new Profile(plugin, uuid);
Expand Down Expand Up @@ -94,7 +94,7 @@ public Profile loadProfile(boolean async, UUID uuid, boolean store, MongoDeseria

public void saveProfile(boolean async, Profile profile) {
Map<String, Object> map = new HashMap<>();
map.put("name", profile.getName());
map.put("name", profile.getName().toLowerCase());
map.put("current_ip", profile.getCurrentIp());
map.put("ip_history", profile.getIpHistory());
map.put("punishments", profile.getPunishments());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/punishmentsx/database/sequel/SQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Type type() {
public Profile loadProfile(boolean async, String name, boolean store, MongoDeserializedResult mdr) {
try {
PreparedStatement ps = getConnection().prepareStatement("SELECT * FROM profiles WHERE name = ?");
ps.setString(1, name);
ps.setString(1, name.toLowerCase());
ResultSet rs = ps.executeQuery();

if (plugin.getStorage().type() == Database.Type.MySQL) {
Expand Down Expand Up @@ -146,7 +146,7 @@ public void saveProfile(boolean async, Profile profile) {
ps.setString(1, profile.getUuid().toString());
ps.setString(2, ipHistoryString);
ps.setString(3, punishmentsString);
ps.setString(4, profile.getName());
ps.setString(4, profile.getName().toLowerCase());
ps.setString(5, profile.getCurrentIp());
ps.executeUpdate();
} catch (SQLException e) {
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/io/github/punishmentsx/utils/PlayerUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ public static Profile findPlayer(PunishmentsX plugin, String target) {
if (targetPlayer == null) {
targetProfile = plugin.getProfileManager().find(target, false);
} else {
try {
targetProfile = plugin.getProfileManager().get(targetPlayer.getUniqueId());
} catch (Exception e) {
return null;
}
targetProfile = plugin.getProfileManager().get(targetPlayer.getUniqueId());
}

return targetProfile;
Expand All @@ -32,11 +28,7 @@ public static Profile findPlayer(PunishmentsX plugin, UUID uuid) {
if (targetPlayer == null) {
targetProfile = plugin.getProfileManager().find(uuid, false);
} else {
try {
targetProfile = plugin.getProfileManager().get(targetPlayer.getUniqueId());
} catch (Exception e) {
return null;
}
targetProfile = plugin.getProfileManager().get(targetPlayer.getUniqueId());
}

return targetProfile;
Expand Down

0 comments on commit f5f11fe

Please sign in to comment.